dev-jaanvi #1

Open
jaanvi wants to merge 155 commits from dev-jaanvi into main
12 changed files with 271 additions and 32 deletions
Showing only changes of commit 1c8177ddbd - Show all commits

BIN
public/home-img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

BIN
public/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View file

@ -203,13 +203,17 @@ const CustomTable: React.FC<CustomTableProps> = ({
handleClose(); handleClose();
}; };
const filteredRows = rows.filter( const filteredRows = rows.filter((row) => {
(row) => if (!searchQuery.trim()) return true; // Return all rows if searchQuery is empty or whitespace
(row.name && const lowerCaseQuery = searchQuery.toLowerCase().trim();
row.name.toLowerCase().includes(searchQuery.toLowerCase())) || return (
row.registeredAddress.toLowerCase().includes(searchQuery.toLowerCase()) || (row.name && row.name.toLowerCase().includes(lowerCaseQuery)) ||
false (row.registeredAddress &&
row.registeredAddress.toLowerCase().includes(lowerCaseQuery))
); );
});
const indexOfLastRow = currentPage * usersPerPage; const indexOfLastRow = currentPage * usersPerPage;
const indexOfFirstRow = indexOfLastRow - usersPerPage; const indexOfFirstRow = indexOfLastRow - usersPerPage;

View file

@ -209,9 +209,9 @@ const EditSlotModal: React.FC<EditSlotModalProps> = ({
> >
{isAvailable ? "Available" : "Not Available"} {isAvailable ? "Available" : "Not Available"}
</Button> </Button>
<Typography> {/* <Typography>
{isAvailable ? "Available" : "Not Available"} {isAvailable ? "Available" : "Not Available"}
</Typography> </Typography> */}
</Box> </Box>
</Box> </Box>

View file

@ -94,9 +94,15 @@ const EditStationModal: React.FC<EditStationModalProps> = ({
setSelectedVehicles(editRow.allowedCarIds || []); setSelectedVehicles(editRow.allowedCarIds || []);
// Set selectedBrands based on the vehicles associated with the station // Set selectedBrands based on the vehicles associated with the station
const brands = vehicles const brands = editRow?.allowedCarIds
.filter((vehicle) => editRow.allowedCarIds.includes(vehicle.id)) ? vehicles
.map((vehicle) => vehicle.company); .filter((vehicle) =>
editRow.allowedCarIds.includes(vehicle.id)
)
.map((vehicle) => vehicle.company)
: [];
setSelectedBrands(brands); setSelectedBrands(brands);
} else { } else {

View file

@ -16,7 +16,7 @@ root.render(
position="top-right" position="top-right"
richColors richColors
closeButton closeButton
duration={6000} duration={3000}
/> />
</Provider> </Provider>
</React.StrictMode> </React.StrictMode>

View file

@ -0,0 +1,228 @@
import React from "react";
import { Box, Button, Container, Grid, Typography } from "@mui/material";
import { useNavigate } from "react-router-dom"; // Import useNavigate for navigation
import SearchIcon from "@mui/icons-material/Search";
const LandingPage = () => {
const navigate = useNavigate(); // Initialize useNavigate
const handleLoginClick = () => {
navigate("/login"); // Redirect to the login page
};
return (
<Box
sx={{
background: `radial-gradient(circle at top left, rgba(125,121,87,0.992) 10%, rgba(67,92,106,0.8) 40%, rgba(55,47,65,1) 70%),
radial-gradient(circle at center, rgba(109, 102, 102, 0.7) 0%, rgba(67,92,106,0.6) 50%, rgba(55,47,65,0.9) 70%),
radial-gradient(circle at top right, rgba(61,42,87,1) 30%, rgba(55,47,65,1) 60%, rgba(40,40,40,0.8) 70%)`,
color: "white",
minHeight: "100vh",
fontFamily: "Inter",
}}
>
{/* Navbar */}
<Box
component="nav"
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
py: 2,
px: 3,
maxWidth: "1200px",
mx: "auto",
fontFamily: "Inter",
}}
>
<img
src="/evLogo.png"
alt="DigiEv Logo"
style={{ height: "40px" }}
/>
<Box
sx={{
display: "flex",
alignItems: "center",
gap: 2,
}}
>
<SearchIcon
sx={{
fontSize: "24px",
cursor: "pointer",
color: "#364056",
}}
/>
<Button
type="button" // Changed to "button" to avoid form submission
onClick={handleLoginClick} // Trigger navigation on click
sx={{
backgroundColor: "#52ACDF",
color: "white",
borderRadius: "8px",
width: "117px",
fontFamily: "Inter",
textTransform: "none",
"&:hover": { backgroundColor: "#439BC1" },
}}
>
Login
</Button>
</Box>
</Box>
{/* Hero Section */}
<Container
sx={{
py: 8,
justifyContent: "space-between",
fontFamily: "Inter",
}}
>
<Grid
container
spacing={4}
alignItems="center"
justifyContent="center"
>
{/* Text Section */}
<Grid
item
xs={12}
md={6}
sx={{
height: { xs: "auto", md: "400px" },
display: "flex",
flexDirection: "column",
justifyContent: "center",
}}
>
<Typography
sx={{
fontFamily: "Inter",
fontWeight: 600,
fontSize: "40px",
lineHeight: "120%",
letterSpacing: "0px",
marginBottom: "16px",
}}
>
Empower Your Business With{" "}
<Box component="span" sx={{ color: "#52ACDF" }}>
Digital Evolution
</Box>
.
</Typography>
<Typography
variant="body1"
sx={{
fontFamily: "Inter",
color: "#CACACA",
marginBottom: "24px",
fontWeight: 400,
fontSize: "20px",
lineHeight: "120%",
}}
>
DigiEv is your one-stop destination for transforming
challenges into opportunities through innovative
technology, seamless integration, and expert
solutions.
</Typography>
<Button
type="submit"
sx={{
backgroundColor: "#52ACDF",
color: "white",
borderRadius: "8px",
width: "117px",
textTransform: "none",
fontFamily: "Inter",
"&:hover": { backgroundColor: "#439BC1" },
}}
>
Get in Touch
</Button>
</Grid>
{/* Image Section */}
<Grid
item
xs={12}
md={6}
sx={{
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<img
src="/home.png"
alt="Dashboard"
style={{
maxHeight: "100%",
maxWidth: "100%",
objectFit: "contain",
borderRadius: "8px",
}}
/>
</Grid>
</Grid>
</Container>
<Container maxWidth="lg">
{" "}
<Grid container spacing={4} textAlign="center">
{" "}
<Grid item xs={12} md={4}>
{" "}
<Typography
variant="h3"
fontWeight="bold"
color="#1e88e5"
>
{" "}
50+{" "}
</Typography>{" "}
<Typography variant="body2" color="gray">
{" "}
Successful Digital Transformations{" "}
</Typography>{" "}
</Grid>{" "}
<Grid item xs={12} md={4}>
{" "}
<Typography
variant="h3"
fontWeight="bold"
color="#1e88e5"
>
{" "}
100%{" "}
</Typography>{" "}
<Typography variant="body2" color="gray">
{" "}
Client Satisfaction{" "}
</Typography>{" "}
</Grid>{" "}
<Grid item xs={12} md={4}>
{" "}
<Typography
variant="h3"
fontWeight="bold"
color="#1e88e5"
>
{" "}
20+{" "}
</Typography>{" "}
<Typography variant="body2" color="gray">
{" "}
Global Partnerships{" "}
</Typography>{" "}
</Grid>{" "}
</Grid>{" "}
</Container>
</Box>
);
};
export default LandingPage;

View file

@ -118,8 +118,8 @@ export default function StationList() {
return { return {
id: station.id, id: station.id,
srno: index + 1, srno: index + 1,
name: station.name, name: station.name || "N/A",
registeredAddress: station.registeredAddress, registeredAddress: station.registeredAddress || "N/A",
totalSlots: station.totalSlots, totalSlots: station.totalSlots,
vehicles: vehicleDisplay, // Add the formatted vehicle display here vehicles: vehicleDisplay, // Add the formatted vehicle display here
status: status:

View file

@ -17,7 +17,6 @@ export default function UserList() {
const [viewModal, setViewModal] = useState<boolean>(false); const [viewModal, setViewModal] = useState<boolean>(false);
const { reset } = useForm(); const { reset } = useForm();
const dispatch = useDispatch<AppDispatch>(); const dispatch = useDispatch<AppDispatch>();
const users = useSelector((state: RootState) => state.userReducer.users); const users = useSelector((state: RootState) => state.userReducer.users);
@ -65,7 +64,6 @@ export default function UserList() {
name, name,
email, email,
phone, phone,
}) })
); );
await dispatch(userList()); await dispatch(userList());
@ -76,13 +74,13 @@ export default function UserList() {
const categoryColumns: Column[] = [ const categoryColumns: Column[] = [
{ id: "srno", label: "Sr No" }, { id: "srno", label: "Sr No" },
{ id: "name", label: "Name" }, { id: "name", label: "User Name" },
{ id: "email", label: "Email" }, { id: "email", label: "Email" },
{ id: "phone", label: "Phone" }, { id: "phone", label: "Phone" },
{ id: "action", label: "Action", align: "center" }, { id: "action", label: "Action", align: "center" },
]; ];
const categoryRows = users?.length const categoryRows = users?.length
? users.map((user, index) => ({ ? users.map((user, index) => ({
id: user.id, id: user.id,
srno: index + 1, srno: index + 1,
@ -92,9 +90,6 @@ const categoryRows = users?.length
})) }))
: []; : [];
return ( return (
<> <>
<CustomTable <CustomTable

View file

@ -79,6 +79,7 @@ export const createAdmin = createAsyncThunk<
>("/create-admin", async (data, { rejectWithValue }) => { >("/create-admin", async (data, { rejectWithValue }) => {
try { try {
const response = await http.post("/create-admin", data); const response = await http.post("/create-admin", data);
toast.success("Admin created successfully");
return response.data; return response.data;
} catch (error: any) { } catch (error: any) {
return rejectWithValue( return rejectWithValue(

View file

@ -63,7 +63,7 @@ export const addManager = createAsyncThunk<
toast.success("Manager created successfully"); toast.success("Manager created successfully");
return response.data?.data; return response.data?.data;
} catch (error: any) { } catch (error: any) {
toast.error("Error creating manager: " + error.message); toast.error("Error creating manager: " + error.response?.data?.message);
return rejectWithValue( return rejectWithValue(
error.response?.data?.message || "An error occurred" error.response?.data?.message || "An error occurred"
); );

View file

@ -9,6 +9,7 @@ import DashboardLayout from "./layouts/DashboardLayout";
// Page imports // Page imports
const Login = lazy(() => import("./pages/Auth/Login")); const Login = lazy(() => import("./pages/Auth/Login"));
const SignUp = lazy(() => import("./pages/Auth/SignUp")); const SignUp = lazy(() => import("./pages/Auth/SignUp"));
const LandingPage = lazy(() => import("./pages/LandingPage"));
const Dashboard = lazy(() => import("./pages/Dashboard")); const Dashboard = lazy(() => import("./pages/Dashboard"));
const VehicleList = lazy(() => import("./pages/VehicleList")); const VehicleList = lazy(() => import("./pages/VehicleList"));
const AdminList = lazy(() => import("./pages/AdminList")); const AdminList = lazy(() => import("./pages/AdminList"));
@ -43,7 +44,7 @@ export default function AppRouter() {
<Suspense fallback={<LoadingComponent />}> <Suspense fallback={<LoadingComponent />}>
<BaseRoutes> <BaseRoutes>
{/* Default Route */} {/* Default Route */}
<Route element={<Navigate to="/login" replace />} index /> <Route path="" element={<LandingPage /> } />
{/* Auth Routes */} {/* Auth Routes */}
<Route path=""> <Route path="">
@ -110,7 +111,11 @@ export default function AppRouter() {
/> />
<Route <Route
path="external-station-list" path="external-station-list"
element={<ProtectedRoute component={<ExternalStationList />} />} element={
<ProtectedRoute
component={<ExternalStationList />}
/>
}
/> />
</Route> </Route>