Merge branch 'feature/passenger_office_implement' into 'develop'
passenger office implement See merge request witel3/loan-facilities-expert!25
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
"login": "ورود",
|
||||
"login_expert": "ورود کارشناس",
|
||||
"expert": "کارشناس",
|
||||
"last_updated_at": "اخرین بروز رسانی",
|
||||
"header": {
|
||||
"open_profile": "پروفایل",
|
||||
"edit_profile": "ویرایش پروفایل",
|
||||
@@ -88,5 +89,15 @@
|
||||
"warning_static_text": "خطا سرور",
|
||||
"success_static_text": "عملیات شما با موفقیت انجام شد",
|
||||
"pending": "در حال انجام..."
|
||||
},
|
||||
"PassengerOffice": {
|
||||
"name": "نام",
|
||||
"id": "کد ملی",
|
||||
"phone_number": "موبایل",
|
||||
"created_at": "تاریخ درخواست",
|
||||
"updated_at": "تاریخ بروزرسانی",
|
||||
"navgan_id": "کد ناوگان",
|
||||
"vehicle_type": "نوع ماشین",
|
||||
"state_name": "وضعیت درخواست"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import {
|
||||
Dialog,
|
||||
DialogTitle,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogActions,
|
||||
Button,
|
||||
} from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
const ConfirmForm = ({
|
||||
open,
|
||||
handleClose,
|
||||
handleDelete,
|
||||
rowId,
|
||||
deleteData,
|
||||
}) => {
|
||||
const t = useTranslations();
|
||||
const handleDeleteExpert = () => {
|
||||
handleDelete();
|
||||
};
|
||||
return (
|
||||
<Dialog open={open} onClose={handleClose}>
|
||||
<DialogTitle>{t("delete-dialog.confirm")}</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText>{t("delete-dialog.context")}</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={handleDeleteExpert} color="primary">
|
||||
{t("delete-dialog.button-delete")}
|
||||
</Button>
|
||||
<Button onClick={handleClose} color="secondary" autoFocus>
|
||||
{t("delete-dialog.button-cancel")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
export default ConfirmForm;
|
||||
@@ -0,0 +1,33 @@
|
||||
import {
|
||||
Dialog,
|
||||
DialogTitle,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogActions,
|
||||
Button,
|
||||
} from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
const RejectForm = ({ open, handleClose, handleDelete, rowId, deleteData }) => {
|
||||
const t = useTranslations();
|
||||
const handleDeleteExpert = () => {
|
||||
handleDelete();
|
||||
};
|
||||
return (
|
||||
<Dialog open={open} onClose={handleClose}>
|
||||
<DialogTitle>{t("delete-dialog.confirm")}</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText>{t("delete-dialog.context")}</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={handleDeleteExpert} color="primary">
|
||||
{t("delete-dialog.button-delete")}
|
||||
</Button>
|
||||
<Button onClick={handleClose} color="secondary" autoFocus>
|
||||
{t("delete-dialog.button-cancel")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
export default RejectForm;
|
||||
@@ -1,42 +1,38 @@
|
||||
import DeleteIcon from "@mui/icons-material/Delete";
|
||||
import EditIcon from "@mui/icons-material/Edit";
|
||||
import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import { Box, IconButton } from "@mui/material";
|
||||
// import EditForm from "./Form/EditForm";
|
||||
import { useContext } from "react";
|
||||
import { DataTableContext } from "@/lib/app/contexts/DataTableContext";
|
||||
import ConfirmForm from "./Form/ConfirmForm";
|
||||
import RejectForm from "./Form/RejectForm";
|
||||
|
||||
// import DeleteForm from "./Form/DeleteForm";
|
||||
|
||||
const TableRowActions = ({ row }) => {
|
||||
const {
|
||||
toggleDrawer,
|
||||
setDrawerContent,
|
||||
openDeleteDialog,
|
||||
handleOpenDeleteDialog,
|
||||
handleCloseDeleteDialog,
|
||||
handleDeleteDialog,
|
||||
rowId,
|
||||
deleteData,
|
||||
} = useContext(DataTableContext);
|
||||
// const {
|
||||
// openDeleteDialog,
|
||||
// handleOpenDeleteDialog,
|
||||
// handleCloseDeleteDialog,
|
||||
// handleDeleteDialog,
|
||||
// rowId,
|
||||
// deleteData,
|
||||
// } = useContext(DataTableContext);
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexWrap: "nowrap", gap: "8px" }}>
|
||||
<IconButton
|
||||
aria-label="edit"
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
toggleDrawer(true);
|
||||
// setDrawerContent(<EditForm />);
|
||||
}}
|
||||
>
|
||||
<EditIcon />
|
||||
<IconButton color="primary" onClick={() => handleOpenDeleteDialog(row)}>
|
||||
<ThumbUpAltIcon />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
aria-label="delete"
|
||||
color="primary"
|
||||
onClick={() => handleOpenDeleteDialog(row)}
|
||||
>
|
||||
<DeleteIcon />
|
||||
{/* <ConfirmForm
|
||||
rowId={rowId}
|
||||
open={openDeleteDialog}
|
||||
handleClose={handleCloseDeleteDialog}
|
||||
handleDelete={handleDeleteDialog}
|
||||
deleteData={deleteData}
|
||||
/> */}
|
||||
<IconButton color="primary" onClick={() => handleOpenDeleteDialog(row)}>
|
||||
<ThumbDownIcon />
|
||||
</IconButton>
|
||||
{/* <DeleteForm
|
||||
{/* <RejectForm
|
||||
rowId={rowId}
|
||||
open={openDeleteDialog}
|
||||
handleClose={handleCloseDeleteDialog}
|
||||
|
||||
@@ -1,30 +1,11 @@
|
||||
import { DataTableContext } from "@/lib/app/contexts/DataTableContext";
|
||||
import DataSaverOnIcon from "@mui/icons-material/DataSaverOn";
|
||||
import { Button, Stack, Tooltip } from "@mui/material";
|
||||
import { Stack, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useContext } from "react";
|
||||
// import AddForm from "./Form/AddForm";
|
||||
|
||||
function TableToolbar() {
|
||||
const t = useTranslations();
|
||||
const { toggleDrawer, setDrawerContent } = useContext(DataTableContext);
|
||||
return (
|
||||
<Stack direction={"row"} spacing={2}>
|
||||
<Tooltip title={t("add")} arrow placement="right">
|
||||
<Button
|
||||
color="primary"
|
||||
variant="contained"
|
||||
size="small"
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
startIcon={<DataSaverOnIcon />}
|
||||
onClick={() => {
|
||||
toggleDrawer(true);
|
||||
// setDrawerContent(<AddForm />);
|
||||
}}
|
||||
>
|
||||
{t("add")}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip title={t("add")} arrow placement="right"></Tooltip>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,32 @@
|
||||
import DataTableStructure from "@/core/components/DatatableStructure";
|
||||
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
||||
import { ContentCopy } from "@mui/icons-material";
|
||||
import { Box, Typography } from "@mui/material";
|
||||
import { DateTimePicker, LocalizationProvider } from "@mui/x-date-pickers";
|
||||
import { format } from "date-fns-jalali";
|
||||
import { useMemo } from "react";
|
||||
import TableToolbar from "./TableTollbar";
|
||||
// import TableToolbar from "./TableTollbar";
|
||||
import { GET_PASSENGER_OFFICE } from "@/core/data/apiRoutes";
|
||||
import { useTranslations } from "next-intl";
|
||||
import TableRowActions from "./TableRowActions";
|
||||
|
||||
function DashboardPassengerOfficeComponent() {
|
||||
const t = useTranslations();
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
accessorFn: (row) => row.name,
|
||||
id: "name",
|
||||
header: t("PassengerOffice.name"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.id,
|
||||
id: "id",
|
||||
header: "Id",
|
||||
header: t("PassengerOffice.id"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
@@ -30,56 +42,98 @@ function DashboardPassengerOfficeComponent() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.username,
|
||||
id: "username",
|
||||
header: "Username",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.name,
|
||||
id: "name",
|
||||
header: "Name",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
muiTableBodyCellCopyButtonProps: {
|
||||
fullWidth: true,
|
||||
endIcon: <ContentCopy />,
|
||||
sx: { justifyContent: "space-between" },
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.phone_number,
|
||||
id: "phone_number",
|
||||
header: "Phone Number",
|
||||
header: t("PassengerOffice.phone_number"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains"],
|
||||
muiTableBodyCellCopyButtonProps: {
|
||||
fullWidth: true,
|
||||
endIcon: <ContentCopy />,
|
||||
sx: { justifyContent: "space-between" },
|
||||
},
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.status,
|
||||
id: "status",
|
||||
header: "Status",
|
||||
accessorFn: (row) => row.created_at,
|
||||
id: "created_at",
|
||||
header: t("PassengerOffice.created_at"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.updated_at,
|
||||
id: "updated_at",
|
||||
header: t("PassengerOffice.updated_at"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.navgan_id,
|
||||
id: "navgan_id",
|
||||
header: t("PassengerOffice.navgan_id"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.vehicle_type,
|
||||
id: "vehicle_type",
|
||||
header: t("PassengerOffice.vehicle_type"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.state_name,
|
||||
id: "state_id",
|
||||
header: t("PassengerOffice.state_name"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
@@ -92,75 +146,6 @@ function DashboardPassengerOfficeComponent() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.gender,
|
||||
id: "gender",
|
||||
header: "Gender",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "equals",
|
||||
filterSelectOptions: [
|
||||
{ text: "Male", value: "male" },
|
||||
{ text: "Female", value: "female" },
|
||||
],
|
||||
filterVariant: "select",
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.national_id_code,
|
||||
id: "national_id_code",
|
||||
header: "National Id Code",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains"],
|
||||
muiTableBodyCellCopyButtonProps: {
|
||||
fullWidth: true,
|
||||
endIcon: <ContentCopy />,
|
||||
sx: { justifyContent: "space-between" },
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => new Date(row.updated_at),
|
||||
id: "updated_at",
|
||||
header: "Update Date",
|
||||
enableColumnFilter: true,
|
||||
datatype: "date",
|
||||
filterFn: "lessThan",
|
||||
columnFilterModeOptions: ["lessThan", "greaterThan"],
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
const date = new Date(renderedCellValue);
|
||||
const formattedDate = format(date, "MM/dd/yyyy HH:mm");
|
||||
return <Typography variant="body2">{formattedDate}</Typography>;
|
||||
},
|
||||
Header: ({ column }) => <em>{column.columnDef.header}</em>,
|
||||
Filter: ({ column }) => {
|
||||
return (
|
||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||
<DateTimePicker
|
||||
onChange={(newValue) => {
|
||||
const date = new Date(newValue);
|
||||
const formattedDate = format(date, "yyyy-MM-dd HH:mm");
|
||||
column.setFilterValue(formattedDate);
|
||||
}}
|
||||
slotProps={{
|
||||
textField: {
|
||||
helperText: `Filter Mode: ${column.columnDef._filterFn}`,
|
||||
sx: { minWidth: "120px" },
|
||||
variant: "standard",
|
||||
},
|
||||
}}
|
||||
value={column.getFilterValue()}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
[]
|
||||
);
|
||||
@@ -168,11 +153,11 @@ function DashboardPassengerOfficeComponent() {
|
||||
<DashboardLayouts>
|
||||
<Box sx={{ px: 3 }}>
|
||||
<DataTableStructure
|
||||
// tableUrl={SHOW_EXPERTS}
|
||||
// columns={columns}
|
||||
tableUrl={GET_PASSENGER_OFFICE}
|
||||
columns={columns}
|
||||
selectableRow={false}
|
||||
enableCustomToolbar={true}
|
||||
CustomToolbar={<TableToolbar />}
|
||||
// CustomToolbar={<TableToolbar />}
|
||||
enableLastUpdate={true}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={true}
|
||||
|
||||
@@ -8,6 +8,17 @@ export const GET_USER_TOKEN = BASE_URL + "/dashboard/login";
|
||||
export const CHANGE_PASSWORD = BASE_URL + "/dashboard/profile/change_password";
|
||||
//end change password
|
||||
|
||||
//user data
|
||||
//user data
|
||||
export const GET_USER_ROUTE = BASE_URL + "/dashboard/profile/info";
|
||||
//user data
|
||||
//user data
|
||||
|
||||
//passenger office
|
||||
export const GET_PASSENGER_OFFICE =
|
||||
BASE_URL + "/dashboard/passenger_office_chief/show";
|
||||
|
||||
export const CONFIRM_PASSENGER_OFFICE =
|
||||
BASE_URL + "/dashboard/passenger_office_chief/confirm";
|
||||
|
||||
export const REJECT_PASSENGER_OFFICE =
|
||||
BASE_URL + "/dashboard/passenger_office_chief/reject";
|
||||
//passenger office
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useState, useReducer, useCallback, useContext } from "react";
|
||||
import axios from "axios";
|
||||
import ImageResizer from "@/core/components/ImageConvertor";
|
||||
import useUser from "./useUser";
|
||||
import { ReloadDataTableContext } from "../contexts/ReloadDatatableContext";
|
||||
// import { ReloadDataTableContext } from "../contexts/ReloadDatatableContext";
|
||||
|
||||
const initialValues = {
|
||||
url: "",
|
||||
@@ -48,7 +48,7 @@ const reducer = (state, action) => {
|
||||
};
|
||||
|
||||
const useDataTable = () => {
|
||||
const { setReloadDataTable } = useContext(ReloadDataTableContext);
|
||||
// const { setReloadDataTable } = useContext(ReloadDataTableContext);
|
||||
const [state, dispatch] = useReducer(reducer, initialValues);
|
||||
const [drawerContent, setDrawerContent] = useState(null);
|
||||
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
||||
@@ -95,7 +95,7 @@ const useDataTable = () => {
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
setReloadDataTable(true);
|
||||
// setReloadDataTable(true);
|
||||
})
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import DashboardPassengerOfficeComponent from "@/components/dashboard/passenger-office";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import WithAuthMiddleware from "@/middlewares/WithoutAuth";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
|
||||
export default function PassengerOffice() {
|
||||
|
||||
Reference in New Issue
Block a user