Merge pull request 'frontend/apiIntegration' (#27) from frontend/apiIntegration into develop
Reviewed-on: DigiMantra/digiev_frontend#27
This commit is contained in:
commit
1c8177ddbd
BIN
public/home-img.png
Normal file
BIN
public/home-img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 MiB |
BIN
public/home.png
Normal file
BIN
public/home.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 120 KiB |
|
@ -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>
|
||||
|
|
228
src/pages/LandingPage/index.tsx
Normal file
228
src/pages/LandingPage/index.tsx
Normal 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;
|
|
@ -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"
|
||||
);
|
||||
|
|
|
@ -9,6 +9,7 @@ import DashboardLayout from "./layouts/DashboardLayout";
|
|||
// Page imports
|
||||
const Login = lazy(() => import("./pages/Auth/Login"));
|
||||
const SignUp = lazy(() => import("./pages/Auth/SignUp"));
|
||||
const LandingPage = lazy(() => import("./pages/LandingPage"));
|
||||
const Dashboard = lazy(() => import("./pages/Dashboard"));
|
||||
const VehicleList = lazy(() => import("./pages/VehicleList"));
|
||||
const AdminList = lazy(() => import("./pages/AdminList"));
|
||||
|
@ -43,7 +44,7 @@ export default function AppRouter() {
|
|||
<Suspense fallback={<LoadingComponent />}>
|
||||
<BaseRoutes>
|
||||
{/* Default Route */}
|
||||
<Route element={<Navigate to="/login" replace />} index />
|
||||
<Route path="" element={<LandingPage /> } />
|
||||
|
||||
{/* Auth Routes */}
|
||||
<Route path="">
|
||||
|
@ -110,7 +111,11 @@ export default function AppRouter() {
|
|||
/>
|
||||
<Route
|
||||
path="external-station-list"
|
||||
element={<ProtectedRoute component={<ExternalStationList />} />}
|
||||
element={
|
||||
<ProtectedRoute
|
||||
component={<ExternalStationList />}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
|
||||
|
|
Loading…
Reference in a new issue