dev-jaanvi #1
|
@ -3,7 +3,7 @@ import { IconButton, TextField } from "@mui/material";
|
||||||
export const CustomIconButton = styled(IconButton)({
|
export const CustomIconButton = styled(IconButton)({
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundColor: "#272727",
|
backgroundColor: "transparent",
|
||||||
},
|
},
|
||||||
"*:where([data-mui-color-scheme='dark']) &": {
|
"*:where([data-mui-color-scheme='dark']) &": {
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
|
@ -20,7 +20,4 @@ export const CustomTextField = styled(TextField)({
|
||||||
"& .MuiInputBase-root.Mui-focused .MuiInputBase-input::placeholder": {
|
"& .MuiInputBase-root.Mui-focused .MuiInputBase-input::placeholder": {
|
||||||
color: "darkgray",
|
color: "darkgray",
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import { CustomIconButton } from "../AddEditUserModel/styled.css.tsx";
|
||||||
import ManagerViewModal from "../Modals/ViewManagerModal";
|
import ManagerViewModal from "../Modals/ViewManagerModal";
|
||||||
import UserViewModal from "../Modals/UserViewModal/index.tsx";
|
import UserViewModal from "../Modals/UserViewModal/index.tsx";
|
||||||
import { deleteUser, userList } from "../../redux/slices/userSlice.ts";
|
import { deleteUser, userList } from "../../redux/slices/userSlice.ts";
|
||||||
import { deleteStation } from "../../redux/slices/stationSlice.ts";
|
import { deleteStation, stationList } from "../../redux/slices/stationSlice.ts";
|
||||||
import StationViewModal from "../Modals/StationViewModal/index.tsx";
|
import StationViewModal from "../Modals/StationViewModal/index.tsx";
|
||||||
import {
|
import {
|
||||||
deleteSlot,
|
deleteSlot,
|
||||||
|
@ -183,6 +183,9 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
case "slots":
|
case "slots":
|
||||||
dispatch(fetchAvailableSlots());
|
dispatch(fetchAvailableSlots());
|
||||||
break;
|
break;
|
||||||
|
case "station":
|
||||||
|
dispatch(stationList());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.error("Unknown table type:", tableType);
|
console.error("Unknown table type:", tableType);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -132,7 +132,7 @@ const EditStationModal: React.FC<EditStationModalProps> = ({
|
||||||
);
|
);
|
||||||
handleClose();
|
handleClose();
|
||||||
reset();
|
reset();
|
||||||
setSelectedBrands([]); // Reset brands after submit
|
//setSelectedBrands([]); // Reset brands after submit
|
||||||
setSelectedVehicles([]); // Reset selected vehicles
|
setSelectedVehicles([]); // Reset selected vehicles
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ type Props = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
setViewModal: Function;
|
setViewModal: Function;
|
||||||
handleView: (id: string | undefined) => void;
|
handleView: (id: string | undefined) => void;
|
||||||
id?: number | undefined;
|
id?: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
|
|
|
@ -330,9 +330,7 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
|
||||||
? "error"
|
? "error"
|
||||||
: "primary"
|
: "primary"
|
||||||
}
|
}
|
||||||
onMouseDown={
|
|
||||||
togglePasswordVisibility
|
|
||||||
}
|
|
||||||
InputProps={{
|
InputProps={{
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
|
|
|
@ -2,7 +2,12 @@ import { Chip } from "@mui/material";
|
||||||
import AddStationModal from "../../components/AddStationModal";
|
import AddStationModal from "../../components/AddStationModal";
|
||||||
import CustomTable, { Column } from "../../components/CustomTable";
|
import CustomTable, { Column } from "../../components/CustomTable";
|
||||||
import EditStationModal from "../../components/EditStationModal";
|
import EditStationModal from "../../components/EditStationModal";
|
||||||
import { createStation, stationList, toggleStatus, updateStation } from "../../redux/slices/stationSlice";
|
import {
|
||||||
|
createStation,
|
||||||
|
stationList,
|
||||||
|
toggleStatus,
|
||||||
|
updateStation,
|
||||||
|
} from "../../redux/slices/stationSlice";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { RootState } from "../../redux/reducers";
|
import { RootState } from "../../redux/reducers";
|
||||||
|
@ -20,14 +25,13 @@ export default function StationList() {
|
||||||
const [rowData, setRowData] = useState<any | null>(null);
|
const [rowData, setRowData] = useState<any | null>(null);
|
||||||
const [searchTerm, setSearchTerm] = useState("");
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
const dispatch = useDispatch<AppDispatch>();
|
const dispatch = useDispatch<AppDispatch>();
|
||||||
const stations = useSelector(
|
|
||||||
(state: RootState) => state.stationReducer.stations
|
|
||||||
);
|
|
||||||
const vehicles = useSelector(
|
const vehicles = useSelector(
|
||||||
(state: RootState) => state.vehicleReducer.vehicles
|
(state: RootState) => state.vehicleReducer.vehicles
|
||||||
);
|
);
|
||||||
|
const stations = useSelector(
|
||||||
|
(state: RootState) => state.stationReducer.stations
|
||||||
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(stationList());
|
dispatch(stationList());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
@ -84,23 +88,21 @@ export default function StationList() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleStatusToggle = async (id: string, newStatus: number) => {
|
const handleStatusToggle = async (id: string, newStatus: number) => {
|
||||||
await dispatch(toggleStatus({ id, status: newStatus }));
|
await dispatch(toggleStatus({ id, status: newStatus }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterStations = Array.isArray(stations)
|
// const filterStations = Array.isArray(stations)
|
||||||
? stations.filter((station) =>
|
// ? stations.filter((station) =>
|
||||||
station.name
|
// station.name
|
||||||
.toLocaleLowerCase()
|
// .toLocaleLowerCase()
|
||||||
.includes(searchTerm.toLowerCase())
|
// .includes(searchTerm.toLowerCase())
|
||||||
)
|
// )
|
||||||
: [];
|
// : [];
|
||||||
|
|
||||||
|
|
||||||
// Mapping and formatting vehicles
|
// Mapping and formatting vehicles
|
||||||
const categoryRows = filterStations?.length
|
const categoryRows = stations?.length
|
||||||
? filterStations?.map((station: any, index: number) => {
|
? stations?.map((station: any, index: number) => {
|
||||||
// Format the selected vehicles from the allowedCars array
|
// Format the selected vehicles from the allowedCars array
|
||||||
const formattedVehicles = station.allowedCars?.map(
|
const formattedVehicles = station.allowedCars?.map(
|
||||||
(car: any) => car.name
|
(car: any) => car.name
|
||||||
|
@ -128,7 +130,7 @@ export default function StationList() {
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
console.log("Rowssss",categoryRows)
|
console.log("Rowssss", categoryRows);
|
||||||
|
|
||||||
const categoryColumns: Column[] = [
|
const categoryColumns: Column[] = [
|
||||||
{ id: "srno", label: "Sr No" },
|
{ id: "srno", label: "Sr No" },
|
||||||
|
|
Loading…
Reference in a new issue