From 4a15fd32931d2c3fff7a39fce03f4198a52d811d Mon Sep 17 00:00:00 2001 From: jaanvi Date: Thu, 3 Apr 2025 10:54:55 +0530 Subject: [PATCH] Dynamic Ev Apis Integration implemented --- .../AddStationLocation/addStationLocation.tsx | 76 +++++++++++++++ src/components/CustomTable/customTable.tsx | 11 ++- .../EditStationModal/editSationModal.tsx | 56 +++++++---- src/components/MenuContent/index.tsx | 5 + src/pages/EvSlotList/index.tsx | 6 +- .../externalStationList.tsx | 92 +++++++++++++++++++ src/pages/RoleList/index.tsx | 3 + src/redux/slices/stationSlice.ts | 86 +++++++++++++++++ src/router.tsx | 7 +- 9 files changed, 318 insertions(+), 24 deletions(-) create mode 100644 src/components/AddStationLocation/addStationLocation.tsx create mode 100644 src/pages/ExternalStationList/externalStationList.tsx diff --git a/src/components/AddStationLocation/addStationLocation.tsx b/src/components/AddStationLocation/addStationLocation.tsx new file mode 100644 index 0000000..a735b63 --- /dev/null +++ b/src/components/AddStationLocation/addStationLocation.tsx @@ -0,0 +1,76 @@ +import { + Dialog, + DialogActions, + DialogContent, + DialogTitle, + Button, + TextField, +} from "@mui/material"; +import { useForm, SubmitHandler } from "react-hook-form"; + +interface FormValues { + city: string; +} + +const AddStationLocationModal = ({ + open, + handleClose, + handleAddStation, +}: any) => { + const { + register, + handleSubmit, + reset, + formState: { errors }, + } = useForm(); + + const onSubmit: SubmitHandler = (data) => { + handleAddStation(data); + reset(); + handleClose(); + }; + + return ( + + Search Near By Stations + +
+ + + + + + +
+
+ ); +}; + +export default AddStationLocationModal; diff --git a/src/components/CustomTable/customTable.tsx b/src/components/CustomTable/customTable.tsx index f5663de..7c13c38 100644 --- a/src/components/CustomTable/customTable.tsx +++ b/src/components/CustomTable/customTable.tsx @@ -85,7 +85,7 @@ interface CustomTableProps { deleteModal: boolean; handleStatusToggle?: (id: string, currentStatus: number) => void; tableType: string; // Adding tableType prop to change header text dynamically - handleClickOpen: () => void; + handleClickOpen?: () => void; } const CustomTable: React.FC = ({ @@ -207,6 +207,7 @@ const CustomTable: React.FC = ({ (row) => (row.name && row.name.toLowerCase().includes(searchQuery.toLowerCase())) || + row.registeredAddress.toLowerCase().includes(searchQuery.toLowerCase()) || false ); @@ -254,6 +255,8 @@ const CustomTable: React.FC = ({ return "Vehicles"; case "station": return "Charging Station"; + case "external-station": + return "Charging Station"; case "booking": return "Booking"; case "slots": @@ -318,7 +321,9 @@ const CustomTable: React.FC = ({ width: "100%", }} > - {!(user?.userType === "user" && tableType === "slots") && ( + {!( + user?.userType === "user" && + (tableType === "slots" )) && (