Functionality bugs fixed
This commit is contained in:
parent
4a15fd3293
commit
f40ac87da1
|
@ -203,13 +203,17 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
|||
handleClose();
|
||||
};
|
||||
|
||||
const filteredRows = rows.filter(
|
||||
(row) =>
|
||||
(row.name &&
|
||||
row.name.toLowerCase().includes(searchQuery.toLowerCase())) ||
|
||||
row.registeredAddress.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
false
|
||||
const filteredRows = rows.filter((row) => {
|
||||
if (!searchQuery.trim()) return true; // Return all rows if searchQuery is empty or whitespace
|
||||
const lowerCaseQuery = searchQuery.toLowerCase().trim();
|
||||
return (
|
||||
(row.name && row.name.toLowerCase().includes(lowerCaseQuery)) ||
|
||||
(row.registeredAddress &&
|
||||
row.registeredAddress.toLowerCase().includes(lowerCaseQuery))
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
||||
const indexOfLastRow = currentPage * usersPerPage;
|
||||
const indexOfFirstRow = indexOfLastRow - usersPerPage;
|
||||
|
|
|
@ -209,9 +209,9 @@ const EditSlotModal: React.FC<EditSlotModalProps> = ({
|
|||
>
|
||||
{isAvailable ? "Available" : "Not Available"}
|
||||
</Button>
|
||||
<Typography>
|
||||
{/* <Typography>
|
||||
{isAvailable ? "Available" : "Not Available"}
|
||||
</Typography>
|
||||
</Typography> */}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
|
|
|
@ -94,9 +94,15 @@ const EditStationModal: React.FC<EditStationModalProps> = ({
|
|||
setSelectedVehicles(editRow.allowedCarIds || []);
|
||||
|
||||
// Set selectedBrands based on the vehicles associated with the station
|
||||
const brands = vehicles
|
||||
.filter((vehicle) => editRow.allowedCarIds.includes(vehicle.id))
|
||||
.map((vehicle) => vehicle.company);
|
||||
const brands = editRow?.allowedCarIds
|
||||
? vehicles
|
||||
.filter((vehicle) =>
|
||||
editRow.allowedCarIds.includes(vehicle.id)
|
||||
)
|
||||
.map((vehicle) => vehicle.company)
|
||||
: [];
|
||||
|
||||
|
||||
|
||||
setSelectedBrands(brands);
|
||||
} else {
|
||||
|
|
|
@ -16,7 +16,7 @@ root.render(
|
|||
position="top-right"
|
||||
richColors
|
||||
closeButton
|
||||
duration={6000}
|
||||
duration={3000}
|
||||
/>
|
||||
</Provider>
|
||||
</React.StrictMode>
|
||||
|
|
|
@ -118,8 +118,8 @@ export default function StationList() {
|
|||
return {
|
||||
id: station.id,
|
||||
srno: index + 1,
|
||||
name: station.name,
|
||||
registeredAddress: station.registeredAddress,
|
||||
name: station.name || "N/A",
|
||||
registeredAddress: station.registeredAddress || "N/A",
|
||||
totalSlots: station.totalSlots,
|
||||
vehicles: vehicleDisplay, // Add the formatted vehicle display here
|
||||
status:
|
||||
|
|
|
@ -17,7 +17,6 @@ export default function UserList() {
|
|||
const [viewModal, setViewModal] = useState<boolean>(false);
|
||||
const { reset } = useForm();
|
||||
|
||||
|
||||
const dispatch = useDispatch<AppDispatch>();
|
||||
|
||||
const users = useSelector((state: RootState) => state.userReducer.users);
|
||||
|
@ -65,7 +64,6 @@ export default function UserList() {
|
|||
name,
|
||||
email,
|
||||
phone,
|
||||
|
||||
})
|
||||
);
|
||||
await dispatch(userList());
|
||||
|
@ -76,24 +74,21 @@ export default function UserList() {
|
|||
|
||||
const categoryColumns: Column[] = [
|
||||
{ id: "srno", label: "Sr No" },
|
||||
{ id: "name", label: "Name" },
|
||||
{ id: "name", label: "User Name" },
|
||||
{ id: "email", label: "Email" },
|
||||
{ id: "phone", label: "Phone" },
|
||||
|
||||
{ id: "action", label: "Action", align: "center" },
|
||||
];
|
||||
const categoryRows = users?.length
|
||||
? users.map((user, index) => ({
|
||||
id: user.id,
|
||||
srno: index + 1,
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
phone: user.phone || "NA", // Ensures it's a string
|
||||
}))
|
||||
: [];
|
||||
|
||||
|
||||
|
||||
const categoryRows = users?.length
|
||||
? users.map((user, index) => ({
|
||||
id: user.id,
|
||||
srno: index + 1,
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
phone: user.phone || "NA", // Ensures it's a string
|
||||
}))
|
||||
: [];
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
@ -79,6 +79,7 @@ export const createAdmin = createAsyncThunk<
|
|||
>("/create-admin", async (data, { rejectWithValue }) => {
|
||||
try {
|
||||
const response = await http.post("/create-admin", data);
|
||||
toast.success("Admin created successfully");
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
return rejectWithValue(
|
||||
|
|
|
@ -63,7 +63,7 @@ export const addManager = createAsyncThunk<
|
|||
toast.success("Manager created successfully");
|
||||
return response.data?.data;
|
||||
} catch (error: any) {
|
||||
toast.error("Error creating manager: " + error.message);
|
||||
toast.error("Error creating manager: " + error.response?.data?.message);
|
||||
return rejectWithValue(
|
||||
error.response?.data?.message || "An error occurred"
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue