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