BPP Admin
BPP Admin
svg
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"[Link]
<!-- Uploaded to: SVG Repo, [Link], Transformed by: SVG Repo Mixer
Tools -->
<svg width="96px" height="96px" viewBox="0 0 100 100"
xmlns="[Link] xmlns:xlink="[Link]
aria-hidden="true" role="img" class="iconify iconify--gis"
preserveAspectRatio="xMidYMid meet" fill="#000000">
<g id="SVGRepo_iconCarrier">
</g>
</svg>
2] ondc\Admin-portal-frontend\bpp_admin\src\assets\location_man_red.svg
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"[Link]
<!-- Uploaded to: SVG Repo, [Link], Transformed by: SVG Repo Mixer
Tools -->
<svg width="64px" height="64px" viewBox="0 0 100 100"
xmlns="[Link] xmlns:xlink="[Link]
aria-hidden="true" role="img" class="iconify iconify--gis"
preserveAspectRatio="xMidYMid meet" fill="#000000">
<g id="SVGRepo_iconCarrier">
</g>
</svg>
3] ondc\Admin-portal-frontend\bpp_admin\src\assets\location_man.svg
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"[Link]
<!-- Uploaded to: SVG Repo, [Link], Transformed by: SVG Repo Mixer
Tools -->
<svg width="64px" height="64px" viewBox="0 0 100 100"
xmlns="[Link] xmlns:xlink="[Link]
aria-hidden="true" role="img" class="iconify iconify--gis"
preserveAspectRatio="xMidYMid meet" fill="#000000">
<g id="SVGRepo_iconCarrier">
</g>
</svg>
4] ondc\Admin-portal-frontend\bpp_admin\src\assets\[Link]
<svg width="14" height="23" viewBox="0 0 14 23" fill="none"
xmlns="[Link]
<line x1="6.15234" y1="11.7412" x2="6.15234" y2="21.6" stroke="black" stroke-
width="2" stroke-linecap="round"/>
<circle cx="6.58824" cy="6.78825" r="4.08824" stroke="black" stroke-width="5"/>
<rect x="4.30762" y="4.50771" width="4.30769" height="4.30769" fill="white"/>
</svg>
5] ondc\Admin-portal-frontend\bpp_admin\src\Components\ApiServices\
[Link]
import env from "../../config/env";
6] ondc\Admin-portal-frontend\bpp_admin\src\Components\ApiServices\
[Link]
import axios from "axios";
import Cookies from "js-cookie";
import { BASE_URL } from "./ApiConstants";
import { removeCookies, setCookies } from "../../CustomUtils/CookiesUtils";
import { error } from "console";
import fileDownload from "js-file-download";
class ApiHandler {
getToken() {
let token = [Link]("bpp_portal_ONDCAdminToken");
return token;
}
getPublicInstance() {
const publicInstance = [Link]({
baseURL: BASE_URL,
headers: {
"Content-Type": "application/json",
context: ["admin_portal"],
},
transformRequest: [
(data) => {
return [Link](data);
},
],
transformResponse: [
(data) => {
let isValidJSON = true;
try {
[Link](data);
} catch {
isValidJSON = false;
}
return isValidJSON ? [Link](data) : data;
},
],
});
return publicInstance;
}
getPrivateInstance() {
const instance = [Link]({
baseURL: BASE_URL,
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache",
context: ["bpp_portal"],
Authorization: [Link](),
},
transformRequest: [
(data) => {
return [Link](data);
},
],
transformResponse: [
(data) => {
try {
const parseData = [Link](data);
if (
parseData?.message?.message ===
"Unauthorized, token not
available." ||
parseData?.message?.message ===
"Unauthorized, Invalid Verified
Token."
) {
removeCookies("bpp_portal_ONDCAdminToken");
removeCookies("bpp_portal_UserName");
removeCookies("bpp_portal_ClientInfo");
}
return parseData;
} catch (e) {
return data;
}
},
],
});
return instance;
}
7] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import Box from "@mui/material/Box";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TablePagination from "@mui/material/TablePagination";
import TableRow from "@mui/material/TableRow";
import TableSortLabel from "@mui/material/TableSortLabel";
import Typography from "@mui/material/Typography";
import Paper from "@mui/material/Paper";
import { Grid, IconButton, useTheme } from "@mui/material";
import {
FirstPage,
KeyboardArrowLeft,
KeyboardArrowRight,
LastPage,
North,
South,
} from "@mui/icons-material";
import { formatDateTime } from "../../CustomUtils/DateTimeUtils";
interface EnhancedTableMainProps {
headers: any[];
tableData: any;
rowProps?: any;
navigate?: any;
count?: any;
refreshPage?: any;
}
[Link](ref, () => ({
handleChangePage,
}));
const handleRequestSortNew = (
event: [Link]<unknown>,
property: string
) => {
const isAsc = orderBy === property && order === "asc";
setOrder(isAsc ? "desc" : "asc");
setOrderBy(property);
const handleRequestSort = (
event: [Link]<unknown>,
property: string
) => {
const isAsc = orderBy === property && order === "asc";
setOrder(isAsc ? "desc" : "asc");
setOrderBy(property);
const handleSelectAllClick = (
event: [Link]<HTMLInputElement>
) => {
// if ([Link]) {
// const newSelected = [Link]((n) => [Link]);
// setSelected(newSelected);
// return;
// }
// setSelected([]);
};
// const handleClick = (
// event: [Link]<unknown>,
// id: string | number
// ) => {
// const selectedIndex = [Link](id);
// let newSelected: readonly number[] = [];
const handleChangeRowsPerPage = (
event: [Link]<HTMLInputElement>
) => {
refreshPage({ rowsPerPage: [Link], page: 0 });
setRowsPerPage(Number([Link]));
setPage(0);
};
[Link](() => {
setTableDataList(tableData);
}, [tableData]);
// Avoid a layout jump when reaching the last page with empty rows.
const emptyRows =
page > 0
? [Link](0, (1 + page) * rowsPerPage -
[Link])
: 0;
return (
<Grid
style={{
display: "flex",
flexDirection: "row",
justifyContent: "Center",
alignItems: "Center",
marginLeft: "4px",
}}
>
<IconButton
size="small"
sx={{ color: northColor }}
onClick={(event) => {
handleRequestSortNew(event, id);
}}
>
<North fontSize="inherit" />
</IconButton>
<IconButton
size="small"
sx={{ marginLeft: -1.5, color: southColor }}
onClick={(event) => {
handleRequestSortNew(event, id);
}}
>
<South fontSize="inherit" />
</IconButton>
</Grid>
);
};
return (
<Box sx={{ width: "100%" }}>
<Paper sx={{ width: "100%" }}>
<TableContainer>
<Table
stickyHeader
sx={{ minWidth: 500 }}
aria-labelledby="tableTitle"
>
<TableHead>
<TableRow>
{[Link]((header,
index) => (
<TableCell
style={{
padding:
10,
backgroundColor: "#eaeaea",
width:
[Link] === "Documents"
? "10px"
? "10px"
? "10px"
? "10px"
: "auto",
//minWidth: "10px",
}}
key={index}
//
align={[Link] ? "right" : "left"}
//
padding={[Link] ? "none" : "normal"}
//
sortDirection={orderBy === [Link] ? order : false}
>
{
[Link] ? (
{[Link]}
</Typography>
) : (
<TableSortLabel
//active={true}
//direction={order}
// onClick={(event) =>
// handleRequestSort(event, [Link])
// }
>
{[Link]}
</Typography>
</TableSortLabel>
) //:
//
<TableSortLabel
//
active={orderBy === [Link]}
//
direction={orderBy === [Link] ? order : "asc"}
//
onClick={(event) =>
//
handleRequestSort(event, [Link])
// }
// >
//
<Typography style={{ fontWeight: 600 }}>
//
{[Link]}
//
</Typography>
//
</TableSortLabel>
}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{[Link]((row: any,
index: any) => (
<TableRow key={index}
sx={{}}>
{[Link]((header,
headerIndex) => (
<TableCell
style={{
padding: 10,
width:
? "10px"
? "10px"
? "10px"
? "10px"
: "auto",
maxWidth: "400px",
color:
? row["driverNameColor"]
? row["passengerNameColor"]
: "black",
//
whiteSpace: "nowrap",
//
textOverflow: "ellipsis",
//width: "300px",
//display: "block",
//overflow: "hidden",
//minWidth: "10px",
//
whiteSpace: "normal",
//
wordWrap: "break-word",
}}
key={headerIndex}
? formatDateTime(
new Date(row[[Link]]).toString(),
true
: row[[Link]]
:
row[[Link]]}
</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
{props?.refreshPage && (
<TablePagination
rowsPerPageOptions={[25, 100, 250]}
component="div"
count={count || [Link]}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
ActionsComponent={TablePaginationActions}
/>
)}
</Paper>
</Box>
);
}
);
interface TablePaginationActionsProps {
count: number;
page: number;
rowsPerPage: number;
onPageChange: (
event: [Link]<HTMLButtonElement>,
newPage: number
) => void;
}
const handleFirstPageButtonClick = (
event: [Link]<HTMLButtonElement>
) => {
onPageChange(event, 0);
//[Link]("406 handleFirstPageButtonClick", 0);
};
const handleBackButtonClick = (
event: [Link]<HTMLButtonElement>
) => {
onPageChange(event, page - 1);
//[Link]("414 handleBackButtonClick", page + " " + (page - 1));
};
const handleNextButtonClick = (
event: [Link]<HTMLButtonElement>
) => {
onPageChange(event, page + 1);
//[Link]("421 handleNextButtonClick", page + " " + (page + 1));
};
const handleLastPageButtonClick = (
event: [Link]<HTMLButtonElement>
) => {
onPageChange(event, [Link](0, [Link](count / rowsPerPage) -
1));
// [Link](
// "429 handleLastPageButtonClick",
// page + " " + [Link](0, [Link](count / rowsPerPage) - 1)
// );
};
return (
<Box sx={{ flexShrink: 0, ml: 2.5 }}>
<IconButton
onClick={handleFirstPageButtonClick}
disabled={page === 0}
aria-label="first page"
>
{[Link] === "rtl" ? <LastPage /> :
<FirstPage />}
</IconButton>
<IconButton
onClick={handleBackButtonClick}
disabled={page === 0}
aria-label="previous page"
>
{[Link] === "rtl" ? (
<KeyboardArrowRight />
) : (
<KeyboardArrowLeft />
)}
</IconButton>
<IconButton
onClick={handleNextButtonClick}
disabled={page >= [Link](count / rowsPerPage) - 1}
aria-label="next page"
>
{[Link] === "rtl" ? (
<KeyboardArrowLeft />
) : (
<KeyboardArrowRight />
)}
</IconButton>
<IconButton
onClick={handleLastPageButtonClick}
disabled={page >= [Link](count / rowsPerPage) - 1}
aria-label="last page"
>
{[Link] === "rtl" ? <FirstPage /> :
<LastPage />}
</IconButton>
</Box>
);
}
8] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import { FC, ReactElement } from "react";
import { Paper, Typography } from "@mui/material";
9] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import {
Dialog,
DialogContent,
DialogTitle,
Grid,
FormControl,
InputLabel,
MenuItem,
Select,
TextareaAutosize,
TextField,
IconButton,
} from "@mui/material";
import { useNavigate } from "react-router-dom";
import { AppContext } from "../Context/AppContext";
import { ShowSnackbarFailure, ShowSnackbarSuccess } from "./MobilitySnackBar";
import { Close } from "@mui/icons-material";
import MobilityButton from "./MobilityButton";
import { apiHandler } from "../ApiServices/ApiHandler";
import { ISSUE_RESOLUTION } from "../ApiServices/ApiConstants";
interface issueFormProps {
issueData: any;
open: boolean;
setOpen: any;
}
// interface ValidationErrors {
// complainantAction: string;
// shortDesc: string;
// }
interface issueDetails {
respondentAction: string;
shortDesc: string;
longDesc: string;
refundAmount: string;
actionTriggered: string;
}
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
const submitButtonStyle = {
marginTop: "40px",
display: "flex",
justifyContent: "center",
};
const textAreaStyle = {
width: "100%",
};
const IssueForm: [Link]<issueFormProps> = ({ issueData, open, setOpen }) => {
const navigate = useNavigate();
let myContext = [Link](AppContext);
const dropdownOptions = [
"PROCESSING",
"CASCADED",
"RESOLVED",
"NEED_MORE_INFO",
];
const actionTypes = ["RESOLVE", "REJECT"];
const [issueDetails, setIssueDetails] = [Link]<issueDetails>({
respondentAction: "",
shortDesc: "",
longDesc: "",
refundAmount: "",
actionTriggered: "",
});
const [actionType, setActionType] = [Link]<any>(null);
const actionTriggeredOption = [
"REFUND",
"REPLACEMENT",
"RETURN",
"CANCEL",
"NO_ACTION",
];
// const [validationErrors, setValidationErrors] =
// [Link]<ValidationErrors>({
// complainantAction: "",
// shortDesc: "",
// });
setIssueDetails({
respondentAction: "",
shortDesc: "",
longDesc: "",
refundAmount: "",
actionTriggered: "",
});
setOpen(false);
} else {
ShowSnackbarFailure(res, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
const handleClose = () => {
setOpen(false);
};
return (
<Dialog
open={open}
onClose={handleClose}
PaperProps={{
style: {
minWidth: "30vw",
// width: "40%",
// height: "85vh",
// maxWidth: "none",
},
}}
>
<DialogTitle
sx={{ backgroundColor: "#eaeaea" }}
// style={{
// backgroundColor: "#e2e2e2",
// textAlign: "center",
// marginBottom: "10px",
// }}
>
Issue Resolved
</DialogTitle>
<IconButton
aria-label="close"
onClick={handleClose}
sx={{
position: "absolute",
right: 8,
top: 16,
}}
>
<Close />
</IconButton>
<DialogContent>
{/* <form onSubmit={handleSubmit}> */}
<Grid container spacing={4}>
<Grid item xs={12}>
<FormControl fullWidth variant="outlined">
<InputLabel id="select-label">Action
type</InputLabel>
<Select
labelId="select-label"
id="select2"
variant="outlined"
fullWidth
value={actionType}
onChange={(e) =>
setActionType([Link])}
label="Action type"
>
{[Link]((option) => (
<MenuItem key={option}
value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
</Grid>
value={[Link]}
onChange={(e) =>
setIssueDetails({
...issueDetails,
respondentAction:
[Link],
})
}
label="Complainant Action"
>
{[Link]((option) =>
(
<MenuItem key={option}
value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
</Grid>
value={[Link]}
onChange={(e) =>
setIssueDetails({
...issueDetails,
actionTriggered:
[Link],
})
}
label="Action triggered"
>
{[Link]((option) => (
<MenuItem key={option}
value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
{/* </Grid> */}
10] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import React, { FC, ReactElement, useState } from "react";
import { Card, Grid, Typography, useMediaQuery } from "@mui/material";
import { useUserDispatch } from "../../CustomUtils/usercontext";
import { apiHandler } from "../ApiServices/ApiHandler";
import { setCookies } from "../../CustomUtils/CookiesUtils";
import MobilityButton from "./MobilityButton";
import MobilityTextField from "./MobilityTextField";
import { AppContext } from "../Context/AppContext";
import { ADMIN_LOGIN } from "../ApiServices/ApiConstants";
import { ShowSnackbarFailure, ShowSnackbarSuccess } from "./MobilitySnackBar";
import env from "../../config/env";
const {
clientsInfo = {},
userInfo = {},
token = {},
} = loginResponse?.data?.data || {};
if (
([Link](clientsInfo) && [Link]
> 0) ||
[Link] === 200
) {
let userRedirct = [Link](
(el: { clientName: string }): any =>
[Link] ===
userInfo?.defaultPortal
);
function detectPlatform() {
return
[Link]().toLowerCase().includes("android");
}
return (
<Grid
style={{
height: "100vh",
justifyContent: "center",
display: "flex",
}}
>
<Card
sx={{
alignSelf: "center",
margin: "20px",
padding: "20px",
width: isMobile ? "auto" : "400px",
borderRadius: "20px",
}}
>
<Grid container spacing={2} alignItems="center"
justifyContent="center">
<Grid item>
<img
src={require("../../assets/Logo_digital.png")}
height="100px"
/>
</Grid>
<Grid item>
<Typography style={{ fontWeight: 800,
fontSize: 20 }}>
BPP (Driver) Admin Login Portal
</Typography>
</Grid>
//[Link]("orickshaw://[Link]/anystring");
}}
/>
</Grid>
{/* <a
href="myapp://open"
onClick={() => {
[Link] =
"[Link]
id=[Link]";
return false;
}}
>
Download App
</a> */}
"[Link]
id=[Link]";
return false;
}}
>
Download Mobile App
</a>
) : (
<a
href="[Link]
id=[Link]">
Download App
</a>
)} */}
</Grid>
<Grid container justifyContent="end">
<Typography style={{ fontSize: 12 }}>
Version : {[Link]}
</Typography>
</Grid>
</Card>
</Grid>
);
};
11] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import styled from "@emotion/styled";
import { ExpandMore } from "@mui/icons-material";
import { AccordionSummary, Grid } from "@mui/material";
import MuiAccordionDetails from "@mui/material/AccordionDetails";
import MuiAccordion, { AccordionProps } from "@mui/material/Accordion";
{props?.summary}
</Grid>
</AccordionSummary>
<AccordionDetails>{props?.details}</AccordionDetails>
</Accordion>
</div>
);
}
13]ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import { Card, Grid } from "@mui/material";
import { MobilityButtonIconBack } from "./MobilityButtonIcon";
<Grid
sx={{
alignItems: "center",
display: "flex",
}}
>
{props?.description}
</Grid>
</Grid>
{props?.menus && (
<Grid
container
sx={{
alignItems: "center",
justifyContent: "end",
marginRight: 1,
}}
>
{props?.menus}
</Grid>
)}
</Card>
);
}
14] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import Tooltip from "@mui/material/Tooltip";
import { Badge } from "@mui/material";
15] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import React from "react";
import { Button } from "@mui/material";
interface MobilityButtonProps {
label: string;
disabled?: boolean;
fullWidth?: boolean;
variant?: any;
style?: [Link];
onClick: (event: [Link]<HTMLButtonElement>) => void;
}
18] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import {
Card,
Grid,
CardContent,
Typography,
CardActionArea,
CardActions,
CardHeader,
CardMedia,
} from "@mui/material";
import { GRAY_200 } from "../Constants/CommonConstants";
import { CheckCircle } from "@mui/icons-material";
19] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import { Chip } from "@mui/material";
import { text } from "stream/consumers";
import {
BLUE_A200,
GRAY_200,
GRAY_800,
GRAY_900,
GREEN_200,
RED_A200,
} from "../Constants/CommonConstants";
20] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import Dialog from "@mui/material/Dialog";
import DialogActions from "@mui/material/DialogActions";
import DialogContent from "@mui/material/DialogContent";
import DialogTitle from "@mui/material/DialogTitle";
import { AppContext } from "../Context/AppContext";
import { styled } from "@mui/material/styles";
import { IconButton, Typography } from "@mui/material";
import { Close } from "@mui/icons-material";
import MobilityButton from "./MobilityButton";
import MobilityTextField from "./MobilityTextField";
import { useState } from "react";
function handleOnClose() {
[Link]({ open: false });
setRejectReason("");
}
return (
<[Link]>
<BootstrapDialog open={dialog?.open ? dialog?.open : false}>
<DialogTitle sx={{ m: 0, p: 2 }} style={{ fontWeight:
600 }}>
{dialog?.title}
</DialogTitle>
<IconButton
onClick={handleOnClose}
sx={{
position: "absolute",
right: 8,
top: 8,
color: (theme) => [Link][500],
}}
>
<Close />
</IconButton>
<DialogContent>
<Typography>{dialog?.message}</Typography>
{dialog?.action === "Rejected" && (
<>
<Typography sx={{ marginBottom: 3 }}>
If yes, please enter reject
reason
</Typography>
<MobilityTextField
label={"Reject Reason"}
type={"text"}
name={"rejectReason"}
value={rejectReason}
onChange={function (
event:
[Link]<HTMLInputElement>
): void {
setRejectReason([Link]);
}}
/>
</>
)}
</DialogContent>
{dialog?.showButton ?
<[Link]><DialogActions
sx={{
marginRight: 1,
marginBottom: 1,
}}
>
<MobilityButton
label="No"
variant="outlined"
onClick={handleOnClose}
/>
<MobilityButton label="Yes"
onClick={handleOnYes} />
</DialogActions></[Link]> :
<[Link]><DialogActions sx={{
marginRight: 1,
marginBottom: 1,
}}>
<MobilityButton
label="Close"
variant="outlined"
onClick={handleOnClose}
/></DialogActions></[Link]>}
</BootstrapDialog>
</[Link]>
);
}
21] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import {
DateValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
import dayjs, { Dayjs } from "dayjs";
interface MobilityDatePickerProps {
label: string;
value?: any;
minDate?: any;
maxDate?: any;
onChange?: (
value: Dayjs | null,
context: PickerChangeHandlerContext<DateValidationError>
) => void;
}
function MobilityDatePicker(props: MobilityDatePickerProps) {
const shouldDisableDate = (date: Dayjs) => {
// Disable all days except Mondays
[Link]("21 [Link]()", [Link]());
return [Link]() !== 2; // Monday is 1, Sunday is 0, Saturday is 6
};
return (
<DatePicker
//shouldDisableDate={shouldDisableDate}
closeOnSelect={true}
label={[Link]}
minDate={props?.minDate}
maxDate={props?.maxDate || dayjs(new Date())}
onChange={props?.onChange}
views={["year", "month", "day"]}
format={"DD/MM/YYYY"}
defaultValue={props?.value ? props?.value : dayjs(new
Date().toString())}
/>
);
}
22] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import dayjs, { Dayjs } from "dayjs";
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
import {
DateTimeValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
interface MobilityDateTimePickerProps {
label: string;
value?: any;
defaultDate?: any;
onChange?: (
value: Dayjs | null,
context: PickerChangeHandlerContext<DateTimeValidationError>
) => void;
}
export default function MobilityDateTimePicker(
props: MobilityDateTimePickerProps
) {
//[Link]("21", props?.defaultDate);
return (
<DateTimePicker
closeOnSelect={true}
label={[Link]}
defaultValue={
props?.defaultDate
? dayjs(props?.defaultDate)
: dayjs(new Date().toString())
}
onChange={props?.onChange}
/>
);
}
23] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import { Grid, Typography } from "@mui/material";
24] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
import Paper from "@mui/material/Paper";
interface Row {
desc: string;
qty: number;
unit: number;
price: number;
}
const rows = [
createRow("Paperclips (Box)", 100, 1.15),
createRow("Paper (Case)", 10, 405.99),
createRow("Waste Basket", 2, 17.99),
];
25] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import { Button, Grid, Link, Tooltip, Typography } from "@mui/material";
import React, { useEffect } from "react";
import MobilityImg from "./MobilityImg";
import { formatDate } from "../../CustomUtils/DateTimeUtils";
import _, { isEmpty } from "lodash";
import { useNavigate } from "react-router-dom";
import MobilityTextField from "./MobilityTextField";
import MobilityButton from "./MobilityButton";
import dayjs, { Dayjs } from "dayjs";
import {
DateValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
import MobilityDatePicker from "./MobilityDatePicker";
import { GET_DRIVER_DOCUMENT } from "../ApiServices/ApiConstants";
import { apiHandler } from "../ApiServices/ApiHandler";
import { AppContext } from "../Context/AppContext";
import { ShowSnackbarFailure } from "./MobilitySnackBar";
navigate(props?.linkUrl);
}}
>
{props?.value}
</Button>
</Tooltip>
</Typography>
) : (
<Typography variant="body2" component="div">
{" : " + props?.value}
</Typography>
)}
</Grid>
setDocNumber([Link] as string);
}}
></MobilityTextField>
)}
setDocNumber([Link] as string);
}}
></MobilityTextField>
)}
setDocNumber([Link] as string);
}}
></MobilityTextField>
)}
</Grid>
)} */}
</Grid>
</div>
);
}
useEffect(() => {
fetchData();
}, []);
if (!isEmpty(response)) {
const image = response?.data?.data;
[Link]("196 image", image);
setImageBase64(image);
} else {
//ShowSnackbarFailure(response, myContext);
}
} catch (error) {
//ShowSnackbarFailure(error, myContext);
} finally {
// [Link]({
// isLoading: false,
// });
}
};
return (
<Grid container>
{props?.heading?.docType?.toString() !== "DL" &&
props?.heading?.docType?.toString() !== "RC" && (
<Grid xs={12} sx={{ marginTop: 1 }}>
<MobilityHeadingValue
heading={"Status"}
value={props?.[Link]}
docType={props?.heading?.docType}
/>
{props?.[Link] && (
<MobilityHeadingValue
heading={"Rejected Reason"}
value={props?.[Link]}
docType={props?.heading?.docType}
/>
)}
{props?.heading?.docNumber && (
<MobilityHeadingValue
heading={"Doc. Number"}
value={props?.heading?.docNumber}
docType={props?.heading?.docType}
/>
)}
{props?.heading?.expiryDate && (
<MobilityHeadingValue
heading={"Doc. Expiry Date"}
value={formatDate(props?.heading?.expiryDate)}
docType={props?.heading?.docType}
/>
)}
{props?.heading?.dateOfBirth && (
<MobilityHeadingValue
heading={"Date of Birth"}
value={formatDate(props?.heading?.dateOfBirth)}
docType={props?.heading?.docType}
/>
)}
</Grid>
)}
{props?.[Link] && (
<Grid container xs={12}>
<Grid textAlign={"left"} xs={3}>
<Typography variant="body2"
component="div">
{"Reject Reason"}
</Typography>
</Grid>
<Grid textAlign={"left"} xs={9}>
<Typography variant="body2"
component="div">
{" : " +
props?.heading?.rejectReason?.toString()}
</Typography>
</Grid>
</Grid>
)}
{props?.heading?.docNumber && (
<Grid container xs={12} marginTop={1}>
<Grid textAlign={"left"} xs={3}>
<Typography variant="body2"
component="div">
{"DL Number"}
</Typography>
</Grid>
{": "}
<Grid textAlign={"left"} width={235}
marginLeft={0.5}>
<MobilityTextField
key={props?.heading}
label={""}
name={"number"}
value={docNumber}
size={"small"}
type={""}
maxLength={16}
onChange={function (
event:
[Link]<HTMLInputElement>
): void {
setDocNumber(([Link] as string).toUpperCase());
}}
></MobilityTextField>
</Grid>
</Grid>
)}
{props?.heading?.expiryDate && (
<Grid container xs={12} marginTop={1}>
<Grid textAlign={"left"} xs={3}>
<Typography variant="body2"
component="div">
{"Doc. Expiry Date"}
</Typography>
<Typography component="div" sx={{
fontSize: 12 }}>
{"(DD/MM/YYYY)"}
</Typography>
</Grid>
{": "}
<Grid textAlign={"left"} xs={8}
marginLeft={0.5}>
<Grid item>
<MobilityDatePicker
label=""
minDate={dayjs(new
Date())}
value={dayjs(expiryDate)}
onChange={(
value: Dayjs |
null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setExpiryDate(value?.toString());
}}
/>
</Grid>
</Grid>
</Grid>
)}
{props?.heading?.dateOfBirth && (
<Grid container xs={12} marginTop={1}>
<Grid textAlign={"left"} xs={3}>
<Typography variant="body2"
component="div">
{"Date of Birth"}
</Typography>
<Typography component="div" sx={{
fontSize: 12 }}>
{"(DD/MM/YYYY)"}
</Typography>
</Grid>
{": "}
<Grid textAlign={"left"} xs={8}
marginLeft={0.5}>
<MobilityDatePicker
label=""
value={dayjs(dob)}
maxDate={dayjs(new Date())}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setDob(value?.toString());
}}
/>
</Grid>
</Grid>
)}
{props?.[Link] && (
<Grid container xs={12}>
<Grid textAlign={"left"} xs={3}>
<Typography variant="body2"
component="div">
{"Reject Reason"}
</Typography>
</Grid>
<Grid textAlign={"left"} xs={9}>
<Typography variant="body2"
component="div">
{" : " +
props?.heading?.rejectReason?.toString()}
</Typography>
</Grid>
</Grid>
)}
{props?.heading?.docNumber && (
<Grid container xs={12} marginTop={1}>
<Grid textAlign={"left"} xs={3}>
<Typography variant="body2"
component="div">
{"Reg. Number"}
</Typography>
</Grid>
{/* <Grid textAlign={"left"} xs={9}>
<Typography variant="body2"
component="div">
{" : " +
props?.heading?.docNumber?.toString()}
</Typography>
</Grid> */}
{": "}
<Grid textAlign={"left"} width={230}
marginLeft={0.5}>
<MobilityTextField
key={props?.heading}
label={""}
name={"number"}
value={docNumber}
size={"small"}
type={""}
maxLength={13}
onChange={function (
event:
[Link]<HTMLInputElement>
): void {
setDocNumber([Link] as string);
}}
></MobilityTextField>
</Grid>
</Grid>
)}
{props?.heading?.expiryDate && (
<Grid container xs={12} marginTop={1}>
<Grid textAlign={"left"} xs={3}>
<Typography variant="body2"
component="div">
{"RC Expiry Date"}
</Typography>
<Typography component="div" sx={{
fontSize: 12 }}>
{"(DD/MM/YYYY)"}
</Typography>
</Grid>
{": "}
<Grid textAlign={"left"} xs={8}
marginLeft={0.5}>
<Grid item>
<MobilityDatePicker
label=""
minDate={dayjs(new
Date())}
value={dayjs(expiryDate)}
onChange={(
value: Dayjs |
null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setExpiryDate(value?.toString());
}}
/>
</Grid>
</Grid>
</Grid>
)}
<Grid
xs={12}
container
sx={{ marginTop: 1, marginLeft: 5 }}
justifyContent="center"
alignItems="center"
>
<MobilityImg imgUrl={imgBase64} />
</Grid>
</Grid>
);
}
26] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import {
Close,
RotateLeft,
RotateRight,
ZoomIn,
ZoomOut,
} from "@mui/icons-material";
import {
Button,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
IconButton,
} from "@mui/material";
import Paper, { PaperProps } from "@mui/material/Paper";
import Draggable from "react-draggable";
import React, { useState } from "react";
import { MobilityChip } from "./MobilityChip";
import env from "../../config/env";
import { AppContext } from "../Context/AppContext";
import { apiHandler } from "../ApiServices/ApiHandler";
import {
GET_DRIVERS_LIST,
GET_DRIVER_DOCUMENT,
} from "../ApiServices/ApiConstants";
import { isEmpty } from "lodash";
import { ShowSnackbarFailure } from "./MobilitySnackBar";
const BASE_URL: string = env.API_BASE_URL;
//[Link]("47", props?.imgUrl);
function base64ToBlob(base64String: string, contentType = "") {
const byteCharacters = atob(base64String);
const byteArrays = [];
return (
<div>
<div>
<img
//src={`${BASE_URL}/${[Link]}`}
//crossOrigin="anonymous"
src={`data:image/jpeg;base64,${props?.imgUrl}`}
height={200}
width={300}
></img>
</div>
<ImageDialog
imageUrl={`${BASE_URL}/${[Link]}`}
selectedValue={selectedValue}
open={open}
onClose={handleClose}
/>
<div
style={{
display: "flex",
flex: 1,
alignItems: "flex-end",
}}
>
<MobilityChip
icon={<ZoomIn />}
clickable={true}
label="Zoom Image"
onClick={(e: any) => {
let blob = base64ToBlob(props?.imgUrl,
"image/jpeg");
var fileURL =
[Link](blob);
let tab = [Link]("", "_blank",
"width=600,height=600");
if (tab) {
[Link] = fileURL;
}
}}
/>
</div>
</div>
);
}
return (
<Dialog
open={open}
onClose={handleClose}
PaperComponent={PaperComponent}
aria-labelledby="draggable-dialog-title"
>
<DialogTitle
style={{ cursor: "move" }}
id="draggable-dialog-title"
sx={{ backgroundColor: "#eaeaea" }}
>
Subscribe
</DialogTitle>
<IconButton
aria-label="close"
onClick={handleClose}
sx={{
position: "absolute",
right: 8,
top: 16,
}}
>
<Close />
</IconButton>
<DialogContent>
{/* <DialogContentText>
To subscribe to this website, please enter your
email address here. We
will send updates occasionally.
</DialogContentText> */}
<div>
<img
src={props?.imageUrl}
crossOrigin="anonymous"
//
src={require("../../assets/Logo_digital.png")}
style={{
transform: `rotate(${rotate}deg)
scale(${zoom})`,
maxHeight: "80vh",
}}
/>
</div>
</DialogContent>
<DialogActions
sx={{ backgroundColor: "#eaeaea", justifyContent:
"center" }}
>
<IconButton
onClick={() => {
setRotate(rotate - 90);
}}
>
<RotateLeft />
</IconButton>
<IconButton
onClick={() => {
setRotate(rotate + 90);
}}
>
<RotateRight />
</IconButton>
<IconButton
onClick={() => {
setZoom(zoom === 2 ? zoom : zoom + 0.25);
}}
>
<ZoomIn />
</IconButton>
<IconButton
onClick={() => {
setZoom(zoom === 0.25 ? zoom : zoom - 0.25);
}}
>
<ZoomOut />
</IconButton>
</DialogActions>
</Dialog>
// <Dialog onClose={handleClose} open={open}
PaperComponent={PaperComponent}>
// <DialogTitle sx={{ backgroundColor: "#eaeaea" }}>
// Image Viewer
// </DialogTitle>
// <IconButton
// aria-label="close"
// onClick={handleClose}
// sx={{
// position: "absolute",
// right: 8,
// top: 16,
// }}
// >
// <Close />
// </IconButton>
// <DialogContent>
// <div>
// <img
// //src={props?.imageUrl}
//
src={require("../../assets/Logo_digital.png")}
// style={{
// transform: `rotate(${rotate}deg)
scale(${zoom})`,
// maxHeight: "80vh",
// }}
// />
// </div>
// </DialogContent>
// <DialogActions
// sx={{ backgroundColor: "#eaeaea", justifyContent:
"center" }}
// >
// <IconButton
// onClick={() => {
// setRotate(rotate - 90);
// }}
// >
// <RotateLeft />
// </IconButton>
// <IconButton
// onClick={() => {
// setRotate(rotate + 90);
// }}
// >
// <RotateRight />
// </IconButton>
// <IconButton
// onClick={() => {
// setZoom(zoom === 2 ? zoom : zoom + 0.25);
// }}
// >
// <ZoomIn />
// </IconButton>
// <IconButton
// onClick={() => {
// setZoom(zoom === 0.25 ? zoom : zoom - 0.25);
// }}
// >
// <ZoomOut />
// </IconButton>
// </DialogActions>
// </Dialog>
);
}
27] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import React from "react";
import {
List,
ListItem,
ListItemButton,
ListItemIcon,
ListItemText,
Tooltip,
} from "@mui/material";
import { MenuItemProps } from "./NavigationDrawerNew";
<ListItemText>
<div
style={{
fontWeight: selectedIndex ===
[Link] ? "bolder" : "normal",
}}
>
{[Link]}
</div>
</ListItemText>
</ListItemButton>
</ListItem>
);
});
return <List>{itemsList}</List>;
}
28] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import React from "react";
import { ListItemIcon, MenuItem, Typography } from "@mui/material";
import {
Assignment,
BorderColorOutlined,
CancelOutlined,
CarRental,
Delete,
DocumentScanner,
DriveEta,
TaskAlt,
Visibility,
} from "@mui/icons-material";
interface MobilityListItemProps {
label?: any;
icon?: any;
color?: any;
disabled?: boolean;
onClick?: (event: [Link]<HTMLLIElement>) => void;
}
29] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import { Backdrop, CircularProgress, Grid, Typography } from "@mui/material";
export interface MobilityLoaderProps {
loader?: MobilityLoaderProp;
}
30] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import React, { PureComponent } from "react";
import { PieChart, Pie, Sector, Cell, ResponsiveContainer } from "recharts";
const data = [
{ name: "Group A", value: 400 },
{ name: "Group B", value: 300 },
{ name: "Group C", value: 300 },
{ name: "Group D", value: 200 },
];
return (
<text
x={x}
y={y}
fill="white"
textAnchor={x > cx ? "start" : "end"}
dominantBaseline="central"
>
{`${(percent * 100).toFixed(0)}%`}
</text>
);
};
render() {
return (
<ResponsiveContainer width="100%" height="100%">
<PieChart width={400} height={400}>
<Pie
data={data}
cx="50%"
cy="50%"
labelLine={false}
label={renderCustomizedLabel}
outerRadius={80}
fill="#8884d8"
dataKey="value"
>
{[Link]((entry, index) => (
<Cell
key={`cell-${index}`}
fill={COLORS[index %
[Link]]}
/>
))}
</Pie>
</PieChart>
</ResponsiveContainer>
);
}
}
31] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import {
FormControl,
InputLabel,
MenuItem,
Select,
SelectChangeEvent,
} from "@mui/material";
interface MobilitySelectProps {
label: string;
value: HTMLSelectElement;
disabled?: boolean;
statusOptions: string[];
size?: any;
onChange: (event: SelectChangeEvent<HTMLSelectElement>) => void;
}
32] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import Stack from "@mui/material/Stack";
import Snackbar from "@mui/material/Snackbar";
import MuiAlert, { AlertColor, AlertProps } from "@mui/material/Alert";
import { AppContext, AppContextPropTypes } from "../Context/AppContext";
import env from "../../config/env";
import { useUserDispatch } from "../../CustomUtils/usercontext";
import { setCommentRange } from "typescript";
[Link]({
open: true,
severity: "success",
message: message,
});
}
myContext?.setSnackbar({
open: true,
severity: "error",
message: message,
});
33] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import React, { useState } from "react";
import { IconButton, InputAdornment, TextField } from "@mui/material";
import VisibilityIcon from "@mui/icons-material/Visibility";
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
import {
ValidateAccountNumber,
ValidateAddress,
ValidateEmail,
ValidateIfscCode,
ValidateMicrCode,
ValidateMobile,
ValidatePincode,
ValidateVehicleRegistrationNumber,
} from "../../CustomUtils/ValidationUtils";
import { Search } from "@mui/icons-material";
interface MobilityTextFieldProps {
label: string;
type: string;
name: string;
value: string;
required?: boolean;
disabled?: boolean;
maxLength?: number;
helperText?: string;
showPassword?: boolean;
fullWidth?: boolean;
multiline?: true;
size?: any;
onChange: (event: [Link]<HTMLInputElement>) => void;
onIconClick?: (event: [Link]<HTMLButtonElement>) => void;
}
onClick={props?.onIconClick}
>
{props?.showPassword ? (
<VisibilityIcon
/>
) : (
<VisibilityOffIcon />
)}
</IconButton>
</InputAdornment>
),
}
: props?.name === "search"
? {
endAdornment: (
<InputAdornment position="end">
<IconButton
onClick={props?.onIconClick}>
<Search />
</IconButton>
</InputAdornment>
),
}
: {}
}
/>
);
}
34] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import { styled, useTheme, Theme, CSSObject } from "@mui/material/styles";
import Box from "@mui/material/Box";
import MuiDrawer from "@mui/material/Drawer";
import MuiAppBar, { AppBarProps as MuiAppBarProps } from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
import List from "@mui/material/List";
import CssBaseline from "@mui/material/CssBaseline";
import Divider from "@mui/material/Divider";
import IconButton from "@mui/material/IconButton";
import MenuIcon from "@mui/icons-material/Menu";
import ListItem from "@mui/material/ListItem";
import ListItemButton from "@mui/material/ListItemButton";
import ListItemText from "@mui/material/ListItemText";
import { useNavigate } from "react-router";
import MobilityList from "./MobilityList";
import {
AirlineSeatReclineNormal,
BugReport,
ElectricCar,
DriveEta,
Logout,
NoCrash,
ReportProblem,
Dashboard,
Assessment,
CarCrash,
Map,
MapsHomeWork,
LocalActivity,
LocationCity,
BroadcastOnHome,
Pending,
TaxiAlert,
MinorCrash,
} from "@mui/icons-material";
import { Card, Typography } from "@mui/material";
import Cookies from "js-cookie";
import { useUserDispatch } from "../../CustomUtils/usercontext";
import env from "../../config/env";
import { MobilityButtonIcon } from "./MobilityButtonIcon";
import logo from "../../assets/Logo_digital.png";
import {
getCookies,
removeCookies,
setCookies,
} from "../../CustomUtils/CookiesUtils";
import { AppContext } from "../Context/AppContext";
function getUsername() {
//const temp: any = [Link]("bpp_portal_UserName")?.toString();
const temp: any = getCookies("bpp_portal_UserName")?.toString();
setUsername(temp);
}
function getAndSetMenus() {
const clientInfo: any =
getCookies("bpp_portal_ClientInfo")?.toString();
[Link](() => {
getUsername();
getAndSetMenus();
}, []);
return (
<Box sx={{ display: "flex" }}>
<CssBaseline />
<AppBar position="fixed" open={open}>
<Toolbar style={{ backgroundColor: "white" }}>
<IconButton
color="primary"
aria-label="open drawer"
onClick={open ? handleDrawerClose :
handleDrawerOpen}
edge="start"
sx={{
marginRight: 5,
//...(open && { display: "none" }),
}}
>
{<MenuIcon />}
{/* {!open && <MenuIcon />}
{open && <ChevronLeftIcon />} */}
</IconButton>
<Typography
//variant=""
component="div"
sx={{ flexGrow: 1 }}
color={"InfoText"}
>
{assignedRoles}
</Typography>
<MobilityButtonIcon
label={username}
onClick={(event:
[Link]<HTMLButtonElement>) => {
setToolbarOpen(!toolbarOpen);
}}
></MobilityButtonIcon>
{/* <img
style={{
cursor: "pointer",
}}
src={require("../../assets/Logo_digital.png")}
alt="logo"
height="55px"
/>*/}
{/* <IconButton
onClick={() => {
setToolbarOpen(!toolbarOpen);
}}
sx={{ position: "absolute", right: "10px" }}
>
{username}
</IconButton> */}
</Toolbar>
{toolbarOpen && (
<Card
sx={{
//width: 200,
//height: 200,
position: "absolute",
right: "30px",
top: "40px",
}}
>
<List>
<ListItem
disablePadding={true}
onClick={LogOut}
onMouseOver={() =>
setToolbarOpen(true)}
onMouseOut={() =>
setToolbarOpen(false)}
>
<ListItemButton>
<Logout />
<ListItemText
primary="Logout" style={{ marginLeft: 10 }} />
</ListItemButton>
</ListItem>
</List>
</Card>
)}
</AppBar>
<Drawer variant="permanent" open={open}>
{/* <DrawerHeaderIcon>
<img
style={{
cursor: "pointer",
}}
src={require("../../assets/Logo_digital.png")}
alt="logo"
height="55px"
/> */}
<DrawerHeader>
<img
src={logo}
//src={""}
height="60px"
style={{ cursor: "pointer" }}
onClick={() => navigate("/")}
/>
{/* <IconButton onClick={handleDrawerClose}>
{[Link] === "rtl" ? (
<ChevronRightIcon color="primary" />
) : (
<ChevronLeftIcon color="primary" />
)}
</IconButton> */}
</DrawerHeader>
{/* </DrawerHeaderIcon> */}
<Divider />
<MobilityList items={menus} />
{/* <List>
{["Inbox", "Starred", "Send email",
"Drafts"].map((text, index) => (
<ListItem key={text} disablePadding
sx={{ display: "block" }}>
<ListItemButton
sx={{
minHeight: 48,
justifyContent: open ?
"initial" : "center",
px: 2.5,
}}
>
<ListItemIcon
sx={{
minWidth: 0,
mr: open ? 3 :
"auto",
justifyContent:
"center",
}}
>
{index % 2 === 0 ?
<InboxIcon /> : <MailIcon />}
</ListItemIcon>
<ListItemText primary={text}
sx={{ opacity: open ? 1 : 0 }} />
</ListItemButton>
</ListItem>
))}
</List> */}
{/* <Divider /> */}
{/* <List>
{["All mail", "Trash", "Spam"].map((text, index)
=> (
<ListItem key={text} disablePadding
sx={{ display: "block" }}>
<ListItemButton
sx={{
minHeight: 48,
justifyContent: open ?
"initial" : "center",
px: 2.5,
}}
>
<ListItemIcon
sx={{
minWidth: 0,
mr: open ? 3 :
"auto",
justifyContent:
"center",
}}
>
{index % 2 === 0 ?
<InboxIcon /> : <MailIcon />}
</ListItemIcon>
<ListItemText primary={text}
sx={{ opacity: open ? 1 : 0 }} />
</ListItemButton>
</ListItem>
))}
</List> */}
</Drawer>
{/* <Box component="main" sx={{ flexGrow: 1, p: 3 }}>
<DrawerHeader />
</Box> */}
</Box>
);
}
35] ondc\Admin-portal-frontend\bpp_admin\src\Components\CommonComponents\
[Link]
import { Box } from "@mui/material";
import { FC, ReactElement } from "react";
import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
const PublicHeader: FC = (): ReactElement => {
return (
<Box sx={{ flexGrow: 1 }}>
<AppBar position="fixed">
<Toolbar
sx={{
backgroundColor: "#FFFF",
}}
>
<img
src="[Link]
9 "
alt=""
width="50px"
height="50px"
/>
</Toolbar>
</AppBar>
</Box>
);
};
36] ondc\Admin-portal-frontend\bpp_admin\src\Components\Constants\
[Link]
export const GRAY_200 = "#eeeeee";
export const GRAY_800 = "#37474F";
export const GRAY_900 = "#212121";
export const BLUE_A200 = "#448AFF";
export const RED_A200 = "#FF5252";
export const GREEN_200 = "#A5D6A7";
37] ondc\Admin-portal-frontend\bpp_admin\src\Components\Context\[Link]
import { createContext } from "react";
import { MobilityLoaderProp } from "../CommonComponents/MobilityLoader";
import { MobilitySnackbarProp } from "../CommonComponents/MobilitySnackBar";
import { MobilityConfirmDialogProp } from
"../CommonComponents/MobilityConfirmDialog";
38] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
CancelledRides\[Link]
import React, { FC, ReactElement } from "react";
import { Card, Grid, Paper, CardContent } from "@mui/material";
import { useLocation, useParams } from "react-router-dom";
import { useSearchParams, useNavigate } from "react-router-dom";
import { useUserDispatch } from "../../../CustomUtils/usercontext";
import { isEmpty, replace } from "lodash";
import styled from "@emotion/styled";
import {
formatAmount,
formatDateTime,
} from "../../../CustomUtils/DateTimeUtils";
import MapTemp from "../CurrentRides/map";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import MobilityAccordion from "../../CommonComponents/MobilityAccordion";
import MobilityButton from "../../CommonComponents/MobilityButton";
import {
MobilityFareHeadingValue,
MobilityHeadingValue,
} from "../../CommonComponents/MobilityHeadingValue";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { COMPLETED_RIDE_DETAILS } from "../../ApiServices/ApiConstants";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
if (!isEmpty(response)) {
const { data } = [Link];
[Link]("70", data);
let baseFare = "",
cgst = "",
sgst = "",
distanceFare = "",
buyerFinderFees = "";
[Link]?.data?.quote?.[Link]((element:
any) => {
switch ([Link]()) {
case "BASE_FARE":
baseFare =
[Link]?.[Link]();
break;
case "CGST":
cgst =
[Link]?.[Link]();
break;
case "SGST":
sgst =
[Link]?.[Link]();
break;
case "BUYER_FINDER_FEES":
buyerFinderFees =
[Link]?.[Link]();
break;
case "DISTANCE_FARE":
distanceFare =
[Link]?.[Link]();
break;
}
});
element?.cancellation_fee?.amount?.[Link]();
break;
case "RIDE_ARRIVED_PICKUP":
rideArrivedPickup =
element?.cancellation_fee?.amount?.[Link]();
break;
case "RIDE_STARTED":
rideStarted =
element?.cancellation_fee?.amount?.[Link]();
break;
}
});
// const locationArray =
[Link]?.data?.locationArray?.map(
// (item: any) => {
// return item?.location;
// }
// );
setRideDetails({
transactionId: [Link]?.data?.transactionId
|| "NA",
driverName: [Link]?.data?.agent?.name ||
"NA",
driverId: [Link]?.data?.agent?.driverId ||
"NA",
passegngerName:
[Link]?.data?.customer?.name || "NA",
estimatedCost:
formatAmount([Link]?.data?.quote?.price?.value),
estimatedTime: [Link]?.data?.eta || "NA",
startDateAndTime: formatDateTime(
[Link]?.data?.pickUpDateTime,
true
),
endDateAndTime: formatDateTime(
[Link]?.data?.dropUpDateTime,
true
),
destinationLocation:
[Link]?.data?.endTipLocationDetails?.address ||
[Link]?.data?.destinationLocation?.address,
sourceLocation:
[Link]?.data?.sourceLocation?.address || "NA",
destinationLocationGps:
[Link]?.data?.endTipLocationDetails?.location ||
[Link]?.data?.destinationLocation?.gps,
sourceLocationGps:
[Link]?.data?.sourceLocation?.gps,
tripPolyline:
[Link]?.data?.routeDetails?.tripPolyline,
locationArray: [Link]?.data?.locationArray,
vehicleCategory:
[Link]?.data?.vehicle?.category || "NA",
vehicleMake: [Link]?.data?.vehicle?.make ||
"NA",
vehicleModel: [Link]?.data?.vehicle?.model
|| "NA",
vehicleRegistration:
[Link]?.data?.vehicle?.registrationNumber || "NA",
beforeStartTripLocationArray:
[Link]?.data?.beforeStartTripLocationArray,
afterStartTripLocationArray:
[Link]?.data?.afterStartTripLocationArray,
//fair
totalFare:
formatAmount([Link]?.data?.quote?.price?.value),
baseFare: formatAmount(baseFare),
cgst: formatAmount(cgst),
sgst: formatAmount(sgst),
distanceFare: formatAmount(distanceFare),
buyerFinderFees: formatAmount(buyerFinderFees),
rideAsigned: formatAmount(rideAsigned),
rideEnroutePickup:
formatAmount(rideEnroutePickup),
rideArrivedPickup:
formatAmount(rideArrivedPickup),
rideStarted: formatAmount(rideStarted),
paymentCollectedBy:
[Link]?.data?.payment?.collected_by
|| "NA",
paymentStatus:
[Link]?.data?.payment?.status || "NA",
paymentType: [Link]?.data?.payment?.type ||
"NA",
waitingCharges: formatAmount(
[Link]?.data?.waitingCharges?.amount
),
extraTimeCharges: formatAmount(
[Link]?.data?.extraTimeCharges?.amount
),
providerName: [Link]?.data?.providerName,
listName: [Link]?.data?.listOfItems?.
[0].[Link],
listCode: [Link]?.data?.listOfItems?.
[0].[Link],
tripStatus: [Link]?.data?.status,
cancellationReason:
[Link]?.data?.status === "Cancelled"
?
response?.data?.data?.tripStatus?.name
: "No reason available",
cancellationBy:
[Link]?.data?.status === "Cancelled"
?
response?.data?.data?.transactionStepName?.isCanceledByPassenger
? "Passenger"
: "Driver"
: "No data available",
});
} else {
ShowSnackbarFailure(response, myContext);
// [Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
apiCall();
setTimeout(() => {
setIsMapVisible(true);
}, 1000);
}, []);
const cardStyle = {
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
padding: 2,
};
const titleStyle = {
fontSize: "28px",
fontWeight: "bold",
};
const formControlStyle = {
width: "100%",
marginBottom: "16px",
};
const buttonStyle = {
marginTop: "25px",
};
const labelStyle = {
fontSize: "18px",
};
const labelValueStyle = {
fontSize: "18px",
fontWeight: "bold",
};
const Img = styled("img")({
margin: "auto",
display: "block",
maxWidth: "100%",
maxHeight: "100%",
});
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<MobilityAppBar
title="Cancelled Ride Details"
onBackClick={() => {
navigate(-1);
}}
menus={<></>}
/>
</Grid>
value={rideDetails?.transactionId}
/>
<MobilityHeadingValue
heading="Trip Status"
value={rideDetails?.tripStatus}
/>
{rideDetails?.cancellationReason && (
<MobilityHeadingValue
heading="Cancellation Reason"
value={rideDetails?.cancellationReason}
/>
)}
{rideDetails?.cancellationBy && (
<MobilityHeadingValue
heading="Cancellation By"
value={rideDetails?.cancellationBy}
/>
)}
<MobilityHeadingValue
heading={"Driver
Name"}
value={rideDetails?.driverName}
linkUrl={`$
{driverDetailsPath}?id=$
{rideDetails?.driverId}&isEdit=false&selectedTab=details`}
/>
<MobilityHeadingValue
heading="Passenger
Name"
value={rideDetails?.passegngerName}
/>
<MobilityHeadingValue
heading="Cost"
value={rideDetails?.estimatedCost}
/>
{/* <MobilityHeadingValue
heading="Trip
Duration"
value={`$
{rideDetails?.estimatedTime}`}
/> */}
{/* <MobilityHeadingValue
heading="Start Date &
Time"
value={rideDetails?.startDateAndTime}
/> */}
{/* <MobilityHeadingValue
heading="End Date &
Time"
value={rideDetails?.endDateAndTime}
/> */}
<MobilityHeadingValue
heading="Source"
value={rideDetails?.sourceLocation}
/>
<MobilityHeadingValue
heading="Destination"
value={rideDetails?.destinationLocation}
/>
</>
}
/>
<MobilityFareHeadingValue
heading="Category"
value={rideDetails?.vehicleCategory}
/>
<MobilityFareHeadingValue
heading="Make"
value={rideDetails?.vehicleMake}
/>
<MobilityFareHeadingValue
heading="Model"
value={rideDetails?.vehicleModel}
/>
<MobilityFareHeadingValue
heading="Reg. Number"
value={rideDetails?.vehicleRegistration}
/>
</>
}
/>
</Grid>
<MobilityFareHeadingValue
heading="Provider Name"
value={rideDetails?.providerName}
/>
<MobilityFareHeadingValue
heading="List Name"
value={rideDetails?.listName}
/>
<MobilityFareHeadingValue
heading="List Code"
value={rideDetails?.listCode}
/>
</>
}
/>
</Grid>
</Grid>
</Grid>
<Grid container item xs={12} md={6}>
<Card style={{ display: "flex", flex: 1 }}>
<CardContent style={{ display: "flex",
flex: 1, padding: 8 }}>
{isMapVisible && (
<MapTemp
rideType="cancelled"
sourceLocation={rideDetails?.sourceLocationGps}
destinationLocation={rideDetails?.destinationLocationGps}
tripPolyline={rideDetails?.tripPolyline}
currentLocation={rideDetails?.destinationLocationGps}
locationArray={[Link]}
startDateAndTime={rideDetails?.startDateAndTime}
endDateAndTime={rideDetails?.endDateAndTime}
beforeStartTripLocationArray={
rideDetails?.beforeStartTripLocationArray
}
afterStartTripLocationArray={
rideDetails?.afterStartTripLocationArray
}
/>
)}
</CardContent>
</Card>
</Grid>
value={rideDetails?.baseFare}
/>
<MobilityFareHeadingValue
heading="Distance
Fare"
value={rideDetails?.distanceFare}
/>
<MobilityFareHeadingValue
heading="Buyer Finder
Fare"
value={rideDetails?.buyerFinderFees}
/>
<MobilityFareHeadingValue
heading="CGST (2.5
%)"
value={rideDetails?.cgst}
/>
<MobilityFareHeadingValue
heading="SGST (2.5
%)"
value={rideDetails?.sgst}
/>
<MobilityFareHeadingValue
heading="Total Fare"
value={rideDetails?.totalFare}
/>
</>
}
/>
</Grid>
value={rideDetails?.rideAsigned}
/>
<MobilityFareHeadingValue
heading="Ride Enroute
Pickup"
value={rideDetails?.rideEnroutePickup}
/>
<MobilityFareHeadingValue
heading="Ride Arrived
Pickup"
value={rideDetails?.rideArrivedPickup}
/>
<MobilityFareHeadingValue
heading="Ride
Started"
value={rideDetails?.rideStarted}
/>
</>
}
/>
</Grid>
value={rideDetails?.paymentCollectedBy}
/>
<MobilityFareHeadingValue
heading="Status"
value={rideDetails?.paymentStatus}
/>
<MobilityFareHeadingValue
heading="Type"
value={rideDetails?.paymentType}
/>
</>
}
/>
</Grid>
value={rideDetails?.waitingCharges}
/>
<MobilityFareHeadingValue
heading="Extra Time
Charges"
value={rideDetails?.extraTimeCharges}
/>
</>
}
/>
</Grid>
</Grid>
</Paper>
</Grid>
);
};
39] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
CancelledRides\[Link]
import { Card, Grid, Paper } from "@mui/material";
import * as React from "react";
import _, { isEmpty } from "lodash";
import { useLocation, useNavigate, useParams } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { formatDate, formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import {
DateValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
import MobilityDatePicker from "../../CommonComponents/MobilityDatePicker";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
TRACK_COMPLETED_RIDE,
TRACK_CANCELLED_RIDE,
} from "../../ApiServices/ApiConstants";
import moment from "moment";
import dayjs, { Dayjs } from "dayjs";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface driverState {
id: string;
firstName: string;
phone: string;
city: string;
status: string;
documents: string;
actions: any;
driverName: any;
passengerName: any;
estimatedCost: any;
estimatedTime: any;
source: any;
destination: any;
dateAndTime: any;
}
[Link](() => {
if (page || rowsPerPage) {
getCancelledRidesList();
}
}, [page, rowsPerPage]);
if (!isEmpty(response)) {
const data = response?.data?.[Link];
const EnhancedTableConfig = {
headers: [
{
id: "driverName",
numeric: false,
disablePadding: true,
label: "Driver Name",
disableSort: false,
},
{
id: "passengerName",
numeric: false,
disablePadding: true,
label: "Passenger Name",
disableSort: false,
},
{
id: "source",
numeric: false,
disablePadding: true,
label: "Source",
disableSort: true,
},
{
id: "destination",
numeric: false,
disablePadding: true,
label: "Destination",
disableSort: true,
},
// {
// id: "buyerFee",
// numeric: false,
// disablePadding: true,
// label: "Buyer Fee",
// disableSort: true,
// },
// {
// id: "price",
// numeric: false,
// disablePadding: true,
// label: "Price",
// disableSort: true,
// },
// {
// id: "total",
// numeric: false,
// disablePadding: true,
// label: "Total",
// disableSort: true,
// },
// {
// id: "paymentCollected",
// numeric: false,
// disablePadding: true,
// label: "Payment Collected",
// disableSort: true,
// },
{
id: "dateAndTime",
numeric: false,
disablePadding: true,
label: "Date Time",
disableSort: false,
},
{
id: "viewDetails",
numeric: true,
disablePadding: true,
label: "View Details",
disableSort: true,
},
],
};
setSearchText(inputValue);
if ([Link] > 2) {
const filteredRows = [Link]((row) => {
return
[Link]().includes(inputValue);
//[Link]().includes(inputValue)
});
setFilteredCancelledRides(filteredRows);
} else {
setFilteredCancelledRides(cancelledRides);
}
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid
container
sx={{
paddingLeft: 2,
paddingTop: 2,
backgroundColor: "white",
}}
>
<Grid container spacing={2} alignItems="center">
<Grid item>
<MobilityDatePicker
label="Start Date"
value={startDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setStartDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityDatePicker
label="End Date"
value={endDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setEndDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityButton
label="Search"
onClick={(
event:
[Link]<HTMLButtonElement, MouseEvent>
) => {
if
(startDate?.isAfter(endDate, "dates")) {
ShowSnackbarFailure(
"Start Date
should be same or before End Date",
myContext
);
} else {
getCancelledRidesList();
}
}}
/>
</Grid>
</Grid>
</Grid>
<Grid padding={2}>
{[Link] > 0 ? (
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredCancelledRides}
count={count}
refreshPage={refreshPage}
/>
) : (
<MobilityEmptyMsg message={"No Ride History
Found"} />
)}
</Grid>
</Paper>
</Grid>
);
};
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
//[Link]("67", [Link]);
if (!isEmpty(response)) {
const { data } = [Link];
element?.cancellation_fee?.amount?.[Link]();
break;
case "RIDE_ARRIVED_PICKUP":
rideArrivedPickup =
element?.cancellation_fee?.amount?.[Link]();
break;
case "RIDE_STARTED":
rideStarted =
element?.cancellation_fee?.amount?.[Link]();
break;
}
});
// const locationArray =
[Link]?.data?.locationArray?.map(
// (item: any) => {
// return item?.location;
// }
// );
setRideDetails({
transactionId: [Link]?.data?.transactionId
|| "NA",
driverName: [Link]?.data?.agent?.name ||
"NA",
driverId: [Link]?.data?.agent?.driverId ||
"NA",
passegngerName:
[Link]?.data?.customer?.name || "NA",
estimatedCost:
formatAmount([Link]?.data?.quote?.price?.value),
estimatedTime: [Link]?.data?.eta || "NA",
startDateAndTime: formatDateTime(
[Link]?.data?.pickUpDateTime,
true
),
endDateAndTime: formatDateTime(
[Link]?.data?.dropUpDateTime,
true
),
destinationLocation:
[Link]?.data?.endTipLocationDetails?.address ||
[Link]?.data?.destinationLocation?.address,
sourceLocation:
[Link]?.data?.sourceLocation?.address || "NA",
destinationLocationGps:
[Link]?.data?.endTipLocationDetails?.location ||
[Link]?.data?.destinationLocation?.gps,
sourceLocationGps:
[Link]?.data?.sourceLocation?.gps,
tripPolyline:
[Link]?.data?.routeDetails?.tripPolyline,
locationArray: [Link]?.data?.locationArray,
beforeStartTripLocationArray:
[Link]?.data?.beforeStartTripLocationArray,
afterStartTripLocationArray:
[Link]?.data?.afterStartTripLocationArray,
vehicleCategory:
[Link]?.data?.vehicle?.category || "NA",
vehicleMake: [Link]?.data?.vehicle?.make ||
"NA",
vehicleModel: [Link]?.data?.vehicle?.model
|| "NA",
vehicleRegistration:
[Link]?.data?.vehicle?.registrationNumber || "NA",
//fair
totalFare:
formatAmount([Link]?.data?.quote?.price?.value),
baseFare: formatAmount(baseFare),
cgst: formatAmount(cgst),
sgst: formatAmount(sgst),
distanceFare: formatAmount(distanceFare),
buyerFinderFees: formatAmount(buyerFinderFees),
rideAsigned: formatAmount(rideAsigned),
rideEnroutePickup:
formatAmount(rideEnroutePickup),
rideArrivedPickup:
formatAmount(rideArrivedPickup),
rideStarted: formatAmount(rideStarted),
paymentCollectedBy:
[Link]?.data?.payment?.collected_by
|| "NA",
paymentStatus:
[Link]?.data?.payment?.status || "NA",
paymentType: [Link]?.data?.payment?.type ||
"NA",
waitingCharges: formatAmount(
[Link]?.data?.waitingCharges?.amount
),
extraTimeCharges: formatAmount(
[Link]?.data?.extraTimeCharges?.amount
),
providerName: [Link]?.data?.providerName,
listName: [Link]?.data?.listOfItems?.
[0].[Link],
listCode: [Link]?.data?.listOfItems?.
[0].[Link],
tripStatus: [Link]?.data?.status,
});
} else {
ShowSnackbarFailure(response, myContext);
// [Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
apiCall();
setTimeout(() => {
setIsMapVisible(true);
}, 1000);
}, []);
const cardStyle = {
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
padding: 2,
};
const titleStyle = {
fontSize: "28px",
fontWeight: "bold",
};
const formControlStyle = {
width: "100%",
marginBottom: "16px",
};
const buttonStyle = {
marginTop: "25px",
};
const labelStyle = {
fontSize: "18px",
};
const labelValueStyle = {
fontSize: "18px",
fontWeight: "bold",
};
const Img = styled("img")({
margin: "auto",
display: "block",
maxWidth: "100%",
maxHeight: "100%",
});
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<MobilityAppBar
title="Completed Ride Details"
onBackClick={() => {
navigate(-1);
}}
menus={
<MobilityButton
label="Raise an Issue"
onClick={(event:
[Link]<HTMLButtonElement>) => {
navigate(
`${RaiseIssuePath}?
transactionId=${rideDetails?.transactionId}`
);
}}
/>
}
/>
</Grid>
value={rideDetails?.transactionId}
/>
<MobilityHeadingValue
heading="Trip Status"
value={rideDetails?.tripStatus}
/>
<MobilityHeadingValue
heading={"Driver
Name"}
value={rideDetails?.driverName}
linkUrl={`$
{driverDetailsPath}?id=$
{rideDetails?.driverId}&isEdit=false&selectedTab=details`}
/>
<MobilityHeadingValue
heading="Passenger
Name"
value={rideDetails?.passegngerName}
/>
<MobilityHeadingValue
heading="Cost"
value={rideDetails?.estimatedCost}
/>
<MobilityHeadingValue
heading="Trip
Duration"
value={`$
{rideDetails?.estimatedTime}`}
/>
<MobilityHeadingValue
heading="Start Date &
Time"
value={rideDetails?.startDateAndTime}
/>
<MobilityHeadingValue
heading="End Date &
Time"
value={rideDetails?.endDateAndTime}
/>
<MobilityHeadingValue
heading="Source"
value={rideDetails?.sourceLocation}
/>
<MobilityHeadingValue
heading="Destination"
value={rideDetails?.destinationLocation}
/>
</>
}
/>
<MobilityFareHeadingValue
heading="Category"
value={rideDetails?.vehicleCategory}
/>
<MobilityFareHeadingValue
heading="Make"
value={rideDetails?.vehicleMake}
/>
<MobilityFareHeadingValue
heading="Model"
value={rideDetails?.vehicleModel}
/>
<MobilityFareHeadingValue
heading="Reg. Number"
value={rideDetails?.vehicleRegistration}
/>
</>
}
/>
</Grid>
<MobilityFareHeadingValue
heading="Provider Name"
value={rideDetails?.providerName}
/>
<MobilityFareHeadingValue
heading="List Name"
value={rideDetails?.listName}
/>
<MobilityFareHeadingValue
heading="List Code"
value={rideDetails?.listCode}
/>
</>
}
/>
</Grid>
</Grid>
</Grid>
<Grid container item xs={12} md={6}>
<Card style={{ display: "flex", flex: 1 }}>
<CardContent style={{ display: "flex",
flex: 1, padding: 8 }}>
{isMapVisible && (
<MapTemp
rideType="completed"
sourceLocation={rideDetails?.sourceLocationGps}
destinationLocation={rideDetails?.destinationLocationGps}
tripPolyline={rideDetails?.tripPolyline}
currentLocation={rideDetails?.destinationLocationGps}
locationArray={[Link]}
startDateAndTime={rideDetails?.startDateAndTime}
endDateAndTime={rideDetails?.endDateAndTime}
beforeStartTripLocationArray={
rideDetails?.beforeStartTripLocationArray
}
afterStartTripLocationArray={
rideDetails?.afterStartTripLocationArray
}
/>
)}
</CardContent>
</Card>
</Grid>
value={rideDetails?.baseFare}
/>
<MobilityFareHeadingValue
heading="Distance
Fare"
value={rideDetails?.distanceFare}
/>
<MobilityFareHeadingValue
heading="Buyer Finder
Fare"
value={rideDetails?.buyerFinderFees}
/>
<MobilityFareHeadingValue
heading="CGST (2.5
%)"
value={rideDetails?.cgst}
/>
<MobilityFareHeadingValue
heading="SGST (2.5
%)"
value={rideDetails?.sgst}
/>
<MobilityFareHeadingValue
heading="Total Fare"
value={rideDetails?.totalFare}
/>
</>
}
/>
</Grid>
<Grid item xs={6} md={3}>
<MobilityAccordion
isExpanded={true}
title={"Cancellation Charges :"}
details={
<>
<MobilityFareHeadingValue
heading="Ride
Assigned"
value={rideDetails?.rideAsigned}
/>
<MobilityFareHeadingValue
heading="Ride Enroute
Pickup"
value={rideDetails?.rideEnroutePickup}
/>
<MobilityFareHeadingValue
heading="Ride Arrived
Pickup"
value={rideDetails?.rideArrivedPickup}
/>
<MobilityFareHeadingValue
heading="Ride
Started"
value={rideDetails?.rideStarted}
/>
</>
}
/>
</Grid>
value={rideDetails?.paymentCollectedBy}
/>
<MobilityFareHeadingValue
heading="Status"
value={rideDetails?.paymentStatus}
/>
<MobilityFareHeadingValue
heading="Type"
value={rideDetails?.paymentType}
/>
</>
}
/>
</Grid>
value={rideDetails?.waitingCharges}
/>
<MobilityFareHeadingValue
heading="Extra Time
Charges"
value={rideDetails?.extraTimeCharges}
/>
</>
}
/>
</Grid>
</Grid>
</Paper>
</Grid>
);
};
41] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
CompletedRides\[Link]
import { Card, Grid, Paper } from "@mui/material";
import * as React from "react";
import _, { isEmpty } from "lodash";
import { useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { formatDate, formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import {
DateValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
import MobilityDatePicker from "../../CommonComponents/MobilityDatePicker";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
TRACK_CANCELLED_RIDE,
TRACK_COMPLETED_RIDE,
} from "../../ApiServices/ApiConstants";
import moment from "moment";
import dayjs, { Dayjs } from "dayjs";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface driverState {
id: string;
firstName: string;
phone: string;
city: string;
status: string;
documents: string;
actions: any;
driverName: any;
passengerName: any;
estimatedCost: any;
estimatedTime: any;
source: any;
destination: any;
dateAndTime: any;
}
[Link](() => {
if (page || rowsPerPage) {
getCompletedRidesList();
}
}, [page, rowsPerPage]);
if (!isEmpty(response)) {
const data = response?.data?.[Link];
const EnhancedTableConfig = {
headers: [
{
id: "driverName",
numeric: false,
disablePadding: true,
label: "Driver Name",
disableSort: false,
},
{
id: "passengerName",
numeric: false,
disablePadding: true,
label: "Passenger Name",
disableSort: false,
},
{
id: "source",
numeric: false,
disablePadding: true,
label: "Source",
disableSort: true,
},
{
id: "destination",
numeric: false,
disablePadding: true,
label: "Destination",
disableSort: true,
},
// {
// id: "buyerFee",
// numeric: false,
// disablePadding: true,
// label: "Buyer Fee",
// disableSort: true,
// },
// {
// id: "price",
// numeric: false,
// disablePadding: true,
// label: "Price",
// disableSort: true,
// },
{
id: "total",
numeric: true,
disablePadding: true,
label: "Actual Fare",
disableSort: true,
},
// {
// id: "paymentCollected",
// numeric: false,
// disablePadding: true,
// label: "Payment Collected",
// disableSort: true,
// },
{
id: "dateAndTime",
numeric: false,
disablePadding: true,
label: "Date Time",
disableSort: false,
},
{
id: "viewDetails",
numeric: true,
disablePadding: true,
label: "View Details",
disableSort: true,
},
],
};
setSearchText(inputValue);
if ([Link] > 2) {
const filteredRows = [Link]((row) => {
return
[Link]().includes(inputValue);
//[Link]().includes(inputValue)
});
setFilteredCompletedRides(filteredRows);
} else {
setFilteredCompletedRides(completedRides);
}
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid
container
sx={{
paddingLeft: 2,
paddingTop: 2,
backgroundColor: "white",
}}
>
<Grid container spacing={2} alignItems="center">
<Grid item>
<MobilityDatePicker
label="Start Date"
value={startDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setStartDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityDatePicker
label="End Date"
value={endDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setEndDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityButton
label="Search"
onClick={(
event:
[Link]<HTMLButtonElement, MouseEvent>
) => {
if
(startDate?.isAfter(endDate, "dates")) {
ShowSnackbarFailure(
"Start Date
should be same or before End Date",
myContext
);
} else {
getCompletedRidesList();
}
}}
/>
</Grid>
</Grid>
</Grid>
<Grid padding={2}>
{[Link] > 0 ? (
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredCompletedRides}
count={count}
refreshPage={refreshPage}
/>
) : (
<MobilityEmptyMsg message={"No Ride History
Found"} />
)}
</Grid>
</Paper>
</Grid>
);
};
42] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
CurrentRides\[Link]
import React, { FC, ReactElement } from "react";
import { Card, Grid, Paper, CardContent } from "@mui/material";
import { useSearchParams, useNavigate } from "react-router-dom";
import { isEmpty } from "lodash";
import MobilityButton from "../../CommonComponents/MobilityButton";
import MapTemp from "./map";
import {
formatAmount,
formatDateTime,
} from "../../../CustomUtils/DateTimeUtils";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import _ from "lodash";
import MobilityAccordion from "../../CommonComponents/MobilityAccordion";
import {
MobilityFareHeadingValue,
MobilityHeadingValue,
} from "../../CommonComponents/MobilityHeadingValue";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { CURRENT_RIDE_DETAILS } from "../../ApiServices/ApiConstants";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
if (!isEmpty(response)) {
let baseFare = "",
cgst = "",
sgst = "",
distanceFare = "",
buyerFinderFees = "";
[Link]?.data?.quote?.[Link]((element:
any) => {
switch ([Link]()) {
case "BASE_FARE":
baseFare =
[Link]?.[Link]();
break;
case "CGST":
cgst =
[Link]?.[Link]();
break;
case "SGST":
sgst =
[Link]?.[Link]();
break;
case "BUYER_FINDER_FEES":
buyerFinderFees =
[Link]?.[Link]();
break;
case "DISTANCE_FARE":
distanceFare =
[Link]?.[Link]();
break;
}
});
element?.cancellation_fee?.amount?.[Link]();
break;
case "RIDE_ARRIVED_PICKUP":
rideArrivedPickup =
element?.cancellation_fee?.amount?.[Link]();
break;
case "RIDE_STARTED":
rideStarted =
element?.cancellation_fee?.amount?.[Link]();
break;
}
});
setRideDetails({
transactionId: [Link]?.data?.transactionId
|| "NA",
driverName: [Link]?.data?.agent?.name ||
"NA",
driverId: [Link]?.data?.agent?.id || "NA",
passegngerName:
[Link]?.data?.customer?.name || "NA",
estimatedCost:
formatAmount([Link]?.data?.quote?.price?.value),
estimatedTime: [Link]?.data?.eta || "NA",
startDateAndTime: formatDateTime(
[Link]?.data?.createdDate,
true
),
destinationLocation:
[Link]?.data?.destinationLocation?.address || "NA",
sourceLocation:
[Link]?.data?.sourceLocation?.address || "NA",
destinationLocationGps:
[Link]?.data?.destinationLocation?.gps,
sourceLocationGps:
[Link]?.data?.sourceLocation?.gps,
//tripPolyline:
[Link]?.data?.routeDetails?.tripPolyline,
beforeStartTripLocationArray:
[Link]?.data?.beforeStartTripLocationArray,
afterStartTripLocationArray:
[Link]?.data?.afterStartTripLocationArray,
locationArray: [Link]?.data?.locationArray,
vehicleCategory:
[Link]?.data?.vehicle?.category || "NA",
vehicleMake: [Link]?.data?.vehicle?.make ||
"NA",
vehicleModel: [Link]?.data?.vehicle?.model
|| "NA",
vehicleRegistration:
[Link]?.data?.vehicle?.registrationNumber || "NA",
//fair
totalFare:
formatAmount([Link]?.data?.quote?.price?.value),
baseFare: formatAmount(baseFare),
cgst: formatAmount(cgst),
sgst: formatAmount(sgst),
distanceFare: formatAmount(distanceFare),
buyerFinderFees: formatAmount(buyerFinderFees),
rideAsigned: formatAmount(rideAsigned),
rideEnroutePickup:
formatAmount(rideEnroutePickup),
rideArrivedPickup:
formatAmount(rideArrivedPickup),
rideStarted: formatAmount(rideStarted),
paymentCollectedBy:
[Link]?.data?.payment?.collected_by
|| "NA",
paymentStatus:
[Link]?.data?.payment?.status || "NA",
paymentType: [Link]?.data?.payment?.type ||
"NA",
waitingCharges: formatAmount(
[Link]?.data?.waitingCharges?.amount
),
extraTimeCharges: formatAmount(
[Link]?.data?.extraTimeCharges?.amount
),
providerName: [Link]?.data?.providerName,
listName: [Link]?.data?.listOfItems?.
[0].[Link],
listCode: [Link]?.data?.listOfItems?.
[0].[Link],
tripStatus: [Link]?.data?.status,
});
} else {
ShowSnackbarFailure(response, myContext);
[Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
apiCall();
setTimeout(() => {
setIsMapVisible(true);
}, 1000);
}, []);
const cardStyle = {
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
padding: 2,
};
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<MobilityAppBar
title="Current Ride Details"
onBackClick={() => {
navigate(-1);
}}
menus={
<MobilityButton
label="Raise an Issue"
onClick={(event:
[Link]<HTMLButtonElement>) => {
navigate(
`${RaiseIssuePath}?
transactionId=${rideDetails?.transactionId}`
);
}}
/>
}
/>
</Grid>
value={rideDetails?.tripStatus}
/>
<MobilityHeadingValue
heading={"Driver
Name"}
value={rideDetails?.driverName}
linkUrl={`$
{driverDetailsPath}?id=$
{rideDetails?.driverId}&isEdit=false&selectedTab=details`}
/>
<MobilityHeadingValue
heading="Passenger
Name"
value={rideDetails?.passegngerName}
/>
<MobilityHeadingValue
heading="Estimated
Cost"
value={rideDetails?.estimatedCost}
/>
<MobilityHeadingValue
heading="Estimated
Time"
value={`$
{rideDetails?.estimatedTime} mins`}
/>
<MobilityHeadingValue
heading="Start Date &
Time"
value={rideDetails?.startDateAndTime}
/>
<MobilityHeadingValue
heading="Source"
value={rideDetails?.sourceLocation}
/>
<MobilityHeadingValue
heading="Destination"
value={rideDetails?.destinationLocation}
/>
</>
}
/>
heading="Category"
value={rideDetails?.vehicleCategory}
/>
<MobilityFareHeadingValue
heading="Make"
value={rideDetails?.vehicleMake}
/>
<MobilityFareHeadingValue
heading="Model"
value={rideDetails?.vehicleModel}
/>
<MobilityFareHeadingValue
heading="Reg. Number"
value={rideDetails?.vehicleRegistration}
/>
</>
}
/>
</Grid>
<MobilityFareHeadingValue
heading="Provider Name"
value={rideDetails?.providerName}
/>
<MobilityFareHeadingValue
heading="List Name"
value={rideDetails?.listName}
/>
<MobilityFareHeadingValue
heading="List Code"
value={rideDetails?.listCode}
/>
</>
}
/>
</Grid>
</Grid>
</Grid>
sourceLocation={rideDetails?.sourceLocationGps}
destinationLocation={rideDetails?.destinationLocationGps}
tripPolyline={rideDetails?.tripPolyline}
currentLocation={rideDetails?.destinationLocationGps}
locationArray={rideDetails?.locationArray}
startDateAndTime={rideDetails?.startDateAndTime}
endDateAndTime={rideDetails?.endDateAndTime}
beforeStartTripLocationArray={
rideDetails?.beforeStartTripLocationArray
}
afterStartTripLocationArray={
rideDetails?.afterStartTripLocationArray
}
/>
)}
</CardContent>
</Card>
</Grid>
value={rideDetails?.baseFare}
/>
<MobilityFareHeadingValue
heading="Distance
Fare"
value={rideDetails?.distanceFare}
/>
<MobilityFareHeadingValue
heading="Buyer Finder
Fare"
value={rideDetails?.buyerFinderFees}
/>
<MobilityFareHeadingValue
heading="CGST (2.5
%)"
value={rideDetails?.cgst}
/>
<MobilityFareHeadingValue
heading="SGST (2.5
%)"
value={rideDetails?.sgst}
/>
<MobilityFareHeadingValue
heading="Total Fare"
value={rideDetails?.totalFare}
/>
</>
}
/>
</Grid>
value={rideDetails?.rideAsigned}
/>
<MobilityFareHeadingValue
heading="Ride Enroute
Pickup"
value={rideDetails?.rideEnroutePickup}
/>
<MobilityFareHeadingValue
heading="Ride Arrived
Pickup"
value={rideDetails?.rideArrivedPickup}
/>
<MobilityFareHeadingValue
heading="Ride
Started"
value={rideDetails?.rideStarted}
/>
</>
}
/>
</Grid>
value={rideDetails?.paymentCollectedBy}
/>
<MobilityFareHeadingValue
heading="Status"
value={rideDetails?.paymentStatus}
/>
<MobilityFareHeadingValue
heading="Type"
value={rideDetails?.paymentType}
/>
</>
}
/>
</Grid>
value={rideDetails?.waitingCharges}
/>
<MobilityFareHeadingValue
heading="Extra Time
Charges"
value={rideDetails?.extraTimeCharges}
/>
</>
}
/>
</Grid>
</Grid>
</Paper>
</Grid>
);
};
43] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
CurrentRides\[Link]
import { Card, Grid, Paper } from "@mui/material";
import * as React from "react";
import _, { isEmpty } from "lodash";
import { useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { formatDate, formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { TRACK_CURRENT_RIDE } from "../../ApiServices/ApiConstants";
import MobilityDatePicker from "../../CommonComponents/MobilityDatePicker";
import dayjs, { Dayjs } from "dayjs";
import {
DateValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
import MobilityButton from "../../CommonComponents/MobilityButton";
interface driverState {
id: string;
firstName: string;
phone: string;
city: string;
status: string;
documents: string;
actions: any;
driverName: any;
passengerName: any;
estimatedCost: any;
estimatedTime: any;
source: any;
destination: any;
dateAndTime: any;
}
[Link](() => {
if (page || rowsPerPage) {
getCurrentRidesList();
}
}, [page, rowsPerPage]);
async function getCurrentRidesList() {
try {
[Link]({
isLoading: true,
message: "Tracking current ride...",
});
[Link]({ startDate, endDate });
const payload = {
rowsPerPage,
pageNo: page,
searchBy: "date",
startDate: startDate?.format("DD/MM/YYYY"),
endDate: endDate?.format("DD/MM/YYYY"),
// startDate: startDate
// ? formatDate(startDate)?.toString()
// : formatDate(new Date().toString()),
// endDate: endDate
// ? formatDate(endDate)?.toString()
// : formatDate(new Date().toString()),
};
const EnhancedTableConfig = {
headers: [
{
id: "driverName",
numeric: false,
disablePadding: true,
label: "Driver Name",
disableSort: false,
},
{
id: "passengerName",
numeric: false,
disablePadding: true,
label: "Passenger Name",
disableSort: false,
},
{
id: "source",
numeric: false,
disablePadding: true,
label: "Source",
disableSort: true,
},
{
id: "destination",
numeric: false,
disablePadding: true,
label: "Destination",
disableSort: true,
},
{
id: "estimatedCost",
numeric: true,
disablePadding: true,
label: "Estimated Fare",
disableSort: true,
},
{
id: "estimatedTime",
numeric: true,
disablePadding: true,
label: "Estimated Time (mins)",
disableSort: true,
},
{
id: "dateAndTime",
numeric: false,
disablePadding: true,
label: "Date Time",
disableSort: false,
},
{
id: "viewDetails",
numeric: true,
disablePadding: true,
label: "View Details",
disableSort: true,
},
],
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid
container
sx={{
paddingLeft: 2,
paddingTop: 2,
backgroundColor: "white",
}}
>
<Grid container spacing={2} alignItems="center">
<Grid item>
<MobilityDatePicker
label="Start Date"
value={startDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setStartDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityDatePicker
label="End Date"
value={endDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setEndDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityButton
label="Search"
onClick={(
event:
[Link]<HTMLButtonElement, MouseEvent>
) => {
if
(startDate?.isAfter(endDate, "dates")) {
ShowSnackbarFailure(
"Start Date
should be same or before End Date",
myContext
);
} else {
getCurrentRidesList();
}
}}
/>
</Grid>
</Grid>
</Grid>
<Grid padding={2}>
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredcurrentRides}
count={count}
refreshPage={refreshPage}
></EnhancedTable>
</Grid>
</Paper>
</Grid>
);
};
44] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
CurrentRides\[Link]
import { LoadScript } from "@react-google-maps/api";
import GoogleMapComponent from "./mapW";
import { MAP_API_KEY } from "../../../config/env";
driverBroadcastedCoordinates={props?.driverBroadcastedCoordinates}
driverBroadcastReceivedCoordinates={
props?.driverBroadcastReceivedCoordinates
}
driverAcceptedByCoordinates={props?.driverAcceptedByCoordinates}
driverAssignedCoordinates={props?.driverAssignedCoordinates}
broadcastCustomerDetails={props?.broadcastCustomerDetails}
broadcastCustomerLocation={props?.broadcastCustomerLocation}
rideType={props?.rideType}
beforeStartTripLocationArray={props?.beforeStartTripLocationArray}
afterStartTripLocationArray={props?.afterStartTripLocationArray}
/>
</LoadScript>
);
}
45] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
CurrentRides\[Link]
import { useState } from "react";
import {
GoogleMap,
Polyline,
Marker,
InfoWindow,
} from "@react-google-maps/api";
import { MapProps } from "./map";
import { MobilityButtonIconReCenter } from
"../../CommonComponents/MobilityButtonIcon";
import { Grid, Typography, colors } from "@mui/material";
import _ from "lodash";
import auto from "../../../assets/[Link]";
import auto_red from "../../../assets/auto_red.png";
import auto_black from "../../../assets/auto_black.png";
import auto_blue from "../../../assets/auto_blue.png";
import location_man_red from "../../../assets/location_man_red.svg";
import source_svg from "../../../assets/[Link]";
import { GRAY_900, RED_A200 } from "../../Constants/CommonConstants";
import { formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import polyline from "./polyline";
import React from "react";
import { AppContext } from "../../Context/AppContext";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import MobilityBadge from "../../CommonComponents/MobilityBadge";
import { useNavigate } from "react-router-dom";
const containerStyle = {
display: "flex",
flex: 1,
minHeight: 200,
//maxHeight: 500,
};
const center = {
lat: 18.559658,
lng: 73.779938,
};
if (
props?.customerLocation &&
props?.customerLocation?.toString() !== "0,0" &&
props?.customerLocation?.toString() != ""
) {
const sourceLatLng = {
lat:
Number(props?.customerLocation?.toString().split(",")[0]),
lng:
Number(props?.customerLocation?.toString().split(",")[1]),
};
//[Link](sourceLatLng);
setCustomerLoc(sourceLatLng);
}
if (
props?.sourceLocation &&
props?.sourceLocation?.toString() !== "0,0" &&
props?.sourceLocation?.toString() != ""
) {
const sourceLatLng = {
lat: Number(props?.sourceLocation?.toString().split(",")
[0]),
lng: Number(props?.sourceLocation?.toString().split(",")
[1]),
};
[Link](sourceLatLng);
[Link]("111 sourceLatLng", sourceLatLng);
setSource(sourceLatLng);
}
if (
props?.destinationLocation &&
props?.destinationLocation?.toString() !== "0,0" &&
props?.destinationLocation?.toString() != ""
) {
const destLatLng = {
lat:
Number(props?.destinationLocation?.toString().split(",")[0]),
lng:
Number(props?.destinationLocation?.toString().split(",")[1]),
};
[Link](destLatLng);
[Link]("125 destLatLng", destLatLng);
setDestination(destLatLng);
}
if (
props?.currentLocation &&
props?.currentLocation?.toString() !== "0,0" &&
props?.currentLocation?.toString() != ""
) {
const currentLatLng = {
lat:
Number(props?.currentLocation?.toString().split(",")[0]),
lng:
Number(props?.currentLocation?.toString().split(",")[1]),
};
[Link](currentLatLng);
setCurrent(currentLatLng);
//[Link]("267", props?.currentLocation);
}
if (props?.driverCoordinates) {
props?.[Link]((item: any) => {
//if (item?.toString() !== "0,0" && item?.toString() !=
"") {
const latlng = {
lat: Number(
item?.currentLocation?.[Link]().split(",")[0]
),
lng: Number(
item?.currentLocation?.[Link]().split(",")[1]
),
};
[Link](latlng);
//[Link]("143", latlng);
//[Link]({
[Link]({
latlng,
name: (
<div>
{item?.name}
<br />
{item?.phone}
<br />
<div>
{item?.currentLocation?.time
?
formatDateTime(item?.currentLocation?.time, true)
: ""}
</div>
</div>
),
auto,
size: new [Link](25, 25),
phone: item?.phone,
//fullName: item?.name,
});
//[Link](latlng);
//}
});
}
//[Link]("281 driverMarkers", ...driverMarkers);
//setDriverCoordinates(driverMarkers);
if (props?.searchCoordinates) {
props?.[Link]((item: any) => {
//if (item?.toString() !== "0,0" && item?.toString() !=
"") {
const latlng = {
lat: Number(item?.toString().split(",")[0]),
lng: Number(item?.toString().split(",")[1]),
};
[Link](latlng);
[Link](latlng);
//}
});
}
if (props?.driverBroadcastedCoordinates) {
props?.[Link]((item: any) => {
[Link]("179 item", item);
if (item?.currentLocations) {
if (
item?.currentLocations?.toString() !== "0,0"
&&
item?.toString() != ""
) {
const name = item?.firstName + " " +
item?.lastName;
const latlng = {
lat:
Number(item?.currentLocations?.toString().split(",")[0]),
lng:
Number(item?.currentLocations?.toString().split(",")[1]),
};
[Link](latlng);
[Link]({
latlng,
name: (
<div>
<div style={{ fontWeight:
"bold" }}>{`Broadcasted to :`}</div>
{name}
<br />
{item?.phone}
{item?.time}
</div>
),
auto,
size: new [Link](25, 25),
});
}
}
});
}
//[Link]("284", driverBroadcastedCoordinates);
setDriverBroadcastedCoordinates(driverBroadcastedCoordinates);
if (props?.driverBroadcastReceivedCoordinates) {
props?.[Link]((item: any) => {
//[Link]("269", item?.[Link]());
if (item?.currentLocations) {
if (
item?.currentLocations?.toString() !== "0,0"
&&
item?.toString() != ""
) {
const name = item?.firstName + " " +
item?.lastName;
const latlng = {
lat:
Number(item?.currentLocations?.toString().split(",")[0]),
lng:
Number(item?.currentLocations?.toString().split(",")[1]),
};
[Link](latlng);
if (props?.driverAcceptedByCoordinates) {
props?.[Link]((item: any) => {
//[Link]("310", item?.[Link]());
if (item?.currentLocations) {
if (
item?.[Link]() !== "0,0"
&&
item?.toString() != ""
) {
const name = item?.firstName + " " +
item?.lastName;
const latlng = {
lat:
Number(item?.currentLocations?.toString().split(",")[0]),
lng:
Number(item?.currentLocations?.toString().split(",")[1]),
};
[Link](latlng);
//[Link]({ latlng,
name });
[Link]({
latlng,
//name: <div>Ride accepted by :
{name}</div>,
name: (
<div>
<div style={{ fontWeight:
"bold" }}>{`Accepted by :`}</div>
{name}
<br />
{item?.phone}
{item?.time}
</div>
),
auto: auto_blue,
size: new [Link](35, 35),
});
}
}
});
}
//[Link]("325", driverAcceptedCoordinates);
setDriverAcceptedCoordinates(driverAcceptedCoordinates);
if (props?.driverAssignedCoordinates) {
props?.[Link]((item: any) => {
[Link]("310", item?.[Link]());
if (item?.currentLocations) {
if (
item?.[Link]() !== "0,0"
&&
item?.toString() != ""
) {
const name = item?.firstName + " " +
item?.lastName;
const latlng = {
lat:
Number(item?.currentLocations?.toString().split(",")[0]),
lng:
Number(item?.currentLocations?.toString().split(",")[1]),
};
[Link](latlng);
//[Link]({ latlng,
name });
[Link]({
latlng,
//name: <div>Ride assigned to :
{name}</div>,
name: (
<div>
<div style={{ fontWeight:
"bold" }}>{`Assigned to :`}</div>
{name}
<br />
{item?.phone}
{item?.time}
</div>
),
auto: auto_red,
size: new [Link](40, 40),
});
}
}
});
}
//[Link]("325", driverAssignedCoordinates);
setDriverAssignedCoordinates(driverAssignedCoordinates);
if (props?.broadcastCustomerDetails) {
let name = props?.broadcastCustomerDetails?.name;
let item: any = {
// name: <div>Passenger : {name}</div>,
name: (
<div>
<div style={{ fontWeight:
"bold" }}>{`Passenger :`}</div>
{name}
</div>
),
auto: location_man_red,
size: new [Link](50, 50),
};
if (
props?.broadcastCustomerLocation &&
props?.broadcastCustomerLocation?.coordinates
) {
const latlng = {
lat:
Number(props?.broadcastCustomerLocation?.coordinates[0]),
lng:
Number(props?.broadcastCustomerLocation?.coordinates[1]),
};
[Link](latlng);
item = { ...item, latlng };
}
// [Link]("425 item", item);
//[Link](item);
[Link](item);
}
if (props?.afterStartTripLocationArray) {
let coArray1 = props?.[Link](
(item: any, index: any) => {
return [
Number(item?.location?.toString().split(",")
[0]),
Number(item?.location?.toString().split(",")
[1]),
];
}
);
//[Link]("506 coArray", coArray1);
let polyline = encodePolyline(coArray1);
//[Link]("508 polyline", polyline);
let s = decodePolyline(polyline);
//[Link]("510 s", s);
setAfterStartTripPolyLatLng(s);
function handleZoomChanged() {
if (googleMap) {
setMapZoom([Link]());
}
}
const polylineOptions = {
strokeColor: GRAY_900,
//strokeOpacity: 1,
//strokeWeight: [Link](1, 6 - (mapZoom - 15)),
};
return coords;
};
//[Link]("507,", props?.locationArray);
return (
// <Grid item>
// <Grid item marginBottom={1}>
// <MobilityAppBar
// title="Broadcast Details"
// menus={createDescription()}
// onBackClick={() => {
// navigate(-1);
// }}
// />
// </Grid>
<GoogleMap
mapContainerStyle={containerStyle}
// center={{
// lat: 18.52,
// lng: 73.8553,
// }}
zoom={mapZoom}
options={{
zoomControl: true,
streetViewControl: false,
mapTypeControl: false,
fullscreenControl: false,
//tilt: 45,
}}
onLoad={onLoad}
onZoomChanged={handleZoomChanged}
// onTilesLoaded={() => {
// setMapZoom(12);
// }}
// onBoundsChanged={onBoundsChanged}
>
{
props?.customerLocation &&
customMarker(
{
latlng: customerLoc,
name: <div>Customer Location</div>,
auto: source_svg,
},
0
)
// <Marker
// position={customerLoc}
// icon={{
// //path: [Link],
// url:
require("../../../assets/[Link]").default,
// //scale: 10,
// //strokeColor: "red",
// }}
// >
// <InfoWindow position={source}>
// <div>Customer Location</div>
// </InfoWindow>
// </Marker>
}
{props?.sourceLocation && (
<Marker
position={source}
icon={{
url:
require("../../../assets/[Link]").default,
}}
>
<InfoWindow position={source}>
<div>
Source Location
<br />
{props?.startDateAndTime}
</div>
</InfoWindow>
</Marker>
)}
{props?.destinationLocation && (
<Marker
position={destination}
icon={{
url:
require("../../../assets/[Link]").default,
}}
>
<InfoWindow>
<div>
Destination Location
<br />
{props?.endDateAndTime}
</div>
</InfoWindow>
</Marker>
)}
{myContext?.broadcastFilter?.driverBroadcastedCoordinatesVisible &&
driverBroadcastedCoordinates?.map((item: any, index:
any) => {
return customMarkerBroadcast(item, index);
})}
{myContext?.broadcastFilter?.driverBroadcastReceivedCoordinatesVisible &&
driverBroadcastReceivedCoordinates &&
driverBroadcastReceivedCoordinates?.map((item: any,
index: any) => {
return customMarkerBroadcast(item, index);
})}
{myContext?.broadcastFilter?.driverAssignedCoordinatesVisible
&&
driverAssignedCoordinates &&
driverAssignedCoordinates?.map((item: any, index: any)
=> {
return customMarkerBroadcast(item, index);
})}
{myContext?.broadcastFilter?.driverAcceptedCoordinatesVisible
&&
driverAcceptedCoordinates &&
driverAcceptedCoordinates?.map((item: any, index: any)
=> {
return customMarkerBroadcast(item, index);
})}
{customerBroadcastedCoordinates &&
customerBroadcastedCoordinates?.map((item: any, index:
any) => {
return customMarkerBroadcast(item, index);
})}
{driverCoordinates &&
driverCoordinates?.map((item: any, index: any) => {
return customMarker(item, index);
})}
</GoogleMap>
// </Grid>
);
}
46] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
CurrentRides\[Link]
"use strict";
/**
* Based off of [the offical Google
document]([Link]
polylinealgorithm)
*
* Some parts from [this
implementation]([Link]
[Link])
* by [Mark McClure]([Link]
*
* @module polyline
*/
function py2_round(value) {
// Google's polyline algorithm uses the same rounding strategy as Python
2, which is different from JS for negative values
return [Link]([Link](value) + 0.5) * (value >= 0 ? 1 : -1);
}
/**
* Decodes to a [latitude, longitude] coordinates array.
*
* This is adapted from the implementation in Project-OSRM.
*
* @param {String} str
* @param {Number} precision
* @returns {Array}
*
* @see [Link]
routing/[Link]
*/
[Link] = function (str, precision) {
var index = 0,
lat = 0,
lng = 0,
coordinates = [],
shift = 0,
result = 0,
byte = null,
latitude_change,
longitude_change,
factor = [Link](10, [Link](precision) ? precision : 5);
// Coordinates have variable length when encoded, so just keep
// track of whether we've hit the end of the string. In each
// loop iteration, a single coordinate is decoded.
while (index < [Link]) {
// Reset shift, result, and byte
byte = null;
shift = 1;
result = 0;
do {
byte = [Link](index++) - 63;
result += (byte & 0x1f) * shift;
shift *= 32;
} while (byte >= 0x20);
shift = 1;
result = 0;
do {
byte = [Link](index++) - 63;
result += (byte & 0x1f) * shift;
shift *= 32;
} while (byte >= 0x20);
lat += latitude_change;
lng += longitude_change;
return coordinates;
};
/**
* Encodes the given [latitude, longitude] coordinates array.
*
* @param {Array.<Array.<Number>>} coordinates
* @param {Number} precision
* @returns {String}
*/
[Link] = function (coordinates, precision) {
if (![Link]) {
return "";
}
return output;
};
function flipped(coords) {
var flipped = [];
for (var i = 0; i < [Link]; i++) {
var coord = coords[i].slice();
[Link]([coord[1], coord[0]]);
}
return flipped;
}
/**
* Encodes a GeoJSON LineString feature/geometry.
*
* @param {Object} geojson
* @param {Number} precision
* @returns {String}
*/
[Link] = function (geojson, precision) {
if (geojson && [Link] === "Feature") {
geojson = [Link];
}
if (!geojson || [Link] !== "LineString") {
throw new Error("Input must be a GeoJSON LineString");
}
return [Link](flipped([Link]), precision);
};
/**
* Decodes to a GeoJSON LineString geometry.
*
* @param {String} str
* @param {Number} precision
* @returns {Object}
*/
[Link] = function (str, precision) {
var coords = [Link](str, precision);
return {
type: "LineString",
coordinates: flipped(coords),
};
};
47] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
DriverRideCount\[Link]
import { Card, Grid, Paper, Tab, Tabs } from "@mui/material";
import * as React from "react";
import { apiHandler } from "../../ApiServices/ApiHandler";
import _ from "lodash";
import { useLocation, useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { GET_DRIVER_AND_RIDE_LIST } from "../../ApiServices/ApiConstants";
import {
formatDateTime,
convertToStartDateString,
convertToEndDateString,
} from "../../../CustomUtils/DateTimeUtils";
import MobilityButton from "../../CommonComponents/MobilityButton";
import dayjs, { Dayjs } from "dayjs";
import MobilityDatePicker from "../../CommonComponents/MobilityDatePicker";
import {
DateValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
const EnhancedTableConfig = {
headers: [
{
id: "date",
numeric: false,
disablePadding: true,
label: "Date",
disableSort: false,
},
{
id: "count",
numeric: false,
disablePadding: true,
label: "Count",
disableSort: true,
},
],
};
[Link](() => {
fetchData();
}, []);
getFilterDriverList(data?.driverCount);
getFilterRideList(data?.rideCount);
}
} catch (error) {
ShowSnackbarFailure(error, myContext);
} finally {
[Link]({
isLoading: false,
});
}
};
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid
container
sx={{
paddingLeft: 2,
paddingTop: 2,
backgroundColor: "white",
}}
>
<Grid container spacing={2} alignItems="center">
<Grid item>
<MobilityDatePicker
label="Start Date"
value={startDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setStartDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityDatePicker
label="End Date"
value={endDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setEndDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityButton
label="Search"
onClick={(
event:
[Link]<HTMLButtonElement, MouseEvent>
) => {
if
(startDate?.isAfter(endDate, "dates")) {
ShowSnackbarFailure(
"Start Date
should be same or before End Date",
myContext
);
} else {
fetchData();
}
}}
/>
</Grid>
</Grid>
</Grid>
<Grid
sx={{
display: "flex",
justifyContent: "space-between",
paddingLeft: 2,
paddingTop: 2,
}}
>
<Grid container>
<Grid item>
<Tabs
value={tabValue}
onChange={(e, newValue) => {
//tableRef?.current?.handleChangePage(null, 0);
setTabValue(newValue);
//setSearchText("");
}}
>
<Tab label="Drivers"
value="drivers" sx={[Link]} />
<Tab label="Rides" value="rides"
sx={[Link]} />
</Tabs>
</Grid>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
>
{/* {tabValue && tabValue !== "all" && (
<Grid marginRight={1}>
<MobilityButton
fullWidth={false}
label={"Download"}
onClick={(event:
[Link]<HTMLButtonElement>) => {
fetchData("", true);
}}
/>
</Grid>
)} */}
{/* <MobilityTextField
label="Search Driver by Phone..."
type="text"
name="search"
value={searchText}
maxLength={50}
fullWidth={false}
onChange={(event:
[Link]<HTMLInputElement>) => {
handleInputChange(event);
}}
/> */}
</Grid>
</Grid>
{filteredDriverList &&
[Link] > 0 &&
tabValue === "drivers" && (
<Grid padding={2}>
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredDriverList}
//count={count}
//refreshPage={refreshPage}
/>
</Grid>
)}
{filteredRideList &&
[Link] > 0 &&
tabValue === "rides" && (
<Grid padding={2}>
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredRideList}
//count={count}
//refreshPage={refreshPage}
/>
</Grid>
)}
{(filteredDriverList?.length === 0 ||
filteredRideList?.length === 0) && (
<MobilityEmptyMsg message={"No Data Found"} />
)}
</Paper>
</Grid>
);
};
48] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Drivers\[Link]
import React, { FC, ReactElement } from "react";
import {
Card,
Grid,
Paper,
Tabs,
Tab,
Divider,
Typography,
Tooltip,
IconButton,
} from "@mui/material";
import { useSearchParams, useNavigate } from "react-router-dom";
import { isEmpty } from "lodash";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import MobilitySelect from "../../CommonComponents/MobilitySelect";
import { BugReport, CancelOutlined, TaskAlt } from "@mui/icons-material";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import MobilityAccordion from "../../CommonComponents/MobilityAccordion";
import { MobilityImgHeading } from
"../../CommonComponents/MobilityHeadingValue";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import { MobilityListItemEdit } from "../../CommonComponents/MobilityListItem";
import MobilityActionMenu from "../../CommonComponents/MobilityActionMenu";
import { formatDate, formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
CHANGE_DOCUMENT_STATUS,
CHANGE_VEHICLE_STATUS_BY_ADMIN,
EDIT_DRIVER,
GET_DRIVER_DETAILS_BY_ID,
GET_DRIVER_DOCUMENT,
UPDATE_DRIVER_DOCUMENTS_BY_ID,
} from "../../ApiServices/ApiConstants";
import _ from "lodash";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
if (!isEmpty(response)) {
const { data } = [Link];
setDriverDetails({
firstName: [Link]?.firstName,
lastName: [Link]?.lastName,
phone: [Link]?.phone,
city: [Link]?.city,
status: [Link]?.status,
email: [Link]?.email,
driverId: [Link]?._id ||
[Link]?.id,
entityId: [Link]?.entityId,
documents: [Link]?.documents,
homeAddress:
[Link]?.homeAddress?.address,
rejectReason: [Link]?.rejectReason,
});
setVehicleDetails([Link]);
setSubscriptionDetails([Link]);
setRideDetails([Link]);
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
return true;
} catch (error) {}
};
if (validateData()) {
try {
[Link]({
isLoading: true,
message: "Updated Driver Details...",
});
const requestBody = {
driverId: [Link],
firstName: [Link],
lastName: [Link],
city: [Link],
email: [Link],
status: [Link],
...(driverDetails?.status === "Rejected" && {
rejectReason: driverDetails?.rejectReason,
}),
};
[Link]("215", requestBody);
const res: Iresponse = await [Link](
UPDATE_DRIVER_DOCUMENTS_BY_ID,
requestBody
);
if (isEmpty(res)) {
apiCall();
}
if ([Link] === 200) {
ShowSnackbarSuccess("Driver details Updated
Successfully", myContext);
apiCall();
} else {
ShowSnackbarFailure(res, myContext);
[Link]("error.", res);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
}
[Link](() => {
apiCall();
}, []);
const cardStyle = {
//padding: "26px",
margin: "auto",
width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
//margin: "26px",
};
const styles = {
extendedTab: {
//minWidth: "500px",
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
function detailsData() {
return (
<>
<Grid container spacing={4} sx={{ padding: 3 }}>
<Grid item xs={12} sm={6}>
<MobilityTextField
//disabled={isEdit ? true : false}
disabled={true}
label="First Name"
name="firstName"
type="text"
value={driverDetails?.firstName || ""}
onChange={(event: any) => {
setDriverDetails({
...driverDetails,
firstName:
[Link],
});
}}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilityTextField
//disabled={isEdit ? true : false}
disabled={true}
label="Last Name"
name="lastName"
type="text"
value={driverDetails?.lastName || ""}
onChange={(event: any) => {
setDriverDetails({
...driverDetails,
lastName:
[Link],
});
}}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilityTextField
label="Phone"
name="phone"
type="text"
disabled={true}
value={driverDetails?.phone || ""}
onChange={(e) =>
setDriverDetails({
...driverDetails,
phone: [Link],
})
}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilityTextField
//disabled={isEdit ? true : false}
disabled={true}
label="City"
name="city"
type="text"
value={driverDetails?.city || ""}
onChange={(e) =>
value={driverDetails?.rejectReason || ""}
onChange={(e) => {
setDriverDetails({
...driverDetails,
rejectReason:
[Link] as string,
});
}}
/>
</Grid>
)}
{!isEdit && (
<Grid container sx={{ marginTop: 2,
justifyContent: "flex-end" }}>
<MobilityButton label="Submit"
onClick={handleSubmit} />
</Grid>
)}
</Grid>
</>
);
}
function documentsData() {
return (
<Grid>
<Grid container item xs={12} md={12} spacing={1}
padding={2}>
{driverDetails?.documents?.length === 0 && (
<MobilityEmptyMsg message="No found
Found" />
)}
if (
[Link]?.toString() === "DL" ||
[Link]?.toString() === "DLBack"
||
[Link]?.toString() === "QRCODE"
||
[Link]?.toString() ===
"ProfilePhoto"
) {
return (
<Grid item xs={12} md={6}
key={index}>
<MobilityAccordion
key={index}
isExpanded={false}
title={getTitle(item)}
summary={getSummary(item, index)}
details={
<MobilityImgHeading
heading={item}
//imgUrl={[Link]}
imgUrl={`${GET_DRIVER_DOCUMENT}?driverId=${[Link]}&docId=$
{[Link]}`}
docType={item?.docType}
onDataSave={saveDocumentData}
/>
}
/>
</Grid>
);
}
})}
</Grid>
</Grid>
);
}
const EnhancedTableConfig = {
vehicleHeaders: [
{
id: "VehicleName",
numeric: false,
disablePadding: true,
label: "Vehicle Name",
disableSort: true,
},
{
id: "registrationNumber",
numeric: true,
disablePadding: true,
label: "Registration Number",
disableSort: true,
},
{
id: "model",
numeric: false,
disablePadding: true,
label: "Model",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "docNew",
numeric: false,
disablePadding: true,
label: "Documents",
disableSort: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
subscriptionHeaders: [
{
id: "subscriptionStartDate",
numeric: false,
disablePadding: true,
label: "Start Date",
disableSort: true,
},
{
id: "subscriptionEndDate",
numeric: false,
disablePadding: true,
label: "End Date",
disableSort: true,
},
{
id: "cost",
numeric: false,
disablePadding: true,
label: "Cost",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "subscriptionDays",
numeric: false,
disablePadding: true,
label: "Days",
disableSort: true,
},
{
id: "subscriptionName",
numeric: false,
disablePadding: true,
label: "Type",
disableSort: true,
},
{
id: "paymentTime",
numeric: false,
disablePadding: true,
label: "Payment Date",
disableSort: false,
},
],
rideHeaders: [
{
id: "customerName",
numeric: false,
disablePadding: true,
label: "Customer Name",
disableSort: true,
},
{
id: "pickUpAddress",
numeric: false,
disablePadding: true,
label: "Pickup Address",
disableSort: true,
},
{
id: "dropAddress",
numeric: false,
disablePadding: true,
label: "Drop Address",
disableSort: true,
},
{
id: "fare",
numeric: false,
disablePadding: true,
label: "Fare",
disableSort: true,
},
{
id: "pickUpDateTime",
numeric: false,
disablePadding: true,
label: "Pickup Date Time",
disableSort: true,
},
{
id: "dropUpDateTime",
numeric: true,
disablePadding: true,
label: "Dropoff Date Time",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
};
if (err?.message) {
}
} finally {
[Link]({
isLoading: false,
});
}
};
const docIcon = (
<MobilityButtonIconView
tooltipTitle="View Documents"
onClick={(e) => {
[Link]();
navigate(path);
}}
/>
);
if (vehicle?.documents?.length > 0) {
return docIcon;
}
return null;
})(),
actionNew: (() => {
const commonIconContainerStyle = {
display: "flex",
justifyContent: "center",
};
return (
<div style={commonIconContainerStyle}>
<MobilityActionMenu items={menuList} />
</div>
);
})(),
model: vehicle?.model,
};
});
const commonIconContainerStyle = {
display: "flex",
justifyContent: "center",
};
const commonIcons = (
<div style={commonIconContainerStyle}>
<Tooltip title="Raise an Issue">
<IconButton
color={"primary"}
aria-label="Raise an Issue"
onClick={(e) => {
[Link]();
issueAction();
}}
>
<BugReport />
</IconButton>
</Tooltip>
</div>
);
return commonIcons;
})(),
};
});
function vehiclesData() {
return (
<Grid container item xs={12} md={12} spacing={1} padding={2}>
<Grid item xs={12} md={12}>
{[Link] > 0 ? (
<EnhancedTable
headers={[Link]}
tableData={filteredVehicleList}
/>
) : (
<MobilityEmptyMsg message="No data found" />
)}
</Grid>
</Grid>
);
}
function subscriptionData() {
return (
<Grid container item xs={12} md={12} spacing={1} padding={2}>
<Grid item xs={12} md={12}>
{[Link] > 0 ? (
<EnhancedTable
headers={[Link]}
tableData={filteredSubscriptionHistoryList}
/>
) : (
<MobilityEmptyMsg message="No data found" />
)}
</Grid>
</Grid>
);
}
function rideData() {
return (
<Grid container item xs={12} md={12} spacing={1} padding={2}>
<Grid item xs={12} md={12}>
{[Link] > 0 ? (
<EnhancedTable
headers={[Link]}
tableData={filteredRideHistoryList}
/>
) : (
<MobilityEmptyMsg message="No data found" />
)}
</Grid>
</Grid>
);
}
const updatedDocuments =
response?.data?.data?.updatedEntity?.documents;
[Link]((selectedDoc: any) => ({
...selectedDoc,
parentId: parentId,
}));
return (
<Grid>
<Grid>
<Typography color="primary" sx={{ fontSize: 16 }}>
{docTitle}
</Typography>
<Typography color={statusColor} sx={{ fontSize: 12
}}>
{[Link]}
</Typography>
</Grid>
</Grid>
);
}
function createDescription() {
return (
<Grid paddingLeft={1}>
<MobilityChip
label={
"Name : " + driverDetails?.firstName + " " +
driverDetails?.lastName
}
size={"medium"}
/>
<MobilityChip
label={"Mobile : " + driverDetails?.phone}
size={"medium"}
/>
</Grid>
);
}
setDocNumber(item?.docNumber);
[Link](
<>
<Grid container xs={12} sx={{ margin: 0, padding: 0 }}>
<Grid textAlign={"left"} xs={3} sx={{ margin: 0,
padding: 0 }}>
<MobilityTextField
label="Document Number"
name="Document Number"
type="alphaNumeric"
size={"small"}
value={docNumber || ""}
onChange={(e) => {
setDocNumber([Link] as
string);
// setDriverDetails({
// ...driverDetails,
// rejectReason:
[Link] as string,
// });
}}
/>
</Grid>
value={formatDateTime(item?.dateOfBirth) || ""}
onChange={(e) => {}}
/>
</Grid>
</Grid>
</>
);
return summary;
}
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<MobilityAppBar
title="Driver Details"
description={createDescription()}
onBackClick={() => {
navigate("/driver", { state: driverTab });
}}
/>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
marginLeft: 1,
}}
>
{tabValue === "documents" && (
<Grid container spacing={2}
padding={2}>
<Grid item xs={12} sm={4}>
<MobilitySelect
size={"small"}
disabled={isEdit ?
true : false}
label="Status"
value={driverDetails?.status || ""}
statusOptions={statusOptions}
onChange={(e) => {
setDriverDetails({
...driver
Details,
status:
[Link] as string,
});
}}
/>
</Grid>
{driverDetails?.status ===
"Rejected" && (
<Grid item xs={12} sm={6}>
<MobilityTextField
label="Rejected
Reason"
name="Rejected
Reason"
type="text"
size={"small"}
value={driverDetails?.rejectReason || ""}
onChange={(e)
=> {
setDriverDetails({
...
driverDetails,
rejectReason: [Link] as string,
});
}}
/>
</Grid>
)}
{!isEdit && (
<Grid item xs={12} sm={2}>
<MobilityButton
label="Submit" onClick={handleSubmit} />
</Grid>
)}
</Grid>
)}
</Grid>
</Grid>
{tabValue === "details" && detailsData()}
{tabValue === "documents" && documentsData()}
{tabValue === "vehicles" && vehiclesData()}
{tabValue === "subscriptionHistory" &&
subscriptionData()}
{tabValue === "rideHistory" && rideData()}
</Paper>
</Grid>
);
};
49] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Drivers\[Link]
import { Card, Grid, Paper, Tab, Tabs } from "@mui/material";
import * as React from "react";
import { apiHandler } from "../../ApiServices/ApiHandler";
import _ from "lodash";
import { useLocation, useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import LongMenu from "../../CommonComponents/MobilityActionMenu";
import {
MobilityListItemDelete,
MobilityListItemDocuments,
MobilityListItemEdit,
MobilityListItemVehicle,
MobilityListItemView,
} from "../../CommonComponents/MobilityListItem";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import {
CHANGE_DRIVER_STATUS_BY_ADMIN,
DELETE_DRIVER_ACCOUNT,
GET_DRIVERS_LIST,
} from "../../ApiServices/ApiConstants";
import {
formatDateTime,
currentDatAndTime,
} from "../../../CustomUtils/DateTimeUtils";
import MobilityButton from "../../CommonComponents/MobilityButton";
import * as XLSX from "xlsx";
const EnhancedTableConfig = {
headers: [
{
id: "driverName",
numeric: false,
disablePadding: true,
label: "Driver Name",
disableSort: false,
},
{
id: "phone",
numeric: false,
disablePadding: true,
label: "Phone",
disableSort: false,
},
{
id: "rideStatus",
numeric: false,
disablePadding: true,
label: "Ride Status",
disableSort: true,
},
{
id: "currentLocationDateTime",
numeric: false,
disablePadding: true,
label: "Location DateTime",
disableSort: false,
},
// {
// id: "city",
// numeric: false,
// disablePadding: true,
// label: "City",
// disableSort: true,
// },
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "modifiedDateTime",
numeric: false,
disablePadding: true,
label: "Modified DateTime",
disableSort: false,
},
{
id: "docNew",
numeric: true,
disablePadding: true,
label: "Documents",
disableSort: true,
},
// {
// id: "history",
// numeric: false,
// disablePadding: true,
// label: "Ride History",
// disableSort: true,
// },
// {
// id: "subscriptionHistory",
// numeric: false,
// disablePadding: true,
// label: "Sub History",
// disableSort: true,
// },
{
id: "actionNew",
numeric: true,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
};
[Link](() => {
if (page || rowsPerPage || tabValue) {
fetchData("");
}
}, [page, rowsPerPage, tabValue]);
async function prepareApprovedDataDownload(data: any) {
let requests: any = [];
[Link]((record: any) => {
let row = {};
row = {
Name:
record?.firstName && record?.lastName
? [Link](" ",
[Link])
: "",
Phone: [Link],
};
if ([Link]) {
[Link]((doc: any) => {
if ([Link] === "DL") {
row = {
...row,
"Driving Licence Status": [Link],
};
} else if ([Link] === "QRCODE") {
row = {
...row,
"QR Code Status": [Link],
};
} else if ([Link] === "ProfilePhoto") {
row = {
...row,
"Profile Photo Status": [Link],
};
}
});
}
row = {
...row,
Status: [Link],
"Modified Date": formatDateTime([Link],
true, true),
// "Last Location Date Time": formatDateTime(
// record?.currentLocation?.time,
// true,
// true
// ),
};
[Link](row);
});
return requests;
}
if ([Link]) {
[Link]((doc: any) => {
if ([Link] === "DL") {
row = {
...row,
"Driving Licence Status": [Link],
};
} else if ([Link] === "QRCODE") {
row = {
...row,
"QR Code Status": [Link],
};
} else if ([Link] === "ProfilePhoto") {
row = {
...row,
"Profile Photo Status": [Link],
};
}
});
}
row = {
...row,
Status: [Link],
"Modified Date": formatDateTime([Link],
true, true),
};
[Link](row);
});
return requests;
}
row = {
Name:
record?.firstName && record?.lastName
? [Link](" ",
[Link])
: "",
Phone: [Link],
};
if ([Link]) {
[Link]((doc: any) => {
if ([Link] === "DL") {
row = {
...row,
"Driving Licence Status": [Link],
};
} else if ([Link] === "QRCODE") {
row = {
...row,
"QR Code Status": [Link],
};
} else if ([Link] === "ProfilePhoto") {
row = {
...row,
"Profile Photo Status": [Link],
};
}
});
}
row = {
...row,
Status: [Link],
"Rejected Reason": [Link],
"Modified Date": formatDateTime([Link],
true, true),
};
[Link](row);
});
return requests;
}
if ([Link]) {
const dataCsv =
[Link].json_to_sheet(requestes);
const wb = [Link].book_new();
[Link].book_append_sheet(wb, dataCsv, "Sheet
1");
const time = currentDatAndTime();
[Link](wb, `Drivers_${tabValue}_$
{time}.xlsx`);
}
} else {
getFilterDriverList({ data: data?.driversList, total:
data?.total });
}
} catch (error) {
} finally {
[Link]({
isLoading: false,
});
}
};
// <MobilityChip
//
label={formatDateTime(driver?.currentLocation?.time, true) || "NA"}
// type={"broadcast"}
// />
modifiedDateTime: new Date(
driver?.documentsUpdateDate
? driver?.documentsUpdateDate
: driver?.modifiedDate
).getTime(),
// formatDateTime(
// driver?.documentsUpdateDate
// ? driver?.documentsUpdateDate
// : driver?.modifiedDate,
// true,
// true
// ),
docNew: (() => {
const docIcon = (
<MobilityButtonIconView
tooltipTitle="View Documents"
onClick={(e) => {
[Link]();
navigate(
`${driverDetailsPath}?id=$
{[Link]}&selectedTab=documents&driverTab=${tabValue}`
);
}}
/>
);
if (driver?.documents?.length > 0) {
return docIcon;
}
return null;
})(),
actionNew: (() => {
const menuList: any = [];
approveDeleteAction(driver);
}}
/>
);
}
[Link](
<MobilityListItemDocuments
key={"ViewD"}
label="View Documents"
onClick={(e) => {
[Link]();
navigate(
`${driverDetailsPath}?id=$
{[Link]}&selectedTab=documents&driverTab=${tabValue}`
);
}}
/>,
<MobilityListItemVehicle
key={"ViewV"}
label="View Vehicles"
onClick={(e) => {
[Link]();
navigate(
`${driverDetailsPath}?id=$
{[Link]}&selectedTab=vehicles&driverTab=${tabValue}`
);
}}
/>,
<MobilityListItemView
key={"Ride"}
label="Ride History"
onClick={(e) => {
[Link]();
navigate(
`${driverDetailsPath}?id=$
{[Link]}&selectedTab=rideHistory&driverTab=${tabValue}`
);
}}
/>,
<MobilityListItemView
key={"Subscription"}
label="Subscription History"
onClick={(e) => {
[Link]();
// navigate(`$
{subscriptionDetailsPath}?id=${driver?.id}`);
navigate(
`${driverDetailsPath}?id=$
{[Link]}&selectedTab=subscriptionHistory&driverTab=${tabValue}`
);
}}
/>
);
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item>
<Tabs
value={tabValue}
onChange={(e, newValue) => {
tableRef?.current?.handleChangePage(null, 0);
setTabValue(newValue);
setSearchText("");
}}
>
<Tab label="All Drivers"
value="all" sx={[Link]} />
<Tab
label="Approved"
value="Approved"
sx={[Link]}
/>
<Tab
label="Rejected"
value="Rejected"
sx={[Link]}
/>
<Tab label="Pending"
value="Pending" sx={[Link]} />
</Tabs>
</Grid>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
>
{tabValue && tabValue !== "all" && (
<Grid marginRight={1}>
<MobilityButton
fullWidth={false}
label={"Download"}
onClick={(event:
[Link]<HTMLButtonElement>) => {
fetchData("", true);
}}
/>
</Grid>
)}
<MobilityTextField
label="Search Driver by Phone..."
type="text"
name="search"
value={searchText}
maxLength={50}
fullWidth={false}
onChange={(event:
[Link]<HTMLInputElement>) => {
handleInputChange(event);
}}
/>
</Grid>
</Grid>
<Grid padding={2}>
{filteredDriverList && [Link] >
0 ? (
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredDriverList}
count={count}
refreshPage={refreshPage}
/>
) : (
<MobilityEmptyMsg message={"No Data
Found"} />
)}
</Grid>
</Paper>
</Grid>
);
};
50] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Drivers\[Link]
import { makeStyles } from "@mui/styles";
51] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Drivers\[Link]
import React, { FC, ReactElement, useState } from "react";
import { Card, Grid, Paper } from "@mui/material";
import { useLocation } from "react-router-dom";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { useSearchParams, useNavigate } from "react-router-dom";
import { useUserDispatch } from "../../../CustomUtils/usercontext";
import { isEmpty } from "lodash";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import MobilitySelect from "../../CommonComponents/MobilitySelect";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { MobilityButtonIconBack } from
"../../CommonComponents/MobilityButtonIcon";
import { GET_ISSUE_CATEGORIES, ISSUE } from "../../ApiServices/ApiConstants";
const id = [Link]("id");
const entityId = [Link]("entityId");
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
const issueShortDescriptionOptions = [
{ key: "Driver related complaint", value: "Driver related complaint"
},
{ key: "Payment related complaint", value: "Payment related
complaint" },
{ key: "Other", value: "Other" },
];
const [selectedIssueShortDescription, setSelectedIssueShortDescription] =
useState<any>("");
const [issuetextbox, setissueTextBox] = useState<any>("");
const [driverComplaintOptions, setDriverComplaintOptions] =
useState<any[]>(
[]
);
if (!isEmpty(response)) {
const { data } = [Link];
const formattedData =
[Link](response?.data?.data).map(
(category) => ({
key: category,
value:
[Link](response?.data?.data[category]).map((issue) => ({
key: issue,
value: response?.data?.data[category]
[issue],
})),
})
);
setIssueCategories(formattedData);
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
if (!selectedSubCategory || [Link] == 0) {
ShowSnackbarFailure("Please Select Issue Sub-Category",
myContext);
return false;
}
if (!selectedIssueType || [Link] == 0) {
ShowSnackbarFailure("Please Select Issue Type",
myContext);
return false;
}
if (
!selectedIssueShortDescription ||
[Link] == 0
) {
ShowSnackbarFailure("Please Select Issue", myContext);
return false;
}
if (!issuetextbox || [Link] == 0) {
ShowSnackbarFailure("Please Enter Issue Description",
myContext);
return false;
}
return true;
} catch (error) {
}
};
if (validateData()) {
try {
[Link]({
isLoading: true,
message: "Raised Issue...",
});
let params = {
//driverId: driverId,
transactionId: transactionId,
description: {
shortDesc: selectedIssueShortDescription,
longDesc: issuetextbox,
},
city: "Pune",
state: "Maharashtra",
issueCategory: selectedIssueCategory,
subCategory: selectedSubCategory,
issueType: selectedIssueType,
issueStatus: "OPEN",
};
let privateInstance = [Link]();
const response: Iresponse = await [Link](
`/issue`,
params
);
//const response: Iresponse = await
[Link](ISSUE, params);
if (!isEmpty(response)) {
[Link]("153:", error);
} finally {
[Link]({
isLoading: false,
});
}
}
};
[Link](() => {
IssueCategoriesapiCall();
}, []);
const cardStyle = {
padding: "26px",
margin: "auto",
width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
};
const titleStyle = {
fontSize: "28px",
fontWeight: "bold",
marginBottom: "25px",
};
const formControlStyle = {
width: "100%",
marginBottom: "16px",
};
const buttonStyle = {
marginTop: "25px",
};
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<Card sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item sx={{ padding: 1 }}>
<MobilityButtonIconBack onClick={() =>
navigate(-1)} />
</Grid>
<Grid item sx={{ alignItems: "center",
display: "flex" }}>
Raise an Issue
</Grid>
</Grid>
<Grid
container
sx={{ alignItems: "center", justifyContent:
"end" }}
></Grid>
</Card>
</Grid>
<Paper component={Card} variant="outlined" sx={cardStyle}>
<Grid container spacing={4}>
<Grid item xs={12} sm={6}>
<MobilitySelect
label="Issue Category"
value={selectedIssueCategory}
setSelectedIssueCategory([Link] as string);
}}
/>
</Grid>
[Link]
) || []
: []
}
onChange={(e) => {
setSelectedSubCategory([Link] as string);
}}
/>
</Grid>
setselectedIssueType([Link])
}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilitySelect
label="Issue"
value={selectedIssueShortDescription}
statusOptions={[Link](
(option) => [Link]
)}
onChange={(event: any) => {
setSelectedIssueShortDescription([Link] as string);
}}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilityTextField
label="Textbox "
name="textbox"
type="text"
value={issuetextbox}
onChange={(event: any) => {
setissueTextBox([Link]);
}}
/>
</Grid>
</Grid>
{/* <Button
type="submit"
variant="contained"
color="primary"
onClick={onPressSubmit}
sx={buttonStyle}
>
Submit
</Button> */}
<Grid container sx={{ marginTop: 2, justifyContent:
"flex-end" }}>
<MobilityButton label="Submit"
onClick={onPressSubmit} />
</Grid>
</Paper>
</Grid>
);
};
52] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Drivers\[Link]
import { Grid, IconButton, Tooltip } from "@mui/material";
import * as React from "react";
import _, { isEmpty } from "lodash";
import { useNavigate } from "react-router-dom";
import { BugReport } from "@mui/icons-material";
import { formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import { apiHandler } from "../../ApiServices/ApiHandler";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface rideHistoryState {
transactionId?: string;
customerName?: string;
pickUpAddress?: any;
dropAddress?: any;
orderId?: string;
pickUpDateTime?: Date;
dropUpDateTime?: Date;
status?: string;
fare?: number;
}
if (!isEmpty(response)) {
const { data } = response?.data;
const commonIconContainerStyle = {
display: "flex",
justifyContent: "center",
};
const commonIcons = (
<div
style={commonIconContainerStyle}>
<Tooltip title="Raise an
Issue">
<IconButton
color={"primary"}
aria-
label="Raise an Issue"
onClick={(e) =>
{
[Link]();
issueAction();
}}
>
<BugReport />
</IconButton>
</Tooltip>
</div>
);
return commonIcons;
})(),
};
});
setRideHistory(_data);
} else {
ShowSnackbarFailure(response, myContext);
[Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
const EnhancedTableConfig = {
headers: [
{
id: "customerName",
numeric: false,
disablePadding: true,
label: "Customer Name",
disableSort: true,
},
{
id: "pickUpAddress",
numeric: false,
disablePadding: true,
label: "Pickup Address",
disableSort: true,
},
{
id: "dropAddress",
numeric: false,
disablePadding: true,
label: "Drop Address",
disableSort: true,
},
{
id: "fare",
numeric: false,
disablePadding: true,
label: "Fare",
disableSort: true,
},
{
id: "pickUpDateTime",
numeric: false,
disablePadding: true,
label: "Pickup Date Time",
disableSort: true,
},
{
id: "dropUpDateTime",
numeric: true,
disablePadding: true,
label: "Dropoff Date Time",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
};
[Link](() => {
if (driverId) {
getRideHistory(1, 10, driverId);
}
}, [driverId]);
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<MobilityAppBar
title="Ride History Details"
onBackClick={() => {
navigate(-1);
}}
// menus={
// <MobilityButton
// label="Raise an Issue"
// onClick={(event:
[Link]<HTMLButtonElement>) => {
// //navigate(`${RaiseIssuePath}`);
// }}
// />
// }
/>
</Grid>
53] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Drivers\[Link]
import { Card, Grid } from "@mui/material";
import React from "react";
import { isEmpty } from "lodash";
import moment from "moment";
import { useSearchParams, useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import { MobilityButtonIconBack } from
"../../CommonComponents/MobilityButtonIcon";
import { apiHandler } from "../../ApiServices/ApiHandler";
const id = [Link]("id");
const entityId = [Link]("entityId");
interface Subresponse {
subscriptionStartDate: string;
subscriptionEndDate: string;
cost: number;
status: string;
paymentTime: string;
}
if (
!isEmpty(response) &&
[Link] &&
[Link]
) {
const data = response?.data?.data?.subscriptionHistory;
subItem?.subscriptionDetails?.subscriptionStartDate
),
subscriptionEndDate: formatDateTime(
subItem?.subscriptionDetails?.subscriptionEndDate
),
cost: subItem?.subscriptionDetails?.cost,
status: (
<MobilityChip
label={subItem?.subscriptionDetails?.status} />
),
paymentTime:
formatDate(subItem?.payment[0]?.paymentTime),
path: subscriptionDetailsPath,
};
});
setSubscription(_data);
} else {
ShowSnackbarFailure(response, myContext);
[Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
if (id) {
SubscriptionapiCall(1, 10);
}
}, []);
const basicTableConfig = {
headers: [
{ text: "Start Date", value: "subscriptionStartDate" },
{ text: "End Date", value: "subscriptionEndDate" },
{ text: "Cost", value: "cost" },
{ text: "Status", value: "status" },
{ text: "Payment Date", value: "paymentTime" },
],
};
const EnhancedTableConfig = {
headers: [
{
id: "subscriptionStartDate",
numeric: false,
disablePadding: true,
label: "Start Date",
disableSort: true,
},
{
id: "subscriptionEndDate",
numeric: false,
disablePadding: true,
label: "End Date",
disableSort: true,
},
{
id: "cost",
numeric: false,
disablePadding: true,
label: "Cost",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "paymentTime",
numeric: false,
disablePadding: true,
label: "Payment Date",
disableSort: false,
},
],
};
const cardStyle = {
padding: "26px",
margin: "auto",
width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
};
const titleStyle = {
fontSize: "28px",
fontWeight: "bold",
marginBottom: "25px",
};
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<Card sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item sx={{ padding: 1 }}>
<MobilityButtonIconBack onClick={() =>
navigate(-1)} />
</Grid>
<Grid item sx={{ alignItems: "center",
display: "flex" }}>
Subscription Details
</Grid>
</Grid>
</Card>
</Grid>
<Grid item style={{ paddingTop: 10 }}>
{/* <EnhancedTable
headers={[Link]}
tableData={subscription}
></EnhancedTable> */}
{[Link] > 0 ? (
<EnhancedTable
headers={[Link]}
tableData={subscription}
/>
) : (
<MobilityEmptyMsg message={"No Subscription
History Found"} />
)}
</Grid>
</Grid>
);
};
54] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
DriversBroadCast\[Link]
import { FC, ReactElement } from "react";
import { useLocation } from "react-router-dom";
import * as React from "react";
import CardContent from "@mui/material/CardContent";
import {
Badge,
Card,
Grid,
IconButton,
Paper,
Tab,
Tabs,
Tooltip,
Typography,
colors,
} from "@mui/material";
import CardActions from "@mui/material/CardActions";
import { Cell, Pie, PieChart, ResponsiveContainer } from "recharts";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { MobilityCard } from "../../CommonComponents/MobilityCard";
import { AppContext } from "../../Context/AppContext";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
GET_DASHBOARD_DRIVERS_DETAILS,
GET_ONLINE_DRIVER_LOCATIONS,
GET_SEARCH_LOCATIONS,
} from "../../ApiServices/ApiConstants";
import MapTemp from "../CurrentRides/map";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import { useNavigate, useNavigation } from "react-router-dom";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import _ from "lodash";
import MobilityBadge from "../../CommonComponents/MobilityBadge";
[Link](() => {
setTimeout(() => {
setIsMapVisible(true);
}, 1000);
}, []);
function createDescription() {
return (
<Grid marginRight={2}>
{locations?.state?.driverBroadcastedCoordinates && (
<MobilityBadge
title="Ride broadcast count"
badgeContent={_.size(
locations?.state?.driverBroadcastedCoordinates
)}
color="secondary"
icon={
<IconButton
sx={{ padding: 0 }}
onClick={() => {
let filter =
[Link];
[Link]({
...filter,
driverBroadcastedCoordinatesVisible: true,
driverBroadcastReceivedCoordinatesVisible: false,
driverAssignedCoordinatesVisible: false,
driverAcceptedCoordinatesVisible: false,
});
}}
>
<img
src={require("../../../assets/[Link]")} height="30px" />
</IconButton>
}
></MobilityBadge>
)}
{locations?.state?.driverBroadcastReceivedCoordinates &&
(
<MobilityBadge
title="Ride broadcast received count"
badgeContent={_.size(
locations?.state?.driverBroadcastReceivedCoordinates
)}
color="warning"
icon={
<IconButton
sx={{ padding: 0 }}
onClick={() => {
let filter =
[Link];
[Link]({
...filter,
driverBroadcastedCoordinatesVisible: false,
driverBroadcastReceivedCoordinatesVisible: true,
driverAssignedCoordinatesVisible: false,
driverAcceptedCoordinatesVisible: false,
});
}}
>
<img
src={require("../../../assets/auto_black.png")}
height="30px"
/>
</IconButton>
}
></MobilityBadge>
)}
{locations?.state?.driverAcceptedByCoordinates && (
<MobilityBadge
title="Ride accepted count"
badgeContent={_.size(locations?.state?.driverAcceptedByCoordinates)}
color="info"
icon={
<IconButton
sx={{ padding: 0 }}
onClick={() => {
let filter =
[Link];
[Link]({
...filter,
driverBroadcastedCoordinatesVisible: false,
driverBroadcastReceivedCoordinatesVisible: false,
driverAssignedCoordinatesVisible: false,
driverAcceptedCoordinatesVisible: true,
});
}}
>
<img
src={require("../../../assets/auto_blue.png")}
height="30px"
/>
</IconButton>
}
></MobilityBadge>
)}
{locations?.state?.driverAssignedCoordinates && (
<MobilityBadge
title="Ride assigned count"
badgeContent={_.size(locations?.state?.driverAssignedCoordinates)}
color="error"
icon={
<IconButton
sx={{ padding: 0 }}
onClick={() => {
let filter =
[Link];
[Link]("147 filter",
filter);
[Link]({
...filter,
driverBroadcastedCoordinatesVisible: false,
driverBroadcastReceivedCoordinatesVisible: false,
driverAssignedCoordinatesVisible: true,
driverAcceptedCoordinatesVisible: false,
});
}}
>
<img
src={require("../../../assets/auto_red.png")}
height="30px"
/>
</IconButton>
}
></MobilityBadge>
)}
</Grid>
);
}
return (
<div>
<Grid style={{ padding: 5 }}>
<Grid item marginBottom={1}>
<MobilityAppBar
title="Broadcast Details"
menus={createDescription()}
onBackClick={() => {
navigate(-1);
//navigate("/driver", { state:
driverTab });
}}
/>
</Grid>
<Grid container item xs={12} md={12} marginTop={1}>
<Card style={{ display: "flex", flex: 1 }}>
<CardContent
style={{
display: "flex",
flex: 1,
padding: 8,
height: "75vh",
}}
>
{isMapVisible && (
<MapTemp
driverBroadcastedCoordinates={
locations?.state?.driverBroadcastedCoordinates
}
driverBroadcastReceivedCoordinates={
locations?.state?.driverBroadcastReceivedCoordinates
}
driverAssignedCoordinates={
locations?.state?.driverAssignedCoordinates
}
driverAcceptedByCoordinates={
locations?.state?.driverAcceptedByCoordinates
}
broadcastCustomerDetails={
locations?.state?.broadcastCustomerDetails
}
broadcastCustomerLocation={
locations?.state?.broadcastCustomerLocation
}
/>
)}
</CardContent>
</Card>
</Grid>
{/* </Paper> */}
</Grid>
</div>
);
};
55] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
DriversBroadCast\[Link]
import { Card, Grid, Paper } from "@mui/material";
import * as React from "react";
import _, { isEmpty } from "lodash";
import { useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { GET_BROADCAST_DETAILS_BY_TRANSACTION_ID } from
"../../ApiServices/ApiConstants";
import dayjs, { Dayjs } from "dayjs";
import MobilityDateTimePicker from
"../../CommonComponents/MobilityDateTimePicker";
import moment from "moment";
import { start } from "repl";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
// [Link](() => {
// if (startDate?.isSame(endDate)) {
// setStartDate(startDate?.subtract(15, "minutes"));
// }
// }, [startDate]);
subItem?.currentLocation?.time,
false,
false,
true
),
currentLocations:
subItem?.currentLocation?.coordinates
?
subItem?.currentLocation?.[Link]()
: "",
});
return (
<div>
<MobilityChip
label={`$
{subItem?.firstName} ${subItem?.lastName}, ${
subItem?.phone
}, $
{formatDateTime(
subItem?.currentLocation?.time,
false,
false,
true
)}`}
size={"small"}
type={"broadcast"}
/>
</div>
);
})
);
break;
case "assigned":
[Link](
[Link]((subItem: any)
=> {
[Link]({
driverId: [Link],
firstName:
[Link],
lastName: [Link],
time: formatDateTime(
subItem?.currentLocation?.time,
false,
false,
true
),
currentLocations:
subItem?.currentLocation?.coordinates
?
subItem?.currentLocation?.[Link]()
: "",
});
return (
<div>
<MobilityChip
label={`$
{subItem?.firstName} ${subItem?.lastName}, ${
subItem?.phone
}, $
{formatDateTime(
subItem?.currentLocation?.time,
false,
false,
true
)}`}
size={"small"}
type={"assigned"}
/>
</div>
);
})
);
break;
case "acceptedBy":
[Link](
[Link]((subItem: any)
=> {
[Link]({
driverId: [Link],
firstName:
[Link],
lastName: [Link],
time: formatDateTime(
subItem?.currentLocation?.time,
false,
false,
true
),
currentLocations:
subItem?.currentLocation?.coordinates
?
subItem?.currentLocation?.[Link]()
: "",
});
return (
<div>
<MobilityChip
label={`$
{subItem?.firstName} ${subItem?.lastName}, ${
subItem?.phone
}, $
{formatDateTime(
subItem?.currentLocation?.time,
false,
false,
true
)}`}
size={"small"}
type={"acceptedBy"}
/>
</div>
);
})
);
break;
case "broadcastReceivedBy":
[Link](
[Link]((subItem: any)
=> {
[Link]({
driverId: [Link],
firstName:
[Link],
lastName: [Link],
time: formatDateTime(
subItem?.currentLocation?.time,
false,
false,
true
),
currentLocations:
subItem?.currentLocation?.coordinates
?
subItem?.currentLocation?.[Link]()
: "",
});
return (
<div>
<MobilityChip
label={`$
{subItem?.firstName} ${subItem?.lastName}, ${
subItem?.phone
}, $
{formatDateTime(
subItem?.currentLocation?.time,
false,
false,
true
)}`}
size={"small"}
type={"broadcastReceivedBy"}
/>
</div>
);
})
);
break;
default:
break;
}
});
let actionNew = [
<MobilityButtonIconView
key={index}
onClick={function (
event: [Link]<HTMLButtonElement,
MouseEvent>
): void {
navigate("/broadcast-to-drivers-details", {
state: {
driverBroadcastedCoordinates:
broadcastedLocations,
driverBroadcastReceivedCoordinates:
broadcastReceivedByLocations,
driverAssignedCoordinates:
assignedLocations,
driverAcceptedByCoordinates:
acceptedByLocations,
broadcastCustomerDetails:
toMapRecord?.customerDetails,
broadcastCustomerLocation:
toMapRecord?.customerLocation,
},
});
}}
></MobilityButtonIconView>,
];
//[Link]("227", broadcasted);
//[Link]("131", acceptedByLocations);
return {
transactionId: (
<div>
<MobilityChip
label={`${customerDetails?.name}, $
{customerDetails?.phone}`}
size={"small"}
type={"transaction"}
/>
<MobilityChip
label={toMapRecord?.transactionId}
size={"small"}
type={"transaction"}
/>
</div>
),
// toMapRecord?.transactionId +
// customerDetails?.name +
// "\n" +
// customerDetails?.phone,
customerLocations: customerLocation,
// currentDriverLocations,
broadcasted,
broadcastReceivedBy,
acceptedBy,
assigned,
broadcastedLocations,
assignedLocations,
acceptedByLocations,
broadcastReceivedByLocations,
actionNew,
};
});
};
if (startDate?.isSame(endDate)) {
}
const payload = {
rowsPerPage: rowsPerPage,
pageNo: page,
searchBy: "date",
startDate: startDate &&
moment(startDate?.toString()).toString(),
endDate: endDate &&
moment(endDate?.toString()).toString(),
// startDate: startDate
// ? moment(startDate).toString()
// : new Date().toString(),
// endDate: endDate ? moment(endDate).toString() : new
Date().toString(),
};
// [Link]("205", payload);
const response: Iresponse = await [Link](
GET_BROADCAST_DETAILS_BY_TRANSACTION_ID,
payload
);
//setCount(data?.length);
setAllList(mappedData);
setFilteredBroadcastedDrivers(mappedData);
} else {
setAllList([]);
setFilteredBroadcastedDrivers([]);
}
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
const EnhancedTableConfig = {
headers: [
{
id: "transactionId",
numeric: false,
disablePadding: true,
label: "Transaction ID",
disableSort: true,
enabelLongText: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "View on Map",
disableSort: true,
enabelLongText: true,
},
{
id: "broadcasted",
numeric: false,
disablePadding: true,
label: "Broadcasted",
disableSort: true,
enabelLongText: true,
},
{
id: "broadcastReceivedBy",
numeric: false,
disablePadding: true,
label: "Broadcast Received By",
disableSort: true,
enabelLongText: true,
},
{
id: "acceptedBy",
numeric: false,
disablePadding: true,
label: "Accepted By",
disableSort: true,
enabelLongText: true,
},
{
id: "assigned",
numeric: false,
disablePadding: true,
label: "Assigned",
disableSort: true,
enabelLongText: true,
},
// {
// id: "viewDetails",
// numeric: false,
// disablePadding: true,
// label: "View Details",
// disableSort: true,
// },
],
};
[Link](() => {
if (page || rowsPerPage) {
getBroadcastedDrivers();
}
}, [page, rowsPerPage]);
if ([Link]) {
setRowsPerPage([Link]);
}
if (pagination?.page?.toString().length > 0) {
setPage([Link]);
}
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid
container
sx={{
padding: 1,
backgroundColor: "white",
}}
>
<Grid container spacing={2} alignItems="center">
<Grid item>
<MobilityDateTimePicker
label="Start Date Time"
value={startDate}
defaultDate={startDate}
onChange={(value: Dayjs | null,
context: any) => {
//[Link]("347",
value?.toString());
setStartDate(value);
}}
/>
</Grid>
{/* <Grid item>
<MobilityDatePicker
label="Start Date"
//value={startDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setStartDate(value?.toString());
}}
/>
</Grid> */}
<Grid item>
<MobilityDateTimePicker
label="End Date Time"
value={endDate}
defaultDate={endDate}
onChange={(value: Dayjs | null,
context: any) => {
//[Link]("401",
value?.toString());
setEndDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityButton
label="Search"
onClick={(
event:
[Link]<HTMLButtonElement, MouseEvent>
) => {
if
(startDate?.isAfter(endDate)) {
ShowSnackbarFailure(
"Start DateTime
should be before End DateTime",
myContext
);
} else {
getBroadcastedDrivers();
}
}}
/>
</Grid>
</Grid>
</Grid>
{[Link] > 0 ? (
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredBroadcastedDrivers}
count={count}
refreshPage={refreshPage}
/>
) : (
<MobilityEmptyMsg message={"No Broadcast Details
Found"} />
)}
</Paper>
</Grid>
);
};
56] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
DriversBroadCast\[Link]
import * as React from "react";
import {
Button,
Dialog,
DialogContent,
DialogTitle,
FormControl,
Grid,
IconButton,
InputLabel,
MenuItem,
Select,
TextareaAutosize,
} from "@mui/material";
import { useNavigate } from "react-router-dom";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { AppBlockingSharp, Close } from "@mui/icons-material";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { ISSUE_RESOLUTION } from "../../ApiServices/ApiConstants";
interface issueFormProps {
issueData: any;
open: boolean;
setOpen: any;
}
// interface ValidationErrors {
// complainantAction: string;
// shortDesc: string;
// }
//
interface issueDetails {
//complainantAction: string;
respondentAction: string;
shortDesc: string;
}
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
const submitButtonStyle = {
marginTop: "25px",
display: "flex",
justifyContent: "center",
};
const textAreaStyle = {
width: "100%",
};
const GrievanceForm: [Link]<issueFormProps> = ({
issueData,
open,
setOpen,
}) => {
const navigate = useNavigate();
// const dropdownOptions = ["OPEN", "ESCALATE", "CLOSE"];
const dropdownOptions = ["PROCESSING", "RESOLVED"];
const [selectedRespondent, setSelectedRespondent] =
[Link]<any>("");
const actionTypes = ["ResolveIssue", "IGM"];
const [issueDetails, setIssueDetails] = [Link]<issueDetails>({
//complainantAction: "",
respondentAction: "",
shortDesc: "",
});
// const [selectedRespondent, setSelectedRespondent] =
[Link]<any>("");
const [isLoading, setIsLoading] = [Link]<boolean>(false);
const [actionType, setActionType] = [Link]<any>(null);
const [complainantAction, setComplainantAction] =
[Link]<any>(null);
// const [validationErrors, setValidationErrors] =
// [Link]<ValidationErrors>({
// complainantAction: "",
// shortDesc: "",
// });
let myContext = [Link](AppContext);
const requestBody = {
...issueData,
issueResolutionKey: "pushToGrievance",
resolutionType: "pushToGrievance",
groRemarks: [Link],
respondentAction: selectedRespondent,
};
// if (isEmpty(res)) {
// // apiCall();
// }
if ([Link] === 200) {
//navigate(-1);
ShowSnackbarSuccess("Issue pushed to GR",
myContext);
setIssueDetails({
//complainantAction: "",
respondentAction: "",
shortDesc: "",
});
setOpen(false);
} else {
ShowSnackbarFailure(res, myContext);
}
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
const handleClose = () => {
setOpen(false);
};
return (
<Dialog
open={open}
onClose={function handleClose() {
setOpen(false);
}}
PaperProps={{
style: {
minWidth: "25vw",
// width: "40%",
// height: "65vh",
// maxWidth: "none",
},
}}
>
<DialogTitle
sx={{ backgroundColor: "#eaeaea" }}
// style={{
// backgroundColor: "#e2e2e2",
// textAlign: "center",
// marginBottom: "10px",
// }}
>
Take Action
</DialogTitle>
<IconButton
aria-label="close"
onClick={handleClose}
sx={{
position: "absolute",
right: 8,
top: 16,
}}
>
<Close />
</IconButton>
<DialogContent>
{/* <form onSubmit={handleSubmit}> */}
<Grid container spacing={4}>
{/* <Grid item xs={12}>
<FormControl fullWidth
variant="outlined">
<InputLabel id="select-
label">Action type</InputLabel>
<Select
labelId="select-
label"
id="select2"
variant="outlined"
fullWidth
value={actionType}
onChange={(e) =>
setActionType([Link])}
label="Action type"
>
{[Link]((option) => (
<MenuItem
key={option} value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid> */}
value={[Link]}
onChange={(e) => {
setComplainantAction([Link]);
setIssueDetails({
...issueD
etails,
complainantAction: [Link],
});
}}
label="Complainant
Action"
>
{[Link]((option) => (
<MenuItem
key={option} value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid> */}
setSelectedRespondent([Link]);
setIssueDetails({
...issueDetails,
respondentAction:
[Link],
});
}}
label="Complainant Action"
>
{[Link]((option) =>
(
<MenuItem key={option}
value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
</Grid>
57] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
DriverSearchMapView\[Link]
import { FC, ReactElement } from "react";
import * as React from "react";
import CardContent from "@mui/material/CardContent";
import {
Avatar,
Badge,
Card,
Grid,
Paper,
Tab,
Tabs,
Typography,
colors,
} from "@mui/material";
import CardActions from "@mui/material/CardActions";
import { Cell, Pie, PieChart, ResponsiveContainer } from "recharts";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { MobilityCard } from "../../CommonComponents/MobilityCard";
import { AppContext } from "../../Context/AppContext";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
GET_DASHBOARD_DRIVERS_DETAILS,
GET_ONLINE_DRIVER_LOCATIONS,
GET_SEARCH_LOCATIONS,
} from "../../ApiServices/ApiConstants";
import MapTemp from "../CurrentRides/map";
import _ from "lodash";
import auto from "../../../assets/[Link]";
import { Mail } from "@mui/icons-material";
import VehicleDetails from "../Vehicle/vehicleDetails";
import MobilityBadge from "../../CommonComponents/MobilityBadge";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import { formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
const data = [
{ name: "Group A", value: 400 },
{ name: "Group B", value: 300 },
{ name: "Group C", value: 300 },
{ name: "Group D", value: 200 },
];
// return (
// <text
// x={x}
// y={y}
// fill="white"
// textAnchor={x > props?.cx ? "start" : "end"}
// dominantBaseline="central"
// >
// {`${(props?.percent * 100).toFixed(0)}%`}
// </text>
// );
// };
[Link](() => {
fetchData();
}, []);
function fetchData() {
fetchDriverData();
fetchSearchData();
setTimeout(() => {
setIsMapVisible(true);
}, 1000);
}
//[Link]("144", _.size(data));
setLocationDetails(_.size(data));
return (
<div>
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined"
sx={{ padding: 1 }}>
<Grid
item
sx={{
display: "flex",
justifyContent: "space-between",
}}
>
<Grid container>
<Typography
fontSize={20}
color={"black"}
fontWeight={600}
sx={{ marginLeft: 1, marginTop: 1
}}
>
Online Drivers, Searches
Dashboard
</Typography>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
}}
>
<Grid marginRight={1} marginTop={1}>
<MobilityBadge
title="Online Drivers"
badgeContent={driverDetails}
color="warning"
icon={
<img
src={require("../../../assets/[Link]")}
height="30px"
/>
}
></MobilityBadge>
<MobilityBadge
title="Searches in Last 1
hour"
badgeContent={locationDetails}
color="success"
icon={
<img
src={require("../../../assets/location_man_red.png")}
height="30px"
/>
}
></MobilityBadge>
<MobilityTextField
label="Search Driver by
Phone..."
type="text"
name="search"
value={searchByPhone}
maxLength={10}
fullWidth={false}
onChange={(event:
[Link]<HTMLInputElement>) => {
setSearchhByPhone(event?.target?.value);
}}
/>
</Grid>
<Grid marginRight={1} marginTop={1}>
<MobilityButton
fullWidth={false}
label={"Refresh Data"}
onClick={(event:
[Link]<HTMLButtonElement>) => {
setIsMapVisible(false);
fetchData();
}}
/>
</Grid>
</Grid>
</Grid>
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
></MobilityCard>
<MobilityCard
title={"Driver's Count"}
description={[Link] ?
[Link] : 0}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
></MobilityCard>
</Grid> */}
search={searchByPhone}
driverCoordinates={uniqueDriverDetails}
searchCoordinates={uniqueLocationDetails}
/>
)}
</CardContent>
</Card>
</Grid>
<Typography
fontSize={20}
color={"black"}
fontWeight={600}
sx={{ paddingInline: 1, marginTop: 5 }}
>
Today's Ride Search Data
</Typography>
<Grid container></Grid> */}
</Paper>
</Grid>
</div>
);
};
const renderCustomizedLabel = ({
cx,
cy,
midAngle,
innerRadius,
outerRadius,
percent,
index,
}: any) => {
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
const x = cx + radius * [Link](-midAngle * RADIAN);
const y = cy + radius * [Link](-midAngle * RADIAN);
return (
<text
x={x}
y={y}
fill="white"
textAnchor={x > cx ? "start" : "end"}
dominantBaseline="central"
>
{`${(percent * 100).toFixed(0)}%`}
</text>
);
};
export function Appd() {
return (
<PieChart width={800} height={800}>
<Pie
data={data}
cx={200}
cy={200}
labelLine={false}
label={renderCustomizedLabel}
outerRadius={180}
fill="#8884d8"
dataKey="value"
onClick={() => {}}
enableBackground={1}
>
{[Link]((entry, index) => (
<Cell
key={`cell-${index}`}
fill={COLORS[index % [Link]]}
onClick={() => {}}
/>
))}
</Pie>
</PieChart>
);
}
58] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Grievances\[Link]
import React, { FC, ReactElement, useState } from "react";
import {
Card,
Grid,
Typography,
CardContent,
Box,
Divider,
} from "@mui/material";
import PersonIcon from "@mui/icons-material/Person";
import AccessTimeIcon from "@mui/icons-material/AccessTime";
import TimerIcon from "@mui/icons-material/Timer";
import { useSearchParams, useNavigate } from "react-router-dom";
import { isEmpty } from "lodash";
import Carousel from "react-material-ui-carousel";
import IconButton, { IconButtonProps } from "@mui/material/IconButton";
import { styled } from "@mui/material/styles";
import moment from "moment";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import MobilityButton from "../../CommonComponents/MobilityButton";
import ActionCard from "../Issue/ActionCard";
import GrievanceForm from "./issue-form";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { GET_ISSUE_DETAILS } from "../../ApiServices/ApiConstants";
import env from "../../../config/env";
const BASE_URL: string = env.API_BASE_URL;
interface ExpandMoreProps extends IconButtonProps {
expand: boolean;
}
const id = [Link]("id");
const navigate = useNavigate();
let myContext = [Link](AppContext);
if (!isEmpty(response)) {
const { data } = [Link];
if (!data) {
alert("empty response......");
// navigate("/issue")
}
const _issueDetails: any = {
...data,
issueDetails: [Link][0],
};
if (_issueDetails?.issueDetails?.createdDate) {
const dateTime1 =
moment(_issueDetails?.issueDetails?.createdDate);
const dateTime2 = moment();
const duration =
[Link]([Link](dateTime1));
const days = [Link]();
const hours = [Link]();
const minute = [Link]();
const second = [Link]();
_issueDetails.[Link] =
(days > 1 && `${days} days ago`) ||
(hours > 1 && `${hours} hours ago`) ||
(minute > 1 && `${minute} minute ago`) ||
`${second} second ago`;
}
_issueDetails.[Link] =
_issueDetails?.issueDetails?.description?.images?.map(
(img: any) => `${BASE_URL}/${img?.filePath}`
);
// [
// '[Link]
// '[Link]
[Link]',
//
'[Link]
// ];
setIssueDetails(_issueDetails);
} else {
ShowSnackbarFailure(response, myContext);
[Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
apiCall();
}, []);
[Link](() => {
const data = {
respondentActions:
issueDetails?.issueDetails?.issueActions?.respondentActions?.map(
(item: any) => {
return {
id: item?._id,
action: item?.respondentActions,
shortDesc: item?.shortDesc,
organization:
item?.updatedBy?.[Link],
name: item?.updatedBy?.person?.name,
};
}
),
complainantActions:
issueDetails?.issueDetails?.issueActions?.complainantActions?.map(
(item: any) => {
return {
id: item?._id,
action: item?.complainantActions,
shortDesc: item?.shortDesc,
organization:
item?.updatedBy?.[Link],
name: item?.updatedBy?.person?.name,
phone:
item?.updatedBy?.contact?.phone,
email:
item?.updatedBy?.contact?.email,
};
}
) || [],
};
setResolutionData(data);
}, [issueDetails]);
return (
<Grid container spacing={1} padding={1}>
<Grid item lg={12} md={12} sm={12} xs={12}>
<Card sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item sx={{ p: 1 }}>
<IconButton onClick={() => navigate(-
1)}>
<ArrowBackIcon />
</IconButton>
</Grid>
<Grid
item
sm={7}
sx={{ p: 1, alignItems: "center",
display: "flex" }}
>
Issue details
</Grid>
</Grid>
<Grid
container
sx={{
alignItems: "center",
justifyContent: "end",
marginRight: 1,
}}
>
{/* <Button
onClick={() => setOpen(true)}
sx={{ p: 1, alignItems: "center",
display: "flex", pr: 2 }}
>
Take action
</Button> */}
<MobilityButton
label="Take Action"
onClick={(event:
[Link]<HTMLButtonElement>) => {
setOpen(true);
}}
/>
</Grid>
</Card>
</Grid>
<Grid item lg={6} md={12} sm={12} xs={12}>
<Card style={[Link]}>
<Grid
item
sx={{
display: "flex",
justifyContent: "space-between",
padding: 1,
paddingLeft: 2,
}}
>
<Typography variant="body1" gutterBottom>
Issue Id
#{issueDetails?.issueDetails?._id}
</Typography>
<Typography variant="body1" gutterBottom>
{issueDetails?.issueDetails?.description?.name}
</Typography>
</Grid>
<CardContent>
<Grid
item
sx={{
display: "flex",
paddingTop: 1,
paddingBottom: 1,
}}
lg={12}
xs={12}
md={12}
>
<Typography variant="h6" gutterBottom>
{issueDetails?.issueDetails?.description?.shortDesc}
</Typography>
</Grid>
<Grid container sx={{ display: "flex" }}>
<Grid item sx={{ display: "flex",
columnGap: "5px", pr: 1 }}>
<PersonIcon
fontSize="small"></PersonIcon>
<Typography
variant="caption"
gutterBottom
sx={{ alignItems:
"center" }}
>
{issueDetails?.issueDetails?.complainantInfo?.person?.name}
</Typography>
</Grid>
<Grid item sx={{ display: "flex", pr:
1, columnGap: "5px" }}>
<AccessTimeIcon
fontSize="small"></AccessTimeIcon>
<Typography
variant="caption"
gutterBottom
sx={{ alignItems:
"center" }}
>
{issueDetails?.issueDetails?.createdAt}
</Typography>
</Grid>
<Grid item sx={{ display: "flex", pr:
1, columnGap: "5px" }}>
<TimerIcon
fontSize="small"></TimerIcon>
<Typography
variant="caption"
gutterBottom
sx={{ alignItems:
"center" }}
>
{issueDetails?.issueDetails?.createdTime}
</Typography>
</Grid>
</Grid>
<Grid
item
sx={{
display: "flex",
paddingTop: 1,
paddingBottom: 1,
}}
>
<Typography variant="subtitle2"
gutterBottom>
{issueDetails?.issueDetails?.description?.longDesc}
</Typography>
</Grid>
<Divider />
{issueDetails?.issueDetails?.orderDetails?.id}
</Typography>
</Grid>
<Grid
item
sx={{
display: "flex",
py: 1,
alignItems: "baseline",
columnGap: "5px",
}}
>
<Typography
fontSize={12}
fontWeight={600}
gutterBottom
style={{ display: "flex" }}
>
Order Item Id:
</Typography>
<Typography fontSize={12}>
{issueDetails?.issueDetails?.orderDetails?.items?.[0]?.itemId}
</Typography>
</Grid>
<Grid
item
sx={{
display: "flex",
py: 1,
alignItems: "baseline",
columnGap: "5px",
}}
>
<Typography
fontSize={12}
fontWeight={600}
gutterBottom
style={{ display: "flex" }}
>
Market Place:
</Typography>
<Typography fontSize={12}>
{issueDetails?.issueDetails?.source?.networkParticipantId}
</Typography>
</Grid>
const props = {
...
(history?.issueHistory?.status && {
actionName: history?.issueHistory?.actionType,
}),
...
(history?.issueHistory?.longDesc && {
longDescription: history?.issueHistory?.longDesc,
}),
...
(history?.issueHistory?.shortDesc && {
shortDescription: history?.issueHistory?.shortDesc,
}),
...
(history?.issueHistory?.createdBy?.performedBy && {
performBy:
history?.issueHistory?.createdBy?.performedBy,
}),
...(!
isEmpty(history?.issueHistory?.createdBy) && {
complainantDetails: {
...
(history?.issueHistory?.createdBy?.name && {
name: history?.issueHistory?.[Link],
}),
...
(history?.issueHistory?.[Link] && {
email: history?.issueHistory?.[Link],
}),
...
(history?.issueHistory?.[Link] && {
id: history?.issueHistory?.[Link],
}),
...
(history?.issueHistory?.[Link] && {
phone: history?.issueHistory?.[Link],
}),
},
}),
status:
history?.status,
date:
[Link],
};
return (
<Grid item
sx={{ p: 1 }} lg={12} xs={12} md={12}>
<CardContent>
<RespondentActions
respondentData={[Link]}
headers={[Link]}
/>
</CardContent>
</Grid>
)} */}
{/* <Grid item
sx={{ display:'flex',py:1 }}>
<Typography variant="subtitle2" fontWeight={600} gutterBottom
style={{ display:'flex' }}>
Agent Name:
</Typography>
<span style={{ paddingLeft: 4,fontSize: 12}}>
{issueDetails?.issueDetails?.source?.networkParticipantId}
</span>
</Grid> */}
</Grid>
</CardContent>
</Card>
</Grid>
<Grid item lg={6} md={12} sm={12} xs={12}>
<Grid container rowGap={2}>
<Grid item lg={12} md={12} sm={12} xs={12}>
<Card style={[Link]}>
<Typography
sx={{
display: "flex",
padding: 1,
paddingLeft: 3,
background: "#e2e2e2",
}}
>
Order Summary
</Typography>
<CardContent>
<Grid container sx={{ py: 1 }}
columnGap={2}>
<Grid
item
sx={{
display:
"flex",
py: 1,
columnGap:
"5px",
alignItems:
"baseline",
}}
>
<Typography
fontSize={12}
fontWeight={600}
gutterBottom
{issueDetails?.issueDetails?.orderDetails?.providerId}
</span>
</Grid>
fontWeight={600}
gutterBottom
issueDetails?.issueDetails?.orderDetails?.items?.[0]
?.i
temId
}
</span>
</Grid>
<Grid
item
sx={{
display:
"flex",
py: 1,
columnGap:
"5px",
alignItems:
"baseline",
}}
>
<Typography
fontSize={12}
fontWeight={600}
gutterBottom
issueDetails?.issueDetails?.orderDetails?.items?.[0]
?.d
escriptor?.name
}
</span>
</Grid>
{/* </Grid>
</Grid> */}
</Grid>
</CardContent>
</Card>
</Grid>
<Grid item lg={12} md={12} sm={12} xs={12}>
<Card style={[Link]}>
<Typography
sx={{
display: "flex",
padding: 1,
paddingLeft: 3,
background: "#e2e2e2",
}}
>
Uploads
</Typography>
<CardContent>
<Carousel fullHeightHover={true}>
{issueDetails?.issueDetails?.description?.images?.map(
(image: string,
index: number) => (
<div
key={index}>
<img
width="450px"
crossOrigin='anonymous'
height="300px"
src={image}
alt={`Images ${index}`}
/>
</div>
)
)}
</Carousel>
</CardContent>
</Card>
</Grid>
</Grid>
</Grid>
<Grid item lg={12} md={12} xs={12} sm={12}>
{
<GrievanceForm
issueData={{
id,
}}
open={open}
setOpen={setOpen}
/>
}
</Grid>
</Grid>
);
};
59] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Grievances\[Link]
import * as React from "react";
import _, { isEmpty } from "lodash";
import { useNavigate } from "react-router-dom";
import { Card, Grid, Paper, Tab, Tabs } from "@mui/material";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import { formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { GET_GRIEVANCE_LIST } from "../../ApiServices/ApiConstants";
switch ([Link]) {
case "CONSUMER":
[Link](issueItem);
break;
case "SELLER":
[Link](issueItem);
break;
case "INTERFACING_NP":
[Link](issueItem);
break;
}
});
setPassengerIssueList(passIssueList);
setfilteredPassengerIssueList(passIssueList);
setPassengerSupportIssueList(passSupportIssueList);
setfilteredPassengerSupportIssueList(passSupportIssueList);
} else {
ShowSnackbarFailure(response, myContext);
[Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
getGrievanceList(1, 0);
}, []);
const basicTableConfig = {
headers: [
{ text: "Created date", value: "createdDate" },
{ text: "Issue Type", value: "issueType" },
{ text: "Short Description", value: "shortDesc" },
{ text: "Long Description", value: "longDesc" },
{ text: "Status", value: "status" },
],
const EnhancedTableConfig = {
headers: [
{
id: "createdDate",
numeric: false,
disablePadding: true,
label: "Created DateTime",
disableSort: false,
},
// {
// id: "issueType",
// numeric: false,
// disablePadding: false,
// label: "Issue Type",
// disableSort: false,
// },
{
id: "shortDesc",
numeric: false,
disablePadding: true,
label: "Short Description",
disableSort: true,
},
{
id: "longDesc",
numeric: false,
disablePadding: true,
label: "Long Description",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Ride Status",
disableSort: true,
},
{
id: "history",
numeric: false,
disablePadding: true,
label: "View Details",
disableSort: true,
},
],
// navigate: (item: any) => {
// navigate(`${[Link]}?id=${[Link]}`);
// },
};
const styles = {
extendedTab: {
//minWidth: "500px",
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
setSearchText(inputValue);
switch (tabValue) {
case "passengerIssue":
const filteredRows = [Link]((row) =>
{
return (
[Link]().includes(inputValue) ||
[Link]().includes(inputValue)
);
});
setfilteredPassengerIssueList(filteredRows);
break;
case "passengerSupportIssue":
const filteredRows2 =
[Link]((row) => {
return (
[Link]().includes(inputValue) ||
[Link]().includes(inputValue)
);
});
setfilteredPassengerSupportIssueList(filteredRows2);
break;
case "driverIssue":
const filteredRows3 = [Link]((row) => {
return
[Link]().includes(inputValue);
});
setfilterdDriverIssueList(filteredRows3);
break;
case "driverSupportIssue":
const filteredRows4 =
[Link]((row) => {
return
[Link]().includes(inputValue);
});
setfilteredDriverSupportIssueList(filteredRows4);
break;
}
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
{/* <Grid
container
sx={{
justifyContent: "end",
padding: 1,
backgroundColor: "white",
}}
>
<MobilityTextField
label="Search Issue..."
type="text"
name="search"
value={searchText}
maxLength={10}
onChange={(event: [Link]<HTMLInputElement>) => {
handleInputChange(event);
}}
/>
</Grid> */}
<Grid sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item>
<Tabs
value={tabValue}
onChange={(e, newValue) => {
setTabValue(newValue);
}}
>
<Tab
label="Passenger"
value="passengerIssue"
sx={[Link]}
/>
<Tab
label="Passenger Support"
value="passengerSupportIssue"
sx={[Link]}
/>
<Tab
label="Driver"
value="driverIssue"
sx={[Link]}
/>
<Tab
label="Driver Support"
value="driverSupportIssue"
sx={[Link]}
/>
</Tabs>
</Grid>
</Grid>
</Grid>
<Grid padding={2}>
{tabValue === "passengerIssue" &&
([Link] > 0 ? (
<EnhancedTable
headers={[Link]}
//
tableData={passengerIssueList}
tableData={filteredPassengerIssueList}
/>
) : (
<MobilityEmptyMsg message={"No
Passenger Issue Found"} />
))}
headers={[Link]}
// tableData={driverIssueList}
tableData={filteredDriverIssueList}
/>
) : (
<MobilityEmptyMsg message={"No Driver
Issue Found"} />
))}
headers={[Link]}
//
tableData={passengerSupportIssueList}
tableData={filteredpassengerSupportIssueList}
/>
) : (
<MobilityEmptyMsg message={"No
Passenger Support Issue Found"} />
))}
headers={[Link]}
//
tableData={driverSupportIssueList}
tableData={filteredDriverSupportIssueList}
/>
) : (
<MobilityEmptyMsg message={"No Driver
Support Issue Found"} />
))}
</Grid>
</Paper>
{/* <EnhancedTable
headers={[Link]}
tableData={issueList}
></EnhancedTable> */}
60] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Grievances\[Link]
import * as React from "react";
import {
Button,
Dialog,
DialogContent,
DialogTitle,
FormControl,
Grid,
IconButton,
InputLabel,
MenuItem,
Select,
TextareaAutosize,
} from "@mui/material";
import { useNavigate } from "react-router-dom";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { AppBlockingSharp, Close } from "@mui/icons-material";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { ISSUE_RESOLUTION } from "../../ApiServices/ApiConstants";
interface issueFormProps {
issueData: any;
open: boolean;
setOpen: any;
}
// interface ValidationErrors {
// complainantAction: string;
// shortDesc: string;
// }
//
interface issueDetails {
//complainantAction: string;
respondentAction: string;
shortDesc: string;
}
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
const submitButtonStyle = {
marginTop: "25px",
display: "flex",
justifyContent: "center",
};
const textAreaStyle = {
width: "100%",
};
const GrievanceForm: [Link]<issueFormProps> = ({
issueData,
open,
setOpen,
}) => {
const navigate = useNavigate();
// const dropdownOptions = ["OPEN", "ESCALATE", "CLOSE"];
const dropdownOptions = ["PROCESSING", "RESOLVED"];
const [selectedRespondent, setSelectedRespondent] =
[Link]<any>("");
const actionTypes = ["ResolveIssue", "IGM"];
const [issueDetails, setIssueDetails] = [Link]<issueDetails>({
//complainantAction: "",
respondentAction: "",
shortDesc: "",
});
// const [selectedRespondent, setSelectedRespondent] =
[Link]<any>("");
const [isLoading, setIsLoading] = [Link]<boolean>(false);
const [actionType, setActionType] = [Link]<any>(null);
const [complainantAction, setComplainantAction] =
[Link]<any>(null);
// const [validationErrors, setValidationErrors] =
// [Link]<ValidationErrors>({
// complainantAction: "",
// shortDesc: "",
// });
let myContext = [Link](AppContext);
const requestBody = {
...issueData,
issueResolutionKey: "pushToGrievance",
resolutionType: "pushToGrievance",
groRemarks: [Link],
respondentAction: selectedRespondent,
};
// if (isEmpty(res)) {
// // apiCall();
// }
if ([Link] === 200) {
//navigate(-1);
ShowSnackbarSuccess("Issue pushed to GR",
myContext);
setIssueDetails({
//complainantAction: "",
respondentAction: "",
shortDesc: "",
});
setOpen(false);
} else {
ShowSnackbarFailure(res, myContext);
}
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
const handleClose = () => {
setOpen(false);
};
return (
<Dialog
open={open}
onClose={function handleClose() {
setOpen(false);
}}
PaperProps={{
style: {
minWidth: "25vw",
// width: "40%",
// height: "65vh",
// maxWidth: "none",
},
}}
>
<DialogTitle
sx={{ backgroundColor: "#eaeaea" }}
// style={{
// backgroundColor: "#e2e2e2",
// textAlign: "center",
// marginBottom: "10px",
// }}
>
Take Action
</DialogTitle>
<IconButton
aria-label="close"
onClick={handleClose}
sx={{
position: "absolute",
right: 8,
top: 16,
}}
>
<Close />
</IconButton>
<DialogContent>
{/* <form onSubmit={handleSubmit}> */}
<Grid container spacing={4}>
{/* <Grid item xs={12}>
<FormControl fullWidth
variant="outlined">
<InputLabel id="select-
label">Action type</InputLabel>
<Select
labelId="select-
label"
id="select2"
variant="outlined"
fullWidth
value={actionType}
onChange={(e) =>
setActionType([Link])}
label="Action type"
>
{[Link]((option) => (
<MenuItem
key={option} value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid> */}
value={[Link]}
onChange={(e) => {
setComplainantAction([Link]);
setIssueDetails({
...issueD
etails,
complainantAction: [Link],
});
}}
label="Complainant
Action"
>
{[Link]((option) => (
<MenuItem
key={option} value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid> */}
setSelectedRespondent([Link]);
setIssueDetails({
...issueDetails,
respondentAction:
[Link],
});
}}
label="Complainant Action"
>
{[Link]((option) =>
(
<MenuItem key={option}
value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
</Grid>
61] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Issue\[Link]
import { Card, Grid, Typography } from "@mui/material";
import PersonIcon from "@mui/icons-material/Person";
import EmailIcon from "@mui/icons-material/Email";
import PhoneIcon from "@mui/icons-material/Phone";
import { isEmpty } from "lodash";
interface ActionCardProps {
actionName: string;
longDescription?: string;
shortDescription?: string;
performBy?: string;
complainantDetails?: {
name?: string;
email?: string;
id?: string;
phone?: string;
};
status?: string;
date: string;
}
}, []);
return (
<Card elevation={6}>
<Grid container>
<Grid
item
sx={{ p: 1, display: "flex", justifyContent:
"space-between" }}
lg={12}
>
<Typography fontSize={17} fontWeight={380}
gutterBottom>
{actionName}
{/* {actionNameMapper[actionName]
? actionNameMapper[actionName]
: actionName}
{actionNameMapper[actionName]
? actionNameMapper[actionName]
: actionName} */}
</Typography>
</Grid>
//
const id = [Link]("id");
const navigate = useNavigate();
if (!isEmpty(response)) {
const { data } = [Link];
if (!data) {
alert("empty response......");
// navigate("/issue")
}
const _issueDetails: any = {
...data,
issueDetails: [Link][0],
};
if (_issueDetails?.issueDetails?.createdDate) {
const dateTime1 =
moment(_issueDetails?.issueDetails?.createdDate);
const dateTime2 = moment();
const duration =
[Link]([Link](dateTime1));
const days = [Link]();
const hours = [Link]();
const minute = [Link]();
const second = [Link]();
_issueDetails.[Link] =
(days > 1 && `${days} days ago`) ||
(hours > 1 && `${hours} hours ago`) ||
(minute > 1 && `${minute} minute ago`) ||
`${second} second ago`;
}
_issueDetails.[Link] =
_issueDetails?.issueDetails?.description?.images?.map(
(img: any) => `${BASE_URL}/${img?.filePath}`
);
// [
// '[Link]
// '[Link]
[Link]',
//
'[Link]
// ];
setIssueDetails(_issueDetails);
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
apiCall();
}, []);
[Link](() => {
const data = {
respondentActions:
issueDetails?.issueDetails?.issueActions?.respondentActions?.map(
(item: any) => {
return {
id: item?._id,
action: item?.respondentActions,
shortDesc: item?.shortDesc,
organization:
item?.updatedBy?.[Link],
name: item?.updatedBy?.person?.name,
};
}
),
complainantActions:
issueDetails?.issueDetails?.issueActions?.complainantActions?.map(
(item: any) => {
return {
id: item?._id,
action: item?.complainantActions,
shortDesc: item?.shortDesc,
organization:
item?.updatedBy?.[Link],
name: item?.updatedBy?.person?.name,
phone:
item?.updatedBy?.contact?.phone,
email:
item?.updatedBy?.contact?.email,
};
}
) || [],
};
setResolutionData(data);
}, [issueDetails]);
return (
<Grid container spacing={1} padding={1}>
<Grid item lg={12} md={12} sm={12} xs={12}>
<Card sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item sx={{ p: 1 }}>
<MobilityButtonIconBack onClick={() =>
navigate(-1)} />
</Grid>
<Grid
item
sm={7}
sx={{ p: 1, alignItems: "center",
display: "flex" }}
>
Issue details
</Grid>
</Grid>
<Grid
container
sx={{ alignItems: "center", justifyContent:
"end", marginRight: 1 }}
>
<MobilityButton
label="Take Action"
onClick={(event:
[Link]<HTMLButtonElement>) => {
setOpen(true);
}}
/>
</Grid>
</Card>
</Grid>
<Grid item lg={6} md={12} sm={12} xs={12}>
<Card style={[Link]}>
<Grid
item
sx={{
display: "flex",
justifyContent: "space-between",
padding: 1,
paddingLeft: 2,
}}
>
<Typography variant="body1" gutterBottom>
Issue Id
#{issueDetails?.issueDetails?._id}
</Typography>
<Typography variant="body1" gutterBottom>
{issueDetails?.issueDetails?.description?.name}
</Typography>
</Grid>
<CardContent>
<Grid
item
sx={{
display: "flex",
paddingTop: 1,
paddingBottom: 1,
}}
lg={12}
xs={12}
md={12}
>
<Typography variant="h6" gutterBottom>
{issueDetails?.issueDetails?.description?.shortDesc}
</Typography>
</Grid>
<Grid container sx={{ display: "flex" }}>
<Grid item sx={{ display: "flex",
columnGap: "5px", pr: 1 }}>
<PersonIcon
fontSize="small"></PersonIcon>
<Typography
variant="caption"
gutterBottom
sx={{ alignItems:
"center" }}
>
{issueDetails?.issueDetails?.complainantInfo?.person?.name}
</Typography>
</Grid>
<Grid item sx={{ display: "flex", pr:
1, columnGap: "5px" }}>
<AccessTimeIcon
fontSize="small"></AccessTimeIcon>
<Typography
variant="caption"
gutterBottom
sx={{ alignItems:
"center" }}
>
{issueDetails?.issueDetails?.createdDate}
</Typography>
</Grid>
<Grid item sx={{ display: "flex", pr:
1, columnGap: "5px" }}>
<TimerIcon
fontSize="small"></TimerIcon>
<Typography
variant="caption"
gutterBottom
sx={{ alignItems:
"center" }}
>
{issueDetails?.issueDetails?.createdTime}
</Typography>
</Grid>
</Grid>
<Grid
item
sx={{
display: "flex",
paddingTop: 1,
paddingBottom: 1,
}}
>
<Typography variant="subtitle2"
gutterBottom>
{issueDetails?.issueDetails?.description?.longDesc}
</Typography>
</Grid>
<Divider />
{issueDetails?.issueDetails?.orderDetails?.id}
</Typography>
</Grid>
<Grid
item
sx={{
display: "flex",
py: 1,
alignItems: "baseline",
columnGap: "5px",
}}
>
<Typography
fontSize={12}
fontWeight={600}
gutterBottom
style={{ display: "flex" }}
>
Order Item Id:
</Typography>
<Typography fontSize={12}>
{issueDetails?.issueDetails?.orderDetails?.items?.[0]?.itemId}
</Typography>
</Grid>
<Grid
item
sx={{
display: "flex",
py: 1,
alignItems: "baseline",
columnGap: "5px",
}}
>
<Typography
fontSize={12}
fontWeight={600}
gutterBottom
style={{ display: "flex" }}
>
Market Place:
</Typography>
<Typography fontSize={12}>
{issueDetails?.issueDetails?.source?.networkParticipantId}
</Typography>
</Grid>
actionName: history?.issueHistory?.status,
}),
...
(history?.issueHistory?.longDesc && {
longDescription: history?.issueHistory?.longDesc,
}),
...
(history?.issueHistory?.shortDesc && {
shortDescription: history?.issueHistory?.shortDesc,
}),
...
(history?.issueHistory?.createdBy?.performedBy && {
performBy:
history?.issueHistory?.createdBy?.performedBy,
}),
...(!
isEmpty(history?.issueHistory?.createdBy) && {
complainantDetails: {
...
(history?.issueHistory?.createdBy?.name && {
name: history?.issueHistory?.[Link],
}),
...
(history?.issueHistory?.[Link] && {
email: history?.issueHistory?.[Link],
}),
...
(history?.issueHistory?.[Link] && {
id: history?.issueHistory?.[Link],
}),
...
(history?.issueHistory?.[Link] && {
phone: history?.issueHistory?.[Link],
}),
},
}),
status:
history?.status,
date:
[Link],
};
return (
<Grid item
sx={{ p: 1 }} lg={12} xs={12} md={12}>
<CardContent>
<RespondentActions
respondentData={[Link]}
headers={[Link]}
/>
</CardContent>
</Grid>
)} */}
{/* <Grid item
sx={{ display:'flex',py:1 }}>
<Typography variant="subtitle2" fontWeight={600} gutterBottom
style={{ display:'flex' }}>
Agent Name:
</Typography>
<span style={{ paddingLeft: 4,fontSize: 12}}>
{issueDetails?.issueDetails?.source?.networkParticipantId}
</span>
</Grid> */}
</Grid>
</CardContent>
</Card>
</Grid>
<Grid item lg={6} md={12} sm={12} xs={12}>
<Grid container rowGap={2}>
<Grid item lg={12} md={12} sm={12} xs={12}>
<Card style={[Link]}>
<Typography
sx={{
display: "flex",
padding: 1,
paddingLeft: 3,
background: "#e2e2e2",
}}
>
Order Summary
</Typography>
<CardContent>
<Grid container sx={{ py: 1 }}
columnGap={2}>
<Grid
item
sx={{
display:
"flex",
py: 1,
columnGap:
"5px",
alignItems:
"baseline",
}}
>
<Typography
fontSize={12}
fontWeight={600}
gutterBottom
{issueDetails?.issueDetails?.orderDetails?.providerId}
</span>
</Grid>
fontWeight={600}
gutterBottom
issueDetails?.issueDetails?.orderDetails?.items?.[0]
?.i
temId
}
</span>
</Grid>
<Grid
item
sx={{
display:
"flex",
py: 1,
columnGap:
"5px",
alignItems:
"baseline",
}}
>
<Typography
fontSize={12}
fontWeight={600}
gutterBottom
issueDetails?.issueDetails?.orderDetails?.items?.[0]
?.d
escriptor?.name
}
</span>
</Grid>
{/* </Grid>
</Grid> */}
</Grid>
</CardContent>
</Card>
</Grid>
<Grid item lg={12} md={12} sm={12} xs={12}>
<Card style={[Link]}>
<Typography
sx={{
display: "flex",
padding: 1,
paddingLeft: 3,
background: "#e2e2e2",
}}
>
Uploads
</Typography>
<CardContent>
<Carousel fullHeightHover={true}>
{issueDetails?.issueDetails?.description?.images?.map(
(image: string,
index: number) => (
<div
key={index}>
<img
width="450px"
height="300px"
crossOrigin='anonymous'
src={image}
alt={`Images ${index}`}
/>
</div>
)
)}
</Carousel>
</CardContent>
</Card>
</Grid>
</Grid>
</Grid>
<Grid item lg={12} md={12} xs={12} sm={12}>
{
<IssueForm
issueData={{
id,
}}
open={open}
setOpen={setOpen}
/>
}
</Grid>
</Grid>
);
};
63] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Issue\[Link]
import * as React from "react";
import _, { isEmpty } from "lodash";
import { useNavigate } from "react-router-dom";
import { Card, Grid, Paper, Tab, Tabs } from "@mui/material";
import IssueForm from "../../CommonComponents/IssueFormDetails";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import { formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { GET_ISSUE_LIST } from "../../ApiServices/ApiConstants";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface issueState {
id: string;
issueType: string;
shortDesc: string;
longDesc: string;
status: string;
actions: any;
}
// setIssueList(_data);
switch ([Link]) {
case "CONSUMER":
[Link](issueItem);
break;
case "SELLER":
[Link](issueItem);
break;
case "INTERFACING_NP":
[Link](issueItem);
break;
}
//[Link](issueItem);
});
//
setPassengerIssueList(passIssueList);
setfilteredPassengerIssueList(passIssueList);
setPassengerSupportIssueList(passSupportIssueList);
setfilteredPassengerSupportIssueList(passSupportIssueList);
setDriverIssueList(driveIssueList);
setfilterdDriverIssueList(driveIssueList);
// setDriverSupportIssueList(driveIssueList);
// setfilteredDriverSupportIssueList(driveIssueList);
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
//
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
getIssueList(1, 0);
}, []);
const EnhancedTableConfig = {
headers: [
{
id: "createdDate",
numeric: false,
disablePadding: true,
label: "Created DateTime",
disableSort: false,
},
// {
// id: "issueType",
// numeric: false,
// disablePadding: true,
// label: "Issue Type",
// disableSort: false,
// },
{
id: "shortDesc",
numeric: false,
disablePadding: true,
label: "Short Description",
disableSort: true,
},
{
id: "longDesc",
numeric: false,
disablePadding: true,
label: "Long Description",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "history",
numeric: false,
disablePadding: true,
label: "View Details",
disableSort: true,
},
],
navigate: (item: any) => {
navigate(`${[Link]}?id=${[Link]}`);
},
};
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
setSearchText(inputValue);
switch (tabValue) {
case "passengerIssue":
const filteredRows = [Link]((row) =>
{
return (
[Link]().includes(inputValue) ||
[Link]().includes(inputValue)
);
});
setfilteredPassengerIssueList(filteredRows);
break;
case "passengerSupportIssue":
const filteredRows2 =
[Link]((row) => {
return
[Link]().includes(inputValue);
});
setfilteredPassengerSupportIssueList(filteredRows2);
break;
case "driverIssue":
const filteredRows3 = [Link]((row) => {
return
[Link]().includes(inputValue);
});
setfilterdDriverIssueList(filteredRows3);
break;
case "driverSupportIssue":
const filteredRows4 =
[Link]((row) => {
return
[Link]().includes(inputValue);
});
setfilteredDriverSupportIssueList(filteredRows4);
break;
}
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item>
<Tabs
value={tabValue}
onChange={(e, newValue) => {
setTabValue(newValue);
}}
>
<Tab
label="Passenger"
value="passengerIssue"
sx={[Link]}
/>
<Tab
label="Passenger Support"
value="passengerSupportIssue"
sx={[Link]}
/>
<Tab
label="Driver"
value="driverIssue"
sx={[Link]}
/>
<Tab
label="Driver Support"
value="driverSupportIssue"
sx={[Link]}
/>
</Tabs>
</Grid>
</Grid>
</Grid>
{/* <Grid
container
sx={{
justifyContent: "end",
padding: 1,
backgroundColor: "white",
}}
>
<MobilityTextField
label="Search Issue..."
type="text"
name="search"
value={searchText}
maxLength={10}
onChange={(event:
[Link]<HTMLInputElement>) => {
handleInputChange(event);
}}
/>
</Grid> */}
{/* <Box
sx={{
borderBottom: 1,
borderColor: "divider",
backgroundColor: "white",
}}
> */}
<Grid padding={2}>
{tabValue === "passengerIssue" &&
([Link] > 0 ? (
<EnhancedTable
headers={[Link]}
tableData={filteredPassengerIssueList}
/>
) : (
<MobilityEmptyMsg message={"No
Passenger Issue Found"} />
))}
headers={[Link]}
tableData={filteredDriverIssueList}
/>
) : (
<MobilityEmptyMsg message={"No Driver
Issue Found"} />
))}
headers={[Link]}
tableData={filteredpassengerSupportIssueList}
/>
) : (
<MobilityEmptyMsg message={"No
Passenger Support Issue Found"} />
))}
headers={[Link]}
tableData={filteredDriverSupportIssueList}
/>
) : (
<MobilityEmptyMsg message={"No Driver
Support Issue Found"} />
))}
</Grid>
64]ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Issue\[Link]
import React, { FC, ReactElement, useState } from "react";
import {
Button,
Card,
Grid,
TextField,
Typography,
Container,
Divider,
Paper,
} from "@mui/material";
import { useLocation } from "react-router-dom";
import { useSearchParams, useNavigate } from "react-router-dom";
import { useUserDispatch } from "../../../CustomUtils/usercontext";
import { isEmpty } from "lodash";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
EDIT_DRIVER,
GET_DRIVER_DETAILS_BY_ID,
} from "../../ApiServices/ApiConstants";
const id = [Link]("id");
const entityId = [Link]("entityId");
const statusOptions = ["Approved", "Pending", "Rejected"];
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
if (!isEmpty(response)) {
const { data } = [Link];
setDriverDetails({
firstName: data?.firstName,
lastName: data?.lastName,
phone: data?.phone,
city: data?.city,
status: data?.status,
email: data?.email,
driverId: data?._id || data?.id,
entityId: data?.entityId,
});
}
} catch (err: any) {
} finally {
[Link]({
isLoading: false,
});
}
}
if (isEmpty(res)) {
apiCall();
}
if ([Link] === 200) {
ShowSnackbarSuccess("Driver details Updated
Successfully", myContext);
navigate(-1);
} else {
ShowSnackbarFailure(res, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
[Link](() => {
apiCall();
}, []);
const cardStyle = {
padding: "24px",
margin: "auto",
width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
};
const titleStyle = {
fontSize: "28px",
fontWeight: "bold",
marginBottom: "25px",
};
const formControlStyle = {
width: "100%",
marginBottom: "16px",
};
const buttonStyle = {
marginTop: "25px",
};
return (
<Container>
<Paper component={Card} variant="outlined" sx={cardStyle}>
<Typography variant="h5" sx={titleStyle}>
issue Details
</Typography>
<Divider />
<form onSubmit={handleSubmit}>
<Grid container spacing={4}>
<Grid item xs={12} sm={6}>
<TextField
label="Issue Number"
variant="outlined"
fullWidth
value={driverDetails?.firstName
|| ""}
onChange={(e) =>
setDriverDetails({
...driverDetails,
firstName:
[Link],
})
}
/>
</Grid>
<Grid item xs={12} sm={6}>
<TextField
label="description"
variant="outlined"
fullWidth
value={driverDetails?.email ||
""}
onChange={(e) =>
65] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Issue\[Link]
import { FC, useState, useEffect } from "react";
import { Tabs, Box, Tab } from "@mui/material";
import { useNavigate, useSearchParams } from "react-router-dom";
import IssueList from "./issueList";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface SubscriberDetailsProps {
name: string;
}
// if (!isEmpty(response)) {
// const { data } = response;
// setSubscriberDetails({
// id: data?.id || data?._id,
// name: data?.name,
// type: data?.type,
// });
// }
// } catch (err: any) {
//
// }
// }
useEffect(() => {
// getSubscribersById();
}, []);
const styles = {
extendedTab: {
minWidth: "500px",
},
};
return (
<div>
{/* <Card>
<CardHeader title="Subscriber details" style={{ textAlign: "start" }} />
<CardContent style={{ textAlign: "start" }}>
{subscriberDetails?.name}
</CardContent>
</Card> */}
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
<Tabs
value={tabeValue}
onChange={(e, newValue) => {
setTabeValue(newValue);
}}
>
<Tab
label="Passenger Issue"
value="passengerIssue"
sx={[Link]}
/>
{/* <Tab label="Driver Issue" value="driverIssue"
sx={[Link]} /> */}
</Tabs>
</Box>
{/* {tabeValue === "passengerIssue" ? <IssueList /> :
<IssueList />} */}
<IssueList />
</div>
);
};
66] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
UnassignedRides\[Link]
import { Card, Grid, Paper } from "@mui/material";
import * as React from "react";
import _, { isEmpty } from "lodash";
import { useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { formatDate, formatDateTime } from "../../../CustomUtils/DateTimeUtils";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import { AppContext } from "../../Context/AppContext";
import { ShowSnackbarFailure } from "../../CommonComponents/MobilitySnackBar";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { TRACK_PENDING_RIDES } from "../../ApiServices/ApiConstants";
import MobilityDatePicker from "../../CommonComponents/MobilityDatePicker";
import dayjs, { Dayjs } from "dayjs";
import {
DateValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import moment from "moment";
interface driverState {
id: string;
firstName: string;
phone: string;
city: string;
status: string;
documents: string;
actions: any;
driverName: any;
passengerName: any;
estimatedCost: any;
estimatedTime: any;
source: any;
destination: any;
dateAndTime: any;
}
[Link](() => {
if (page || rowsPerPage) {
getPendingRidesList();
}
}, [page, rowsPerPage]);
if (!isEmpty(response)) {
const data = response?.data?.data?.result;
//[Link]("125", data);
const _data = data?.map((ride: any) => {
return {
id: ride?.id,
driverName: ride?.driverName,
passengerName: ride?.customreName,
source: ride?.source,
destination: ride?.destination,
estimatedCost: ride?.cost,
estimatedTime: ride?.eta,
//dateAndTime:
formatDateTime(ride?.dateAndTime, true),
dateAndTime: new
Date(ride?.dateAndTime).getTime(),
transactionStepName: (
<MobilityChip
label={ride?.transactionStepName?.status || ""} />
),
status: <MobilityChip label={ride?.status ||
""} />,
viewDetails: (
<MobilityButtonIconView
tooltipTitle="View Ride Details"
onClick={(e) => {
[Link]();
navigate(`$
{pendingRideDetailsPath}?id=${ride?.id}`);
}}
/>
),
};
});
setPendingRides(_data);
setFilteredPendingRides(_data);
setCount(response?.data?.data?.totalCount);
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
const EnhancedTableConfig = {
headers: [
{
id: "driverName",
numeric: false,
disablePadding: true,
label: "Driver Name",
disableSort: false,
},
{
id: "passengerName",
numeric: false,
disablePadding: true,
label: "Passenger Name",
disableSort: false,
},
{
id: "source",
numeric: false,
disablePadding: true,
label: "Source",
disableSort: true,
},
{
id: "destination",
numeric: false,
disablePadding: true,
label: "Destination",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Ride Status",
disableSort: true,
},
{
id: "transactionStepName",
numeric: false,
disablePadding: true,
label: "Transaction Step",
disableSort: true,
},
// {
// id: "estimatedCost",
// numeric: true,
// disablePadding: true,
// label: "Estimated Fare",
// disableSort: true,
// },
// {
// id: "estimatedTime",
// numeric: true,
// disablePadding: true,
// label: "Estimated Time (mins)",
// disableSort: true,
// },
{
id: "dateAndTime",
numeric: false,
disablePadding: true,
label: "Date Time",
disableSort: false,
},
// {
// id: "viewDetails",
// numeric: true,
// disablePadding: true,
// label: "View Details",
// disableSort: true,
// },
],
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
{/* <Grid
container
sx={{
justifyContent: "end",
padding: 1,
backgroundColor: "white",
}}
>
<MobilityTextField
label="Search..."
type="text"
name="search"
value={searchText}
fullWidth={false}
maxLength={50}
onChange={(event:
[Link]<HTMLInputElement>) => {
handleInputChange(event);
}}
/>
</Grid> */}
<Grid
container
sx={{
paddingLeft: 2,
paddingTop: 2,
backgroundColor: "white",
}}
>
<Grid container spacing={2} alignItems="center">
<Grid item>
<MobilityDatePicker
label="Start Date"
value={startDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setStartDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityDatePicker
label="End Date"
value={endDate}
onChange={(
value: Dayjs | null,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setEndDate(value);
}}
/>
</Grid>
<Grid item>
<MobilityButton
label="Search"
onClick={(
event:
[Link]<HTMLButtonElement, MouseEvent>
) => {
if
(startDate?.isAfter(endDate, "dates")) {
ShowSnackbarFailure(
"Start Date
should be same or before End Date",
myContext
);
} else {
getPendingRidesList();
}
}}
/>
</Grid>
</Grid>
</Grid>
<Grid padding={2}>
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredPendingRides}
count={count}
refreshPage={refreshPage}
></EnhancedTable>
</Grid>
</Paper>
</Grid>
);
};
67] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Vehicle\[Link]
import React, { FC, ReactElement } from "react";
import {
Card,
Grid,
Typography,
Divider,
Paper,
Tabs,
Tab,
} from "@mui/material";
import { useSearchParams, useNavigate } from "react-router-dom";
import { isEmpty } from "lodash";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import MobilitySelect from "../../CommonComponents/MobilitySelect";
import { CancelOutlined, Margin, TaskAlt } from "@mui/icons-material";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import MobilityAccordion from "../../CommonComponents/MobilityAccordion";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import { MobilityImgHeading } from
"../../CommonComponents/MobilityHeadingValue";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
CHANGE_DOCUMENT_STATUS,
EDIT_VEHICLE_DETAILS,
GET_DRIVER_DOCUMENT,
GET_VEHICLES_DETAILS_BY_ID,
GET_VEHICLE_DOCUMENT,
UPDATE_VEHICLE_DOCUMENTS_BY_ID,
} from "../../ApiServices/ApiConstants";
import moment from "moment";
//
//
let selectedTab = [Link]("selectedTab");
let vehicleTab = [Link]("vehicleTab");
let pageFrom = [Link]("pageFrom");
//[Link]("47", selectedTab + " " + vehicleTab + " ", pageFrom);
return true;
} catch (error) {}
};
apiCall();
// navigate(-1);
} else {
ShowSnackbarFailure(res, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
}
[Link](() => {
apiCall();
}, []);
const cardStyle = {
margin: "auto",
width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
};
const titleStyle = {
fontSize: "28px",
fontWeight: "bold",
marginBottom: "25px",
};
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
function detailsData() {
return (
<>
<Grid container spacing={4} sx={{ padding: 3 }}>
<Grid item xs={12} sm={6}>
<MobilityTextField
//disabled={isEdit ? true : false}
disabled={true}
label="Vehicle Company Name"
type="text"
name="vehicleCompanyName"
value={[Link] || ""}
onChange={(e) =>
setVehicleDetails({
...vehicleDetails,
name: [Link],
})
}
/>
</Grid>
value={[Link] || ""}
onChange={(e) =>
setVehicleDetails({
...vehicleDetails,
registrationNumber:
[Link],
})
}
/>
</Grid>
value={vehicleDetails?.rejectReason || ""}
onChange={(e) => {
setVehicleDetails({
...vehicleDetails,
rejectReason:
[Link],
});
}}
/>
</Grid>
)}
{!isEdit && (
<Grid container sx={{ marginTop: 2,
justifyContent: "flex-end" }}>
<MobilityButton label="Submit"
onClick={handleSubmit} />
</Grid>
)}
</Grid>
</>
);
}
[Link]("215", requestBody);
const res: Iresponse = await [Link](
UPDATE_VEHICLE_DOCUMENTS_BY_ID,
requestBody
);
if (isEmpty(res)) {
apiCall();
}
if ([Link] === 200) {
ShowSnackbarSuccess("Driver details Updated
Successfully", myContext);
apiCall();
//navigate("/driver", { state: driverTab });
} else {
ShowSnackbarFailure(res, myContext);
[Link]("error.", res);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
}
function documentsData() {
return (
<>
<Grid container item xs={12} md={12} spacing={1}
padding={2}>
{vehicleDetails?.documents?.map((item: any, index:
any) => {
if (
[Link]?.toString() ===
"AutoFront" ||
//[Link]?.toString() ===
"AutoBack" ||
[Link]?.toString() === "RC"
) {
return (
<Grid item xs={12} md={6}
key={index}>
<MobilityAccordion
key={index}
isExpanded={false}
title={getTitle(item)}
summary={getSummary(item, index)}
details={
<>
<MobilityImgHeading
heading={item}
value=""
//imgUrl={[Link]}
imgUrl={`${GET_VEHICLE_DOCUMENT}?driverId=$
{vehicleDetails?.driverId}&vehicleId=${vehicleDetails?.vehicleId}&docId=$
{[Link]}`}
onDataSave={saveDocumentData}
/>
</>
}
/>
</Grid>
);
}
})}
</Grid>
</>
);
}
const updatedDocuments =
response?.data?.data?.updatedEntity?.documents;
[Link]((selectedDoc: any) => ({
...selectedDoc,
parentId: parentId,
}));
switch ([Link]()) {
case "pending":
case "expired":
if (!isExpired) {
dialogProp = {
open: true,
title: "Confirmation",
message: "Are you sure you want to
proceed?",
onYesClick: () => {
handleApprove("Approved", item?.docId,
[Link]);
//navigate(-1);
},
};
}
[Link](
<>
<MobilityChip
key={index}
label="Approve Document"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<TaskAlt />}
onClick={(event) => {
[Link]({ ...dialogProp });
}}
/>
<Divider sx={{ width: 10 }} />
<MobilityChip
key={index}
label="Reject Document"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<CancelOutlined />}
onClick={(event) => {
[Link]({
action: "Rejected",
open: true,
title: "Confirmation",
message: "Are you sure you
want to proceed?",
onYesClick: (event: any,
param: string | undefined) => {
handleApprove(
"Rejected",
item?.docId,
[Link],
param
);
},
});
}}
/>
<Divider sx={{ width: 10 }} />
</>
);
break;
case "rejected":
if (!isExpired) {
dialogProp = {
open: true,
title: "Confirmation",
message: "Are you sure you want to
proceed?",
onYesClick: () => {
handleApprove("Approved", item?.docId,
[Link]);
//navigate(-1);
},
};
}
[Link](
<MobilityChip
key={index}
label="Approve Document"
color={"primary"}
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<TaskAlt />}
onClick={(event) => {
[Link]({
...dialogProp,
});
}}
/>
);
break;
case "approved":
[Link](
<MobilityChip
key={index}
label="Reject Document"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<CancelOutlined />}
onClick={(event) => {
[Link]({
action: "Rejected",
open: true,
title: "Confirmation",
message: "Are you sure you want
to proceed?",
onYesClick: (event: any, param:
string | undefined) => {
handleApprove(
"Rejected",
[Link],
[Link],
param
);
//navigate(-1);
},
});
}}
/>
);
break;
}
return summary;
}
function createDescription() {
return (
<Grid paddingLeft={1}>
{vehicleDetails?.rcOwnerName && (
<MobilityChip
label={"Owner Name : " +
vehicleDetails?.rcOwnerName}
size={"medium"}
/>
)}
{vehicleDetails?.ownerType && (
<MobilityChip
label={"Owner Type : " +
vehicleDetails?.ownerType}
size={"medium"}
/>
)}
{/* <MobilityChip
label={"Year : " + vehicleDetails?.year}
size={"medium"}
/> */}
<MobilityChip
label={"Reg. Number : " +
vehicleDetails?.registrationNumber}
size={"medium"}
/>
</Grid>
);
//return description;
}
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<MobilityAppBar
title="Vehicles Details ::"
description={createDescription()}
onBackClick={() => {
//[Link]("694", pageFrom + " " +
vehicleTab);
if (pageFrom && pageFrom === "vehicle") {
navigate("/vehicle", { state:
vehicleTab });
} else {
navigate(-1);
}
}}
/>
</Grid>
<Tab
label="Documents"
value="documents"
sx={[Link]}
/>
</Tabs>
</Grid>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
>
{tabValue === "documents" && (
<Grid container spacing={2}
padding={2}>
<Grid item xs={12} sm={4}>
<MobilitySelect
size={"small"}
disabled={isEdit ?
true : false}
label="Status"
value={[Link] || ""}
onChange={(e) =>
setVehicleDetails({
...vehicl
eDetails,
status:
[Link] as string,
})
}
statusOptions={statusOptions}
/>
</Grid>
{vehicleDetails?.status ===
"InActive" && (
<Grid item xs={12} sm={6}>
<MobilityTextField
size={"small"}
label="Rejected
Reason"
name="rejectedReason"
type="text"
value={vehicleDetails?.rejectReason || ""}
onChange={(e)
=> {
setVehicleDetails({
...
vehicleDetails,
rejectReason: [Link],
});
}}
/>
</Grid>
)}
{!isEdit && (
<Grid item xs={12} sm={2}>
<MobilityButton
label="Submit" onClick={handleSubmit} />
</Grid>
)}
</Grid>
)}
</Grid>
</Grid>
68] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Vehicle\[Link]
// import React, { useState } from "react";
// import { Card, Grid, Typography, CardContent, Link } from "@mui/material";
// import EnhancedTable from "../../CommonComponents/EnhancedTable";
// import {
// MobilityButtonIconApprove,
// MobilityButtonIconReject,
// } from "../../CommonComponents/MobilityButtonIcon";
// import { AppContext } from "../../Context/AppContext";
// import {
// ShowSnackbarFailure,
// ShowSnackbarSuccess,
// } from "../../CommonComponents/MobilitySnackBar";
// const vehicleDocumentTablePath: string = "/vehicleDocumentTable";
// interface DocumentTableProps {
// documents: {
// driverId?: any;
// docId?: any;
// docType?: any;
// docName?: any;
// docNumber?: any;
// path?: any;
// status?: any;
// _id?: any;
// }[];
// }
// interface Iresponse {
// headers?: any;
// data?: any;
// status?: number;
// message?: string;
// }
// actions:
// doc?.status === "Approved" ? (
// <MobilityButtonIconReject
// tooltipTitle="Reject"
// onClick={(event) => {
// handleApprove("Rejected", doc?.docId,
doc?.driverId);
// }}
// />
// ) : doc?.status === "Rejected" ? (
// <MobilityButtonIconApprove
// tooltipTitle="Approve"
// onClick={(event) => {
// handleApprove("Approved", doc?.docId,
doc?.driverId);
// }}
// />
// ) : (
// <>
// <MobilityButtonIconApprove
// tooltipTitle="Approve"
// onClick={(event) => {
// handleApprove("Approved",
doc?.docId, doc?.driverId);
// }}
// />
// <MobilityButtonIconReject
// tooltipTitle="Reject"
// onClick={(event) => {
// handleApprove("Rejected",
doc?.docId, doc?.driverId);
// }}
// />
// </>
// ),
// path: vehicleDocumentTablePath,
// }));
// }
// const handleApprove = async (status: any, docId: any, parentId: any) => {
// try {
// [Link]({
// isLoading: true,
// message: "Updating document status...",
// });
// const payload = {
// status,
// docId,
// parentId,
// };
// const response: Iresponse = await [Link](
// `/api/change-document-status`,
// payload
// );
// const EnhancedTableConfig = {
// headers: [
// { id: "srNo", label: "Sr. No" },
// { id: "docType", label: "Doc Type" },
// { id: "docUrl", label: "Doc URL" },
// { id: "status", label: "Status" },
// { id: "actions", label: "Actions" },
// ],
// };
// return (
// <Grid container spacing={2}>
// <Card>
// <CardContent>
// <Typography variant="h6" gutterBottom>
// Document List
// </Typography>
// <EnhancedTable
// headers={[Link]}
// tableData={DocumentList(documents)}
// />
// </CardContent>
// </Card>
// <Grid item xs={12}></Grid>
// </Grid>
// );
// }
69] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
Vehicle\[Link]
import { Card, Paper, Tabs, Tab } from "@mui/material";
import { Grid } from "@mui/material";
import React, { FC, ReactElement, useEffect, useRef, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import {
MobilityListItemDocuments,
MobilityListItemEdit,
} from "../../CommonComponents/MobilityListItem";
import LongMenu from "../../CommonComponents/MobilityActionMenu";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
CHANGE_VEHICLE_STATUS_BY_ADMIN,
GET_VEHICLE_LIST,
} from "../../ApiServices/ApiConstants";
import {
formatDateTime,
currentDatAndTime,
} from "../../../CustomUtils/DateTimeUtils";
import * as XLSX from "xlsx";
import _ from "lodash";
import MobilityButton from "../../CommonComponents/MobilityButton";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface vehicleState {
_id: string;
name: any;
documents: any;
id: string;
VehicleName: string;
registrationNumber: string;
status: string;
statusFilter: string;
model: string;
docNew: string;
actionNew: any;
firstName: string;
lastName: string;
phone: string;
documentsUpdateDate: string;
modifiedDate: string;
}
const buttonStyle = {
backgroundColor: "#007bff",
color: "white",
padding: "8px 16px",
borderRadius: "4px",
border: "none",
cursor: "pointer",
fontSize: "10px",
fontWeight: "bold",
};
interface docState {
vehicleId?: string;
docId?: string;
docName?: string;
docNumber?: string;
docType?: string;
path?: string;
status?: string;
_id?: string;
}
if (err?.message) {
}
} finally {
[Link]({
isLoading: false,
});
}
};
const EnhancedTableConfig = {
headers: [
{
id: "driverName",
numeric: false,
disablePadding: true,
label: "Driver Name",
disableSort: false,
},
{
id: "driverPhone",
numeric: false,
disablePadding: true,
label: "Phone",
disableSort: false,
},
{
id: "VehicleName",
numeric: false,
disablePadding: true,
label: "Vehicle",
disableSort: false,
},
// {
// id: "model",
// numeric: false,
// disablePadding: true,
// label: "Model",
// disableSort: true,
// },
{
id: "registrationNumber",
numeric: true,
disablePadding: true,
label: "Reg. No.",
disableSort: false,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "modifiedDateTime",
numeric: false,
disablePadding: true,
label: "Modified DateTime",
disableSort: false,
},
{
id: "docNew",
numeric: true,
disablePadding: true,
label: "Documents",
disableSort: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
navigate: (item: any) => {
navigate(`${[Link]}?id=${[Link]}`);
},
};
if ([Link]) {
const dataCsv =
[Link].json_to_sheet(requestes);
const wb = [Link].book_new();
[Link].book_append_sheet(wb, dataCsv, "Sheet
1");
const time = currentDatAndTime();
[Link](wb, `Vehicles_${tabValue}_$
{time}.xlsx`);
}
} else {
getFilterVehicleList({ data: data?.vehiclesList, total:
data?.total });
}
// [Link]('response', data);
// setVehicleList([...[Link]]);
// setVehicleList([Link]);
// setCount(data?.total);
//[Link]("infetch data");
} catch (error) {
ShowSnackbarFailure(error, myContext);
} finally {
[Link]({
isLoading: false,
});
}
};
async function preparePendingDataDownload(data: any) {
let requests: any = [];
data?.forEach((record: any) => {
let row = {};
row = {
"Driver Name":
record?.firstName && record?.lastName
? [Link](" ",
[Link])
: "",
"Vehicle Name": record?.name || "",
"Vehicle Registration Number":
record?.registrationNumber || "",
Phone: [Link],
};
if ([Link]) {
[Link]((doc: any) => {
if ([Link] === "RC") {
row = {
...row,
RC: [Link],
};
} else if ([Link] === "AutoFront") {
row = {
...row,
"AutoFront Photo": [Link],
};
}
// else if ([Link] === "AutoBack") {
// row = {
// ...row,
// "AutoBack Photo": [Link],
// };
// }
});
}
row = {
...row,
Status: [Link],
"Modified Date": formatDateTime([Link],
true, true),
};
[Link](row);
});
return requests;
}
async function prepareRejectedDataDownload(data: any) {
let requests: any = [];
data?.forEach((record: any) => {
let row = {};
row = {
"Driver Name":
record?.firstName && record?.lastName
? [Link](" ",
[Link])
: "",
"Vehicle Name": record?.name || "",
"Vehicle Registration Number":
record?.registrationNumber || "",
Phone: [Link],
};
if ([Link]) {
[Link]((doc: any) => {
if ([Link] === "RC") {
row = {
...row,
RC: [Link],
};
} else if ([Link] === "AutoFront") {
row = {
...row,
"AutoFront Photo": [Link],
};
}
// else if ([Link] === "AutoBack") {
// row = {
// ...row,
// "AutoBack Photo": [Link],
// };
// }
});
}
row = {
...row,
Status: [Link],
"Rejected Reason": [Link],
"Modified Date": formatDateTime([Link],
true, true),
};
[Link](row);
});
return requests;
}
async function prepareApprovedDataDownload(data: any) {
let requests: any = [];
[Link]((record: any) => {
let row = {};
row = {
"Driver Name":
record?.firstName && record?.lastName
? [Link](" ",
[Link])
: "",
"Vehicle Name": record?.name || "",
"Vehicle Registration Number":
record?.registrationNumber || "",
Phone: [Link],
};
if ([Link]) {
[Link]((doc: any) => {
if ([Link] === "RC") {
row = {
...row,
RC: [Link],
};
} else if ([Link] === "AutoFront") {
row = {
...row,
"AutoFront Photo": [Link],
};
}
// else if ([Link] === "AutoBack") {
// row = {
// ...row,
// "AutoBack Photo": [Link],
// };
// }
});
}
row = {
...row,
Status: [Link],
"Modified Date": formatDateTime([Link],
true, true),
};
[Link](row);
});
return requests;
}
useEffect(() => {
if (page || rowsPerPage || tabValue) {
fetchData("");
}
}, [page, rowsPerPage, tabValue]);
return null;
})(),
actionNew: (() => {
const menuList: any = [];
model: vehicle?.model,
// path: vehicleDetailsPath,
};
});
// [Link]('updatedFilteredList', updatedFilteredList);
// [Link]('updatedFilteredList', vehicleList);
// setVehicleList([...updatedFilteredList])
// setFilteredVehicleList([...updatedFilteredList])
// [Link]('after set filteredVehicleList',
filteredVehicleList);
setVehicleList(updatedFilteredList);
//[Link]("befire", updatedFilteredList);
setFilteredVehicleList(updatedFilteredList);
// [Link]("sete", filteredVehicleList);
//[Link]("sete", obj?.total);
setCount(obj?.total);
}
setSearchText(inputValue);
if ([Link] > 12 || [Link] === 0) {
fetchData(inputValue);
}
// if ([Link] > 0) {
// const filteredRows = vehicleList?.filter((row: any) => {
// return (
//
[Link]?.toLowerCase().includes([Link]()) ||
//
[Link]?.toLowerCase().includes([Link]()) ||
// [Link]
// ?.toString()
// ?.toLowerCase()
// .includes([Link]()) ||
//
[Link]?.toString().includes([Link]())
// );
// });
// setFilteredVehicleList(filteredRows);
// } else {
// setFilteredVehicleList(vehicleList);
// }
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item>
<Tabs
value={tabValue}
onChange={(e, newValue) => {
tableRef?.current?.handleChangePage(null, 0);
setTabValue(newValue);
setSearchText("");
}}
>
<Tab label="All Vehicles"
value="all" sx={[Link]} />
<Tab label="Active"
value="Active" sx={[Link]} />
<Tab
label="InActive"
value="InActive"
sx={[Link]}
/>
<Tab label="Pending"
value="Pending" sx={[Link]} />
<Tab
label="Re-verification"
value="Reverification"
sx={[Link]}
/>
</Tabs>
</Grid>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
>
{tabValue && tabValue !== "all" && (
<Grid marginRight={1}>
<MobilityButton
fullWidth={false}
label={"Download"}
onClick={(event:
[Link]<HTMLButtonElement>) => {
fetchData("", true);
}}
/>
</Grid>
)}
<MobilityTextField
label="Search Vehicle by Registration
number..."
type="text"
name="search"
value={searchText}
maxLength={50}
fullWidth={false}
onChange={(event:
[Link]<HTMLInputElement>) => {
handleInputChange(event);
}}
/>
</Grid>
</Grid>
<Grid padding={2}>
{filteredVehicleList && [Link]
> 0 ? (
<EnhancedTable
ref={tableRef}
headers={[Link]}
tableData={filteredVehicleList}
count={count}
refreshPage={refreshPage}
/>
) : (
<MobilityEmptyMsg message={"No Data
Found"} />
)}
</Grid>
</Paper>
</Grid>
);
};
70] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
[Link]
import { FC, ReactElement } from "react";
import * as React from "react";
import { AppContext } from "../Context/AppContext";
import { apiHandler } from "../ApiServices/ApiHandler";
import { GET_DASHBOARD_DRIVERS_DETAILS } from "../ApiServices/ApiConstants";
import CardContent from "@mui/material/CardContent";
import {
Card,
Grid,
Paper,
Tab,
Tabs,
Typography,
colors,
} from "@mui/material";
import CardActions from "@mui/material/CardActions";
import Example from "../CommonComponents/MobilityPieChart";
import { Cell, Pie, PieChart, ResponsiveContainer } from "recharts";
import { MobilityCard } from "../CommonComponents/MobilityCard";
import MobilityButton from "../CommonComponents/MobilityButton";
import { ShowSnackbarFailure } from "../CommonComponents/MobilitySnackBar";
import {
AppsSharp,
Cancel,
CheckCircle,
Flaky,
OfflineBolt,
Pending,
Search,
SearchOff,
ThumbUpAlt,
Timelapse,
} from "@mui/icons-material";
import MobilityBadge from "../CommonComponents/MobilityBadge";
const data = [
{ name: "Group A", value: 400 },
{ name: "Group B", value: 300 },
{ name: "Group C", value: 300 },
{ name: "Group D", value: 200 },
];
// return (
// <text
// x={x}
// y={y}
// fill="white"
// textAnchor={x > props?.cx ? "start" : "end"}
// dominantBaseline="central"
// >
// {`${(props?.percent * 100).toFixed(0)}%`}
// </text>
// );
// };
[Link](() => {
fetchData();
}, []);
if (data?.totalVehiclesCount?.[0]) {
data?.totalVehiclesCount?.[0]?.status?.map((item:
any) => {
//[Link]("96", item);
switch ([Link]) {
case "Active":
data = { ...data, activeVehicles:
item?.total };
break;
case "InActive":
data = { ...data,
inActiveVehicles: item?.total };
break;
case "Pending":
data = { ...data,
pendingVehicles: item?.total };
break;
}
});
}
if (data?.totalDriversCount?.[0]) {
data?.totalDriversCount?.[0]?.status?.map((item:
any) => {
//[Link]("96", item);
switch ([Link]) {
case "Approved":
data = { ...data,
approvedDrivers: item?.total };
break;
case "Rejected":
data = { ...data,
rejectedDrivers: item?.total };
break;
case "Pending":
data = { ...data, pendingDrivers:
item?.total };
break;
}
});
}
setAllDetails(data);
}
} catch (error: any) {
ShowSnackbarFailure(error, myContext);
} finally {
[Link]({
isLoading: false,
});
}
};
const commonCardProps = {
gridstyle: {
size: 2,
margin: 1,
},
titleStyle: {
fontSize: 15,
color: "black",
fontWeight: 400,
},
descriptionStyle: {
fontSize: 15,
color: "black",
fontWeight: 500,
},
};
return (
<div>
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined"
sx={{ padding: 2 }}>
<Grid
item
sx={{
display: "flex",
justifyContent: "space-between",
//padding: 1,
}}
>
<Grid container>
<Typography
fontSize={20}
color={"black"}
fontWeight={600}
//sx={{ margin: 1 }}
>
Driver App Dashboard
</Typography>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
}}
>
<Grid marginRight={1}>
<MobilityBadge
title="Online Drivers"
badgeContent={[Link]}
color="success"
icon={
<img
src={require("../../assets/[Link]")} height="35px" />
}
></MobilityBadge>
<MobilityButton
fullWidth={false}
label={"Refresh Data"}
onClick={(event:
[Link]<HTMLButtonElement>) => {
fetchData();
}}
/>
</Grid>
</Grid>
</Grid>
<Grid
item
sx={{
display: "flex",
justifyContent: "space-between",
//padding: 1,
}}
>
<Grid container>
<Typography
fontSize={16}
color={"black"}
fontWeight={500}
sx={{ margin: 1 }}
>
Drivers Data
</Typography>
{/* <MobilityBadge
title="Online Drivers"
badgeContent={[Link]}
color="success"
icon={
<img
src={require("../../assets/[Link]")} height="30px" />
}
></MobilityBadge> */}
</Grid>
</Grid>
<Grid container>
<MobilityCard
title={`Updated App ($
{allDetails?.appUpdateCount?.version})`}
description={allDetails?.appUpdateCount?.count}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={
<img
src={require("../../assets/[Link]")} height="25px" />
}
backgroundColor={"#ECEFF1"}
></MobilityCard>
<MobilityCard
title="Current Online "
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={
<img
src={require("../../assets/[Link]")} height="25px" />
}
backgroundColor={"#ECEFF1"}
></MobilityCard>
<MobilityCard
title="Approved"
description={allDetails?.approvedDrivers}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<CheckCircle color="success" />}
backgroundColor={"#E8F5E9"}
></MobilityCard>
<MobilityCard
title="Rejected"
description={allDetails?.rejectedDrivers}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Cancel color="error" />}
backgroundColor={"#FFEBEE"}
></MobilityCard>
<MobilityCard
title="Pending"
description={allDetails?.pendingDrivers}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Pending color="warning" />}
backgroundColor={"#FFF3E0"}
></MobilityCard>
<MobilityCard
title="Total Drivers"
description={allDetails?.totalDriversCount?.[0]?.total}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Flaky color="info" />}
backgroundColor={"#E1F5FE"}
></MobilityCard>
<MobilityCard
title="Approved Drivers with Active
Vehicles"
description={
allDetails?.approvedDriversActiveVehiclesCount?.[0]?.count
}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={{ margin: 1, size: 4 }}
icon={<ThumbUpAlt color="success" />}
backgroundColor={"#E1F5FE"}
></MobilityCard>
</Grid>
<Typography
fontSize={16}
color={"black"}
fontWeight={500}
sx={{ paddingInline: 1, marginTop: 2 }}
>
Vehicles Data
</Typography>
<Grid container>
{/* {allDetails?.totalVehiclesCount?.[0] &&
allDetails?.totalVehiclesCount?.
[0]?.status?.map(
(status: any) => {
return (
<MobilityCard
title={status?.status}
description={status?.total}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
></MobilityCard>
);
}
)} */}
<MobilityCard
title={"Active"}
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<CheckCircle color="success" />}
backgroundColor={"#E8F5E9"}
></MobilityCard>
<MobilityCard
title={"InActive"}
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Cancel color="error" />}
backgroundColor={"#FFEBEE"}
></MobilityCard>
<MobilityCard
title={"Pending"}
description={
allDetails?.pendingVehicles ?
allDetails?.pendingVehicles : "0"
}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Pending color="warning" />}
backgroundColor={"#FFF3E0"}
></MobilityCard>
<MobilityCard
title="Total Vehicles"
description={allDetails?.totalVehiclesCount?.[0]?.total}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Flaky color="info" />}
backgroundColor={"#E1F5FE"}
></MobilityCard>
</Grid>
<Typography
fontSize={16}
color={"black"}
fontWeight={500}
sx={{ paddingInline: 1, marginTop: 2 }}
>
Today's Rides Data
</Typography>
<Grid container>
<MobilityCard
title="On Going "
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={
<img
src={require("../../assets/[Link]")} height="25px" />
}
backgroundColor={"#ECEFF1"}
></MobilityCard>
<MobilityCard
title="Completed "
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<CheckCircle color="success" />}
backgroundColor={"#E8F5E9"}
></MobilityCard>
<MobilityCard
title="Cancelled "
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Cancel color="error" />}
backgroundColor={"#FFEBEE"}
></MobilityCard>
<MobilityCard
title="UnAssigned/Pending"
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Pending color="warning" />}
backgroundColor={"#FFF3E0"}
></MobilityCard>
<MobilityCard
title="Total Rides"
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Flaky color="info" />}
backgroundColor={"#E1F5FE"}
></MobilityCard>
</Grid>
<Typography
fontSize={16}
color={"black"}
fontWeight={500}
sx={{ paddingInline: 1, marginTop: 2 }}
>
Today's Ride Search Data
</Typography>
<Grid container>
<MobilityCard
title="Searches in last 1 hr"
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Search color="action" />}
backgroundColor={"#ECEFF1"}
></MobilityCard>
<MobilityCard
title="Total Searches"
description={[Link]}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
icon={<Flaky color="info" />}
backgroundColor={"#E1F5FE"}
></MobilityCard>
</Grid>
</Paper>
</Grid>
</div>
);
};
const renderCustomizedLabel = ({
cx,
cy,
midAngle,
innerRadius,
outerRadius,
percent,
index,
}: any) => {
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
const x = cx + radius * [Link](-midAngle * RADIAN);
const y = cy + radius * [Link](-midAngle * RADIAN);
return (
<text
x={x}
y={y}
fill="white"
textAnchor={x > cx ? "start" : "end"}
dominantBaseline="central"
>
{`${(percent * 100).toFixed(0)}%`}
</text>
);
};
export function Appd() {
return (
<PieChart width={800} height={800}>
<Pie
data={data}
cx={200}
cy={200}
labelLine={false}
label={renderCustomizedLabel}
outerRadius={180}
fill="#8884d8"
dataKey="value"
onClick={() => {}}
enableBackground={1}
>
{[Link]((entry, index) => (
<Cell
key={`cell-${index}`}
fill={COLORS[index % [Link]]}
onClick={() => {}}
/>
))}
</Pie>
</PieChart>
);
}
71] ondc\Admin-portal-frontend\bpp_admin\src\Components\ProtectedComponents\
[Link]
import { Button, Card, Grid, Paper, Typography } from "@mui/material";
import * as React from "react";
import { MobilityCard } from "../CommonComponents/MobilityCard";
import _, { isEmpty } from "lodash";
import {
convertToStartDateString,
convertToEndDateString,
} from "../../CustomUtils/DateTimeUtils";
import { AppContext } from "../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../CommonComponents/MobilitySnackBar";
import { apiHandler } from "../ApiServices/ApiHandler";
import {
DOWNLOAD_EVENT_REPORT,
DOWNLOAD_NOTIFICATION_HISTORY_REPORT,
GET_REPORTS_DETAILS,
} from "../ApiServices/ApiConstants";
import MobilityDatePicker from "../CommonComponents/MobilityDatePicker";
import dayjs, { Dayjs } from "dayjs";
import {
DateValidationError,
PickerChangeHandlerContext,
} from "@mui/x-date-pickers";
import MobilityButton from "../CommonComponents/MobilityButton";
import moment from "moment";
import { Download } from "@mui/icons-material";
import fileDownload from "js-file-download";
import { start } from "repl";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
[Link](() => {
getReportsList();
createDynamicButtons();
}, []);
const payload = {
date: moment(date).format("YYYY-MM-DD"),
};
const payload = {
date: moment(date).format("YYYY-MM-DD"),
};
function createDynamicButtons() {
let dateArray = getDaysArray(startDate, endDate);
setButtonList(dateArray);
}
const commonCardProps = {
gridstyle: {
size: 2.75,
margin: 1,
},
titleStyle: {
fontSize: 14,
color: "GrayText",
fontWeight: 600,
},
descriptionStyle: {
fontSize: 16,
color: "black",
fontWeight: 600,
},
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid
container
sx={{
paddingLeft: 2,
paddingTop: 2,
backgroundColor: "white",
}}
>
<Grid container spacing={2} alignItems="center">
<Grid item>
<MobilityDatePicker
label="Start Date"
value={startDate}
minDate={dayjs(new
Date()).subtract(7, "days")}
onChange={(
value: any,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setStartDate(value);
// let sd = new
Date(value?.toString()).setHours(0, 0, 0, 0);
// let ed = new
Date(endDate).setHours(0, 0, 0, 0);
// if
(moment(sd).isSameOrAfter(moment(ed))) {
// ShowSnackbarFailure(
// "Start Date
should be same or before End Date",
// myContext
// );
// }
}}
/>
</Grid>
<Grid item>
<MobilityDatePicker
label="End Date"
value={endDate}
minDate={dayjs(new
Date()).subtract(7, "days")}
maxDate={dayjs(new Date())}
onChange={(
value: any,
context:
PickerChangeHandlerContext<DateValidationError>
) => {
setEndDate(value);
// let sd = new
Date(startDate).setHours(0, 0, 0, 0);
// let ed = new
Date(value?.toString()).setHours(0, 0, 0, 0);
// if
(moment(sd).isSameOrAfter(moment(ed))) {
// ShowSnackbarFailure(
// "End Date
should be same or after Start Date",
// myContext
// );
// }
}}
/>
</Grid>
<Grid item>
<MobilityButton
label="Search"
onClick={(
event:
[Link]<HTMLButtonElement, MouseEvent>
) => {
// let sd = new
Date(startDate).setHours(0, 0, 0, 0);
// let ed = new
Date(endDate).setHours(0, 0, 0, 0);
if
(startDate?.isAfter(endDate, "dates")) {
setAllDetails("");
ShowSnackbarFailure(
"Start Date
should be same or before End Date",
myContext
);
} else {
getReportsList();
createDynamicButtons();
}
// if
(moment(sd).isSameOrBefore(moment(ed))) {
//
getCurrentRidesList();
//
createDynamicButtons(sd, ed);
// } else {
// setAllDetails("");
// ShowSnackbarFailure(
// "Start Date
should be same or before End Date",
// myContext
// );
// }
}}
/>
</Grid>
</Grid>
</Grid>
<Grid
item
sx={{
display: "flex",
justifyContent: "space-between",
padding: 1,
}}
>
<Grid container>
<MobilityCard
title="On boarded Drivers"
description={allDetails?.onboardedDriversCount}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
></MobilityCard>
<MobilityCard
title="Drivers taken at least 1 ride"
description={allDetails?.atleastOneRideDriverCount}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
></MobilityCard>
<MobilityCard
title="Completed Rides"
description={allDetails?.completedRidesCount}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
></MobilityCard>
<MobilityCard
title="Total search request came to
Driver server"
description={allDetails?.searchRequestCount}
titleStyle={[Link]}
descriptionStyle={[Link]}
gridstyle={[Link]}
></MobilityCard>
</Grid>
</Grid>
downloadReport(event?.target?.id);
}}
>
{item}
</Button>
);
})}
</Grid>
downloadNotificationReport(event?.target?.id);
}}
>
{item}
</Button>
);
})}
</Grid>
</Paper>
</Grid>
);
};
72] ondc\Admin-portal-frontend\bpp_admin\src\Components\Routes\[Link]
import { FC, ReactElement } from "react";
import { Routes, Route } from "react-router-dom";
import { useUserState } from "../../CustomUtils/usercontext";
import Box from "@mui/material/Box";
import Footer from "../CommonComponents/Footer";
import routesList from "./routesList";
import { useStyles } from "./routestyle";
import NavigationDrawerNew, {
DrawerHeader,
} from "../CommonComponents/NavigationDrawerNew";
import { Login } from "../CommonComponents/login";
73] ondc\Admin-portal-frontend\bpp_admin\src\Components\Routes\[Link]
import Dashboard from "../ProtectedComponents/dashboard";
import Reports from "../ProtectedComponents/reports";
import Drivers from "../ProtectedComponents/Drivers/drivers";
import DriverDetails from "../ProtectedComponents/Drivers/driverDetails";
import VehicleDetails from "../ProtectedComponents/Vehicle/vehicleDetails";
import VehicleList from "../ProtectedComponents/Vehicle/vehicleList";
import RideHistory from "../ProtectedComponents/Drivers/rideHistory";
import IssueList from "../ProtectedComponents/Issue/issueList";
import IssueResolvedForm from "../ProtectedComponents/Issue/IssueResolvedForm";
import IssueDetails from "../ProtectedComponents/Issue/IssueDetails";
import SubscriptionHistory from
"../ProtectedComponents/Drivers/subscriptionHistory";
import CurrentRides from "../ProtectedComponents/CurrentRides/currentRidesList";
import CurrentRideDetails from
"../ProtectedComponents/CurrentRides/currentRidesDetails";
import RaiseIssue from "../ProtectedComponents/Drivers/raiseIssue";
import CompletedRidesList from
"../ProtectedComponents/CompletedRides/completedRidesList";
import CompletedRideDetails from
"../ProtectedComponents/CompletedRides/completedRidesDetails";
import GrievanceList from "../ProtectedComponents/Grievances/grievances-list";
import DriversBroadcast from "../ProtectedComponents/DriversBroadCast/drivers-
broadcast";
import DriversBroadcastDetails from
"../ProtectedComponents/DriversBroadCast/drivers-broadcast-details";
import GrievanceDetails from "../ProtectedComponents/Grievances/grievance-
details";
import CancelledRidesList from
"../ProtectedComponents/CancelledRides/cancelledRidesList";
import MapView from
"../ProtectedComponents/DriverSearchMapView/driverSearchMapView";
import DriverSearchMapView from
"../ProtectedComponents/DriverSearchMapView/driverSearchMapView";
import CancelledRideDetails from
"../ProtectedComponents/CancelledRides/cancelledRidesDetails";
import PendingRidesList from
"../ProtectedComponents/UnassignedRides/pendingRidesList";
import DriverRideCount from
"../ProtectedComponents/DriverRideCount/driverRideCount";
//import categoriesList from "../ProtectedComponents/Categories/categoriesList";
const routesList: Array<Object> = [
{
path: "/",
component: Dashboard,
},
{
path: "/dashboard",
component: Dashboard,
},
{
path: "/reports",
component: Reports,
},
// {
// path: "/categoriesList",
// component: categoriesList,
// },
{
path: "/driver",
component: Drivers,
},
{
path: "/vehicle",
component: VehicleList,
},
{
path: "/driverDetails",
component: DriverDetails,
},
{
path: "/vehicleDetails",
component: VehicleDetails,
},
{
path: "/rideHistory",
component: RideHistory,
},
{
path: "/subscriptionHistory",
component: SubscriptionHistory,
},
{
path: "/issue-list",
component: IssueList,
},
{
path: "/issue-resolved",
component: IssueResolvedForm,
},
{
path: "/issue",
component: IssueList,
},
{
path: "/issue-details",
component: IssueDetails,
},
{
path: "/current-rides",
component: CurrentRides,
},
{
path: "/current-ride-details",
component: CurrentRideDetails,
},
{
path: "/raiseIssue",
component: RaiseIssue,
},
{
path: "/completed-rides",
component: CompletedRidesList,
},
{
path: "/completed-ride-details",
component: CompletedRideDetails,
},
{
path: "/grievances",
component: GrievanceList,
},
{
path: "/grievance-details",
component: GrievanceDetails,
},
{
path: "/cancelled-rides",
component: CancelledRidesList,
},
{
path: "/driver-search-map-view",
component: DriverSearchMapView,
},
{
path: "/broadcast-to-drivers",
component: DriversBroadcast,
},
{
path: "/broadcast-to-drivers-details",
component: DriversBroadcastDetails,
},
{
path: "/cancelled-ride-details",
component: CancelledRideDetails,
},
{
path: "/pending-rides",
component: PendingRidesList,
},
{
path: "/driver-ride-count",
component: DriverRideCount,
},
];
74] ondc\Admin-portal-frontend\bpp_admin\src\Components\Routes\[Link]
import { makeStyles } from "@mui/styles";
75] ondc\Admin-portal-frontend\bpp_admin\src\config\[Link]
const dev = {
VERSION: "1.2.9",
BUILD_ENV: "local", //production
DOMAIN: "localhost",
API_BASE_URL: "[Link]
//API_BASE_URL: '[Link]
//API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
};
const loc_static = {
BUILD_ENV: "local", //production
DOMAIN: "localhost",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
ADMIN_REDIRECTION: "[Link]
SUPER_ADMIN_REDIRECTION: "[Link]
};
const uat = {
VERSION: "1.2.9",
BUILD_ENV: "uat", //production
DOMAIN: "[Link]",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
ADMIN_REDIRECTION: "[Link]
SUPER_ADMIN_REDIRECTION: "[Link]
admin",
};
const staging = {
VERSION: "1.2.9",
BUILD_ENV: "staging", //production
DOMAIN: "[Link]",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION:
"[Link]
ADMIN_REDIRECTION:
"[Link]
SUPER_ADMIN_REDIRECTION:
"[Link]
};
const preProd = {
VERSION: "1.2.9",
BUILD_ENV: "oRickshaw", // oRickshaw
DOMAIN: "[Link]",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
};
const oRickshaw = {
VERSION: "1.2.9",
BUILD_ENV: "oRickshaw", // oRickshaw
DOMAIN: "[Link]",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
};
76] ondc\Admin-portal-frontend\bpp_admin\src\CustomUtils\[Link]
import Cookies from "js-cookie";
import env from "../config/env";
77] ondc\Admin-portal-frontend\bpp_admin\src\CustomUtils\[Link]
import moment from "moment";
return `${formattedDate}_${formattedTime}`;
}
78] ondc\Admin-portal-frontend\bpp_admin\src\CustomUtils\[Link]
// import axios from "axios";
// import env from "../config/env";
// const BASE_URL: string = env.API_BASE_URL;
79] ondc\Admin-portal-frontend\bpp_admin\src\CustomUtils\[Link]
import Cookies from "js-cookie";
import React, { useEffect, createContext, FC, ReactElement } from "react";
useEffect(() => {
if (isUserAuthenticated) {
}
}, [isUserAuthenticated]);
return (
<[Link] value={isUserAuthenticated}>
<[Link] value={dispatch}>
{children}
</[Link]>
</[Link]>
);
};
return context;
};
const useUserDispatch = () => {
const context = [Link](userDispatchContext);
return context;
};
81] ondc\Admin-portal-frontend\bpp_admin\src\[Link]
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
82] ondc\Admin-portal-frontend\bpp_admin\src\[Link]
import { render, screen } from "@testing-library/react";
import App from "./App";
83] ondc\Admin-portal-frontend\bpp_admin\src\[Link]
import { useState } from "react";
import "./[Link]";
import AppRouter from "./Components/Routes/routes";
import MobilityLoader, {
MobilityLoaderProp,
} from "./Components/CommonComponents/MobilityLoader";
import { AppContext, RidesFilterProps } from "./Components/Context/AppContext";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { MobilitySnackbarProp } from
"./Components/CommonComponents/MobilitySnackBar";
import MobilitySnackbar from "./Components/CommonComponents/MobilitySnackBar";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import MobilityConfirmDialog, {
MobilityConfirmDialogProp,
} from "./Components/CommonComponents/MobilityConfirmDialog";
import moment from "moment";
function App() {
const [loader, setLoader] = useState<MobilityLoaderProp>({});
const [snackbar, setSnackbar] = useState<MobilitySnackbarProp>({});
const [confirmDialog, setConfirmDialog] =
useState<MobilityConfirmDialogProp>(
{}
);
const [cancelledRidesFilter, setCancelledRidesFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [currentRidesFilter, setCurrentRidesFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [completedRidesFilter, setCompletedRidesFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [unassignedRidesFilter, setUnassignedRidesFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [driverRideStatsFilter, setDriverRideStatsFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [reportsFilter, setReportsFilter] = useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [broadcastFilter, setBroadcastFilter] = useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<[Link]
value={{
loader,
setLoader,
snackbar,
setSnackbar,
confirmDialog,
setConfirmDialog,
cancelledRidesFilter,
setCancelledRidesFilter,
currentRidesFilter,
setCurrentRidesFilter,
completedRidesFilter,
setCompletedRidesFilter,
unassignedRidesFilter,
setUnassignedRidesFilter,
driverRideStatsFilter,
setDriverRideStatsFilter,
reportsFilter,
setReportsFilter,
broadcastFilter,
setBroadcastFilter,
}}
>
<AppRouter />
<MobilityLoader loader={loader} />
<MobilitySnackbar snackbar={snackbar} />
<MobilityConfirmDialog dialog={confirmDialog} />
</[Link]>
</LocalizationProvider>
);
}
function App() {
const [loader, setLoader] = useState<MobilityLoaderProp>({});
const [snackbar, setSnackbar] = useState<MobilitySnackbarProp>({});
const [confirmDialog, setConfirmDialog] =
useState<MobilityConfirmDialogProp>(
{}
);
const [cancelledRidesFilter, setCancelledRidesFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [currentRidesFilter, setCurrentRidesFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [completedRidesFilter, setCompletedRidesFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [unassignedRidesFilter, setUnassignedRidesFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [driverRideStatsFilter, setDriverRideStatsFilter] =
useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [reportsFilter, setReportsFilter] = useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
const [broadcastFilter, setBroadcastFilter] = useState<RidesFilterProps>({
startDate: moment(),
endDate: moment(),
});
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<[Link]
value={{
loader,
setLoader,
snackbar,
setSnackbar,
confirmDialog,
setConfirmDialog,
cancelledRidesFilter,
setCancelledRidesFilter,
currentRidesFilter,
setCurrentRidesFilter,
completedRidesFilter,
setCompletedRidesFilter,
unassignedRidesFilter,
setUnassignedRidesFilter,
driverRideStatsFilter,
setDriverRideStatsFilter,
reportsFilter,
setReportsFilter,
broadcastFilter,
setBroadcastFilter,
}}
>
<AppRouter />
<MobilityLoader loader={loader} />
<MobilitySnackbar snackbar={snackbar} />
<MobilityConfirmDialog dialog={confirmDialog} />
</[Link]>
</LocalizationProvider>
);
}
85] ondc\Admin-portal-frontend\bpp_admin\src\[Link]
import ReactDOM from "react-dom/client";
import "./[Link]";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { BrowserRouter } from "react-router-dom";
import { UserProvider } from "./CustomUtils/usercontext";
import { ThemeProvider } from "@mui/material/styles";
import { theme } from "./Theme";
86] ondc\Admin-portal-frontend\bpp_admin\src\[Link]
<svg xmlns="[Link] viewBox="0 0 841.9 595.3"><g
fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-
114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8
19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-
18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9
53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28
31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9
14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4
66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4
63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6
36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-
130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-
4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8
106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-
8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-
39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3
11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7
39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-
15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4
18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-
2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5
15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-
18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6
8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5
125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7
27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-
6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4
19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84
46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9
2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1
63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-
13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4
15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle
cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
87] ondc\Admin-portal-frontend\bpp_admin\src\[Link]
/// <reference types="react-scripts" />
88] ondc\Admin-portal-frontend\bpp_admin\src\[Link]
import { ReportHandler } from 'web-vitals';
90] ondc\Admin-portal-frontend\bpp_admin\src\[Link]
import { createTheme } from "@mui/material/styles";
91] ondc\Admin-portal-frontend\bpp_admin\.gitignore
# See [Link] for more about ignoring
files.
# dependencies
/node_modules
/.pnp
.[Link]
[Link]
build
# testing
/coverage
# production
/build
# misc
.DS_Store
.[Link]
.[Link]
.[Link]
.[Link]
[Link]*
[Link]*
[Link]*
92] ondc\Admin-portal-frontend\bpp_admin\[Link]
{
"name": "ondc_admin_react",
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.13.7",
"@mui/material": "^5.13.7",
"@mui/styles": "^5.14.0",
"@mui/x-date-pickers": "^6.18.2",
"@react-google-maps/api": "^2.19.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/js-cookie": "^3.0.3",
"@types/lodash": "^4.14.195",
"@types/node": "^16.18.38",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"axios": "^1.4.0",
"dayjs": "^1.11.10",
"js-cookie": "^3.0.5",
"js-file-download": "^0.4.12",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-draggable": "^4.4.6",
"react-loading-overlay-ts": "^2.0.2",
"react-material-ui-carousel": "^3.4.2",
"react-router-dom": "^6.14.1",
"react-scripts": "5.0.1",
"recharts": "^2.12.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4",
"xlsx": "^0.18.5"
},
"scripts": {
"start": "set PORT=3004 && react-scripts start",
"start-mac": "PORT=3004 react-scripts start",
"build": "BUILD_PATH='../../driver-service/admin' react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
93] ondc\Admin-portal-frontend\bpp_admin\[Link]
# Getting Started with Create React App
## Available Scripts
**Note: this is a one-way operation. Once you `eject`, you canât go back!**
If you arenât satisfied with the build tool and configuration choices, you can
`eject` at any time. This command will remove the single build dependency from
your project.
Instead, it will copy all the configuration files and the transitive
dependencies (webpack, Babel, ESLint, etc) right into your project so you have
full control over them. All of the commands except `eject` will still work, but
they will point to the copied scripts so you can tweak them. At this point
youâre on your own.
You donât have to ever use `eject`. The curated feature set is suitable for
small and middle deployments, and you shouldnât feel obligated to use this
feature. However we understand that this tool wouldnât be useful if you
couldnât customize it when you are ready for it.
## Learn More
94] ondc\Admin-portal-frontend\bpp_admin\[Link]
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "[Link]", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"]
}
95]ondc\Admin-portal-frontend\super_admin\src\Components\ApiServices\
[Link]
import env from "../../config/env";
96] ondc\Admin-portal-frontend\super_admin\src\Components\ApiServices\
[Link]
import axios from "axios";
import Cookies from "js-cookie";
import { BASE_URL } from "./ApiConstants";
class ApiHandler {
getToken() {
let token = [Link]("bpp_admin_portal_ONDCAdminToken");
return token;
}
getPublicInstance() {
const publicInstance = [Link]({
baseURL: BASE_URL,
headers: {
"Content-Type": "application/json",
context: ["admin_portal"],
},
transformRequest: [
(data) => {
return [Link](data);
},
],
transformResponse: [
(data) => {
let isValidJSON = true;
try {
[Link](data);
} catch {
isValidJSON = false;
}
return isValidJSON ? [Link](data) : data;
},
],
});
return publicInstance;
}
getPrivateInstance() {
const instance = [Link]({
baseURL: BASE_URL,
headers: {
"Content-Type": "application/json",
context: ["admin_portal"],
Authorization: [Link](),
},
transformRequest: [
(data) => {
return [Link](data);
},
],
transformResponse: [
(data) => {
let isValidJSON = true;
try {
[Link](data);
} catch {
isValidJSON = false;
}
const parseData = isValidJSON ? [Link](data) :
data;
if (
parseData?.message?.message ===
"Unauthorized, token not available."
) {
[Link]("bpp_admin_portal_ONDCAdminToken");
}
return parseData;
},
],
});
return instance;
}
// function getToken() {
// let token = [Link]("bpp_portal_ONDCAdminToken");
// return token;
// }
97] ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import { alpha } from "@mui/material/styles";
import Box from "@mui/material/Box";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TablePagination from "@mui/material/TablePagination";
import TableRow from "@mui/material/TableRow";
import TableSortLabel from "@mui/material/TableSortLabel";
import Toolbar from "@mui/material/Toolbar";
import Typography from "@mui/material/Typography";
import Paper from "@mui/material/Paper";
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import FormControlLabel from "@mui/material/FormControlLabel";
import Switch from "@mui/material/Switch";
import DeleteIcon from "@mui/icons-material/Delete";
import FilterListIcon from "@mui/icons-material/FilterList";
import { visuallyHidden } from "@mui/utils";
import { PropsOf } from "@emotion/react";
import { Button as MUIButton } from "@mui/material";
interface EnhancedTableProps {
numSelected: number;
onRequestSort: (event: [Link]<unknown>, property: string) =>
void;
onSelectAllClick: (event: [Link]<HTMLInputElement>) => void;
order: Order;
orderBy: string;
rowCount: number;
headers: any;
}
const tableRowStyle = {
//cursor: "pointer",
//backgroundColor: "#f0f0f0",
//borderRadius: 2,
};
return (
<TableHead>
<TableRow>
{/* <TableCell padding="checkbox">
<Checkbox
color="primary"
indeterminate={numSelected > 0 &&
numSelected < rowCount}
checked={rowCount > 0 && numSelected ===
rowCount}
onChange={onSelectAllClick}
inputProps={{
"aria-label": "select all desserts",
}}
/>
</TableCell> */}
{[Link]((headCell: any) => (
<TableCell
style={{
padding: 10,
}}
key={[Link]}
//align={[Link] ? "right" :
"left"}
padding={[Link] ? "none" :
"normal"}
sortDirection={orderBy === [Link] ?
order : false}
>
{[Link] ? (
<Typography style={{ fontWeight:
800 }}>
{[Link]}
</Typography>
) : (
<TableSortLabel
active={orderBy === [Link]}
direction={orderBy ===
[Link] ? order : "asc"}
onClick={createSortHandler([Link])}
>
{/* {[Link]} */}
<Typography style={{ fontWeight:
800 }}>
{[Link]}
</Typography>
{orderBy === [Link] ? (
<Box component="span"
sx={visuallyHidden}>
{order === "desc"
? "sorted
descending"
: "sorted
ascending"}
</Box>
) : null}
</TableSortLabel>
)}
</TableCell>
))}
</TableRow>
</TableHead>
);
}
interface EnhancedTableToolbarProps {
numSelected: number;
}
return (
<Toolbar
sx={{
pl: { sm: 2 },
pr: { xs: 1, sm: 1 },
...(numSelected > 0 && {
bgcolor: (theme) =>
alpha(
[Link],
[Link]
),
}),
}}
>
{/* {numSelected > 0 ? (
<Typography
sx={{ flex: "1 1 100%" }}
color="inherit"
variant="subtitle1"
component="div"
>
{numSelected} selected
</Typography>
) : (
<Typography
sx={{ flex: "1 1 100%" }}
variant="h6"
id="tableTitle"
component="div"
>
</Typography>
)} */}
{/* {numSelected > 0 ? (
<Tooltip title="Delete">
<IconButton>
<DeleteIcon />
</IconButton>
</Tooltip>
) : (
<Tooltip title="Filter list">
<IconButton>
<FilterListIcon />
</IconButton>
</Tooltip>
)} */}
</Toolbar>
);
}
interface EnhancedTableMainProps {
headers: any[];
tableData: any;
rowProps?: any;
navigate?: any;
}
const handleRequestSort = (
event: [Link]<unknown>,
property: string
) => {
const isAsc = orderBy === property && order === "asc";
setOrder(isAsc ? "desc" : "asc");
setOrderBy(property);
};
// const handleClick = (
// event: [Link]<unknown>,
// id: string | number
// ) => {
// const selectedIndex = [Link](id);
// let newSelected: readonly number[] = [];
const handleChangeRowsPerPage = (
event: [Link]<HTMLInputElement>
) => {
setRowsPerPage(parseInt([Link], 10));
setPage(0);
};
// Avoid a layout jump when reaching the last page with empty rows.
const emptyRows =
page > 0
? [Link](0, (1 + page) * rowsPerPage -
[Link])
: 0;
return (
<Box sx={{ width: "100%" }}>
<Paper sx={{ width: "100%" }}>
{/* <EnhancedTableToolbar numSelected={0} /> */}
<TableContainer sx={{ maxHeight: 500 }}>
<Table
stickyHeader
sx={{ minWidth: 500 }}
aria-labelledby="tableTitle"
>
<TableHead>
<TableRow>
{/* {[Link]((headCell,
index) => (
<TableCell
key={index}
align={[Link] ? "right" : "left"}
padding={[Link] ? "none" : "normal"}
>
{[Link] ? (
[Link]
) : (
<TableSortLabel
active={orderBy === [Link]}
direction={orderBy === [Link] ? order : "asc"}
onClick={(event) =>
handleRequestSort(event, [Link])
}
>
{[Link]}
</TableSortLabel>
)}
</TableCell>
))} */}
{[Link]((header, index) => (
<TableCell
style={{
padding: 10,
backgroundColor: "#eee",
width:
{[Link]}
</Typography>
) : (
<TableSortLabel
{[Link]}
</Typography>
</TableSortLabel>
)}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{[Link]((row, index) => (
<TableRow key={index} sx={{}}>
{[Link]((header,
headerIndex) => (
<TableCell
style={{
padding:
10,
width:
? "10px"
: "auto",
}}
key={headerIndex}
98]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import { FC, ReactElement } from "react";
import { Paper, Typography } from "@mui/material";
99] ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import React, { FC, ReactElement, useState } from "react";
import { Card, Grid, Typography, useMediaQuery } from "@mui/material";
import { useUserDispatch } from "../../CustomUtils/usercontext";
import { apiHandler } from "../ApiServices/ApiHandler";
import { ADMIN_LOGIN } from "../ApiServices/ApiConstants";
import { setCookies } from "../../CustomUtils/CookiesUtils";
import MobilityTextField from "./MobilityTextField";
import MobilityButton from "./MobilityButton";
import { ShowSnackbarFailure, ShowSnackbarSuccess } from "./MobilitySnackBar";
import { AppContext } from "../Context/AppContext";
const {
clientsInfo = {},
userInfo = {},
token = {},
} = loginResponse?.data?.data || {};
if (
([Link](clientsInfo) && [Link]
> 0) ||
[Link] === 200
) {
let userRedirct = [Link](
(el: { clientName: string }): any =>
[Link] ===
userInfo?.defaultPortal
);
setCookies("bpp_admin_portal_ONDCAdminToken", token);
setCookies("bpp_admin_portal_UserName",
[Link]);
setCookies(
"bpp_admin_portal_ClientInfo",
[Link](clientsInfo)
);
ShowSnackbarSuccess("Logged in
Successfully", myContext);
} else {
ShowSnackbarFailure("Please enter valid
Credentials", myContext);
disptch("LOGIN_FAILURE");
}
} else {
disptch("LOGIN_FAILURE");
}
}
} catch (error) {
ShowSnackbarFailure(error, myContext);
} finally {
[Link]({
isLoading: false,
});
}
};
src={require("../../assets/Logo_digital.png")}
height="100px"
/>
</Grid>
<Grid item>
<Typography style={{ fontWeight: 800,
fontSize: 20 }}>
Super (Driver) Admin Login Portal
</Typography>
</Grid>
<Grid item md={12} xs={12} sx={{ marginTop: 2 }}>
<MobilityTextField
label="Phone"
type="text"
name="phone"
required={true}
value={phone}
maxLength={10}
onChange={(event:
[Link]<HTMLInputElement>) => {
setUserDetails(event);
}}
/>
</Grid>
<Grid item md={12} xs={12}>
<MobilityTextField
type={showPassword ? "text" :
"password"}
name="password"
label="Password"
value={password}
showPassword={showPassword}
onChange={(event:
[Link]<HTMLInputElement>) => {
setUserDetails(event);
}}
onIconClick={(event:
[Link]<HTMLButtonElement>) => {
handleClickShowPassword();
}}
/>
</Grid>
<Grid item>
<MobilityButton
label="Login"
onClick={(event:
[Link]<HTMLButtonElement>) => {
OnSubmit();
}}
/>
</Grid>
</Grid>
</Card>
</Grid>
);
};
100] ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import styled from "@emotion/styled";
import {ExpandMore} from "@mui/icons-material";
import {
AccordionSummary,
Grid,
} from "@mui/material";
import React from "react";
import MuiAccordionDetails from "@mui/material/AccordionDetails";
import MuiAccordion, { AccordionProps } from "@mui/material/Accordion";
export interface MobilityAccordionprops {
title: any;
summary?: any;
details: any;
isExpanded: boolean;
}
{props?.summary}
</Grid>
</AccordionSummary>
<AccordionDetails>{props?.details}</AccordionDetails>
</Accordion>
</div>
);
}
101] ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import Box from "@mui/material/Box";
import Menu from "@mui/material/Menu";
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import Settings from "@mui/icons-material/Settings";
import Logout from "@mui/icons-material/Logout";
import { MoreVert } from "@mui/icons-material";
102] ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import { Card, Grid } from "@mui/material";
import { MobilityButtonIconBack } from "./MobilityButtonIcon";
return (
<Card sx={{ display: "flex", justifyContent: "space-between" }}>
<Grid container>
<Grid item sx={{ padding: 1 }}>
<MobilityButtonIconBack
onClick={props?.onBackClick} />
</Grid>
<Grid item sx={{ alignItems: "center", display:
"flex" }}>
{props?.title}
</Grid>
</Grid>
<Grid
container
sx={{
alignItems: "center",
justifyContent: "end",
marginRight: 1,
}}
>
{props?.menus}
</Grid>
</Card>
);
}
103] ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import React from "react";
import { Button } from "@mui/material";
import { Add, Place } from "@mui/icons-material";
interface MobilityButtonProps {
label: string;
icon?: any;
disabled?: boolean;
variant?: any;
style?: [Link];
onClick: (event: [Link]<HTMLButtonElement>) => void;
}
104] ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import React from "react";
import { Avatar, IconButton, Tooltip } from "@mui/material";
import {
ArrowBack,
Autorenew,
BorderColorOutlined,
CancelOutlined,
TaskAlt,
TrendingUp,
Visibility,
} from "@mui/icons-material";
import _ from "lodash";
interface MobilityButtonIconProps {
color?: any;
label?: string;
disabled?: boolean;
icon?: any;
tooltipTitle?: string;
onClick: (event: [Link]<HTMLButtonElement>) => void;
}
105] ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import { Chip } from "@mui/material";
return props?.clickable ? (
<Chip
size={"small"}
color={textColor}
label={props?.label}
onClick={props?.onClick}
icon={props?.icon}
disabled={props?.disabled}
/>
) : (
<Chip
size={"small"}
color={textColor}
label={props?.label}
disabled={props?.disabled}
/>
);
}
106]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import Button from "@mui/material/Button";
import Dialog from "@mui/material/Dialog";
import DialogActions from "@mui/material/DialogActions";
import DialogContent from "@mui/material/DialogContent";
import DialogContentText from "@mui/material/DialogContentText";
import DialogTitle from "@mui/material/DialogTitle";
import { AppContext } from "../Context/AppContext";
import { styled } from "@mui/material/styles";
import { IconButton, Typography } from "@mui/material";
import { Close, ClosedCaption } from "@mui/icons-material";
import MobilityButton from "./MobilityButton";
function handleOnClose() {
[Link]({ open: false });
}
return (
<[Link]>
<BootstrapDialog open={props?.dialog?.open ?
props?.dialog?.open : false}>
<DialogTitle sx={{ m: 0, p: 2 }} style={{ fontWeight:
600 }}>
{props?.dialog?.title}
</DialogTitle>
<IconButton
onClick={handleOnClose}
sx={{
position: "absolute",
right: 8,
top: 8,
color: (theme) => [Link][500],
}}
>
<Close />
</IconButton>
<DialogContent>
<Typography>{props?.dialog?.message}</Typography>
</DialogContent>
<DialogActions
sx={{
marginRight: 1,
marginBottom: 1,
}}
>
<MobilityButton
label="No"
variant="outlined"
onClick={handleOnClose}
/>
<MobilityButton label="Yes"
onClick={handleOnYes} />
</DialogActions>
</BootstrapDialog>
</[Link]>
);
}
107]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import { Grid, Typography } from "@mui/material";
108]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import { Grid, Link, Tooltip, Typography } from "@mui/material";
import React from "react";
import MobilityImg from "./MobilityImg";
import { formatDate } from "../../CustomUtils/DateTimeUtils";
{heading?.docNumber && (
<MobilityHeadingValue
heading={"Doc. Number"}
value={heading?.docNumber}
/>
)}
{heading?.expiryDate && (
<MobilityHeadingValue
heading={"Doc. Expiry Date"}
value={formatDate(heading?.expiryDate)}
/>
)}
{heading?.dateOfBirth && (
<MobilityHeadingValue
heading={"Date of Birth"}
value={formatDate(heading?.dateOfBirth)}
/>
)}
</Grid>
<Grid
xs={12}
container
sx={{ marginTop: 1 }}
justifyContent="center"
alignItems="center"
>
<MobilityImg imgUrl={[Link]} />
</Grid>
</Grid>
);
return (
<ImgHeading
heading={[Link]}
value={[Link]}
imgUrl={[Link]}
/>
);
}
109]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import {
Close,
RotateLeft,
RotateRight,
ZoomIn,
ZoomOut,
} from "@mui/icons-material";
import {
Dialog,
DialogActions,
DialogContent,
DialogTitle,
IconButton,
} from "@mui/material";
import React, { useState } from "react";
import { MobilityChip } from "./MobilityChip";
import env from "../../config/env";
const BASE_URL: string = env.API_BASE_URL;
return (
<div>
<div>
<img src={`${BASE_URL}/${[Link]}`} height={200}
width={300}></img>
</div>
<ImageDialog
imageUrl={`${BASE_URL}/${[Link]}`}
selectedValue={selectedValue}
open={open}
onClose={handleClose}
/>
<div
style={{
display: "flex",
flex: 1,
alignItems: "flex-end",
}}
>
<MobilityChip
icon={<ZoomIn />}
clickable={true}
label="Zoom Image"
onClick={(e: any) => {
setOpen(true);
}}
/>
</div>
</div>
);
}
return (
<Dialog onClose={handleClose} open={open}>
<DialogTitle sx={{ backgroundColor: "#eaeaea" }}>
Image Viewer
</DialogTitle>
<IconButton
aria-label="close"
onClick={handleClose}
sx={{
position: "absolute",
right: 8,
top: 16,
}}
>
<Close />
</IconButton>
<DialogContent>
<div>
<img
src={props?.imageUrl}
style={{
transform: `rotate(${rotate}deg)
scale(${zoom})`,
maxHeight: "80vh",
}}
/>
</div>
</DialogContent>
<DialogActions
sx={{ backgroundColor: "#eaeaea", justifyContent:
"center" }}
>
<IconButton
onClick={() => {
setRotate(rotate - 90);
}}
>
<RotateLeft />
</IconButton>
<IconButton
onClick={() => {
setRotate(rotate + 90);
}}
>
<RotateRight />
</IconButton>
<IconButton
onClick={() => {
setZoom(zoom === 2 ? zoom : zoom + 0.25);
}}
>
<ZoomIn />
</IconButton>
<IconButton
onClick={() => {
setZoom(zoom === 0.25 ? zoom : zoom - 0.25);
}}
>
<ZoomOut />
</IconButton>
</DialogActions>
</Dialog>
);
}
110]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import React from "react";
import {
List,
ListItem,
ListItemButton,
ListItemIcon,
ListItemText,
Tooltip,
} from "@mui/material";
import { MenuItemProps } from "./NavigationDrawerNew";
<ListItemText>
<div
style={{
fontWeight: selectedIndex ===
[Link] ? "bolder" : "normal",
}}
>
{[Link]}
</div>
</ListItemText>
</ListItemButton>
</ListItem>
);
});
return <List>{itemsList}</List>;
}
111]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import React from "react";
import {
ListItemIcon,
MenuItem,
Typography,
} from "@mui/material";
import {
Assignment,
Autorenew,
BorderColorOutlined,
CancelOutlined,
DriveEta,
TaskAlt,
TrendingUp,
Visibility,
} from "@mui/icons-material";
interface MobilityListItemProps {
label?: any;
icon?: any;
color?: any;
disabled?: boolean;
onClick?: (event: [Link]<HTMLLIElement>) => void;
}
113]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import React, { FC, ReactElement } from "react";
import {
Button,
FormControl,
InputLabel,
MenuItem,
Paper,
Select,
SelectChangeEvent,
SelectProps,
TextField,
Typography,
} from "@mui/material";
import LoadingOverlayWrapper from "react-loading-overlay-ts";
interface MobilityLoaderProps {
text: string;
isLoading: boolean;
children: any;
}
114]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import {
FormControl,
InputLabel,
MenuItem,
Select,
SelectChangeEvent,
} from "@mui/material";
interface MobilitySelectProps {
label: string;
value: HTMLSelectElement;
disabled?: boolean;
statusOptions: string[];
onChange: (event: SelectChangeEvent<HTMLSelectElement>) => void;
}
115]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import Stack from "@mui/material/Stack";
import Snackbar from "@mui/material/Snackbar";
import MuiAlert, { AlertColor, AlertProps } from "@mui/material/Alert";
import { AppContext, AppContextPropTypes } from "../Context/AppContext";
[Link]({
open: true,
severity: "success",
message: message,
});
}
[Link]({
open: true,
severity: "error",
message: message,
});
}
116]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import {
Button,
Dialog,
DialogContent,
DialogTitle,
Grid,
} from "@mui/material";
import MobilitySelect from "./MobilitySelect";
import { AppContext } from "../Context/AppContext";
import { ShowSnackbarFailure, ShowSnackbarSuccess } from "./MobilitySnackBar";
import { apiHandler } from "../ApiServices/ApiHandler";
import { UPDATE_ENTITY_SUBSCRIPTION_PLAN } from "../ApiServices/ApiConstants";
interface issueFormProps {
issueData?: any;
openDialog: boolean;
setOpenDialog: any;
title: string;
entityId: string;
planType: string;
}
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
const submitButtonStyle = {
marginTop: "25px",
display: "flex",
justifyContent: "center",
};
const MobilitySubscriptionDialog: [Link]<issueFormProps> = ({
issueData,
openDialog,
setOpenDialog,
title,
entityId,
planType,
}) => {
let myContext = [Link](AppContext);
function handleClose() {
setOpenDialog(false);
}
return (
<Dialog
open={openDialog}
onClose={handleClose}
PaperProps={{
style: {
width: "auto",
minWidth: "25vw",
maxWidth: "75vw",
height: "auto",
maxHeight: "75vh",
},
}}
>
<DialogTitle
style={{
backgroundColor: "#e2e2e2",
textAlign: "center",
marginBottom: "10px",
}}
>
{title}
</DialogTitle>
<DialogContent style={{ padding: "15px" }}>
<form onSubmit={handleSubmit}>
<Grid container spacing={4}>
<Grid item xs={12}>
<MobilitySelect
label="Subscription Type"
value={selectedSubscription}
onChange={(event: any) =>
setselectedSubscription([Link])
}
statusOptions={subscriptionOptions}
/>
</Grid>
</Grid>
117]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import React, { useState } from "react";
import { IconButton, InputAdornment, TextField } from "@mui/material";
import VisibilityIcon from "@mui/icons-material/Visibility";
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
import {
ValidateAccountNumber,
ValidateAddress,
ValidateEmail,
ValidateIfscCode,
ValidateMicrCode,
ValidateMobile,
ValidateMultiplier,
ValidateName,
ValidateNumber,
ValidatePincode,
} from "../../CustomUtils/ValidationUtils";
interface MobilityTextFieldProps {
label: string;
type: string;
name: string;
value: string;
required?: boolean;
disabled?: boolean;
maxLength?: number;
helperText?: string;
showPassword?: boolean;
fullWidth?: boolean;
onChange: (event: [Link]<HTMLInputElement>) => void;
onIconClick?: (event: [Link]<HTMLButtonElement>) => void;
}
case "accountNumber":
if (ValidateAccountNumber([Link])) {
setHelperText("");
setError(false);
} else {
setHelperText("Please Enter Valid Account Number");
setError(true);
}
break;
case "number":
if (ValidateNumber([Link])) {
setHelperText("");
setError(false);
} else {
setHelperText("");
setError(true);
}
break;
case "multiplier":
if (ValidateMultiplier([Link])) {
setHelperText("");
setError(false);
} else {
setHelperText("");
setError(true);
}
break;
case "search":
break;
case "alphaNumeric":
break;
default:
if (ValidateName([Link])) {
setHelperText("");
setError(false);
} else {
setHelperText(`Please Enter Valid Value`);
setError(true);
}
break;
}
}
return (
<TextField
fullWidth={props?.fullWidth === false ? false : true}
variant="outlined"
name={[Link]}
type={[Link]}
label={[Link]}
value={[Link]}
required={[Link]}
helperText={helperText}
error={error}
disabled={[Link] ? [Link] : false}
color={"success"}
size={props?.name === "search" ? "small" : "medium"}
onChange={(event: [Link]<HTMLInputElement>) => {
validate([Link]);
[Link](event);
}}
inputProps={
[Link]
? {
maxLength: [Link],
}
: { maxLength: 100 }
}
InputProps={
props?.name === "password"
? {
endAdornment: (
<InputAdornment position="end">
<IconButton
aria-label="Toggle Password Visibility"
onClick={props?.onIconClick}
>
{props?.showPassword ? (
<VisibilityIcon />
) : (
<VisibilityOffIcon />
)}
</IconButton>
</InputAdornment>
),
}
: {}
}
/>
);
}
118]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import { TimePicker } from "@mui/x-date-pickers/TimePicker";
import {
DateValidationError,
PickerChangeHandlerContext,
TimeValidationError,
} from "@mui/x-date-pickers";
import dayjs, { Dayjs } from "dayjs";
interface MobilityTimePickerProps {
label: string;
value?: Dayjs| null;
disabled?: boolean;
onChange?: (
value: Dayjs | null,
) => void;
}
function MobilityTimePicker(props: MobilityTimePickerProps) {
return <TimePicker label={[Link]} onChange={[Link]}
disabled={[Link] ? [Link] : false}
/>;
}
119]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
interface Props {
window?: () => Window;
children?: any;
}
// const container =
// window !== undefined ? () => window().[Link] : undefined;
return (
<>
<CssBaseline />
<AppBar
position="fixed"
sx={{
backgroundColor: "#FFFF",
width: { sm: `calc(100% - ${drawerWidth}px)` },
ml: { sm: `${drawerWidth}px` },
}}
>
<Toolbar>
<IconButton
edge="start"
onClick={handleDrawerToggle}
sx={{ mr: 2, display: { sm: "none" } }}
>
<MenuIcon sx={{ color: "black" }} />
</IconButton>
<IconButton
onClick={() => {
setToolbarOpen(!toolbarOpen);
}}
sx={{ position: "absolute", right: "5px" }}
>
AD
</IconButton>
</Toolbar>
{toolbarOpen && (
<Card
sx={{
width: 200,
height: 200,
position: "absolute",
right: "25px",
top: "30px",
}}
>
<List>
<ListItem button onClick={LogOut}>
<LogoutIcon />
Log Out
</ListItem>
</List>
</Card>
)}
</AppBar>
<Box
component="nav"
sx={{ width: { sm: drawerWidth }, flexShrink: { sm:
0 } }}
aria-label="mailbox folders"
>
<Drawer
// container={container}
variant="temporary"
open={mobileOpen}
onClose={handleDrawerToggle}
ModalProps={{
keepMounted: true,
}}
sx={{
display: { xs: "block", sm: "none" },
"& .MuiDrawer-paper": {
boxSizing: "border-box",
width: drawerWidth,
},
}}
>
{drawer}
</Drawer>
<Drawer
variant="permanent"
sx={{
display: { xs: "none", sm: "block" },
"& .MuiDrawer-paper": {
boxSizing: "border-box",
width: drawerWidth,
},
}}
open
>
{drawer}
</Drawer>
</Box>
</>
);
}
120]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import * as React from "react";
import { styled, useTheme, Theme, CSSObject } from "@mui/material/styles";
import Box from "@mui/material/Box";
import MuiDrawer from "@mui/material/Drawer";
import MuiAppBar, { AppBarProps as MuiAppBarProps } from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
import List from "@mui/material/List";
import CssBaseline from "@mui/material/CssBaseline";
import Divider from "@mui/material/Divider";
import IconButton from "@mui/material/IconButton";
import MenuIcon from "@mui/icons-material/Menu";
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import ListItem from "@mui/material/ListItem";
import ListItemButton from "@mui/material/ListItemButton";
import ListItemText from "@mui/material/ListItemText";
import { useNavigate } from "react-router";
import {
AirlineSeatReclineNormal,
BugReport,
ElectricCar,
DriveEta,
Logout,
Subscript,
Visibility,
EmojiTransportation,
} from "@mui/icons-material";
import { Button, Card, Grid, Icon, Typography } from "@mui/material";
import Cookies from "js-cookie";
import { useUserDispatch } from "../../CustomUtils/usercontext";
import env from "../../config/env";
import MobilityList from "./MobilityList";
import { MobilityButtonIcon } from "./MobilityButtonIcon";
import MobilityButton from "./MobilityButton";
function getUsername() {
const temp: any =
[Link]("bpp_admin_portal_UserName")?.toString();
SetUsername(temp);
}
[Link](() => {
getUsername();
});
return (
<Box sx={{ display: "flex" }}>
<CssBaseline />
<AppBar position="fixed" open={open}>
<Toolbar style={{ backgroundColor: "white" }}>
<IconButton
color="primary"
aria-label="open drawer"
onClick={open ? handleDrawerClose :
handleDrawerOpen}
edge="start"
sx={{
marginRight: 5,
//...(open && { display: "none" }),
}}
>
{<MenuIcon />}
{/* {!open && <MenuIcon />}
{open && <ChevronLeftIcon />} */}
</IconButton>
<Typography
//variant="h6"
component="div"
sx={{ flexGrow: 1 }}
color={"InfoText"}
>
Super Admin
</Typography>
<MobilityButtonIcon
label={username}
onClick={(event:
[Link]<HTMLButtonElement>) => {
setToolbarOpen(!toolbarOpen);
}}
></MobilityButtonIcon>
{/* <img
style={{
cursor: "pointer",
}}
src={require("../../assets/Logo_digital.png")}
alt="logo"
height="55px"
/> */}
{/* <IconButton
onClick={() => {
setToolbarOpen(!toolbarOpen);
}}
sx={{ center: "10px" }}
>
{username}
</IconButton> */}
</Toolbar>
{toolbarOpen && (
<Card
sx={{
position: "absolute",
right: "5vh",
top: "50px",
}}
>
<List>
<ListItem
disablePadding={true}
onClick={LogOut}
onMouseOver={() =>
setToolbarOpen(true)}
onMouseOut={() =>
setToolbarOpen(false)}
>
<ListItemButton>
<Logout />
<ListItemText
primary="Logout" style={{ marginLeft: 10 }} />
</ListItemButton>
</ListItem>
</List>
</Card>
)}
</AppBar>
<Drawer variant="permanent" open={open}>
<DrawerHeader>
<img
src={require("../../assets/Logo_digital.png")}
height="60px"
style={{ cursor: "pointer" }}
onClick={() => navigate("/")}
/>
{/* <IconButton onClick={handleDrawerClose}>
{[Link] === "rtl" ? (
<ChevronRightIcon color="primary" />
) : (
<ChevronLeftIcon color="primary" />
)}
</IconButton> */}
</DrawerHeader>
<Divider />
<MobilityList items={menus} />
{/* <List>
{["Inbox", "Starred", "Send email",
"Drafts"].map((text, index) => (
<ListItem key={text} disablePadding
sx={{ display: "block" }}>
<ListItemButton
sx={{
minHeight: 48,
justifyContent: open ?
"initial" : "center",
px: 2.5,
}}
>
<ListItemIcon
sx={{
minWidth: 0,
mr: open ? 3 :
"auto",
justifyContent:
"center",
}}
>
{index % 2 === 0 ?
<InboxIcon /> : <MailIcon />}
</ListItemIcon>
<ListItemText primary={text}
sx={{ opacity: open ? 1 : 0 }} />
</ListItemButton>
</ListItem>
))}
</List> */}
{/* <Divider /> */}
{/* <List>
{["All mail", "Trash", "Spam"].map((text, index)
=> (
<ListItem key={text} disablePadding
sx={{ display: "block" }}>
<ListItemButton
sx={{
minHeight: 48,
justifyContent: open ?
"initial" : "center",
px: 2.5,
}}
>
<ListItemIcon
sx={{
minWidth: 0,
mr: open ? 3 :
"auto",
justifyContent:
"center",
}}
>
{index % 2 === 0 ?
<InboxIcon /> : <MailIcon />}
</ListItemIcon>
<ListItemText primary={text}
sx={{ opacity: open ? 1 : 0 }} />
</ListItemButton>
</ListItem>
))}
</List> */}
</Drawer>
{/* <Box component="main" sx={{ flexGrow: 1, p: 3 }}>
<DrawerHeader />
</Box> */}
</Box>
);
}
121]ondc\Admin-portal-frontend\super_admin\src\Components\CommonComponents\
[Link]
import { Box } from "@mui/material";
import { FC, ReactElement } from "react";
import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
src="[Link]
9 "
alt=""
width="50px"
height="50px"
/>
</Toolbar>
</AppBar>
</Box>
);
};
122]ondc\Admin-portal-frontend\super_admin\src\Components\Context\
[Link]
import { createContext } from "react";
import { MobilityLoaderProp } from "../CommonComponents/MobilityLoader";
import { MobilitySnackbarProp } from "../CommonComponents/MobilitySnackBar";
import { MobilityConfirmDialogProp } from
"../CommonComponents/MobilityConfirmDialog";
123]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Drivers\[Link]
import React, { FC, ReactElement, useState } from "react";
import {
Card,
Grid,
Typography,
Divider,
Paper,
Tabs,
Tab,
} from "@mui/material";
import { useLocation } from "react-router-dom";
import { useSearchParams, useNavigate } from "react-router-dom";
import { useUserDispatch } from "../../../CustomUtils/usercontext";
import { isEmpty } from "lodash";
import { CancelOutlined, TaskAlt } from "@mui/icons-material";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import MobilitySelect from "../../CommonComponents/MobilitySelect";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { AppContext } from "../../Context/AppContext";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import { MobilityImgHeading } from
"../../CommonComponents/MobilityHeadingValue";
import MobilityAccordion from "../../CommonComponents/MobilityAccordion";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import {
MobilityListItemApprove,
MobilityListItemEdit,
MobilityListItemReject,
} from "../../CommonComponents/MobilityListItem";
import MobilityActionMenu from "../../CommonComponents/MobilityActionMenu";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
CHANGE_DOCUMENT_STATUS,
CHANGE_VEHICLE_STATUS_BY_ADMIN,
EDIT_DRIVER,
GET_DRIVER_DETAILS_BY_ID,
} from "../../ApiServices/ApiConstants";
const DriverDetails: FC = (): ReactElement => {
let myContext = [Link](AppContext);
const id = [Link]("id");
const entityId = [Link]("entityId");
let isEdit = [Link]("isEdit");
if (!isEmpty(response)) {
const { data } = [Link];
setDriverDetails({
firstName: [Link]?.firstName || "",
lastName: [Link]?.lastName || "",
phone: [Link]?.phone || "",
city: [Link]?.city || "",
status: [Link]?.status || "",
email: [Link]?.email || "",
driverId: [Link]?._id ||
[Link]?.id || "",
entityId: [Link]?.entityId || "",
documents: [Link]?.documents,
});
setVehicleDetails([Link]);
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({ isLoading: false });
}
}
const validateData = () => {
try {
if (!driverDetails?.firstName ||
driverDetails?.firstName?.length == 0) {
ShowSnackbarFailure("Please Enter First Name",
myContext);
return false;
}
if (!driverDetails?.lastName ||
driverDetails?.lastName?.length == 0) {
ShowSnackbarFailure("Please Enter Last Name",
myContext);
return false;
}
if (!driverDetails?.city || driverDetails?.city?.length == 0)
{
ShowSnackbarFailure("Please Enter City", myContext);
return false;
}
if (!driverDetails?.email || driverDetails?.email?.length ==
0) {
ShowSnackbarFailure("Please Enter Email", myContext);
return false;
}
return true;
} catch (error) {
}
};
async function handleSubmit(event: [Link]) {
[Link]();
if (validateData()) {
try {
[Link]({
isLoading: true,
message: "Updating Driver Details...",
});
const requestBody = {
// ...driverDetails,
driverId: [Link],
firstName: [Link],
lastName: [Link],
city: [Link],
email: [Link],
status: [Link],
};
// const res: Iresponse = await [Link](
// `/api/edit-driver?entityId=${entityId}`,
// requestBody
// //{ params: { entityId } }
// );
const res: Iresponse = await [Link](
`${EDIT_DRIVER}?entityId=${entityId}`,
requestBody
//{ params: { entityId } }
);
if (isEmpty(res)) {
apiCall();
}
if ([Link] === 200) {
ShowSnackbarSuccess("Driver details Updated
Successfully", myContext);
navigate(-1);
} else {
ShowSnackbarFailure(res, myContext);
[Link]("error.", res);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({ isLoading: false });
}
}
}
[Link](() => {
apiCall();
}, []);
const cardStyle = {
// padding: "26px",
margin: "auto",
width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
};
const buttonStyle = {
marginTop: "25px",
};
const styles = {
extendedTab: {
//minWidth: "500px",
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
function detailsData() {
return (
<>
<Grid container spacing={4} sx={{ padding: 3 }}>
<Grid item xs={12} sm={6}>
<MobilityTextField
disabled={isEdit ? true : false}
label="First Name"
name="firstName"
type="text"
maxLength={10}
value={driverDetails?.firstName || ""}
onChange={(event: any) => {
setDriverDetails({
...driverDetails,
firstName:
[Link],
});
}}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilityTextField
disabled={isEdit ? true : false}
label="Last Name"
name="lastName"
type="text"
value={driverDetails?.lastName || ""}
onChange={(event: any) => {
setDriverDetails({
...driverDetails,
lastName:
[Link],
});
}}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilityTextField
label="Phone"
name="phone"
type="text"
disabled={true}
value={driverDetails?.phone || ""}
onChange={(e) =>
setDriverDetails({
...driverDetails,
phone: [Link],
})
}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilityTextField
disabled={isEdit ? true : false}
label="City"
name="city"
type="text"
value={driverDetails?.city || ""}
onChange={(e) =>
{!isEdit && (
<Grid container sx={{ marginTop: 4,
justifyContent: "flex-end" }}>
<MobilityButton label="Submit"
onClick={handleSubmit} />
</Grid>
)}
</Grid>
</>
);
}
function documentsData() {
return (
<Grid container item xs={12} md={12} spacing={1} padding={2}>
{driverDetails?.documents?.map((item: any) => {
return (
<Grid item xs={12} md={6}>
<MobilityAccordion
isExpanded={false}
title={getTitle(item)}
summary={getSummary(item)}
details={
<>
<MobilityImgHeading
heading={item}
value=""
imgUrl={[Link]}
//
heading={undefined}
/>
{/* <MobilityImg
imgUrl={[Link]}/> */}
</>
}
/>
</Grid>
);
})}
</Grid>
);
}
const EnhancedTableConfig = {
headers: [
{
id: "VehicleName",
numeric: false,
disablePadding: true,
label: "Vehicle Name",
disableSort: true,
},
{
id: "registrationNumber",
numeric: true,
disablePadding: true,
label: "Registration Number",
disableSort: true,
},
{
id: "model",
numeric: false,
disablePadding: true,
label: "Model",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "docNew",
numeric: false,
disablePadding: true,
label: "Documents",
disableSort: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
navigate: (item: any) => {
navigate(`${[Link]}?id=${[Link]}`);
},
};
if (err?.message) {
} finally {
[Link]({
isLoading: false,
});
}
};
const approveAction = (vehicle: any) => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you want to proceed?",
onYesClick: () => {
changeVehicleStatus(
"Active", //"Approved"
[Link],
0,
1
);
},
});
//
};
//
};
const editAction = (vehicle: any) => {
navigate(`${vehicleDetailsPath}?id=${[Link]}
&selectedTab=details`);
};
let filteredVehicleList = [Link]((vehicle: any) => {
return {
id: vehicle?._id || vehicle?.id,
VehicleName: vehicle?.name,
registrationNumber: vehicle?.registrationNumber,
status: <MobilityChip label={vehicle?.status} />,
statusFilter: vehicle?.status,
navigate(
`${vehicleDetailsPath}?id=$
{vehicle?.id} &selectedTab=documents`
);
}}
/>
);
if (vehicle?.documents?.length > 0) {
return docIcon;
}
//
return null;
})(),
actionNew: (() => {
const commonIconContainerStyle = {
display: "flex",
justifyContent: "center",
};
return (
<div style={commonIconContainerStyle}>
<MobilityActionMenu items={menuList} />
</div>
);
})(),
model: vehicle?.model,
// path: vehicleDetailsPath,
};
});
function vehiclesData() {
return (
<Grid container item xs={12} md={12} spacing={1} padding={2}>
<Grid item xs={12} md={12}>
<EnhancedTable
headers={[Link]}
tableData={filteredVehicleList}
/>
</Grid>
</Grid>
);
}
const handleApprove = async (status: any, docId: any, parentId: any) => {
try {
[Link]({
isLoading: true,
message: "Updated document status...",
});
const payload = {
status,
docId,
parentId,
};
setIsLoading(true);
const updatedDocuments =
response?.data?.data?.updatedEntity?.documents;
[Link]((selectedDoc: any) => ({
...selectedDoc,
parentId: parentId,
}));
return (
<Grid>
<Grid>
<Typography color="primary" sx={{ fontSize: 16 }}>
{docTitle}
</Typography>
<Typography color={statusColor} sx={{ fontSize: 12
}}>
{[Link]}
</Typography>
</Grid>
</Grid>
);
}
[Link]
);
},
});
}}
/>
<Divider sx={{ width: 10 }} />
<MobilityChip
label="Reject"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<CancelOutlined />}
onClick={(event) => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you
want to proceed?",
onYesClick: () => {
handleApprove(
"Rejected",
item?.docId,
[Link]
);
},
});
}}
/>
<Divider sx={{ width: 10 }} />
</>
);
break;
case "rejected":
[Link](
<MobilityChip
label="Approve"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<TaskAlt />}
onClick={(event) => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you want
to proceed?",
onYesClick: () => {
handleApprove(
"Approved",
item?.docId,
[Link]
);
},
});
}}
/>
);
break;
case "approved":
[Link](
<MobilityChip
label="Reject"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<CancelOutlined />}
onClick={(event) => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you want
to proceed?",
onYesClick: () => {
handleApprove("Rejected",
[Link], [Link]);
},
});
}}
/>
);
break;
}
return summary;
}
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<MobilityAppBar
title="Driver Details"
onBackClick={() => {
navigate(-1);
}}
/>
</Grid>
124]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Drivers\[Link]
import { makeStyles } from "@mui/styles";
125]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Subscribers\driver\[Link]
import { Card, Grid, Paper, Tabs, Tab } from "@mui/material";
import { isEmpty } from "lodash";
import React, { FC, ReactElement, useEffect, useState } from "react";
import { useNavigate, useSearchParams } from "react-router-dom";
import EnhancedTable from "../../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../../CommonComponents/MobilityButtonIcon";
import MobilityTextField from "../../../CommonComponents/MobilityTextField";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../../CommonComponents/MobilitySnackBar";
import { AppContext } from "../../../Context/AppContext";
import { MobilityChip } from "../../../CommonComponents/MobilityChip";
import {
MobilityListItemApprove,
MobilityListItemDocuments,
MobilityListItemEdit,
MobilityListItemReject,
MobilityListItemVehicle,
} from "../../../CommonComponents/MobilityListItem";
import LongMenu from "../../../CommonComponents/MobilityActionMenu";
import MobilityEmptyMsg from "../../../CommonComponents/MobilityEmptyMsg";
import { apiHandler } from "../../../ApiServices/ApiHandler";
import {
CHANGE_DRIVER_STATUS_BY_ADMIN,
GET_DRIVERS_LIST,
} from "../../../ApiServices/ApiConstants";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface driverState {
isAdminUser: any;
id: string;
firstName: string;
phone: string;
city: string;
status: string;
statusFilter: string;
documents: string;
actions: any;
lastName: string;
}
const DriverList: FC = (): ReactElement => {
let myContext = [Link](AppContext);
const driverHeader = [
"Name",
"Phone",
"City",
"Status",
"Documents",
"Actions",
"",
];
if (!isEmpty(response)) {
ShowSnackbarSuccess(response, myContext);
// getDriversList(page, 0, driverPath, "driver");
await fetchData();
} else {
ShowSnackbarFailure(response, myContext);
await fetchData();
[Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({ isLoading: false });
}
};
// async function getTableData(
// page: number,
// rowsPerPage: number,
// path: string,
// type: string
// ) {
// try {
// [Link]({
// isLoading: true,
// message: "Getting Driver List...",
// });
// let response: Iresponse;
// const payload = { rowsPerPage: 0, pageNo: 0 };
// response = await [Link](driverPath, payload, {
// params: { entityId },
// });
// let allList: any = [],
// approvedList: any = [],
// rejectedList: any = [],
// pendingList: any = [];
// if (!isEmpty(response)) {
// const { data } = response?.data;
//
// const _data = data?.driversList?.map((driver: any) => {
// let item = {
// id: driver?.id,
// firstName: `${driver?.firstName || ""} ${driver?.lastName ||
" "}`,
// phone: driver?.phone,
// city: driver?.city,
// status: <MobilityChip label={driver?.status} />,
// statusFilter: driver?.status,
// userType: driver?.isAdminUser ? "Admin" : "Driver",
// const docIcon = (
// <MobilityButtonIconView
// tooltipTitle="View Documents"
// onClick={(e) => {
// [Link]();
// // openDocumentDialogAction();
// navigate(
// `${driverDetailsPath}?id=$
{[Link]}&selectedTab=documents`
// );
// }}
// />
// );
// if (driver?.documents?.length > 0) {
// return docIcon;
// }
// return null;
// })(),
// const commonIconContainerStyle = {
// display: "flex",
// justifyContent: "center",
// };
// const menuList: any = [
// <MobilityListItemEdit
// label="Edit Driver"
// onClick={(e) => {
// [Link]();
// editAction();
// }}
// />,
// ];
// [Link](item);
// });
// // setDriverList(_data);
// // setFilteredDriverList(_data);
// setApprovedDrivers(approvedList);
// setRejectedDrivers(rejectedList);
// setPendingDrivers(pendingList);
// setDriverList(allList);
// setFilteredDriverList(allList);
// } else {
// ShowSnackbarFailure(response, myContext);
// // [Link]("error.", response);
// }
// } catch (err: any) {
// ShowSnackbarFailure(err, myContext);
// //
// } finally {
// [Link]({ isLoading: false });
// }
// }
useEffect(() => {
// getTableData(1, 0, driverPath, "driver");
fetchData();
}, [open]);
const EnhancedTableConfig = {
headers: [
{
id: "userType",
numeric: false,
disablePadding: true,
label: "User Type",
disableSort: false,
},
{
id: "firstName",
numeric: false,
disablePadding: true,
label: "Name",
disableSort: false,
},
{
id: "phone",
numeric: true,
disablePadding: true,
label: "Phone",
disableSort: true,
},
{
id: "city",
numeric: false,
disablePadding: true,
label: "City",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "docNew",
numeric: false,
disablePadding: true,
label: "Documents",
disableSort: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
};
} finally {
[Link]({
isLoading: false,
});
}
};
[Link]?.toLowerCase().includes([Link]()) ||
[Link]?.toLowerCase().includes([Link]())
);
})
.map((driver) => {
return {
id: driver?.id,
firstName: `${driver?.firstName || ""} $
{driver?.lastName || " "}`,
phone: driver?.phone,
city: driver?.city,
status: <MobilityChip label={driver?.status} />,
statusFilter: driver?.status,
userType: driver?.isAdminUser ? "Admin" : "Driver",
const docIcon = (
<MobilityButtonIconView
tooltipTitle="View Documents"
onClick={(e) => {
[Link]();
// openDocumentDialogAction();
navigate(
`${driverDetailsPath}?id=$
{[Link]}&entityId=${entityId}&selectedTab=documents`
);
}}
/>
);
if (driver?.documents?.length > 0) {
return docIcon;
}
return null;
})(),
const commonIconContainerStyle = {
display: "flex",
justifyContent: "center",
};
const menuList: any = [
<MobilityListItemEdit
label="Edit Driver"
onClick={(e) => {
[Link]();
editAction(driver);
}}
/>,
];
approveAction(driver);
}}
/>
<MobilityListItemReject
label="Reject Driver"
onClick={(e) => {
[Link]();
rejectAction(driver);
}}
/>
</>
);
}
[Link](
<MobilityListItemDocuments
label="View Documents"
onClick={(e) => {
[Link]();
navigate(
`${driverDetailsPath}?id=$
{[Link]}&entityId=${entityId}&selectedTab=documents`
);
}}
/>,
<MobilityListItemVehicle
label="View Vehicles"
onClick={(e) => {
[Link]();
navigate(
`${driverDetailsPath}?id=$
{[Link]}&selectedTab=vehicles`
);
}}
/>
);
return (
<div style={commonIconContainerStyle}>
<LongMenu items={menuList} />
</div>
);
})(),
};
});
const closeDocumentDialog = () => {
setOpen(false);
};
const handleInputChange = (event: [Link]<HTMLInputElement>) =>
{
const inputValue = [Link]();
setSearchText(inputValue);
// if ([Link] > 2) {
// const filteredRows = [Link]((row: any) => {
// return (
// [Link]().includes(inputValue) ||
// [Link]().includes(inputValue)
// );
// });
//
// setFilteredDriverList(filteredRows);
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
>
<MobilityTextField
label="Search Driver..."
type="text"
name="search"
value={searchText}
maxLength={50}
fullWidth={false}
onChange={(event:
[Link]<HTMLInputElement>) => {
handleInputChange(event);
}}
/>
</Grid>
</Grid>
<Grid padding={2}>
{/* {tabValue === "all" && */}
{[Link] > 0 ? (
<EnhancedTable
headers={[Link]}
tableData={filteredDriverList}
/>
) : (
<MobilityEmptyMsg message={"No Data
Found"} />
)}
126]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Subscribers\vehicle\[Link]
import { Card, Grid, Paper, Tabs, Tab } from "@mui/material";
import { isEmpty } from "lodash";
import React, { FC, ReactElement, useEffect, useState } from "react";
import { useNavigate, useSearchParams } from "react-router-dom";
import EnhancedTable from "../../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../../CommonComponents/MobilityButtonIcon";
import MobilityTextField from "../../../CommonComponents/MobilityTextField";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../../CommonComponents/MobilitySnackBar";
import { AppContext } from "../../../Context/AppContext";
import MobilityEmptyMsg from "../../../CommonComponents/MobilityEmptyMsg";
import { MobilityChip } from "../../../CommonComponents/MobilityChip";
import LongMenu from "../../../CommonComponents/MobilityActionMenu";
import {
MobilityListItemApprove,
MobilityListItemEdit,
MobilityListItemReject,
} from "../../../CommonComponents/MobilityListItem";
import { apiHandler } from "../../../ApiServices/ApiHandler";
import {
CHANGE_VEHICLE_STATUS_BY_ADMIN,
GET_VEHICLE_LIST,
} from "../../../ApiServices/ApiConstants";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface vehicleState {
_id: string;
name: any;
documents: any;
id: string;
VehicleName: string;
registrationNumber: string;
status: string;
statusFilter: string;
model: string;
docNew: string;
actionNew: any;
}
//TODO: add vehicle status change for the admin
const VehicleList: FC = (): ReactElement => {
let myContext = [Link](AppContext);
const vehicleHeader = [
"Name",
"Model",
"Registration Number",
"Status",
"Documents",
"Actions",
"",
];
const [selectedDocument, setSelectedDocument] = [Link]<any[]>([]);
const [open, setOpen] = [Link](false);
const [message, setMessage] = useState<string>("");
const [isLoading, setIsLoading] = useState<boolean>(false);
const openDocumentDialog = (doc: any, parentId: any) => {
setSelectedDocument(
[Link]((selectedDoc: any) => ({ ...selectedDoc, vehicleId:
parentId }))
);
setOpen(true);
};
const closeDocumentDialog = () => {
setOpen(false);
};
const changeVehicleStatus = async (
status: string,
id: string,
// getVehicleList: any,
rowsPerPage: number,
page: number
) => {
try {
[Link]({
isLoading: true,
message: "Changing Vehicle status...",
});
if (!isEmpty(response)) {
ShowSnackbarSuccess("Vehicle Status Updated
Successfully", myContext);
await fetchData();
// getVehicleList(page, 0, vehiclePath, "driver");
} else {
ShowSnackbarFailure(response, myContext);
await fetchData();
[Link]("error.", response);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
};
// async function getTableData(
// page: number,
// rowsPerPage: number,
// path: string,
// type: string
// ) {
// try {
// [Link]({
// isLoading: true,
// message: "Getting Vehicle list...",
// });
// let response: Iresponse;
// const payload = { rowsPerPage: 0, pageNo: 0 };
// response = await [Link](vehiclePath, {
// params: { entityId, ...payload },
// });
//
// let allList: any = [],
// activeList: any = [],
// inActiveList: any = [],
// pendingList: any = [];
// if (!isEmpty(response)) {
// const { data } = response?.data;
// const vehicleList = data?.vehiclesList?.map((vehicle: any) => {
// let item = {
// id: vehicle?._id || vehicle?.id,
// VehicleName: vehicle?.name,
// registrationNumber: vehicle?.registrationNumber,
// status: <MobilityChip label={vehicle?.status} />,
// statusFilter: vehicle?.status,
// docNew: (() => {
// const openDocumentDialogAction = () => {
// openDocumentDialog(vehicle?.documents, [Link]);
// //
// //
// };
// const docIcon = (
// <MobilityButtonIconView
// tooltipTitle="View Documents"
// onClick={(e) => {
// [Link]();
// openDocumentDialogAction();
// // navigate(`${vehicleDocumentTablePath}?id=$
{vehicle?.id}`);
// navigate(
// `${vehicleDetailsPath}?id=${vehicle?.id}
&selectedTab=documents`
// );
// }}
// />
// );
// if (vehicle?.documents?.length > 0) {
// //
// return docIcon;
// }
// //
// return null;
// })(),
// actionNew: (() => {
// // const approveAction = () => {
// // [Link]({
// // open: true,
// // title: "Confirmation",
// // message: "Are you sure you want to proceed?",
// // onYesClick: () => {
// // changeVehicleStatus(
// // "Active",
// // [Link],
// // getTableData,
// // rowsPerPage,
// // page
// // );
// // },
// // });
// // };
//
// return (
// <div style={commonIconContainerStyle}>
// <LongMenu items={menuList} />
// </div>
// );
// })(),
// model: vehicle?.model,
// path: vehicleDetailsPath,
// };
// switch (vehicle?.status?.toString()) {
// case "Active":
// case "Approved":
// [Link](item);
// break;
// case "InActive":
// case "Rejected":
// [Link](item);
// break;
// case "Pending":
// [Link](item);
// break;
// }
// [Link](item);
// });
// //
// setActiveVehicles(activeList);
// setInActiveVehicles(inActiveList);
// setPendingVehicles(pendingList);
// setVehicleList(allList);
// setFilteredVehicleList(allList);
// } else {
// ShowSnackbarFailure(response, myContext);
// // [Link]("error.", response);
// }
// } catch (err: any) {
// ShowSnackbarFailure(err, myContext);
// //
// } finally {
// [Link]({
// isLoading: false,
// });
// }
// }
//
const EnhancedTableConfig = {
headers: [
{
id: "VehicleName",
numeric: false,
disablePadding: true,
label: "Vehicle Name",
disableSort: true,
},
{
id: "registrationNumber",
numeric: true,
disablePadding: true,
label: "Registration Number",
disableSort: true,
},
{
id: "model",
numeric: false,
disablePadding: true,
label: "Model",
disableSort: true,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "docNew",
numeric: false,
disablePadding: true,
label: "Documents",
disableSort: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
navigate: (item: any) => {
navigate(`${[Link]}?id=${[Link]}`);
},
};
} catch (error) {
} finally {
[Link]({
isLoading: false,
});
}
};
[Link]?.toLowerCase().includes([Link]()) ||
[Link]?.toLowerCase().includes([Link]())
);
})
.map((vehicle) => {
return {
id: vehicle?._id || vehicle?.id,
VehicleName: vehicle?.name,
registrationNumber: vehicle?.registrationNumber,
status: <MobilityChip label={vehicle?.status} />,
statusFilter: vehicle?.status,
const docIcon = (
<MobilityButtonIconView
tooltipTitle="View Documents"
onClick={(e) => {
[Link]();
// openDocumentDialogAction();
navigate(
`${vehicleDetailsPath}?id=$
{vehicle?.id} &selectedTab=documents`
);
}}
/>
);
if (vehicle?.documents?.length > 0) {
return docIcon;
}
return null;
})(),
actionNew: (() => {
const commonIconContainerStyle = {
display: "flex",
justifyContent: "center",
};
// return commonIcons;
return (
<div style={commonIconContainerStyle}>
<LongMenu items={menuList} />
</div>
);
})(),
model: vehicle?.model,
// path: vehicleDetailsPath,
};
});
setSearchText(inputValue);
// if ([Link] > 0) {
// const filteredRows = [Link]((row:any) => {
// return (
// [Link]?.toLowerCase().includes(inputValue) ||
// [Link]
// ?.toString()
// ?.toLowerCase()
// .includes(inputValue) ||
// [Link]?.toString()?.toLowerCase().includes(inputValue)
// );
// });
//
// setFilteredVehicleList(filteredRows);
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item>
<Tabs
value={tabValue}
onChange={(e, newValue) => {
setTabValue(newValue);
}}
>
<Tab label="All Vehicles"
value="all" sx={[Link]} />
<Tab label="Active"
value="active" sx={[Link]} />
<Tab
label="InActive"
value="inActive"
sx={[Link]}
/>
<Tab label="Pending"
value="pending" sx={[Link]} />
</Tabs>
</Grid>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
>
<MobilityTextField
label="Search Vehicle..."
type="text"
name="search"
value={searchText}
maxLength={50}
fullWidth={false}
onChange={(event:
[Link]<HTMLInputElement>) => {
handleInputChange(event);
}}
/>
</Grid>
</Grid>
<Grid padding={2}>
{/* {tabValue === "all" && */}
{[Link] > 0 ? (
<EnhancedTable
headers={[Link]}
tableData={filteredVehicleList}
/>
) : (
<MobilityEmptyMsg message={"No Data
Found"} />
)}
127]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Subscribers\[Link]
import React, { FC, ReactElement, useEffect, useState } from "react";
import { Card, Grid, Paper, AlertColor } from "@mui/material";
import { useLocation } from "react-router-dom";
import { useSearchParams, useNavigate } from "react-router-dom";
import { isEmpty } from "lodash";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import MobilitySelect from "../../CommonComponents/MobilitySelect";
import MobilityButton from "../../CommonComponents/MobilityButton";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { AppContext } from "../../Context/AppContext";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { ADD_EDIT_ENTITY_USER } from "../../ApiServices/ApiConstants";
const AddNewSubscriberPath: string = " AddNewSubscriber";
//
//
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
const [vehicleDetails, setVehicleDetails] = [Link]<any>({});
useEffect(() => {
if (subscriberDetails) {
setSubscriberName(subscriberDetails?.name);
setselectedSubscription(
subscriberDetails?.subscriptionDetails?.subscriptionName
);
setAddress(subscriberDetails?.address?.address1);
setselectedState(subscriberDetails?.address?.state);
setselectedCity(subscriberDetails?.address?.city);
setSubscriberPinCode(subscriberDetails?.address?.pinCode);
setBankName(subscriberDetails?.bankDetails?.bankName);
setBranchName(subscriberDetails?.bankDetails?.branchName);
setAccountNo(subscriberDetails?.bankDetails?.accountNumber);
setreEnterAccountNo(subscriberDetails?.bankDetails?.accountNumber);
setIfscCode(subscriberDetails?.bankDetails?.ifscCode);
setMicrCode(subscriberDetails?.bankDetails?.micrCode);
setselectedBankState(subscriberDetails?.bankDetails?.state);
setselectedBankCity(subscriberDetails?.bankDetails?.city);
setBankPinCode(subscriberDetails?.bankDetails?.pinCode);
setFirstName(subscriberDetails?.contact?.[0]?.firstName);
setLastName(subscriberDetails?.contact?.[0]?.lastName);
setEmail(subscriberDetails?.contact?.[0]?.email);
setNumber(subscriberDetails?.contact?.[0]?.phone);
//
setContactAddress([Link][0].contactAddress);
//
setselectedContactState([Link][0].state);
setselectedContactCity([Link]?.[0]?.city);
// setContactPinCode([Link][0].pinCode);
}
}, []);
if (!bankName || bankName?.length == 0) {
ShowSnackbarFailure("Please Enter Bank Name",
myContext);
return false;
}
if (!branchName || branchName?.length == 0) {
ShowSnackbarFailure("Please Enter Branch Name",
myContext);
return false;
}
if (!accountNo || accountNo?.length == 0) {
ShowSnackbarFailure("Please Enter Account Number",
myContext);
return false;
}
if (!reEnterAccountNo || reEnterAccountNo?.length == 0) {
ShowSnackbarFailure("Please Re-Enter Account Number",
myContext);
return false;
}
if (!ifscCode || ifscCode?.length == 0) {
ShowSnackbarFailure("Please Enter IFSC Code",
myContext);
return false;
}
if (!micrCode || micrCode?.length == 0) {
ShowSnackbarFailure("Please Enter MICR Code",
myContext);
return false;
}
if (!selectedBankState || selectedBankState?.length == 0) {
ShowSnackbarFailure("Please Select State", myContext);
return false;
}
if (!selectedBankCity || selectedBankCity?.length == 0) {
ShowSnackbarFailure("Please Select City", myContext);
return false;
}
if (!firstName || firstName?.length == 0) {
ShowSnackbarFailure("Please Enter First Name",
myContext);
return false;
}
if (!lastName || lastName?.length == 0) {
ShowSnackbarFailure("Please Enter Last Name",
myContext);
return false;
}
if (!number || number?.length == 0) {
ShowSnackbarFailure("Please Enter Number", myContext);
return false;
}
if (!email || email?.length == 0) {
ShowSnackbarFailure("Please Enter Email", myContext);
return false;
}
// if ([Link] == 0) {
// [Link]("Please Enter Primary Contact Address");
// return false;
// }
// if ([Link] == 0) {
// [Link]("Please Select Primary Contact State");
// return false;
// }
if (!selectedContactCity || selectedContactCity?.length == 0)
{
ShowSnackbarFailure("Please Select Primary Contact
City", myContext);
return false;
}
// if ([Link] == 0) {
// [Link]("Please Enter Primary Contact Pin Code");
// return false;
// }
// if ([Link] == 0) {
// [Link]("Please Enter Password");
// return false;
// }
// if ([Link] == 0) {
// [Link]("Please Re-Enter Password");
// return false;
// }
// if (password !== reEnterPassword) {
// [Link]("Passwords do not match. Please re-enter
the passwords.");
// return false;
// }
if (accountNo !== reEnterAccountNo) {
ShowSnackbarFailure(
"Account do not match. Please re-enter the Account
Number.",
myContext
);
return false;
}
return true;
} catch (error) {
//
}
};
let params = {
primaryContact: {
firstName: firstName,
lastName: lastName,
phone: number,
email: email,
//password: password,
// address1: contactAddress,
// state: selectedContactState,
city: selectedContactCity,
// pinCode: ContactPinCode,
},
bankDetails: {
bankName: bankName,
branchName: branchName,
accountNumber: accountNo,
ifscCode: ifscCode,
micrCode: micrCode,
state: selectedBankState,
city: selectedBankCity,
pinCode: BankPinCode,
},
name: subscriberName,
subscriptionType: selectedSubscription,
address: {
address1: address,
address2: "",
city: selectedCity,
state: selectedState,
pinCode: subscriberPinCode,
},
};
if (subscriberDetails) {
[Link](params, { entityId:
[Link]() });
}
//
//
if (!isEmpty(response)) {
//
if (response?.status === 200) {
ShowSnackbarSuccess("Subscriber Saved
Successfully", myContext);
navigate(-1);
} else {
ShowSnackbarFailure(response, myContext);
}
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
};
const cardStyle = {
padding: "20px",
margin: "auto",
width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
};
const titleStyle = {
alignItems: "center",
display: "flex",
// padding: "1%",
paddingTop: "15px",
paddingBottom: "15px",
fontweight: "800",
};
return (
<Grid>
<Grid item>
<MobilityAppBar
title={subscriberDetails ? "Edit Subscriber" :
"Add New Subscriber"}
onBackClick={() => {
navigate(-1);
}}
// menus={
// <MobilityButton
// label="Raise an Issue"
// onClick={(event:
[Link]<HTMLButtonElement>) => {
// //navigate(`${RaiseIssuePath}`);
// }}
// />
// }
/>
</Grid>
setSubscriberName([Link]);
}}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilitySelect
disabled={subscriberDetails ?
selectedSubscription : false}
label="Subscription Type"
value={selectedSubscription}
onChange={(event: any) =>
setselectedSubscription([Link])
}
statusOptions={subscriptionOptions}
/>
</Grid>
<Grid item xs={12} sm={6}>
<MobilityTextField
label="Address"
maxLength={50}
required={true}
name="address"
type="text"
value={address}
onChange={(event: any) => {
setAddress([Link]);
}}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilitySelect
label="State"
value={selectedState}
onChange={(event: any) =>
setselectedState([Link])}
statusOptions={stateOptions}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilitySelect
label="City"
value={selectedCity}
onChange={(event: any) =>
setselectedCity([Link])}
statusOptions={cityOptions}
/>
</Grid>
setSubscriberPinCode([Link]);
}}
/>
</Grid>
</Grid>
<Grid item sx={titleStyle}>
Bank Details
</Grid>
<Grid container spacing={3}>
<Grid item xs={12} sm={3}>
<MobilityTextField
label="Bank Name"
maxLength={30}
required={true}
name="bankName"
type="text"
value={bankName}
onChange={(event: any) => {
setBankName([Link]);
}}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilityTextField
label="Branch Name"
maxLength={30}
required={true}
name="branchName"
type="text"
value={branchName}
onChange={(event: any) => {
setBranchName([Link]);
}}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilityTextField
label="Account Number"
maxLength={20}
required={true}
name="accountNumber"
type="text"
value={accountNo}
onChange={(event: any) => {
setAccountNo([Link]);
}}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilityTextField
label="Re-enter Account Number"
maxLength={20}
required={true}
name="accountNumber"
type="text"
value={reEnterAccountNo}
onChange={(event: any) => {
setreEnterAccountNo([Link]);
}}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilityTextField
label="IFSC Code"
maxLength={11}
required={true}
name="IfscCode"
type="text"
value={ifscCode}
onChange={(event: any) => {
setIfscCode([Link]);
}}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilityTextField
label="MICR Code"
maxLength={9}
required={true}
name="MicrCode"
type="text"
value={micrCode}
onChange={(event: any) => {
setMicrCode([Link]);
}}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilitySelect
label="State"
value={selectedBankState}
onChange={(event: any) =>
setselectedBankState([Link])
}
statusOptions={bankStateOptions}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilitySelect
label="City"
value={selectedBankCity}
onChange={(event: any) =>
setselectedBankCity([Link])}
statusOptions={bankCityOptions}
/>
</Grid>
<Grid item xs={12} sm={3}>
<MobilityTextField
label="Pin Code "
maxLength={6}
required={true}
name="PinCode"
type="text"
value={BankPinCode}
onChange={(event: any) => {
setBankPinCode([Link]);
}}
/>
</Grid>
</Grid>
setreEnterPassword([Link]);
}}
/>
</Grid> */}
setselectedContactCity([Link])
}
statusOptions={contactCityOptions}
/>
</Grid>
128]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Subscribers\[Link]
import { Card, Grid, Paper, Tabs, Tab } from "@mui/material";
import { isEmpty } from "lodash";
import React, { FC, ReactElement, useEffect, useState } from "react";
import { useNavigate, useSearchParams } from "react-router-dom";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { AppContext } from "../../Context/AppContext";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import MobilityButton from "../../CommonComponents/MobilityButton";
import MobilityAccordion from "../../CommonComponents/MobilityAccordion";
import { MobilityHeadingValue } from
"../../CommonComponents/MobilityHeadingValue";
import { isConstructorDeclaration } from "typescript";
import { apiHandler } from "../../ApiServices/ApiHandler";
import { GET_VEHICLE_CATEGORY_CONFIG } from "../../ApiServices/ApiConstants";
// import instance from "../../../../CustomUtils/privateaxios";
// import EnhancedTable from "../../../CommonComponents/EnhancedTable";
// import { MobilityButtonIconView } from
"../../../CommonComponents/MobilityButtonIcon";
// import MobilityTextField from "../../../CommonComponents/MobilityTextField";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface categoryState {
name: string;
code: string;
actions: any;
}
const Categories: FC = (): ReactElement => {
let myContext = [Link](AppContext);
const [queryParameters] = useSearchParams();
const entityId = [Link]("id");
// const [queryParameters] = useSearchParams();
// const entityId = [Link]("id");
const [open, setOpen] = [Link](false);
const driverHeader = [
"Name",
"Phone",
"City",
"Status",
"Documents",
"Actions",
"",
];
// const category = [
// {
// _id: "64ddaacaa5fecda2e2097558",
// // name: "CAB",
// name: "AUTO_RICKSHAW",
// code: "TAXI",
// cityCode: "std:020",
// entityId: "64df4347a5fecda2e20afda0",
// applyBuyerFinderFee: true,
// skipGST: true,
// isMeterBased: true,
// subcategories: [
// {
// action: "",
// _id: "64ddaacaa5fecda2e2097559",
// name: "AECONOMICAL",
// code: "RIDE",
// farePolicies: {
// MIN_FARE: 23,
// PER_KM_CHARGE: 15,
// WAITING_CHARGE_PER_MIN: 3,
// NIGHT_CHARGE_MULTIPLIER: 0.1,
// NIGHT_SHIFT_START_TIME: "22:00",
// NIGHT_SHIFT_END_TIME: "22:00",
// },
// cancellationPoliciesMultiplier: {
// RIDE_ASSIGNED: 0.5,
// RIDE_ARRIVED_PICKUP: 0.4,
// RIDE_STARTED: 0.3,
// DRIVER_EN_ROUTE_TO_PICKUP: 0.2,
// },
// },
// {
// action: "",
// _id: "64ddaacaa5fecda2e2097560",
// name: "ALUXURY",
// code: "RIDE",
// farePolicies: {
// MIN_FARE: 23,
// PER_KM_CHARGE: 15,
// WAITING_CHARGE_PER_MIN: 3,
// NIGHT_CHARGE_MULTIPLIER: 0.1,
// NIGHT_SHIFT_START_TIME: "22:00",
// NIGHT_SHIFT_END_TIME: "22:00",
// },
// cancellationPoliciesMultiplier: {
// RIDE_ASSIGNED: 0,
// RIDE_ARRIVED_PICKUP: 0,
// RIDE_STARTED: 0,
// DRIVER_EN_ROUTE_TO_PICKUP: 0,
// },
// },
// {
// action: "",
// _id: "64ddaacaa5fecda2e2097561",
// name: "SPREMIUM",
// code: "RIDE",
// farePolicies: {
// MIN_FARE: 23,
// PER_KM_CHARGE: 15,
// WAITING_CHARGE_PER_MIN: 3,
// NIGHT_CHARGE_MULTIPLIER: 0.1,
// NIGHT_SHIFT_START_TIME: "22:00",
// NIGHT_SHIFT_END_TIME: "22:00",
// },
// cancellationPoliciesMultiplier: {
// RIDE_ASSIGNED: 0,
// RIDE_ARRIVED_PICKUP: 0,
// RIDE_STARTED: 0,
// DRIVER_EN_ROUTE_TO_PICKUP: 0,
// },
// },
// ],
// },
// {
// _id: "64ddaacaa5fecda2e2097558",
// name: "CAB",
// // name:"AUTO_RICKSHAW",
// code: "TAXI",
// cityCode: "std:020",
// entityId: "64df4347a5fecda2e20afda0",
// applyBuyerFinderFee: true,
// skipGST: false,
// isMeterBased: false,
// subcategories: [
// {
// _id: "64ddaacaa5fecda2e2097559",
// name: "ECONOMICAL",
// code: "RIDE",
// farePolicies: {
// MIN_FARE: 23,
// PER_KM_CHARGE: 15,
// WAITING_CHARGE_PER_MIN: 3,
// NIGHT_CHARGE_MULTIPLIER: 0.1,
// NIGHT_SHIFT_START_TIME: "22:00",
// NIGHT_SHIFT_END_TIME: "22:00",
// },
// cancellationPoliciesMultiplier: {
// RIDE_ASSIGNED: 0.5,
// RIDE_ARRIVED_PICKUP: 0.4,
// RIDE_STARTED: 0.3,
// DRIVER_EN_ROUTE_TO_PICKUP: 0.2,
// },
// },
// {
// _id: "64ddaacaa5fecda2e2097560",
// name: "LUXURY",
// code: "RIDE",
// farePolicies: {
// MIN_FARE: 23,
// PER_KM_CHARGE: 15,
// WAITING_CHARGE_PER_MIN: 3,
// NIGHT_CHARGE_MULTIPLIER: 0.1,
// NIGHT_SHIFT_START_TIME: "22:00",
// NIGHT_SHIFT_END_TIME: "22:00",
// },
// cancellationPoliciesMultiplier: {
// RIDE_ASSIGNED: 0,
// RIDE_ARRIVED_PICKUP: 0,
// RIDE_STARTED: 0,
// DRIVER_EN_ROUTE_TO_PICKUP: 0,
// },
// },
// {
// _id: "64ddaacaa5fecda2e2097561",
// name: "PREMIUM",
// code: "RIDE",
// farePolicies: {
// MIN_FARE: 23,
// PER_KM_CHARGE: 15,
// WAITING_CHARGE_PER_MIN: 3,
// NIGHT_CHARGE_MULTIPLIER: 0.1,
// NIGHT_SHIFT_START_TIME: "22:00",
// NIGHT_SHIFT_END_TIME: "22:00",
// },
// cancellationPoliciesMultiplier: {
// RIDE_ASSIGNED: 0,
// RIDE_ARRIVED_PICKUP: 0,
// RIDE_STARTED: 0,
// DRIVER_EN_ROUTE_TO_PICKUP: 0,
// },
// },
// ],
// },
// ];
useEffect(() => {
// getTableData(1, 0, driverPath, "driver");
fetchData();
}, [open]);
const EnhancedTableConfig = {
headers: [
{
id: "name",
numeric: false,
disablePadding: true,
label: "Name",
disableSort: false,
},
{
id: "code",
numeric: false,
disablePadding: true,
label: "Code",
disableSort: false,
},
{
id: "action",
numeric: true,
disablePadding: true,
label: "Edit",
disableSort: true,
},
],
};
cab_Data.subcategories=cab_Data.[Link]((subcategory:any) => {
return{
...subcategory,
action:
(() => {
return <MobilityButton
label="Edit"
onClick={(e) => {
[Link]();
// [Link] = [Link];
//openDocumentDialogAction();
navigate(`/subscriberConfiguration?entityId=${entityId}`,
{
state: { subcategory, vehicleCategoryName: "CAB" },
});
}}
/>;
})(),
};
});
// [Link] = "";
// (() => {
// const edit = (
// <MobilityButton
// label="Edit"
// onClick={(e) => {
// [Link]();
// // [Link] = [Link];
// //openDocumentDialogAction();
// // navigate(`${subscriberConfiguration}`, {
// // state: { subCat },
// // });
// }}
// />
// );
// return edit;
// })(),
// };
// });
// }
setAutCategoryData(auto_Data);
setCabData(cab_Data);
if (tabValue === "CAB" && !isEmpty(cab_Data)) {
setCategoryDetails({
cityCode: cab_Data.cityCode,
applyBuyerFinderFee: cab_Data.applyBuyerFinderFee,
skipGST: cab_Data.skipGST,
isMeterBased: cab_Data.isMeterBased,
subcategories: cab_Data.subcategories,
action: "sdf",
});
if (cab_Data.[Link]) {
setFilteredList(cab_Data.subcategories);
}
} else if (!isEmpty(auto_Data)) {
setCategoryDetails({
cityCode: auto_Data.cityCode,
applyBuyerFinderFee: auto_Data.applyBuyerFinderFee,
skipGST: auto_Data.skipGST,
isMeterBased: auto_Data.isMeterBased,
subcategories: auto_Data.subcategories,
action: "sdf",
});
if (auto_Data.[Link]) {
setFilteredList(auto_Data.subcategories);
}
}
//
} catch (error) {
} finally {
[Link]({
isLoading: false,
});
}
};
// let aCategory = [Link]((cat :any)=>{
// return cat?.categoryName?.toLowerCase() === [Link]();
// })[0];
//
// let aSubCategory =
aCategory?.[Link]((subCategory :any)=>{return subCategory});
//
//
// return a;
// //return {
// // name: [Link],
// // code: [Link],
// // id: driver?.id,
// // firstName: `${driver?.firstName || ""} ${driver?.lastName || "
"}`,
// // phone: driver?.phone,
// // city: driver?.city,
// // status: label={driver?.status || ""} />,
// // statusFilter: driver?.status || "",
// // const edit = (
// // <MobilityButton
// // label="Edit"
// // onClick={(e) => {
// // [Link]();
// // [Link] = [Link];
// // //openDocumentDialogAction();
// // navigate(`${subscriberConfiguration}`, {
// // state: { subCat },
// // });
// // }}
// // />
// // );
// // // if (driver?.documents?.length > 0) {
// // return edit;
// // // }
// // // return null;
// // })(),
// //};
// //} );
// });
// return {
// ...category,
// action: editButton,
// };
// });
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
return (
<Grid style={{ padding: 5 }}>
<Paper component={Card} variant="outlined">
<Grid sx={{ display: "flex", justifyContent: "space-between" }}>
<Grid container>
<Grid item>
<Tabs
value={tabValue}
onChange={(e, newValue) => {
setTabValue(newValue);
updatedata(newValue);
}}
>
<Tab label="CAB" value="CAB" sx={[Link]} />
<Tab
label="AUTO_RICKSHAW"
value="AUTO_RICKSHAW"
sx={[Link]}
/>
</Tabs>
</Grid>
</Grid>
{/* <Grid
container
sx={{
alignItems: "start",
justifyContent: "start",
// marginRight: 1,
}}
></Grid> */}
</Grid>
<Grid container spacing={1}>
<Grid item xs={12} md={12}>
<MobilityAccordion
isExpanded={true}
title={"Category Details"}
details={
<>
<MobilityHeadingValue
heading="City Code"
value={categoryDetails?.cityCode}
// value={undefined}
/>
<MobilityHeadingValue
heading="Buyer Finder Fee"
value={categoryDetails?.applyBuyerFinderFee}
// value={undefined}
/>
<MobilityHeadingValue
heading="Skip GST"
value={categoryDetails?.skipGST}
// value={undefined}
/>
<MobilityHeadingValue
heading="IsMeter Based"
value={[Link]}
// value={undefined}
/>
</>
}
/>
</Grid>
</Grid>
{/* <Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
></Grid> */}
<Grid padding={2}>
{/* {tabValue === "all" && */}
{/* {[Link] > 0 ? ( */}
<EnhancedTable
headers={[Link]}
tableData={filteredList}
/>
{/* ) : (
<MobilityEmptyMsg message={"No Data Found"} />
)} */}
</Grid>
</Paper>
</Grid>
);
};
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
useEffect(() => {
if (categoryDetails) {
setselectedCity(cityCodeMaper[cityCategory]);
setselectedVehicleCategory(vehicleCategory);
setselectedVehicleSubCategory(categoryDetails?.name);
setSelectedApplyBuyerFinderFee(
categoryDetails?.applyBuyerFinderFee ? "YES" : "NO"
);
setSelectedMeterBased(categoryDetails?.isMeterBased ? "YES" : "NO");
setSelectedSkipGST(categoryDetails?.skipGST ? "YES" : "NO");
setMinimumFare(categoryDetails?.farePolicies?.MIN_FARE);
setPerKm(categoryDetails?.farePolicies?.PER_KM_CHARGE);
setWaitingCharges(categoryDetails?.farePolicies?.WAITING_CHARGE_PER_MIN);
setNightCharges(categoryDetails?.farePolicies?.NIGHT_CHARGE_MULTIPLIER);
// setStartTime(categoryDetails?.farePolicies?.NIGHT_SHIFT_END_TIME);
setStartTime(dayjs(categoryDetails?.farePolicies?.NIGHT_SHIFT_END_TIME));
setEndTime(
categoryDetails?.farePolicies?.NIGHT_SHIFT_START_TIME.toString()
);
setRideAssigned(
categoryDetails?.cancellationPoliciesMultiplier?.RIDE_ASSIGNED
);
setDiverAtPickup(
categoryDetails?.cancellationPoliciesMultiplier?.RIDE_ARRIVED_PICKUP
);
setRideStarted(
categoryDetails?.cancellationPoliciesMultiplier?.RIDE_STARTED
);
setDriverEnRoute(
categoryDetails?.cancellationPoliciesMultiplier
?.RIDE_ENROUTE_PICKUP
);
setRideEnded(
categoryDetails?.cancellationPoliciesMultiplier?.
RIDE_ENDED
);
}
}, []);
const validateData = () => {
try {
if (!selectedCity || selectedCity?.length == 0) {
ShowSnackbarFailure("Please Select City", myContext);
return false;
}
if (!selectedVehicleCategory || selectedVehicleCategory?.length == 0) {
ShowSnackbarFailure("Please Select Vehicle Category", myContext);
return false;
}
if (
!selectedVehicleSubCategory ||
selectedVehicleSubCategory?.length == 0
) {
ShowSnackbarFailure("Please Select Vehicle Sub-Category", myContext);
return false;
}
if (!selectedCode || selectedCode?.length == 0) {
ShowSnackbarFailure("Please Select Code", myContext);
return false;
}
if (!minimumFare || minimumFare?.length == 0) {
ShowSnackbarFailure("Please Enter Minimum Fare", myContext);
return false;
}
if (!perKm || perKm?.length == 0) {
ShowSnackbarFailure("Please Enter Per KM", myContext);
return false;
}
if (!waitingCharges || waitingCharges?.length == 0) {
ShowSnackbarFailure("Please Enter Waiting Charges", myContext);
return false;
}
if (!nightCharges || nightCharges?.length == 0) {
ShowSnackbarFailure("Please Enter Night Charges", myContext);
return false;
}
if (!rideAssigned || rideAssigned?.length == 0) {
ShowSnackbarFailure(
"Please Enter Ride Assigned Multiplier in Cancellation Charges",
myContext
);
return false;
}
if (!diverAtPickup || diverAtPickup?.length == 0) {
ShowSnackbarFailure(
"Please Enter Driver at pickup Multiplier in Cancellation Charges",
myContext
);
return false;
}
if (!rideStarted || rideStarted?.length == 0) {
ShowSnackbarFailure(
"Please Enter Ride Started Multiplier in Cancellation Charges",
myContext
);
return false;
}
if (!driverEnRoute || driverEnRoute?.length == 0) {
ShowSnackbarFailure(
"Please Enter Driver EN Route Multiplier in Cancellation Charges",
myContext
);
return false;
}
if (!rideEnded || rideEnded?.length == 0) {
ShowSnackbarFailure(
"Please Enter Ride Ended Multiplier in Cancellation Charges",
myContext
);
return false;
}
if (
!selectedApplyBuyerFinderFee ||
selectedApplyBuyerFinderFee?.length == 0
) {
ShowSnackbarFailure("Please Select Apply Buyer Finder Fee", myContext);
return false;
}
if (!selectedSkipGST || selectedSkipGST?.length == 0) {
ShowSnackbarFailure("Please Select Skip GST", myContext);
return false;
}
if (!selectedMeterBased || selectedMeterBased?.length == 0) {
ShowSnackbarFailure("Please Select Meter Based", myContext);
return false;
}
if (endTime < startTime) {
ShowSnackbarFailure(
"End time must be greater than start time",
myContext
);
return;
}
return true;
} catch (error) {
}
};
applyBuyerFinderFee:
selectedApplyBuyerFinderFee === "YES" ? true : false,
skipGST: selectedSkipGST === "YES" ? true : false,
ismeterBased: selectedMeterBased === "YES" ? true : false,
},
farePolicies: {
minimumFare: minimumFare,
perKm: perKm,
waitingCharges: waitingCharges,
nightCharges: nightCharges,
startTime: startTime?.toString(),
endTime: endTime?.toString(),
},
cancellationPolicies: {
rideAssigned: rideAssigned,
diverAtPickup: diverAtPickup,
rideStarted: rideStarted,
driverEnRoute: driverEnRoute,
rideEnded: rideEnded,
},
};
if (!isEmpty(response)) {
setStartTime(value);
}}
/>
</Grid>
setEndTime(value);
}}
/>
</Grid>
</Grid>
130]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Subscribers\[Link]
import { FC, useState, useEffect } from "react";
import { Card, Tabs, Box, Tab, Grid, Paper } from "@mui/material";
import { useNavigate, useSearchParams } from "react-router-dom";
import { isEmpty } from "lodash";
import VehicleList from "./vehicle/vehicleList";
import DriverList from "./driver/driverList";
import { AppContext } from "../../Context/AppContext";
import React from "react";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { Add } from "@mui/icons-material";
import Categories from "./Categories";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
interface SubscriberDetailsProps {
name: string;
}
// if (!isEmpty(response)) {
// const { data } = response;
// setSubscriberDetails({
// id: data?.id || data?._id,
// name: data?.name,
// type: data?.type,
// });
// }
// } catch (err: any) {
//
// }finally {
// [Link]({ isLoading: false });
// }
// }
useEffect(() => {
//getSubscribersById();
}, []);
const styles = {
extendedTab: {
//minWidth: "500px",
textTransform: "none",
fontSize: 16,
fontWeight: 500,
},
};
const cardStyle = {
//padding: "26px",
//margin: "auto",
//width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
//padding: 2,
//margin: 1,
};
return (
<div>
<Grid style={{ padding: 5 }}>
<MobilityAppBar
title="Subscriber Details"
onBackClick={() => {
navigate(-1);
}}
// menus={
// <MobilityButton
// label="Raise an Issue"
// onClick={(event: [Link]<HTMLButtonElement>) =>
{
// //navigate(`${RaiseIssuePath}`);
// }}
// />
// }
/>
{/* <Card>
<CardHeader title="Subscriber details"
style={{ textAlign: "start" }} />
<CardContent style={{ textAlign: "start" }}>
{subscriberDetails?.name}
</CardContent>
</Card> */}
<Paper component={Card} variant="outlined" sx={cardStyle}>
<Box
sx={{
// display: "flex",
// borderBottom: 1,
// borderColor: "divider",
backgroundColor: "white",
// justifyContent: "space-between",
}}
>
<Tabs
value={tabeValue}
onChange={(e, newValue) => {
setTabeValue(newValue);
}}
>
<Tab
label="Drivers/Users"
value="Drivers"
sx={[Link]}
/>
<Tab label="Vehicles" value="Vehicles" sx={[Link]} />
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
>
<MobilityButton
// icon={<Add />}
label="Subscriber Configuration"
onClick={(event: [Link]<HTMLButtonElement>) => {
navigate(`/subscriberConfiguration?entityId=${entityId}`);
}}
/>
</Grid>
</Tabs>
</Box>
{/* {tabeValue === "Drivers" ? <DriverList /> :
// <VehicleList />
<Categories/>} */}
{tabeValue === "Drivers" && <DriverList /> ||
tabeValue === "Vehicles" && <VehicleList /> ||
tabeValue === "Categories" && <Categories />}
{/* {tabeValue === "Drivers" ? <DriverList /> :
tabeValue === "Vehicles" ? <VehicleList /> :
<Categories />} */}
</Paper>
</Grid>
</div>
);
};
131]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Subscribers\[Link]
import { FC, ReactElement, useState, useEffect } from "react";
import { Card, Grid, Tab, Tabs } from "@mui/material";
import * as React from "react";
import Paper from "@mui/material/Paper";
import _ from "lodash";
import { useNavigate } from "react-router-dom";
import EnhancedTable from "../../CommonComponents/EnhancedTable";
import { MobilityButtonIconView } from
"../../CommonComponents/MobilityButtonIcon";
import MobilityButton from "../../CommonComponents/MobilityButton";
import MobilitySubscriptionDialog from
"../../CommonComponents/MobilitySubscriptionDialog";
import { AppContext } from "../../Context/AppContext";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import {
MobilityListItemApprove,
MobilityListItemEdit,
MobilityListItemReject,
MobilityListItemRenew,
MobilityListItemUpgarde,
} from "../../CommonComponents/MobilityListItem";
import LongMenu from "../../CommonComponents/MobilityActionMenu";
import MobilityEmptyMsg from "../../CommonComponents/MobilityEmptyMsg";
import { Add } from "@mui/icons-material";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
CHANGE_ENTITY_STATUS,
GET_ENTITY_LIST,
} from "../../ApiServices/ApiConstants";
interface Iresponse {
headers?: any;
data?: any;
status?: number;
message?: string;
}
const payload = {
entityId: entityId,
status: status,
};
view: (
<MobilityButtonIconView
tooltipTitle="View Subscriber
Details"
onClick={(e) => {
[Link]();
navigate(`/subscriberDetails?id=${subscriber?.id}`);
}}
/>
),
setEntityId([Link]);
setPlanType("Renewal");
},
});
};
const upgradeAction = () => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you
want to proceed?",
onYesClick: () => {
setOpenDialog(true);
setDialogTitle("Upgrade Subscription");
setEntityId([Link]);
setPlanType("Upgrade");
},
});
};
const editAction = () => {
navigate(`/addNewSubscriber?id=$
{subscriber?.id}`, {
state: { subscriber },
});
};
const activeAction = () => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you
want to proceed?",
onYesClick: () => {
PlanStatus("Active",
[Link]);
},
});
};
const commonIconContainerStyle = {
display: "flex",
justifyContent: "center",
};
<MobilityListItemReject
label="Inactive Subscriber"
onClick={(e) => {
[Link]();
inActiveAction();
}}
/>
<MobilityListItemUpgarde
label="Upgrade Subscription"
onClick={(e) => {
[Link]();
upgradeAction();
}}
/>
</>
);
} else if (
<MobilityListItemReject
label="Inactive"
onClick={(e) => {
[Link]();
inActiveAction();
}}
/>
<MobilityListItemRenew
label="Renew Subscription"
onClick={(e) => {
[Link]();
renewAction();
}}
/>
</>
);
} else if (
<MobilityListItemReject
label="Inactive
Subscriber"
onClick={(e) =>
{
[Link]();
inActiveAction();
}}
/>
);
}
} else if (subscriber?.status ===
"InActive") {
[Link](
<MobilityListItemApprove
label="Active
Subscriber"
onClick={(e) => {
[Link]();
activeAction();
}}
/>
);
} else if (subscriber?.status ===
"Pending") {
[Link](
<>
<MobilityListItemApprove
label="Active
Subscriber"
onClick={(e) =>
{
[Link]();
activeAction();
}}
/>
<MobilityListItemReject
label="Inactive
Subscriber"
onClick={(e) =>
{
[Link]();
inActiveAction();
}}
/>
</>
);
}
return (
<div
style={commonIconContainerStyle}>
<LongMenu
items={menuList} />
</div>
);
})(),
};
switch (subscriber?.status?.toString()) {
case "Active":
[Link](item);
break;
case "InActive":
[Link](item);
break;
case "Pending":
[Link](item);
break;
}
[Link](item);
});
setActiveSubscribers(activeList);
setInActiveSubscribers(inActiveList);
setPendingSubscribers(pendingList);
setSubscribersList(allList);
setFilteredList(allList);
//setSubscribersList(_data);
} else {
ShowSnackbarFailure(response, myContext);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({
isLoading: false,
});
}
}
useEffect(() => {
getSubscribersList(page, rowsPerPage < 0 ? 0 : rowsPerPage);
}, []);
const EnhancedTableConfig = {
headers: [
{
id: "name",
numeric: false,
disablePadding: true,
label: "Name",
disableSort: true,
},
{
id: "city",
numeric: false,
disablePadding: true,
label: "City",
disableSort: false,
},
{
id: "status",
numeric: false,
disablePadding: true,
label: "Status",
disableSort: true,
},
{
id: "view",
numeric: false,
disablePadding: true,
label: "Details",
disableSort: true,
},
{
id: "actionNew",
numeric: false,
disablePadding: true,
label: "Actions",
disableSort: true,
},
],
};
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
return (
<Paper component={Card} variant="outlined">
<Grid sx={{ display: "flex", justifyContent: "space-
between" }}>
<Grid container>
<Grid item>
<Tabs
value={tabValue}
onChange={(e, newValue) => {
setTabValue(newValue);
}}
>
<Tab
label="All Subscribers"
value="all"
sx={[Link]}
/>
<Tab label="Active" value="active"
sx={[Link]} />
<Tab label="InActive" value="inactive"
sx={[Link]} />
<Tab label="Pending" value="pending"
sx={[Link]} />
</Tabs>
</Grid>
</Grid>
<Grid
container
sx={{
alignItems: "end",
justifyContent: "end",
marginRight: 1,
}}
>
<MobilityButton
icon={<Add />}
label="New Subscriber"
onClick={handleButtonClick}
/>
</Grid>
</Grid>
<Grid padding={2}>
{tabValue === "all" &&
([Link] > 0 ? (
<EnhancedTable
headers={[Link]}
tableData={filteredList}
/>
) : (
<MobilityEmptyMsg message={"No Data
Found"} />
))}
<MobilitySubscriptionDialog
openDialog={openDialog}
setOpenDialog={setOpenDialog}
title={dialogTitle}
entityId={entityId}
planType={planType}
></MobilitySubscriptionDialog>
</Paper>
// <Grid style={{ padding: 5 }}>
// <Grid item lg={12} md={12} xs={12} sm={12}>
// <Grid
// container
// sx={{
// justifyContent: "end",
// marginRight: 1,
// marginBottom: 2,
// }}
// >
// <MobilityButton
// label="Add New Subscriber"
// onClick={handleButtonClick}
// />
// </Grid>
// <Paper sx={{ overflow: "auto" }}>
// <EnhancedTable
// headers={[Link]}
// tableData={subscribersList}
// ></EnhancedTable>
// </Paper>
// <MobilitySubscriptionDialog
// openDialog={openDialog}
// setOpenDialog={setOpenDialog}
// title={dialogTitle}
// entityId={entityId}
// planType={planType}
// ></MobilitySubscriptionDialog>
// </Grid>
// </Grid>
);
};
132]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
Vehicle\[Link]
import React, { FC, ReactElement, useState } from "react";
import {
Card,
Grid,
Typography,
Paper,
Tab,
Tabs,
Divider,
} from "@mui/material";
import { useSearchParams, useNavigate } from "react-router-dom";
import { isEmpty } from "lodash";
import { CancelOutlined, TaskAlt } from "@mui/icons-material";
import MobilityTextField from "../../CommonComponents/MobilityTextField";
import MobilitySelect from "../../CommonComponents/MobilitySelect";
import {
ShowSnackbarFailure,
ShowSnackbarSuccess,
} from "../../CommonComponents/MobilitySnackBar";
import { AppContext } from "../../Context/AppContext";
import MobilityButton from "../../CommonComponents/MobilityButton";
import { MobilityAppBar } from "../../CommonComponents/MobilityAppBar";
import { MobilityImgHeading } from
"../../CommonComponents/MobilityHeadingValue";
import MobilityAccordion from "../../CommonComponents/MobilityAccordion";
import { MobilityChip } from "../../CommonComponents/MobilityChip";
import { apiHandler } from "../../ApiServices/ApiHandler";
import {
CHANGE_DOCUMENT_STATUS,
EDIT_VEHICLE_DETAILS,
GET_VEHICLES_DETAILS_BY_ID,
} from "../../ApiServices/ApiConstants";
}
};
async function handleSubmit(event: [Link]) {
[Link]();
if (validateData()) {
try {
[Link]({
isLoading: true,
message: "Updating Vehicle Details...",
});
const requestBody = {
// ...vehicleDetails,
isEdit: true,
driverId: [Link],
vehicleId: [Link],
name: [Link],
model: [Link],
year: [Link],
status: [Link],
registrationNumber:
[Link],
};
// const res: Iresponse = await [Link](
// `/api/edit-vehicle-details?entityId=${entityId}`,
// requestBody
// //{ params: { entityId } }
// );
const res: Iresponse = await [Link](
`${EDIT_VEHICLE_DETAILS}?entityId=${entityId}`,
requestBody
);
if (isEmpty(res)) {
apiCall();
}
if ([Link] === 200) {
ShowSnackbarSuccess(
"Vehicle details Updated Successfully",
myContext
);
navigate(-1);
} else {
ShowSnackbarFailure(res, myContext);
[Link]("error.", res);
}
} catch (err: any) {
ShowSnackbarFailure(err, myContext);
} finally {
[Link]({ isLoading: false });
}
}
}
[Link](() => {
apiCall();
}, []);
const cardStyle = {
margin: "auto",
width: "100%",
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
marginTop: "10px",
};
const styles = {
extendedTab: {
textTransform: "none",
fontSize: 16,
fontWeight: 400,
},
};
function detailsData() {
return (
<>
<Grid container spacing={4} sx={{ padding: 3 }}>
<Grid item xs={12} sm={6}>
<MobilityTextField
disabled={isEdit ? true : false}
label="Vehicle Company Name"
type="text"
name="vehicleName"
value={[Link] || ""}
onChange={(e) =>
setVehicleDetails({
...vehicleDetails,
name: [Link],
})
}
/>
</Grid>
value={[Link] || ""}
onChange={(e) =>
setVehicleDetails({
...vehicleDetails,
registrationNumber:
[Link],
})
}
/>
</Grid>
{!isEdit && (
<Grid container sx={{ marginTop: 4,
justifyContent: "flex-end" }}>
<MobilityButton label="Submit"
onClick={handleSubmit} />
</Grid>
)}
</Grid>
</>
);
}
function documentsData() {
return (
<>
<Grid container item xs={12} md={12} spacing={1}
padding={2}>
{vehicleDetails?.documents?.map((item: any) => {
return (
<Grid item xs={12} md={6}>
<MobilityAccordion
isExpanded={false}
title={getTitle(item)}
summary={getSummary(item)}
details={
<>
<MobilityImgHeading
heading={item}
value=""
imgUrl={[Link]}
/>
</>
}
/>
</Grid>
);
})}
</Grid>
</>
);
}
const handleApprove = async (status: any, docId: any, parentId: any) => {
try {
[Link]({
isLoading: true,
message: "Updated document status...",
});
const payload = {
status,
docId,
parentId,
};
const updatedDocuments =
response?.data?.data?.updatedEntity?.documents;
[Link]((selectedDoc: any) => ({
...selectedDoc,
parentId: parentId,
}));
[Link]
);
},
});
}}
/>
<Divider sx={{ width: 10 }} />
<MobilityChip
label="Reject"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<CancelOutlined />}
onClick={(event) => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you
want to proceed?",
onYesClick: () => {
handleApprove(
"Rejected",
item?.docId,
[Link]
);
},
});
}}
/>
<Divider sx={{ width: 10 }} />
</>
);
break;
case "rejected":
[Link](
<MobilityChip
label="Approve"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<TaskAlt />}
onClick={(event) => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you want
to proceed?",
onYesClick: () => {
handleApprove(
"Approved",
item?.docId,
[Link]
);
},
});
}}
/>
);
break;
case "approved":
[Link](
<MobilityChip
label="Reject"
disabled={isEdit ? true : false}
clickable={isEdit ? false : true}
icon={<CancelOutlined />}
onClick={(event) => {
[Link]({
open: true,
title: "Confirmation",
message: "Are you sure you want
to proceed?",
onYesClick: () => {
handleApprove(
"Rejected",
[Link],
[Link]
);
},
});
}}
/>
);
break;
}
return summary;
}
return (
<Grid style={{ padding: 5 }}>
<Grid item>
<MobilityAppBar
title="Vehicles Details"
onBackClick={() => {
navigate(-1);
}}
/>
</Grid>
133]ondc\Admin-portal-frontend\super_admin\src\Components\ProtectedComponents\
[Link]
import { FC, ReactElement } from "react";
134]ondc\Admin-portal-frontend\super_admin\src\Components\Routes\[Link]
import { FC, ReactElement } from "react";
import { Routes, Route } from "react-router-dom";
import { useUserState } from "../../CustomUtils/usercontext";
import Box from "@mui/material/Box";
import { Login } from "../CommonComponents/login";
import Footer from "../CommonComponents/Footer";
import routesList from "./routesList";
import { useStyles } from "./routestyle";
import NavigationDrawerNew, {
DrawerHeader,
} from "../CommonComponents/NavigationDrawerNew";
backgroundColor: "#e7e7e7",
}}
>
<DrawerHeader />
<[Link] />
</Box>
</Box>
<Footer />
</>
) : (
<Login />
)
}
/>
))}
</Routes>
);
};
export default AppRouter;
135]ondc\Admin-portal-frontend\super_admin\src\Components\Routes\[Link]
import Dashboard from "../ProtectedComponents/dashboard";
import Subscribers from "../ProtectedComponents/Subscribers/Subscribers";
import SubscriberDetails from
"../ProtectedComponents/Subscribers/SubscriberDetails";
//import Drivers from "../ProtectedComponents/Drivers/drivers";
import DriverDetails from "../ProtectedComponents/Drivers/driverDetails";
import VehicleDetails from "../ProtectedComponents/Vehicle/vehicleDetails";
import AddNewSubscriber from
"../ProtectedComponents/Subscribers/AddNewSubscriber";
import SubscriberConfiguration from
"../ProtectedComponents/Subscribers/SubscriberConfiguration";
136]ondc\Admin-portal-frontend\super_admin\src\Components\Routes\[Link]
import { makeStyles } from "@mui/styles";
137]ondc\Admin-portal-frontend\super_admin\src\config\[Link]
const dev = {
BUILD_ENV: "local", //production
DOMAIN: "localhost",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
};
const loc_static = {
BUILD_ENV: "local", //production
DOMAIN: "localhost",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
ADMIN_REDIRECTION: "[Link]
SUPER_ADMIN_REDIRECTION: "[Link]
};
const uat = {
BUILD_ENV: "uat", //production
DOMAIN: "[Link]",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
ADMIN_REDIRECTION: "[Link]
SUPER_ADMIN_REDIRECTION: "[Link]
};
const staging = {
BUILD_ENV: "staging", //production
DOMAIN: "[Link]",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
ADMIN_REDIRECTION: "[Link]
SUPER_ADMIN_REDIRECTION:
"[Link]
};
const preProd = {
BUILD_ENV: "oRickshaw", // oRickshaw
DOMAIN: "[Link]",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
};
const oRickshaw = {
BUILD_ENV: "oRickshaw", // oRickshaw
DOMAIN: "[Link]",
API_BASE_URL: "[Link]
LOGIN_REDIRECTION: "[Link]
};
138]ondc\Admin-portal-frontend\super_admin\src\CustomUtils\[Link]
import Cookies from "js-cookie";
import env from "../config/env";
export function setCookies(key: string, value: string) {
[Link](key, value, { domain: [Link] });
}
139]ondc\Admin-portal-frontend\super_admin\src\CustomUtils\[Link]
import moment from "moment";
export function formatDateTime(dateString: string, dateWithTime?: boolean) {
if (dateWithTime) {
let a = moment(dateString).format("DD/MM/YYYY LTS").replace(" ", "\
n");
return a;
} else {
return moment(dateString).format("DD/MM/YYYY");
}
}
140] ondc\Admin-portal-frontend\super_admin\src\CustomUtils\[Link]
import Cookies from "js-cookie";
import React, { useEffect, createContext, FC, ReactElement } from "react";
useEffect(() => {
if (isUserAuthenticated) {
}
}, [isUserAuthenticated]);
return (
<[Link] value={isUserAuthenticated}>
<[Link] value={dispatch}>
{children}
</[Link]>
</[Link]>
);
};
return context;
};
const useUserDispatch = () => {
const context = [Link](userDispatchContext);
return context;
};
141]ondc\Admin-portal-frontend\super_admin\src\CustomUtils\[Link]
const ValidateInput = (regex: RegExp, input: string) => {
return [Link](input) ? true : false;
};
142]ondc\Admin-portal-frontend\super_admin\src\[Link]
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
143]ondc\Admin-portal-frontend\super_admin\src\[Link]
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
144]ondc\Admin-portal-frontend\super_admin\src\[Link]
import { useState } from "react";
import "./[Link]";
import AppRouter from "./Components/Routes/routes";
import MobilityLoader, {
MobilityLoaderProp,
} from "./Components/CommonComponents/MobilityLoader";
import { AppContext } from "./Components/Context/AppContext";
import MobilitySnackBar, {
MobilitySnackbarProp,
} from "./Components/CommonComponents/MobilitySnackBar";
import MobilityConfirmDialog, {
MobilityConfirmDialogProp,
} from "./Components/CommonComponents/MobilityConfirmDialog";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
function App() {
const [loader, setLoader] = useState<MobilityLoaderProp>({});
const [snackbar, setSnackbar] = useState<MobilitySnackbarProp>({});
const [confirmDialog, setConfirmDialog] =
useState<MobilityConfirmDialogProp>(
{}
);
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<[Link]
value={{
loader,
setLoader,
snackbar,
setSnackbar,
confirmDialog,
setConfirmDialog,
}}
>
<AppRouter />
<MobilityLoader loader={loader} />
<MobilitySnackBar snackbar={snackbar} />
<MobilityConfirmDialog dialog={confirmDialog} />
</[Link]>
</LocalizationProvider>
);
}
145]ondc\Admin-portal-frontend\super_admin\src\[Link]
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
146]ondc\Admin-portal-frontend\super_admin\src\[Link]
import React from "react";
import ReactDOM from "react-dom/client";
import "./[Link]";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { BrowserRouter } from "react-router-dom";
import { UserProvider } from "./CustomUtils/usercontext";
import { ThemeProvider } from "@mui/material/styles";
import { theme } from "./Theme";
147]ondc\Admin-portal-frontend\super_admin\src\[Link]
<svg xmlns="[Link] viewBox="0 0 841.9 595.3"><g
fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-
114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8
19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-
18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9
53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28
31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9
14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4
66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4
63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6
36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-
130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-
4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8
106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-
8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-
39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3
11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7
39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-
15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4
18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-
2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5
15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-
18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6
8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5
125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7
27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-
6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4
19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84
46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9
2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1
63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-
13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4
15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle
cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
148]ondc\Admin-portal-frontend\super_admin\src\[Link]
/// <reference types="react-scripts" />
149]ondc\Admin-portal-frontend\super_admin\src\[Link]
import { ReportHandler } from 'web-vitals';
150]ondc\Admin-portal-frontend\super_admin\src\[Link]
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: [Link]
import '@testing-library/jest-dom';
151]ondc\Admin-portal-frontend\super_admin\src\[Link]
import { createTheme } from "@mui/material/styles";
152]ondc\Admin-portal-frontend\super_admin\.gitignore
# See [Link] for more about ignoring
files.
# dependencies
/node_modules
/.pnp
.[Link]
[Link]
# testing
/coverage
# production
/build
# misc
.DS_Store
.[Link]
.[Link]
.[Link]
.[Link]
[Link]*
[Link]*
[Link]*
153]ondc\Admin-portal-frontend\super_admin\[Link]
import React from "react";
import {
Button,
ListItem,
ListItemButton,
ListItemIcon,
ListItemText,
MenuItem,
SvgIconTypeMap,
Typography,
} from "@mui/material";
import {
AirlineSeatFlat,
BorderColorOutlined,
CancelOutlined,
Logout,
TaskAlt,
Visibility,
} from "@mui/icons-material";
import { OverridableComponent } from "@mui/material/OverridableComponent";
interface MobilityListItemProps {
label?: any;
icon?: any;
color?: any;
disabled?: boolean;
onClick?: (event: [Link]<HTMLLIElement>) => void;
}
154]ondc\Admin-portal-frontend\super_admin\[Link]
{
"name": "ondc_admin_react",
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.13.7",
"@mui/material": "^5.15.3",
"@mui/styles": "^5.14.0",
"@mui/x-date-pickers": "^6.18.6",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/js-cookie": "^3.0.3",
"@types/lodash": "^4.14.195",
"@types/node": "^16.18.38",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"axios": "^1.4.0",
"dayjs": "^1.11.10",
"js-cookie": "^3.0.5",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-loading-overlay-ts": "^2.0.2",
"react-router-dom": "^6.14.1",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "set PORT=3003 && react-scripts start",
"start-mac": "PORT=3003 react-scripts start",
"build": "BUILD_PATH='../../driver-service/super_admin' react-scripts
build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
155]ondc\Admin-portal-frontend\super_admin\[Link]
# Getting Started with Create React App
## Available Scripts
**Note: this is a one-way operation. Once you `eject`, you canât go back!**
If you arenât satisfied with the build tool and configuration choices, you can
`eject` at any time. This command will remove the single build dependency from
your project.
Instead, it will copy all the configuration files and the transitive
dependencies (webpack, Babel, ESLint, etc) right into your project so you have
full control over them. All of the commands except `eject` will still work, but
they will point to the copied scripts so you can tweak them. At this point
youâre on your own.
You donât have to ever use `eject`. The curated feature set is suitable for
small and middle deployments, and you shouldnât feel obligated to use this
feature. However we understand that this tool wouldnât be useful if you
couldnât customize it when you are ready for it.
## Learn More
156]ondc\Admin-portal-frontend\super_admin\[Link]
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "[Link]", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"]
}