Merge pull request 'Latest changes as per UI requirement' (#31) from bugfixes into develop
Reviewed-on: DigiMantra/digiev_frontend#31
This commit is contained in:
commit
9a09d588a6
BIN
public/logo.png
Normal file
BIN
public/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
0
public/mobileLogo.png
Normal file
0
public/mobileLogo.png
Normal file
|
@ -158,6 +158,7 @@ const AddEditCategoryModal: React.FC<AddEditCategoryModalProps> = ({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
width: "50%",
|
width: "50%",
|
||||||
|
...autofillFix,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
@ -189,8 +190,11 @@ const AddEditCategoryModal: React.FC<AddEditCategoryModalProps> = ({
|
||||||
{...field}
|
{...field}
|
||||||
required
|
required
|
||||||
placeholder="Enter Admin Name"
|
placeholder="Enter Admin Name"
|
||||||
|
// autoComplete="new-username"
|
||||||
|
type="text"
|
||||||
fullWidth
|
fullWidth
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={errors.name?.message}
|
helperText={errors.name?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -229,6 +233,7 @@ const AddEditCategoryModal: React.FC<AddEditCategoryModalProps> = ({
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
autoComplete="new-email"
|
autoComplete="new-email"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
required
|
required
|
||||||
fullWidth
|
fullWidth
|
||||||
color={
|
color={
|
||||||
|
@ -294,6 +299,7 @@ const AddEditCategoryModal: React.FC<AddEditCategoryModalProps> = ({
|
||||||
: "primary"
|
: "primary"
|
||||||
}
|
}
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
slotProps={{
|
slotProps={{
|
||||||
input: {
|
input: {
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
|
@ -329,6 +335,7 @@ const AddEditCategoryModal: React.FC<AddEditCategoryModalProps> = ({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
width: "50%",
|
width: "50%",
|
||||||
|
...autofillFix,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
@ -358,6 +365,7 @@ const AddEditCategoryModal: React.FC<AddEditCategoryModalProps> = ({
|
||||||
required
|
required
|
||||||
placeholder="Enter Phone Number"
|
placeholder="Enter Phone Number"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.phone}
|
error={!!errors.phone}
|
||||||
helperText={errors.phone?.message}
|
helperText={errors.phone?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -372,6 +380,7 @@ const AddEditCategoryModal: React.FC<AddEditCategoryModalProps> = ({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
width: "50%",
|
width: "50%",
|
||||||
|
...autofillFix,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
@ -392,6 +401,7 @@ const AddEditCategoryModal: React.FC<AddEditCategoryModalProps> = ({
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
{...field}
|
{...field}
|
||||||
required
|
required
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
placeholder="Enter Address"
|
placeholder="Enter Address"
|
||||||
fullWidth
|
fullWidth
|
||||||
size="small"
|
size="small"
|
||||||
|
|
|
@ -121,7 +121,7 @@ export default function AddManagerModal({
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* Manager Name */}
|
{/* Manager Name */}
|
||||||
<Box sx={{ display: "flex", gap: 2, mb: 2 }}>
|
<Box sx={{ display: "flex", gap: 2, mb: 2 }}>
|
||||||
<Box sx={{ flex: 1 }}>
|
<Box sx={{ flex: 1, ...autofillFix }}>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography variant="body2" fontWeight={500}>
|
||||||
Manager Name
|
Manager Name
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -129,6 +129,8 @@ export default function AddManagerModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Manager Name"
|
placeholder="Enter Manager Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={
|
helperText={
|
||||||
errors.name ? errors.name.message : ""
|
errors.name ? errors.name.message : ""
|
||||||
|
@ -158,17 +160,43 @@ export default function AddManagerModal({
|
||||||
{/* Station Dropdown */}
|
{/* Station Dropdown */}
|
||||||
<Box sx={{ display: "flex", gap: 2, mb: 2 }}>
|
<Box sx={{ display: "flex", gap: 2, mb: 2 }}>
|
||||||
<Box sx={{ flex: 1 }}>
|
<Box sx={{ flex: 1 }}>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
fontWeight={500}
|
||||||
|
>
|
||||||
Select Station
|
Select Station
|
||||||
</Typography>
|
</Typography>
|
||||||
<FormControl fullWidth error={!!errors.stationName}>
|
<FormControl
|
||||||
<InputLabel>Select Station</InputLabel>
|
fullWidth
|
||||||
|
size="small"
|
||||||
|
error={!!errors.stationName}
|
||||||
|
>
|
||||||
<Select
|
<Select
|
||||||
{...register("stationName", {
|
{...register("stationName", {
|
||||||
required: "Station Name is required",
|
required: "Station Name is required",
|
||||||
})}
|
})}
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
|
displayEmpty
|
||||||
defaultValue=""
|
defaultValue=""
|
||||||
size="small"
|
renderValue={(selected) => {
|
||||||
|
if (!selected) {
|
||||||
|
return (
|
||||||
|
<Typography color="text.secondary">
|
||||||
|
Choose Station
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return selected;
|
||||||
|
}}
|
||||||
|
MenuProps={{
|
||||||
|
PaperProps: {
|
||||||
|
style: {
|
||||||
|
maxHeight: 224,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{Array.isArray(stations) &&
|
{Array.isArray(stations) &&
|
||||||
stations.length > 0 ? (
|
stations.length > 0 ? (
|
||||||
|
@ -187,7 +215,11 @@ export default function AddManagerModal({
|
||||||
)}
|
)}
|
||||||
</Select>
|
</Select>
|
||||||
{errors.stationName && (
|
{errors.stationName && (
|
||||||
<Typography color="error" variant="body2">
|
<Typography
|
||||||
|
color="error"
|
||||||
|
variant="body2"
|
||||||
|
sx={{ mt: 0.5 }}
|
||||||
|
>
|
||||||
{errors.stationName.message}
|
{errors.stationName.message}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
@ -206,6 +238,8 @@ export default function AddManagerModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Manager Email"
|
placeholder="Enter Manager Email"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
autoComplete="new-email"
|
autoComplete="new-email"
|
||||||
error={!!errors.email}
|
error={!!errors.email}
|
||||||
helperText={
|
helperText={
|
||||||
|
@ -246,6 +280,8 @@ export default function AddManagerModal({
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
{...field}
|
{...field}
|
||||||
required
|
required
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
placeholder="Enter Password"
|
placeholder="Enter Password"
|
||||||
type={
|
type={
|
||||||
|
@ -289,7 +325,7 @@ export default function AddManagerModal({
|
||||||
|
|
||||||
{/* Phone Number */}
|
{/* Phone Number */}
|
||||||
<Box sx={{ display: "flex", gap: 2, mb: 2 }}>
|
<Box sx={{ display: "flex", gap: 2, mb: 2 }}>
|
||||||
<Box sx={{ flex: 1 }}>
|
<Box sx={{ flex: 1, ...autofillFix }}>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography variant="body2" fontWeight={500}>
|
||||||
Phone Number
|
Phone Number
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -297,6 +333,8 @@ export default function AddManagerModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Phone Number"
|
placeholder="Enter Phone Number"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.phone}
|
error={!!errors.phone}
|
||||||
helperText={
|
helperText={
|
||||||
errors.phone ? errors.phone.message : ""
|
errors.phone ? errors.phone.message : ""
|
||||||
|
|
|
@ -38,13 +38,17 @@ const AddSlotModal = ({ open, handleClose, handleAddSlot }: any) => {
|
||||||
<DialogTitle>Add EV Slot</DialogTitle>
|
<DialogTitle>Add EV Slot</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
Date
|
||||||
|
</Typography>
|
||||||
<TextField
|
<TextField
|
||||||
{...register("date", {
|
{...register("date", {
|
||||||
required: "Date is required",
|
required: "Date is required",
|
||||||
validate: (value) =>
|
validate: (value) =>
|
||||||
value >= today || "Date cannot be in the past",
|
value >= today || "Date cannot be in the past",
|
||||||
})}
|
})}
|
||||||
label="Date"
|
// label="Date"
|
||||||
|
// sx={{ marginTop: 1 }}
|
||||||
type="date"
|
type="date"
|
||||||
fullWidth
|
fullWidth
|
||||||
margin="normal"
|
margin="normal"
|
||||||
|
@ -58,12 +62,16 @@ const AddSlotModal = ({ open, handleClose, handleAddSlot }: any) => {
|
||||||
// Set the min value to today's date
|
// Set the min value to today's date
|
||||||
inputProps={{ min: today }}
|
inputProps={{ min: today }}
|
||||||
/>
|
/>
|
||||||
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
Start Hour
|
||||||
|
</Typography>
|
||||||
<TextField
|
<TextField
|
||||||
{...register("startHour", {
|
{...register("startHour", {
|
||||||
required: "Start hour is required",
|
required: "Start hour is required",
|
||||||
})}
|
})}
|
||||||
label="Start Hour"
|
// label="Start Hour"
|
||||||
type="time"
|
type="time"
|
||||||
|
// sx={{ marginTop: 1 }}
|
||||||
fullWidth
|
fullWidth
|
||||||
margin="normal"
|
margin="normal"
|
||||||
slotProps={{
|
slotProps={{
|
||||||
|
@ -74,12 +82,16 @@ const AddSlotModal = ({ open, handleClose, handleAddSlot }: any) => {
|
||||||
error={!!errors.startHour}
|
error={!!errors.startHour}
|
||||||
helperText={errors.startHour?.message}
|
helperText={errors.startHour?.message}
|
||||||
/>
|
/>
|
||||||
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
End Hour
|
||||||
|
</Typography>
|
||||||
<TextField
|
<TextField
|
||||||
{...register("endHour", {
|
{...register("endHour", {
|
||||||
required: "End hour is required",
|
required: "End hour is required",
|
||||||
})}
|
})}
|
||||||
label="End Hour"
|
// label="End Hour"
|
||||||
type="time"
|
type="time"
|
||||||
|
// sx={{ marginTop: 1 }}
|
||||||
fullWidth
|
fullWidth
|
||||||
margin="normal"
|
margin="normal"
|
||||||
InputLabelProps={{
|
InputLabelProps={{
|
||||||
|
@ -95,10 +107,13 @@ const AddSlotModal = ({ open, handleClose, handleAddSlot }: any) => {
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
gap={2}
|
gap={2}
|
||||||
>
|
>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setIsAvailable((prev) => !prev)}
|
onClick={() => setIsAvailable((prev) => !prev)}
|
||||||
variant={isAvailable ? "contained" : "outlined"}
|
variant={isAvailable ? "contained" : "outlined"}
|
||||||
color="primary"
|
color="primary"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
>
|
>
|
||||||
Check Availability
|
Check Availability
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -44,7 +44,8 @@ const AddStationLocationModal = ({
|
||||||
"City name must be at least 2 characters",
|
"City name must be at least 2 characters",
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
label="City Name"
|
// label="City Name"
|
||||||
|
placeholder="Enter City Name"
|
||||||
fullWidth
|
fullWidth
|
||||||
margin="normal"
|
margin="normal"
|
||||||
error={!!errors.city}
|
error={!!errors.city}
|
||||||
|
|
|
@ -22,6 +22,8 @@ import {
|
||||||
vehicleList,
|
vehicleList,
|
||||||
} from "../../redux/slices/VehicleSlice.ts"; // Adjust this import path accordingly
|
} from "../../redux/slices/VehicleSlice.ts"; // Adjust this import path accordingly
|
||||||
import { CustomIconButton, CustomTextField } from "../AddUserModal/styled.css"; // Assuming custom styled components
|
import { CustomIconButton, CustomTextField } from "../AddUserModal/styled.css"; // Assuming custom styled components
|
||||||
|
import React from "react";
|
||||||
|
import { autofillFix } from "../../shared-theme/customizations/autoFill.tsx";
|
||||||
|
|
||||||
export default function AddStationModal({
|
export default function AddStationModal({
|
||||||
open,
|
open,
|
||||||
|
@ -158,6 +160,7 @@ export default function AddStationModal({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
|
...autofillFix,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
@ -167,6 +170,7 @@ export default function AddStationModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Station Name"
|
placeholder="Enter Station Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={
|
helperText={
|
||||||
errors.name ? errors.name.message : ""
|
errors.name ? errors.name.message : ""
|
||||||
|
@ -192,6 +196,7 @@ export default function AddStationModal({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
|
...autofillFix,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
@ -201,6 +206,8 @@ export default function AddStationModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Charging Station Address"
|
placeholder="Enter Charging Station Address"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.registeredAddress}
|
error={!!errors.registeredAddress}
|
||||||
helperText={
|
helperText={
|
||||||
errors.registeredAddress
|
errors.registeredAddress
|
||||||
|
@ -231,6 +238,8 @@ export default function AddStationModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Total Slots"
|
placeholder="Enter Total Slots"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
type="number"
|
type="number"
|
||||||
error={!!errors.totalSlots}
|
error={!!errors.totalSlots}
|
||||||
helperText={
|
helperText={
|
||||||
|
@ -252,116 +261,118 @@ export default function AddStationModal({
|
||||||
|
|
||||||
{/* Vehicle Brand Dropdown with Checkboxes */}
|
{/* Vehicle Brand Dropdown with Checkboxes */}
|
||||||
<Box sx={{ display: "flex", gap: 2 }}>
|
<Box sx={{ display: "flex", gap: 2 }}>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="body2"
|
|
||||||
fontWeight={500}
|
|
||||||
sx={{ mb: 1 }}
|
|
||||||
>
|
>
|
||||||
Vehicle Brand
|
<Typography
|
||||||
</Typography>
|
variant="body2"
|
||||||
<FormControl fullWidth size="small">
|
fontWeight={500}
|
||||||
<Select
|
sx={{ mb: 1 }}
|
||||||
multiple
|
|
||||||
displayEmpty
|
|
||||||
value={selectedBrands}
|
|
||||||
onChange={handleBrandChange}
|
|
||||||
renderValue={(selected) => {
|
|
||||||
if (selected.length === 0) {
|
|
||||||
return (
|
|
||||||
<Typography color="text.secondary">
|
|
||||||
Choose Brands
|
|
||||||
</Typography>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const displayNames = (
|
|
||||||
selected as string[]
|
|
||||||
).slice(0, 1);
|
|
||||||
const moreCount =
|
|
||||||
(selected as string[]).length -
|
|
||||||
1;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
flexWrap: "wrap",
|
|
||||||
gap: 0.5,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{displayNames.map((id) => {
|
|
||||||
const brand =
|
|
||||||
vehicleBrands.find(
|
|
||||||
(b) =>
|
|
||||||
b.id === id
|
|
||||||
);
|
|
||||||
return brand ? (
|
|
||||||
<Chip
|
|
||||||
key={id}
|
|
||||||
label={
|
|
||||||
brand.name
|
|
||||||
}
|
|
||||||
size="small"
|
|
||||||
sx={{
|
|
||||||
height: 24,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
) : null;
|
|
||||||
})}
|
|
||||||
{moreCount > 0 && (
|
|
||||||
<Chip
|
|
||||||
label={`+${moreCount} more`}
|
|
||||||
size="small"
|
|
||||||
sx={{ height: 24 }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
MenuProps={{
|
|
||||||
PaperProps: {
|
|
||||||
style: {
|
|
||||||
maxHeight: 224,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{vehicleBrands.length > 0 ? (
|
Vehicle Brand
|
||||||
vehicleBrands.map((brand) => (
|
</Typography>
|
||||||
<MenuItem
|
<FormControl fullWidth size="small">
|
||||||
key={brand.id}
|
<Select
|
||||||
value={brand.id}
|
multiple
|
||||||
>
|
displayEmpty
|
||||||
<Checkbox
|
sx={{ marginTop: 1 }}
|
||||||
checked={selectedBrands.includes(
|
|
||||||
brand.id
|
value={selectedBrands}
|
||||||
|
onChange={handleBrandChange}
|
||||||
|
renderValue={(selected) => {
|
||||||
|
if (selected.length === 0) {
|
||||||
|
return (
|
||||||
|
<Typography color="text.secondary">
|
||||||
|
Choose Brands
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const displayNames = (
|
||||||
|
selected as string[]
|
||||||
|
).slice(0, 1);
|
||||||
|
const moreCount =
|
||||||
|
(selected as string[]).length -
|
||||||
|
1;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexWrap: "wrap",
|
||||||
|
gap: 0.5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{displayNames.map((id) => {
|
||||||
|
const brand =
|
||||||
|
vehicleBrands.find(
|
||||||
|
(b) =>
|
||||||
|
b.id === id
|
||||||
|
);
|
||||||
|
return brand ? (
|
||||||
|
<Chip
|
||||||
|
key={id}
|
||||||
|
label={
|
||||||
|
brand.name
|
||||||
|
}
|
||||||
|
size="small"
|
||||||
|
sx={{
|
||||||
|
height: 24,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : null;
|
||||||
|
})}
|
||||||
|
{moreCount > 0 && (
|
||||||
|
<Chip
|
||||||
|
label={`+${moreCount} more`}
|
||||||
|
size="small"
|
||||||
|
sx={{ height: 24 }}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
</Box>
|
||||||
<ListItemText
|
);
|
||||||
primary={brand.name}
|
}}
|
||||||
/>
|
MenuProps={{
|
||||||
|
PaperProps: {
|
||||||
|
style: {
|
||||||
|
maxHeight: 224,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{vehicleBrands.length > 0 ? (
|
||||||
|
vehicleBrands.map((brand) => (
|
||||||
|
<MenuItem
|
||||||
|
key={brand.id}
|
||||||
|
value={brand.id}
|
||||||
|
>
|
||||||
|
<Checkbox
|
||||||
|
checked={selectedBrands.includes(
|
||||||
|
brand.id
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<ListItemText
|
||||||
|
primary={brand.name}
|
||||||
|
/>
|
||||||
|
</MenuItem>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<MenuItem disabled>
|
||||||
|
No vehicle brands available
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))
|
)}
|
||||||
) : (
|
</Select>
|
||||||
<MenuItem disabled>
|
<FormHelperText>
|
||||||
No vehicle brands available
|
{errors.vehicleBrand
|
||||||
</MenuItem>
|
? errors.vehicleBrand.message
|
||||||
)}
|
: ""}
|
||||||
</Select>
|
</FormHelperText>
|
||||||
<FormHelperText>
|
</FormControl>
|
||||||
{errors.vehicleBrand
|
</Box>
|
||||||
? errors.vehicleBrand.message
|
|
||||||
: ""}
|
|
||||||
</FormHelperText>
|
|
||||||
</FormControl>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
{/* Replace the Vehicle Name Dropdown code with this */}
|
{/* Replace the Vehicle Name Dropdown code with this */}
|
||||||
<Box
|
<Box
|
||||||
|
@ -386,6 +397,8 @@ export default function AddStationModal({
|
||||||
<Select
|
<Select
|
||||||
multiple
|
multiple
|
||||||
displayEmpty
|
displayEmpty
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
value={selectedVehicles}
|
value={selectedVehicles}
|
||||||
onChange={handleVehicleChange}
|
onChange={handleVehicleChange}
|
||||||
renderValue={(selected) => {
|
renderValue={(selected) => {
|
||||||
|
|
|
@ -140,6 +140,7 @@ const AddUserModal: React.FC<AddUserModalProps> = ({
|
||||||
placeholder="Enter User Name"
|
placeholder="Enter User Name"
|
||||||
fullWidth
|
fullWidth
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={errors.name?.message}
|
helperText={errors.name?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -177,6 +178,7 @@ const AddUserModal: React.FC<AddUserModalProps> = ({
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
autoComplete="new-email"
|
autoComplete="new-email"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
required
|
required
|
||||||
fullWidth
|
fullWidth
|
||||||
color={
|
color={
|
||||||
|
@ -228,6 +230,7 @@ const AddUserModal: React.FC<AddUserModalProps> = ({
|
||||||
: "primary"
|
: "primary"
|
||||||
}
|
}
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
slotProps={{
|
slotProps={{
|
||||||
input: {
|
input: {
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
|
@ -261,6 +264,7 @@ const AddUserModal: React.FC<AddUserModalProps> = ({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
...autofillFix,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="body2" fontWeight={500}>
|
<Typography variant="body2" fontWeight={500}>
|
||||||
|
@ -290,6 +294,7 @@ const AddUserModal: React.FC<AddUserModalProps> = ({
|
||||||
required
|
required
|
||||||
placeholder="Enter Phone Number"
|
placeholder="Enter Phone Number"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.phone}
|
error={!!errors.phone}
|
||||||
helperText={errors.phone?.message}
|
helperText={errors.phone?.message}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -94,6 +94,8 @@ export default function AddVehicleModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Company Name"
|
placeholder="Enter Company Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.company}
|
error={!!errors.company}
|
||||||
helperText={
|
helperText={
|
||||||
errors.company
|
errors.company
|
||||||
|
@ -124,6 +126,8 @@ export default function AddVehicleModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Vehicle Name"
|
placeholder="Enter Vehicle Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={
|
helperText={
|
||||||
errors.name ? errors.name.message : ""
|
errors.name ? errors.name.message : ""
|
||||||
|
@ -166,6 +170,8 @@ export default function AddVehicleModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Model Name"
|
placeholder="Enter Model Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.modelName}
|
error={!!errors.modelName}
|
||||||
helperText={
|
helperText={
|
||||||
errors.modelName
|
errors.modelName
|
||||||
|
@ -192,6 +198,8 @@ export default function AddVehicleModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Charge Type"
|
placeholder="Enter Charge Type"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.chargeType}
|
error={!!errors.chargeType}
|
||||||
helperText={
|
helperText={
|
||||||
errors.chargeType
|
errors.chargeType
|
||||||
|
@ -220,6 +228,8 @@ export default function AddVehicleModal({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Image URL"
|
placeholder="Enter Image URL"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.imageUrl}
|
error={!!errors.imageUrl}
|
||||||
helperText={
|
helperText={
|
||||||
errors.imageUrl
|
errors.imageUrl
|
||||||
|
|
|
@ -9,8 +9,16 @@ import Typography from "@mui/material/Typography";
|
||||||
import MenuRoundedIcon from "@mui/icons-material/MenuRounded";
|
import MenuRoundedIcon from "@mui/icons-material/MenuRounded";
|
||||||
import DashboardRoundedIcon from "@mui/icons-material/DashboardRounded";
|
import DashboardRoundedIcon from "@mui/icons-material/DashboardRounded";
|
||||||
import ColorModeIconDropdown from "../../shared-theme/ColorModeIconDropdown";
|
import ColorModeIconDropdown from "../../shared-theme/ColorModeIconDropdown";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
import { AppDispatch, RootState } from "../../redux/store/store";
|
||||||
|
import { fetchAdminProfile } from "../../redux/slices/profileSlice";
|
||||||
|
import NotificationsNoneIcon from "@mui/icons-material/NotificationsNone";
|
||||||
|
import InputBase from "@mui/material/InputBase";
|
||||||
|
import SearchIcon from "@mui/icons-material/Search";
|
||||||
import MenuButton from "../MenuButton";
|
import MenuButton from "../MenuButton";
|
||||||
import SideMenuMobile from "../SideMenuMobile";
|
import SideMenuMobile from "../SideMenuMobile";
|
||||||
|
import { Avatar } from "@mui/material";
|
||||||
|
import OptionsMenu from "../OptionsMenu";
|
||||||
|
|
||||||
const Toolbar = styled(MuiToolbar)({
|
const Toolbar = styled(MuiToolbar)({
|
||||||
width: "100%",
|
width: "100%",
|
||||||
|
@ -30,18 +38,28 @@ const Toolbar = styled(MuiToolbar)({
|
||||||
|
|
||||||
export default function AppNavbar() {
|
export default function AppNavbar() {
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
|
const [showNotifications, setShowNotifications] = React.useState(false);
|
||||||
|
const toggleNotifications = () => {
|
||||||
|
setShowNotifications((prev) => !prev);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dispatch = useDispatch<AppDispatch>();
|
||||||
|
const { user } = useSelector((state: RootState) => state?.profileReducer);
|
||||||
const toggleDrawer = (newOpen: boolean) => () => {
|
const toggleDrawer = (newOpen: boolean) => () => {
|
||||||
setOpen(newOpen);
|
setOpen(newOpen);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
dispatch(fetchAdminProfile());
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar
|
<AppBar
|
||||||
position="fixed"
|
position="fixed"
|
||||||
sx={{
|
sx={{
|
||||||
display: { xs: "auto", md: "none" },
|
display: { xs: "auto", md: "none" },
|
||||||
boxShadow: 0,
|
boxShadow: 0,
|
||||||
backgroundColor:"#1C1C1C",
|
backgroundColor: "#1C1C1C",
|
||||||
backgroundImage: "none",
|
backgroundImage: "none",
|
||||||
borderBottom: "1px solid",
|
borderBottom: "1px solid",
|
||||||
borderColor: "divider",
|
borderColor: "divider",
|
||||||
|
@ -64,13 +82,64 @@ export default function AppNavbar() {
|
||||||
sx={{ justifyContent: "center", mr: "auto" }}
|
sx={{ justifyContent: "center", mr: "auto" }}
|
||||||
>
|
>
|
||||||
<CustomIcon />
|
<CustomIcon />
|
||||||
<Typography
|
{/* <Typography
|
||||||
variant="h4"
|
variant="h4"
|
||||||
component="h1"
|
component="h1"
|
||||||
sx={{ color: "#202020" }}
|
sx={{ color: "#202020" }}
|
||||||
>
|
>
|
||||||
Dashboard
|
Dashboard
|
||||||
|
</Typography> */}
|
||||||
|
</Stack>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
// width: { xs: "100%", sm: "360px" },
|
||||||
|
height: "40px",
|
||||||
|
|
||||||
|
borderRadius: "8px",
|
||||||
|
border: "1px solid #424242",
|
||||||
|
display: {
|
||||||
|
md: "none",
|
||||||
|
xs: "flex",
|
||||||
|
sm: "flex",
|
||||||
|
lg: "none",
|
||||||
|
},
|
||||||
|
alignItems: "center",
|
||||||
|
padding: "0 12px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SearchIcon sx={{ color: "#FFFFFF" }} />
|
||||||
|
<InputBase
|
||||||
|
sx={{
|
||||||
|
marginLeft: 1,
|
||||||
|
flex: 1,
|
||||||
|
color: "#FFFFFF",
|
||||||
|
fontSize: { xs: "12px", sm: "14px" },
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={2}
|
||||||
|
alignItems="center"
|
||||||
|
sx={{
|
||||||
|
pointer: "cursor",
|
||||||
|
display: { xs: "none", sm: "flex" }, // Hide on mobile, show on larger screens
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<NotificationsNoneIcon
|
||||||
|
sx={{ cursor: "pointer" }}
|
||||||
|
onClick={toggleNotifications}
|
||||||
|
/>
|
||||||
|
<Avatar
|
||||||
|
alt="User Avatar"
|
||||||
|
src="/avatar.png"
|
||||||
|
sx={{ width: 36, height: 36 }}
|
||||||
|
/>
|
||||||
|
<Typography variant="body1" sx={{ color: "#FFFFFF" }}>
|
||||||
|
{user?.name || "No Adminsss"}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
|
<OptionsMenu />
|
||||||
</Stack>
|
</Stack>
|
||||||
{/* <ColorModeIconDropdown /> */}
|
{/* <ColorModeIconDropdown /> */}
|
||||||
<MenuButton aria-label="menu" onClick={toggleDrawer(true)}>
|
<MenuButton aria-label="menu" onClick={toggleDrawer(true)}>
|
||||||
|
@ -85,26 +154,29 @@ export default function AppNavbar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CustomIcon() {
|
export function CustomIcon() {
|
||||||
|
const [open, setOpen] = React.useState(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
width: "1.5rem",
|
|
||||||
height: "1.5rem",
|
|
||||||
bgcolor: "black",
|
|
||||||
borderRadius: "999px",
|
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
alignSelf: "center",
|
pt: 2,
|
||||||
backgroundImage:
|
|
||||||
"linear-gradient(135deg, hsl(210, 98%, 60%) 0%, hsl(210, 100%, 35%) 100%)",
|
|
||||||
color: "hsla(210, 100%, 95%, 0.9)",
|
|
||||||
border: "1px solid",
|
|
||||||
borderColor: "hsl(210, 100%, 55%)",
|
|
||||||
boxShadow: "inset 0 2px 5px rgba(255, 255, 255, 0.3)",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DashboardRoundedIcon color="inherit" sx={{ fontSize: "1rem" }} />
|
<img
|
||||||
|
src="/evLogo.png"
|
||||||
|
alt="Logo"
|
||||||
|
style={{
|
||||||
|
justifyContent: "center",
|
||||||
|
width: open ? "120px" : "60px",
|
||||||
|
height: "auto",
|
||||||
|
transition: "width 0.5s ease",
|
||||||
|
marginBottom: "10px",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,13 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({
|
||||||
"&:nth-of-type(odd)": {
|
"&:nth-of-type(odd)": {
|
||||||
backgroundColor: theme.palette.action.hover,
|
backgroundColor: theme.palette.action.hover,
|
||||||
},
|
},
|
||||||
|
"&:nth-of-type(even)": {
|
||||||
|
backgroundColor: theme.palette.action.hover,
|
||||||
|
},
|
||||||
"& td, th": {
|
"& td, th": {
|
||||||
borderColor: "#454545", // Applying border color to both td and th
|
borderColor: "#454545", // Applying border color to both td and th
|
||||||
borderWidth: "1px", // Set border width to ensure it appears
|
borderWidth: "1px", // Set border width to ensure it appears
|
||||||
|
borderBottom: "1px solid #454545",
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -227,11 +231,16 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
width: "calc(100% - 48px)",
|
width: { xs: "100%", sm: "100%" },
|
||||||
margin: "0 auto",
|
margin: "0 auto",
|
||||||
padding: "24px",
|
padding: "24px",
|
||||||
backgroundColor: "#1C1C1C",
|
backgroundColor: "#1C1C1C",
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
|
overflowX: "auto",
|
||||||
|
boxSizing: "border-box",
|
||||||
|
// Ensure CustomTable doesn't affect layout above it
|
||||||
|
position: "relative",
|
||||||
|
zIndex: 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
|
@ -276,22 +285,24 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
flexDirection: { xs: "column", sm: "column", md: "row" },
|
||||||
|
gap: { xs: "16px", sm: "16px", md: "0" },
|
||||||
marginTop: "16px",
|
marginTop: "16px",
|
||||||
alignItems: "center",
|
alignItems: { xs: "stretch", sm: "stretch", md: "center" },
|
||||||
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
sx={{
|
sx={{
|
||||||
width: "422px",
|
width: { xs: "100%", sm: "100%", md: "380px" },
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
input: { color: "#FFFFFF" },
|
input: { color: "#FFFFFF" },
|
||||||
backgroundColor: "#272727",
|
backgroundColor: "#272727",
|
||||||
"& .MuiOutlinedInput-root": {
|
"& .MuiOutlinedInput-root": {
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
width: "422px",
|
width: { xs: "100%", sm: "100%", md: "380px" },
|
||||||
height: "44px",
|
height: "44px",
|
||||||
borderWidth: "1px",
|
borderWidth: "1px",
|
||||||
padding: "14px 12px 14px 12px",
|
padding: "14px 12px 14px 12px",
|
||||||
|
@ -319,6 +330,7 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
@ -374,7 +386,7 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<IconButton
|
{/* <IconButton
|
||||||
sx={{
|
sx={{
|
||||||
width: "44px",
|
width: "44px",
|
||||||
height: "44px",
|
height: "44px",
|
||||||
|
@ -388,7 +400,7 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TuneIcon />
|
<TuneIcon />
|
||||||
</IconButton>
|
</IconButton> */}
|
||||||
</Box>
|
</Box>
|
||||||
{/* Table Section */}
|
{/* Table Section */}
|
||||||
<TableContainer
|
<TableContainer
|
||||||
|
@ -397,10 +409,21 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
marginTop: "24px",
|
marginTop: "24px",
|
||||||
backgroundColor: "#1C1C1C",
|
backgroundColor: "#1C1C1C",
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
overflow: "hidden",
|
overflow: "auto",
|
||||||
|
maxWidth: "100%",
|
||||||
|
"&::-webkit-scrollbar": {
|
||||||
|
height: "3px",
|
||||||
|
},
|
||||||
|
"&::-webkit-scrollbar-track": {
|
||||||
|
background: "#1C1C1C",
|
||||||
|
},
|
||||||
|
"&::-webkit-scrollbar-thumb": {
|
||||||
|
background: "#52ACDF",
|
||||||
|
borderRadius: "4px",
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Table>
|
<Table sx={{ minWidth: "750px", tableLayout: "auto" }}>
|
||||||
<TableHead
|
<TableHead
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: "#272727",
|
backgroundColor: "#272727",
|
||||||
|
@ -408,6 +431,7 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
".css-1ex4ubw-MuiTableCell-root.MuiTableCell-head ":
|
".css-1ex4ubw-MuiTableCell-root.MuiTableCell-head ":
|
||||||
{
|
{
|
||||||
backgroundColor: "#272727",
|
backgroundColor: "#272727",
|
||||||
|
borderBottom: "1px solid #454545",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -419,6 +443,16 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
sx={{
|
sx={{
|
||||||
color: "#FFFFFF",
|
color: "#FFFFFF",
|
||||||
fontWeight: "600",
|
fontWeight: "600",
|
||||||
|
...(column.id === "action" && {
|
||||||
|
position: "sticky",
|
||||||
|
right: 0,
|
||||||
|
zIndex: 2,
|
||||||
|
backgroundColor: "#272727",
|
||||||
|
boxShadow:
|
||||||
|
"-5px 0 5px -2px rgba(0,0,0,0.15)",
|
||||||
|
borderBottom:
|
||||||
|
"1px solid #454545",
|
||||||
|
}),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{column.label}
|
{column.label}
|
||||||
|
@ -433,51 +467,103 @@ const CustomTable: React.FC<CustomTableProps> = ({
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{currentRows.map((row, rowIndex) => (
|
{/* This is where the modification starts */}
|
||||||
<StyledTableRow key={rowIndex}>
|
{currentRows.length === 0 ? (
|
||||||
{columns.map((column) => (
|
<StyledTableRow>
|
||||||
<StyledTableCell
|
<StyledTableCell
|
||||||
key={column.id}
|
colSpan={columns.length}
|
||||||
sx={{
|
sx={{
|
||||||
color: "#D9D8D8",
|
color: "#D9D8D8",
|
||||||
backgroundColor: "#272727",
|
backgroundColor: "#272727",
|
||||||
}}
|
textAlign: "center",
|
||||||
>
|
padding: "32px 0",
|
||||||
{isImage(row[column.id]) ? (
|
}}
|
||||||
<img
|
>
|
||||||
src={row[column.id]}
|
{(() => {
|
||||||
alt="Row "
|
switch (tableType) {
|
||||||
style={{
|
case "admin":
|
||||||
width: "50px",
|
return "No admins found";
|
||||||
height: "50px",
|
case "role":
|
||||||
objectFit: "cover",
|
return "No roles found";
|
||||||
}}
|
case "user":
|
||||||
/>
|
return "No users found";
|
||||||
) : column.id !== "action" ? (
|
case "manager":
|
||||||
row[column.id]
|
return "No managers found";
|
||||||
) : (
|
case "vehicle":
|
||||||
<CustomIconButton
|
return "No vehicles found";
|
||||||
onClick={(e) => {
|
case "station":
|
||||||
handleClick(e, row);
|
return "No charging stations found";
|
||||||
setRowData(row); // Store the selected row
|
case "external-station":
|
||||||
}}
|
return "No charging stations found";
|
||||||
sx={{
|
case "booking":
|
||||||
padding: 0,
|
return "No bookings found";
|
||||||
minWidth: 0,
|
case "slots":
|
||||||
width: "auto",
|
return "No slots found";
|
||||||
height: "auto",
|
case "all-available-slots":
|
||||||
color: "#FFFFFF",
|
return "No available slots found";
|
||||||
}}
|
default:
|
||||||
>
|
return "No data available";
|
||||||
<MoreHorizRoundedIcon
|
}
|
||||||
sx={{ fontSize: "24px" }}
|
})()}
|
||||||
/>
|
</StyledTableCell>
|
||||||
</CustomIconButton>
|
|
||||||
)}
|
|
||||||
</StyledTableCell>
|
|
||||||
))}
|
|
||||||
</StyledTableRow>
|
</StyledTableRow>
|
||||||
))}
|
) : (
|
||||||
|
currentRows.map((row, rowIndex) => (
|
||||||
|
<StyledTableRow key={rowIndex}>
|
||||||
|
{columns.map((column) => (
|
||||||
|
<StyledTableCell
|
||||||
|
key={column.id}
|
||||||
|
sx={{
|
||||||
|
color: "#D9D8D8",
|
||||||
|
backgroundColor: "#272727",
|
||||||
|
...(column.id === "action" && {
|
||||||
|
position: "sticky",
|
||||||
|
right: 0,
|
||||||
|
zIndex: 2,
|
||||||
|
backgroundColor: "#272727",
|
||||||
|
boxShadow:
|
||||||
|
"-5px 0 5px -2px rgba(0,0,0,0.15)",
|
||||||
|
}),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isImage(row[column.id]) ? (
|
||||||
|
<img
|
||||||
|
src={row[column.id]}
|
||||||
|
alt="Row "
|
||||||
|
style={{
|
||||||
|
width: "50px",
|
||||||
|
height: "50px",
|
||||||
|
objectFit: "cover",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : column.id !== "action" ? (
|
||||||
|
row[column.id]
|
||||||
|
) : (
|
||||||
|
<CustomIconButton
|
||||||
|
onClick={(e) => {
|
||||||
|
handleClick(e, row);
|
||||||
|
setRowData(row);
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
padding: 0,
|
||||||
|
minWidth: 0,
|
||||||
|
width: "auto",
|
||||||
|
height: "auto",
|
||||||
|
color: "#FFFFFF",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MoreHorizRoundedIcon
|
||||||
|
sx={{
|
||||||
|
fontSize: "24px",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</CustomIconButton>
|
||||||
|
)}
|
||||||
|
</StyledTableCell>
|
||||||
|
))}
|
||||||
|
</StyledTableRow>
|
||||||
|
))
|
||||||
|
)}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
</TableContainer>
|
</TableContainer>
|
||||||
|
|
|
@ -171,6 +171,8 @@ const EditManagerModal: React.FC<EditManagerModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Manager Name"
|
placeholder="Enter Manager Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={errors.name?.message}
|
helperText={errors.name?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -193,6 +195,8 @@ const EditManagerModal: React.FC<EditManagerModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Email"
|
placeholder="Enter Email"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.email}
|
error={!!errors.email}
|
||||||
helperText={errors.email?.message}
|
helperText={errors.email?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -229,6 +233,8 @@ const EditManagerModal: React.FC<EditManagerModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Phone Number"
|
placeholder="Enter Phone Number"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
|
|
||||||
error={!!errors.phone}
|
error={!!errors.phone}
|
||||||
helperText={errors.phone?.message}
|
helperText={errors.phone?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -249,6 +255,7 @@ const EditManagerModal: React.FC<EditManagerModalProps> = ({
|
||||||
borderRadius: "8px",
|
borderRadius: "8px",
|
||||||
width: "117px",
|
width: "117px",
|
||||||
"&:hover": { backgroundColor: "#439BC1" },
|
"&:hover": { backgroundColor: "#439BC1" },
|
||||||
|
whiteSpace: "pre",
|
||||||
}}
|
}}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
|
|
|
@ -249,6 +249,7 @@ const EditStationModal: React.FC<EditStationModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Station Name"
|
placeholder="Enter Station Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={
|
helperText={
|
||||||
errors.name
|
errors.name
|
||||||
|
@ -282,6 +283,7 @@ const EditStationModal: React.FC<EditStationModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Registered Address"
|
placeholder="Enter Registered Address"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.registeredAddress}
|
error={!!errors.registeredAddress}
|
||||||
helperText={
|
helperText={
|
||||||
errors.registeredAddress
|
errors.registeredAddress
|
||||||
|
@ -320,6 +322,7 @@ const EditStationModal: React.FC<EditStationModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Total Slots"
|
placeholder="Enter Total Slots"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
type="number"
|
type="number"
|
||||||
error={!!errors.totalSlots}
|
error={!!errors.totalSlots}
|
||||||
helperText={
|
helperText={
|
||||||
|
@ -349,6 +352,7 @@ const EditStationModal: React.FC<EditStationModalProps> = ({
|
||||||
<InputLabel>Choose Brand</InputLabel>
|
<InputLabel>Choose Brand</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
multiple
|
multiple
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
value={selectedBrands}
|
value={selectedBrands}
|
||||||
onChange={handleBrandChange}
|
onChange={handleBrandChange}
|
||||||
label="Choose Brands"
|
label="Choose Brands"
|
||||||
|
@ -439,6 +443,7 @@ const EditStationModal: React.FC<EditStationModalProps> = ({
|
||||||
<InputLabel>Choose Vehicles</InputLabel>
|
<InputLabel>Choose Vehicles</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
multiple
|
multiple
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
value={selectedVehicles}
|
value={selectedVehicles}
|
||||||
onChange={handleCheckboxChange}
|
onChange={handleCheckboxChange}
|
||||||
renderValue={(selected) => {
|
renderValue={(selected) => {
|
||||||
|
|
|
@ -133,6 +133,7 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Full Name"
|
placeholder="Enter Full Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={errors.name?.message}
|
helperText={errors.name?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -163,6 +164,7 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Email"
|
placeholder="Enter Email"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.email}
|
error={!!errors.email}
|
||||||
helperText={errors.email?.message}
|
helperText={errors.email?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -199,6 +201,7 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Phone Number"
|
placeholder="Enter Phone Number"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.phone}
|
error={!!errors.phone}
|
||||||
helperText={errors.phone?.message}
|
helperText={errors.phone?.message}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -174,6 +174,7 @@ const EditVehicleModal: React.FC<EditVehicleModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Vehicle Name"
|
placeholder="Enter Vehicle Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.name}
|
error={!!errors.name}
|
||||||
helperText={errors.name?.message}
|
helperText={errors.name?.message}
|
||||||
|
|
||||||
|
@ -206,6 +207,7 @@ const EditVehicleModal: React.FC<EditVehicleModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Company Name"
|
placeholder="Enter Company Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.company}
|
error={!!errors.company}
|
||||||
helperText={errors.company?.message}
|
helperText={errors.company?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -240,6 +242,7 @@ const EditVehicleModal: React.FC<EditVehicleModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Model Name"
|
placeholder="Enter Model Name"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.modelName}
|
error={!!errors.modelName}
|
||||||
helperText={errors.modelName?.message}
|
helperText={errors.modelName?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -271,6 +274,7 @@ const EditVehicleModal: React.FC<EditVehicleModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Charge Type"
|
placeholder="Enter Charge Type"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.chargeType}
|
error={!!errors.chargeType}
|
||||||
helperText={errors.chargeType?.message}
|
helperText={errors.chargeType?.message}
|
||||||
/>
|
/>
|
||||||
|
@ -300,6 +304,7 @@ const EditVehicleModal: React.FC<EditVehicleModalProps> = ({
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Enter Image URL"
|
placeholder="Enter Image URL"
|
||||||
size="small"
|
size="small"
|
||||||
|
sx={{ marginTop: 1 }}
|
||||||
error={!!errors.imageUrl}
|
error={!!errors.imageUrl}
|
||||||
helperText={errors.imageUrl?.message}
|
helperText={errors.imageUrl?.message}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -26,16 +26,25 @@ export default function Header() {
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: "84px",
|
height: "84px",
|
||||||
backgroundColor: "#1C1C1C",
|
minHeight: "84px",
|
||||||
padding: { xs: "20px 12px", sm: "20px 24px" },
|
maxHeight: "84px",
|
||||||
display: "flex",
|
backgroundColor: "#1C1C1C",
|
||||||
alignItems: "center",
|
padding: { xs: "20px 12px", sm: "20px 24px" },
|
||||||
justifyContent: "space-between",
|
display: {
|
||||||
flexDirection: { xs: "column", sm: "row" },
|
xs: "none",
|
||||||
}}
|
md: "flex",
|
||||||
|
},
|
||||||
|
marginTop: { xs: "0px", sm: "0px" },
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
flexDirection: { xs: "column", sm: "row" },
|
||||||
|
boxSizing: "border-box",
|
||||||
|
overflowX: "hidden",
|
||||||
|
flex: "0 0 84px",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
|
@ -45,14 +54,17 @@ export default function Header() {
|
||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
justifyContent: { xs: "center", sm: "flex-end" },
|
justifyContent: { xs: "center", sm: "flex-end" },
|
||||||
marginTop: { xs: 2, sm: 0 },
|
marginTop: { xs: 0, sm: 0 }, // Remove top margin on mobile
|
||||||
|
flexWrap: { xs: "wrap", sm: "nowrap" },
|
||||||
|
maxHeight: "100%", // Ensure content doesn't push height
|
||||||
|
overflow: "hidden", // Prevent overflow
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* Search Bar */}
|
{/* Search Bar */}
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
// width: { xs: "100%", sm: "360px" },
|
// width: { xs: "100%", sm: "360px" },
|
||||||
height: "44px",
|
height: "40px",
|
||||||
|
|
||||||
borderRadius: "8px",
|
borderRadius: "8px",
|
||||||
border: "1px solid #424242",
|
border: "1px solid #424242",
|
||||||
|
@ -83,7 +95,7 @@ export default function Header() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NotificationsNoneIcon
|
<NotificationsNoneIcon
|
||||||
sx={{ pointer: "cursor" }}
|
sx={{ cursor: "pointer" }}
|
||||||
onClick={toggleNotifications}
|
onClick={toggleNotifications}
|
||||||
/>
|
/>
|
||||||
<Avatar
|
<Avatar
|
||||||
|
|
|
@ -10,6 +10,7 @@ import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { AppDispatch, RootState } from "../../redux/store/store";
|
import { AppDispatch, RootState } from "../../redux/store/store";
|
||||||
import { fetchDashboardData } from "../../redux/slices/dashboardSlice";
|
import { fetchDashboardData } from "../../redux/slices/dashboardSlice";
|
||||||
|
import { Box } from "@mui/material";
|
||||||
|
|
||||||
function AreaGradient({ color, id }: { color: string; id: string }) {
|
function AreaGradient({ color, id }: { color: string; id: string }) {
|
||||||
return (
|
return (
|
||||||
|
@ -159,12 +160,13 @@ export default function LineChartCard() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Line Chart */}
|
{/* Line Chart */}
|
||||||
|
<Box sx={{ mt: 7.5 }}>
|
||||||
<LineChart
|
<LineChart
|
||||||
colors={[theme.palette.primary.main]}
|
colors={[theme.palette.primary.main]}
|
||||||
xAxis={[
|
xAxis={[
|
||||||
{
|
{
|
||||||
scaleType: "point",
|
scaleType: "point",
|
||||||
data: chartData.map((data) => data.label), // Use intervals as x-axis labels
|
data: chartData.map((data) => data.label),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
series={[
|
series={[
|
||||||
|
@ -173,7 +175,7 @@ export default function LineChartCard() {
|
||||||
showMark: false,
|
showMark: false,
|
||||||
curve: "linear",
|
curve: "linear",
|
||||||
area: true,
|
area: true,
|
||||||
data: chartData.map((data) => data.value), // Use interval data for y-axis
|
data: chartData.map((data) => data.value),
|
||||||
color: theme.palette.primary.main,
|
color: theme.palette.primary.main,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
@ -191,6 +193,7 @@ export default function LineChartCard() {
|
||||||
id="totalBookings"
|
id="totalBookings"
|
||||||
/>
|
/>
|
||||||
</LineChart>
|
</LineChart>
|
||||||
|
</Box>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,10 +12,10 @@ import { useEffect } from "react";
|
||||||
import { fetchDashboardData } from "../../redux/slices/dashboardSlice";
|
import { fetchDashboardData } from "../../redux/slices/dashboardSlice";
|
||||||
|
|
||||||
const colorPalette = [
|
const colorPalette = [
|
||||||
"hsla(202, 69%, 60%, 1)",
|
"hsla(202, 69%, 60%, 1)",
|
||||||
"hsl(204, 48.60%, 72.50%)",
|
"hsl(204, 48.60%, 72.50%)",
|
||||||
"hsl(214, 56.40%, 30.60%)",
|
"hsl(214, 56.40%, 30.60%)",
|
||||||
"hsl(222, 6.80%, 50.80%)",
|
"hsl(222, 6.80%, 50.80%)",
|
||||||
];
|
];
|
||||||
|
|
||||||
// const data = [
|
// const data = [
|
||||||
|
@ -26,17 +26,17 @@ const colorPalette = [
|
||||||
// ];
|
// ];
|
||||||
|
|
||||||
export default function ResourcePieChart() {
|
export default function ResourcePieChart() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isXsScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
const isXsScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
||||||
const isSmScreen = useMediaQuery(theme.breakpoints.between("sm", "md"));
|
const isSmScreen = useMediaQuery(theme.breakpoints.between("sm", "md"));
|
||||||
const dispatch = useDispatch<AppDispatch>();
|
const dispatch = useDispatch<AppDispatch>();
|
||||||
|
|
||||||
// // Fetch role and carPortCounts from Redux state
|
// // Fetch role and carPortCounts from Redux state
|
||||||
// const {user} = useSelector((state: RootState) => state.profileReducer); // Assuming user role is stored in Redux
|
// const {user} = useSelector((state: RootState) => state.profileReducer); // Assuming user role is stored in Redux
|
||||||
const { carPortCounts } = useSelector(
|
const { carPortCounts } = useSelector(
|
||||||
(state: RootState) => state.dashboardReducer
|
(state: RootState) => state.dashboardReducer
|
||||||
);
|
);
|
||||||
console.log("first",carPortCounts)
|
console.log("first", carPortCounts);
|
||||||
// Static data for non-superadmin roles
|
// Static data for non-superadmin roles
|
||||||
// const staticCarPorts = [
|
// const staticCarPorts = [
|
||||||
// { carPort: "240V", count: 5 },
|
// { carPort: "240V", count: 5 },
|
||||||
|
@ -45,52 +45,50 @@ export default function ResourcePieChart() {
|
||||||
// { carPort: "Other", count: 7 },
|
// { carPort: "Other", count: 7 },
|
||||||
// ];
|
// ];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
dispatch(fetchDashboardData());
|
dispatch(fetchDashboardData());
|
||||||
|
}, [dispatch]);
|
||||||
}, [dispatch]);
|
|
||||||
|
|
||||||
// console.log("Raw CarPortCounts from API:", carPortCounts);
|
// console.log("Raw CarPortCounts from API:", carPortCounts);
|
||||||
|
|
||||||
const dataToDisplay =carPortCounts
|
const dataToDisplay = carPortCounts;
|
||||||
|
|
||||||
// const dataToDisplay =
|
// const dataToDisplay =
|
||||||
// user?.userType === "superadmin"
|
// user?.userType === "superadmin"
|
||||||
// ? carPortCounts.filter((entry) => entry.count > 0) // Exclude zero counts
|
// ? carPortCounts.filter((entry) => entry.count > 0) // Exclude zero counts
|
||||||
// : staticCarPorts.filter((entry) => entry.count > 0);
|
// : staticCarPorts.filter((entry) => entry.count > 0);
|
||||||
// console.log("Filtered Data to Display:", dataToDisplay);
|
// console.log("Filtered Data to Display:", dataToDisplay);
|
||||||
const getChartDimensions = () => {
|
const getChartDimensions = () => {
|
||||||
if (isXsScreen) {
|
if (isXsScreen) {
|
||||||
return {
|
return {
|
||||||
height: 240,
|
height: 240,
|
||||||
width: 240,
|
width: 240,
|
||||||
innerRadius: 40,
|
innerRadius: 40,
|
||||||
outerRadius: 80,
|
outerRadius: 80,
|
||||||
margin: { left: 20, right: 20, top: 40, bottom: 40 }
|
margin: { left: 20, right: 20, top: 40, bottom: 40 },
|
||||||
};
|
};
|
||||||
} else if (isSmScreen) {
|
} else if (isSmScreen) {
|
||||||
return {
|
return {
|
||||||
height: 260,
|
height: 260,
|
||||||
width: 260,
|
width: 260,
|
||||||
innerRadius: 50,
|
innerRadius: 50,
|
||||||
outerRadius: 90,
|
outerRadius: 90,
|
||||||
margin: { left: 40, right: 40, top: 60, bottom: 60 }
|
margin: { left: 40, right: 40, top: 60, bottom: 60 },
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
height: 350,
|
height: 350,
|
||||||
width: 350,
|
width: 350,
|
||||||
innerRadius: 55,
|
innerRadius: 55,
|
||||||
outerRadius: 110,
|
outerRadius: 110,
|
||||||
margin: { left: 60, right: 80, top: 80, bottom: 80 }
|
margin: { left: 60, right: 80, top: 80, bottom: 80 },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const dimensions = getChartDimensions();
|
const dimensions = getChartDimensions();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -162,7 +160,6 @@ const dataToDisplay =carPortCounts
|
||||||
legend: { hidden: true },
|
legend: { hidden: true },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack
|
<Stack
|
||||||
spacing={1}
|
spacing={1}
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -170,6 +167,8 @@ const dataToDisplay =carPortCounts
|
||||||
ml: { xs: 0, sm: 2 },
|
ml: { xs: 0, sm: 2 },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Typography sx={{whiteSpace: "pre"}}>Car Port Types:</Typography>
|
||||||
|
|
||||||
{dataToDisplay.map((entry, index) => (
|
{dataToDisplay.map((entry, index) => (
|
||||||
<Stack
|
<Stack
|
||||||
key={index}
|
key={index}
|
||||||
|
@ -207,5 +206,5 @@ const dataToDisplay =carPortCounts
|
||||||
</Box>
|
</Box>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import CardAlert from "../CardAlert/CardAlert";
|
||||||
import { AppDispatch, RootState } from "../../redux/store/store";
|
import { AppDispatch, RootState } from "../../redux/store/store";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { fetchAdminProfile } from "../../redux/slices/profileSlice";
|
import { fetchAdminProfile } from "../../redux/slices/profileSlice";
|
||||||
|
import Logout from "../LogOutFunction/LogOutFunction";
|
||||||
|
|
||||||
interface SideMenuMobileProps {
|
interface SideMenuMobileProps {
|
||||||
open: boolean | undefined;
|
open: boolean | undefined;
|
||||||
|
@ -25,6 +26,7 @@ export default function SideMenuMobile({
|
||||||
toggleDrawer,
|
toggleDrawer,
|
||||||
}: SideMenuMobileProps) {
|
}: SideMenuMobileProps) {
|
||||||
const dispatch = useDispatch<AppDispatch>();
|
const dispatch = useDispatch<AppDispatch>();
|
||||||
|
const [logoutModal, setLogoutModal] = React.useState<boolean>(false);
|
||||||
const { user } = useSelector((state: RootState) => state?.profileReducer);
|
const { user } = useSelector((state: RootState) => state?.profileReducer);
|
||||||
// React.useEffect(() => {
|
// React.useEffect(() => {
|
||||||
// dispatch(fetchAdminProfile());
|
// dispatch(fetchAdminProfile());
|
||||||
|
@ -79,9 +81,18 @@ export default function SideMenuMobile({
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
fullWidth
|
fullWidth
|
||||||
startIcon={<LogoutRoundedIcon />}
|
startIcon={<LogoutRoundedIcon />}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
setLogoutModal(true);
|
||||||
|
}}
|
||||||
|
sx={{ color: "red" }}
|
||||||
>
|
>
|
||||||
Logout
|
Logout
|
||||||
</Button>
|
</Button>
|
||||||
|
<Logout
|
||||||
|
setLogoutModal={setLogoutModal}
|
||||||
|
logoutModal={logoutModal}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
|
@ -16,9 +16,11 @@ const DashboardLayout: React.FC<LayoutProps> = ({ customStyles }) => {
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
height: "auto",
|
// height: "auto",
|
||||||
flexDirection: { xs: "column", md: "row" },
|
flexDirection: { xs: "column", md: "row" },
|
||||||
width: "100%",
|
width: "100%",
|
||||||
|
height: "100vh", // Full height from root, not auto
|
||||||
|
overflow: "hidden",
|
||||||
margin: 0,
|
margin: 0,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
}}
|
}}
|
||||||
|
@ -43,29 +45,32 @@ const DashboardLayout: React.FC<LayoutProps> = ({ customStyles }) => {
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
height: "100vh",
|
height: "100vh",
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
// backgroundColor: theme.vars
|
|
||||||
// ? `rgba(${theme.vars.palette.background.defaultChannel} / 1)`
|
|
||||||
// : theme.palette.background.default,
|
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: theme.palette.background.default,
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
|
overflowX: "hidden",
|
||||||
...customStyles,
|
...customStyles,
|
||||||
mt: { xs: 8, md: 0 },
|
mt: { xs: 8, md: 0 },
|
||||||
padding: 0,
|
padding: 0,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
<Box sx={{ height: "84px", flex: "0 0 84px" }}>
|
||||||
|
<Header />
|
||||||
|
</Box>
|
||||||
<Stack
|
<Stack
|
||||||
spacing={2}
|
spacing={2}
|
||||||
sx={{
|
sx={{
|
||||||
|
padding: "30px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyItems: "center",
|
justifyItems: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
mx: 3,
|
// mx: { xs: 1, sm: 3 },
|
||||||
pb: 5,
|
// pb: 5,
|
||||||
mt: { xs: 3, md: 0 },
|
mt: { xs: 3, md: 0 },
|
||||||
|
width: "100%",
|
||||||
|
boxSizing: "border-box",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Header />
|
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
@ -52,48 +52,40 @@ const ProfilePage = () => {
|
||||||
</Typography>
|
</Typography>
|
||||||
<Card
|
<Card
|
||||||
sx={{
|
sx={{
|
||||||
width: "1132px",
|
borderRadius: 2,
|
||||||
height: "331px",
|
p: { xs: 2, sm: 3 },
|
||||||
gap: "24px",
|
mx: "auto",
|
||||||
borderRadius: "12px",
|
|
||||||
padding: "16px",
|
|
||||||
maxWidth: "100%",
|
|
||||||
margin: "0 auto",
|
|
||||||
backgroundColor: "#1C1C1C",
|
backgroundColor: "#1C1C1C",
|
||||||
}}
|
}}
|
||||||
|
// sx={{
|
||||||
|
// width: "1132px",
|
||||||
|
// height: "331px",
|
||||||
|
// gap: "24px",
|
||||||
|
// borderRadius: "12px",
|
||||||
|
// padding: "16px",
|
||||||
|
// maxWidth: "100%",
|
||||||
|
// margin: "0 auto",
|
||||||
|
// backgroundColor: "#1C1C1C",
|
||||||
|
// }}
|
||||||
>
|
>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Stack direction="column" spacing={2}>
|
<Stack direction="column" spacing={2}>
|
||||||
<Stack
|
<Stack direction="row" spacing={2} alignItems="center">
|
||||||
direction="row"
|
|
||||||
spacing={1.5}
|
|
||||||
alignItems="center"
|
|
||||||
>
|
|
||||||
<Avatar
|
<Avatar
|
||||||
alt="User Avatar"
|
alt="User Avatar"
|
||||||
src="/avatar.png"
|
src="/avatar.png"
|
||||||
sx={{ width: "60px", height: "60px" }}
|
sx={{ width: 60, height: 60 }}
|
||||||
/>
|
/>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
variant="body1"
|
||||||
width="1028px"
|
sx={{ color: "#FFFFFF", fontWeight: 500 }}
|
||||||
height="24px"
|
|
||||||
fontWeight={500}
|
|
||||||
fontSize={"20px"}
|
|
||||||
lineHeight={"100%"}
|
|
||||||
sx={{ color: "#FFFFFF" }}
|
|
||||||
>
|
>
|
||||||
{user?.name || "No Admin"}
|
{user?.name || "No Admin"}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
variant="body2"
|
variant="body2"
|
||||||
color="#D9D8D8"
|
sx={{ color: "#D9D8D8" }}
|
||||||
fontWeight={400}
|
|
||||||
fontSize={"16px"}
|
|
||||||
lineHeight={"100%"}
|
|
||||||
width="46px"
|
|
||||||
height="19px"
|
|
||||||
>
|
>
|
||||||
{user?.userType || "N/A"}
|
{user?.userType || "N/A"}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -105,18 +97,13 @@ const ProfilePage = () => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction={{ xs: "column", sm: "row" }}
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
alignItems="center"
|
alignItems={{ xs: "flex-start", sm: "center" }}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
variant="body1"
|
||||||
width="1048px"
|
sx={{ color: "#FFFFFF", fontWeight: 500 }}
|
||||||
height="19px"
|
|
||||||
fontWeight={500}
|
|
||||||
fontSize={"16px"}
|
|
||||||
lineHeight={"100%"}
|
|
||||||
sx={{ color: "#FFFFFF" }}
|
|
||||||
>
|
>
|
||||||
Personal Information
|
Personal Information
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -129,40 +116,22 @@ const ProfilePage = () => {
|
||||||
</Link> */}
|
</Link> */}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Grid
|
<Grid container spacing={3} sx={{ overflowX: "auto" }}>
|
||||||
container
|
<Grid item xs={12} sm={4}>
|
||||||
width="1100px"
|
|
||||||
height="38px"
|
|
||||||
// gap={"100px"}
|
|
||||||
>
|
|
||||||
<Grid
|
|
||||||
item
|
|
||||||
xs={12}
|
|
||||||
sm={4}
|
|
||||||
width="64px"
|
|
||||||
height="16px"
|
|
||||||
fontSize={"14px"}
|
|
||||||
lineHeight={"100%"}
|
|
||||||
>
|
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
variant="body2"
|
||||||
fontWeight={500}
|
sx={{ color: "#FFFFFF", fontWeight: 500 }}
|
||||||
sx={{ color: "#FFFFFF" }}
|
|
||||||
>
|
>
|
||||||
Full Name:
|
Full Name:
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography variant="body2" color="#D9D8D8">
|
||||||
variant="body2"
|
|
||||||
fontWeight={400}
|
|
||||||
color="#D9D8D8"
|
|
||||||
>
|
|
||||||
{user?.name || "N/A"}
|
{user?.name || "N/A"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={4}>
|
<Grid item xs={12} sm={4}>
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
variant="body2"
|
||||||
sx={{ color: "#FFFFFF" }}
|
sx={{ color: "#FFFFFF", fontWeight: 500 }}
|
||||||
>
|
>
|
||||||
Phone:
|
Phone:
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -172,8 +141,8 @@ const ProfilePage = () => {
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={4}>
|
<Grid item xs={12} sm={4}>
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
variant="body2"
|
||||||
sx={{ color: "#FFFFFF" }}
|
sx={{ color: "#FFFFFF", fontWeight: 500 }}
|
||||||
>
|
>
|
||||||
Email:
|
Email:
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -181,24 +150,18 @@ const ProfilePage = () => {
|
||||||
{user?.email || "N/A"}
|
{user?.email || "N/A"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid item xs={12} sm={4}>
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
sx={{ color: "#FFFFFF", fontWeight: 500 }}
|
||||||
|
>
|
||||||
|
Bio:
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body2" color="#D9D8D8">
|
||||||
|
{user?.bio || "No bio available."}
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Typography
|
|
||||||
variant="body1"
|
|
||||||
width="21px"
|
|
||||||
height="16px"
|
|
||||||
sx={{ color: "#FFFFFF" }}
|
|
||||||
>
|
|
||||||
Bio:
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="body2"
|
|
||||||
width="1100px"
|
|
||||||
height="32px"
|
|
||||||
color="#D9D8D8"
|
|
||||||
>
|
|
||||||
{user?.bio || "No bio available."}
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
|
@ -23,7 +23,9 @@ const StationList = lazy(() => import("./pages/StationList"));
|
||||||
const EVSlotManagement = lazy(() => import("./pages/EVSlotManagement"));
|
const EVSlotManagement = lazy(() => import("./pages/EVSlotManagement"));
|
||||||
const BookingList = lazy(() => import("./pages/BookingList"));
|
const BookingList = lazy(() => import("./pages/BookingList"));
|
||||||
const EvSlotList = lazy(() => import("./pages/EvSlotList"));
|
const EvSlotList = lazy(() => import("./pages/EvSlotList"));
|
||||||
const ExternalStationList = lazy(() => import("./pages/ExternalStationList/externalStationList.tsx"));
|
const ExternalStationList = lazy(
|
||||||
|
() => import("./pages/ExternalStationList/externalStationList.tsx")
|
||||||
|
);
|
||||||
const AllManagersList = lazy(() => import("./pages/AllMangersList"));
|
const AllManagersList = lazy(() => import("./pages/AllMangersList"));
|
||||||
const AvailableSlotsList = lazy(() => import("./pages/AvailableSlotsList"));
|
const AvailableSlotsList = lazy(() => import("./pages/AvailableSlotsList"));
|
||||||
interface ProtectedRouteProps {
|
interface ProtectedRouteProps {
|
||||||
|
@ -32,7 +34,7 @@ interface ProtectedRouteProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Protected Route Component
|
// Protected Route Component
|
||||||
const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ component }) => {
|
const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ component }) => {
|
||||||
if (!localStorage.getItem("authToken")) {
|
if (!localStorage.getItem("authToken")) {
|
||||||
return <Navigate to="/login" replace />;
|
return <Navigate to="/login" replace />;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +129,9 @@ export default function AppRouter() {
|
||||||
<Route
|
<Route
|
||||||
path="all-available-slots"
|
path="all-available-slots"
|
||||||
element={
|
element={
|
||||||
<ProtectedRoute component={<AvailableSlotsList />} />
|
<ProtectedRoute
|
||||||
|
component={<AvailableSlotsList />}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
|
|
Loading…
Reference in a new issue