Merge branch 'feature/transportation_assistance_design' into 'develop'
Feature/transportation assistance design See merge request witel3/loan-facilities-expert!34
This commit is contained in:
@@ -101,6 +101,16 @@
|
|||||||
"vehicle_type": "نوع ماشین",
|
"vehicle_type": "نوع ماشین",
|
||||||
"state_name": "وضعیت درخواست"
|
"state_name": "وضعیت درخواست"
|
||||||
},
|
},
|
||||||
|
"TransportationAssistance": {
|
||||||
|
"name": "نام",
|
||||||
|
"id": "کد ملی",
|
||||||
|
"phone_number": "موبایل",
|
||||||
|
"created_at": "تاریخ درخواست",
|
||||||
|
"updated_at": "تاریخ بروزرسانی",
|
||||||
|
"navgan_id": "کد ناوگان",
|
||||||
|
"vehicle_type": "نوع ماشین",
|
||||||
|
"state_name": "وضعیت درخواست"
|
||||||
|
},
|
||||||
"MachinaryOffice": {
|
"MachinaryOffice": {
|
||||||
"name": "نام",
|
"name": "نام",
|
||||||
"national_id": "کد ملی",
|
"national_id": "کد ملی",
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { CONFIRM_TRANSPORTATION_ASSISTANCE } from "@/core/data/apiRoutes";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogTitle,
|
||||||
|
DialogContent,
|
||||||
|
DialogContentText,
|
||||||
|
DialogActions,
|
||||||
|
Button,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
|
const ConfirmForm = ({
|
||||||
|
open,
|
||||||
|
handleClose,
|
||||||
|
handleDelete,
|
||||||
|
rowId,
|
||||||
|
confirmData,
|
||||||
|
}) => {
|
||||||
|
const t = useTranslations();
|
||||||
|
const handleConfirm = () => {
|
||||||
|
handleDelete();
|
||||||
|
confirmData(CONFIRM_TRANSPORTATION_ASSISTANCE, rowId);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<Dialog open={open} onClose={handleClose}>
|
||||||
|
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<DialogContentText>{t("ConfirmDialog.context")}</DialogContentText>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button onClick={handleConfirm} color="primary">
|
||||||
|
{t("ConfirmDialog.button-confirm")}
|
||||||
|
</Button>
|
||||||
|
<Button onClick={handleClose} color="secondary" autoFocus>
|
||||||
|
{t("ConfirmDialog.button-cancel")}
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmForm;
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { REJECT_TRANSPORTATION_ASSISTANCE } from "@/core/data/apiRoutes";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogTitle,
|
||||||
|
DialogContent,
|
||||||
|
DialogContentText,
|
||||||
|
DialogActions,
|
||||||
|
Button,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
|
const RejectForm = ({ open, handleClose, handleDelete, rowId, rejectData }) => {
|
||||||
|
const t = useTranslations();
|
||||||
|
const handleRejectRequest = () => {
|
||||||
|
handleDelete();
|
||||||
|
rejectData(REJECT_TRANSPORTATION_ASSISTANCE, rowId);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<Dialog open={open} onClose={handleClose}>
|
||||||
|
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<DialogContentText>{t("RejectDialog.context")}</DialogContentText>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button onClick={handleRejectRequest} color="primary">
|
||||||
|
{t("RejectDialog.button-reject")}
|
||||||
|
</Button>
|
||||||
|
<Button onClick={handleClose} color="secondary" autoFocus>
|
||||||
|
{t("RejectDialog.button-cancel")}
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default RejectForm;
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
|
||||||
|
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||||
|
import { Box, IconButton } from "@mui/material";
|
||||||
|
import { useContext } from "react";
|
||||||
|
import { DataTableContext } from "@/lib/app/contexts/DataTableContext";
|
||||||
|
import ConfirmForm from "./Form/ConfirmForm";
|
||||||
|
import RejectForm from "./Form/RejectForm";
|
||||||
|
|
||||||
|
const TableRowActions = ({ row }) => {
|
||||||
|
const {
|
||||||
|
openConfirmDialog,
|
||||||
|
openRejectDialog,
|
||||||
|
handleOpenConfirmDialog,
|
||||||
|
handleOpenRejectDialog,
|
||||||
|
handleCloseConfirmDialog,
|
||||||
|
handleCloseRejectDialog,
|
||||||
|
handleConfirmDialog,
|
||||||
|
handleRejectDialog,
|
||||||
|
rowId,
|
||||||
|
confirmData,
|
||||||
|
rejectData,
|
||||||
|
} = useContext(DataTableContext);
|
||||||
|
return (
|
||||||
|
<Box sx={{ display: "flex", flexWrap: "nowrap", gap: "8px" }}>
|
||||||
|
<IconButton color="primary" onClick={() => handleOpenConfirmDialog(row)}>
|
||||||
|
<ThumbUpAltIcon />
|
||||||
|
</IconButton>
|
||||||
|
<ConfirmForm
|
||||||
|
rowId={rowId}
|
||||||
|
open={openConfirmDialog}
|
||||||
|
handleClose={handleCloseConfirmDialog}
|
||||||
|
handleDelete={handleConfirmDialog}
|
||||||
|
confirmData={confirmData}
|
||||||
|
/>
|
||||||
|
<IconButton color="primary" onClick={() => handleOpenRejectDialog(row)}>
|
||||||
|
<ThumbDownIcon />
|
||||||
|
</IconButton>
|
||||||
|
<RejectForm
|
||||||
|
rowId={rowId}
|
||||||
|
open={openRejectDialog}
|
||||||
|
handleClose={handleCloseRejectDialog}
|
||||||
|
handleDelete={handleRejectDialog}
|
||||||
|
rejectData={rejectData}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TableRowActions;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { Stack, Tooltip } from "@mui/material";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
|
function TableToolbar() {
|
||||||
|
const t = useTranslations();
|
||||||
|
return (
|
||||||
|
<Stack direction={"row"} spacing={2}>
|
||||||
|
<Tooltip title={t("add")} arrow placement="right"></Tooltip>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TableToolbar;
|
||||||
177
src/components/dashboard/transportation-assistance/index.jsx
Normal file
177
src/components/dashboard/transportation-assistance/index.jsx
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
import DataTableStructure from "@/core/components/DatatableStructure";
|
||||||
|
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
||||||
|
import { Box, Typography } from "@mui/material";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
// import TableToolbar from "./TableTollbar";
|
||||||
|
import { GET_TRANSPORTATION_ASSISTANCE } from "@/core/data/apiRoutes";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
import TableRowActions from "./TableRowActions";
|
||||||
|
|
||||||
|
function DashboardTransportationAssistanceComponent() {
|
||||||
|
const t = useTranslations();
|
||||||
|
const columns = useMemo(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.name,
|
||||||
|
id: "name",
|
||||||
|
header: t("TransportationAssistance.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: t("TransportationAssistance.id"),
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "numeric",
|
||||||
|
filterFn: "equals",
|
||||||
|
columnFilterModeOptions: [
|
||||||
|
"equals",
|
||||||
|
"notEquals",
|
||||||
|
"contains",
|
||||||
|
"lessThan",
|
||||||
|
"greaterThan",
|
||||||
|
"between",
|
||||||
|
],
|
||||||
|
Cell: ({ renderedCellValue }) => (
|
||||||
|
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.phone_number,
|
||||||
|
id: "phone_number",
|
||||||
|
header: t("TransportationAssistance.phone_number"),
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "numeric",
|
||||||
|
filterFn: "equals",
|
||||||
|
columnFilterModeOptions: [
|
||||||
|
"equals",
|
||||||
|
"notEquals",
|
||||||
|
"contains",
|
||||||
|
"lessThan",
|
||||||
|
"greaterThan",
|
||||||
|
"between",
|
||||||
|
],
|
||||||
|
Cell: ({ renderedCellValue }) => (
|
||||||
|
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.created_at,
|
||||||
|
id: "created_at",
|
||||||
|
header: t("TransportationAssistance.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("TransportationAssistance.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("TransportationAssistance.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("TransportationAssistance.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("TransportationAssistance.state_name"),
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "numeric",
|
||||||
|
filterFn: "equals",
|
||||||
|
filterSelectOptions: [
|
||||||
|
{ text: "Active", value: "0" },
|
||||||
|
{ text: "Deactive", value: "1" },
|
||||||
|
],
|
||||||
|
filterVariant: "select",
|
||||||
|
Cell: ({ renderedCellValue }) => (
|
||||||
|
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<DashboardLayouts>
|
||||||
|
<Box sx={{ px: 3 }}>
|
||||||
|
<DataTableStructure
|
||||||
|
tableUrl={GET_TRANSPORTATION_ASSISTANCE}
|
||||||
|
columns={columns}
|
||||||
|
selectableRow={false}
|
||||||
|
enableCustomToolbar={true}
|
||||||
|
// CustomToolbar={<TableToolbar />}
|
||||||
|
enableLastUpdate={true}
|
||||||
|
enablePinning={true}
|
||||||
|
enableDensityToggle={true}
|
||||||
|
enableColumnFilters={true}
|
||||||
|
enableHiding={true}
|
||||||
|
enableFullScreenToggle={false}
|
||||||
|
enableGlobalFilter={false}
|
||||||
|
enableColumnResizing={false} // if you want true this you shold change renderRowActions props ** see https://www.material-react-table.com/docs/guides/row-actions
|
||||||
|
enableRowActions={true}
|
||||||
|
renderRowActions={({ row }) => <TableRowActions row={row} />}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</DashboardLayouts>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DashboardTransportationAssistanceComponent;
|
||||||
@@ -23,6 +23,18 @@ export const REJECT_PASSENGER_OFFICE =
|
|||||||
BASE_URL + "/dashboard/passenger_office_chief/reject";
|
BASE_URL + "/dashboard/passenger_office_chief/reject";
|
||||||
//passenger office
|
//passenger office
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
//transportation assistance
|
||||||
|
export const GET_TRANSPORTATION_ASSISTANCE =
|
||||||
|
BASE_URL + "/dashboard/transportation_asisstants/show";
|
||||||
|
|
||||||
|
export const CONFIRM_TRANSPORTATION_ASSISTANCE =
|
||||||
|
BASE_URL + "/dashboard/transportation_asisstants/confirm";
|
||||||
|
|
||||||
|
export const REJECT_TRANSPORTATION_ASSISTANCE =
|
||||||
|
BASE_URL + "/dashboard/transportation_asisstants/reject";
|
||||||
|
//transportation assistance
|
||||||
|
=======
|
||||||
//machinary office
|
//machinary office
|
||||||
export const GET_MACHINARY_OFFICE =
|
export const GET_MACHINARY_OFFICE =
|
||||||
BASE_URL + "/dashboard/machinery_expert/show";
|
BASE_URL + "/dashboard/machinery_expert/show";
|
||||||
@@ -33,3 +45,4 @@ export const CONFIRM_MACHINARY_OFFICE =
|
|||||||
export const REJECT_MACHINARY_OFFICE =
|
export const REJECT_MACHINARY_OFFICE =
|
||||||
BASE_URL + "/dashboard/machinery_expert/reject";
|
BASE_URL + "/dashboard/machinery_expert/reject";
|
||||||
//passenger office
|
//passenger office
|
||||||
|
>>>>>>> a683c4029fdd3b3cae26a4cc7823835ad7e687b1
|
||||||
|
|||||||
23
src/pages/dashboard/transportation-assistance/index.jsx
Normal file
23
src/pages/dashboard/transportation-assistance/index.jsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import DashboardTransportationAssistanceComponent from "@/components/dashboard/transportation-assistance";
|
||||||
|
import TitlePage from "@/core/components/TitlePage";
|
||||||
|
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||||
|
import { parse } from "next-useragent";
|
||||||
|
|
||||||
|
export default function TransportationAssistance() {
|
||||||
|
return (
|
||||||
|
<WithAuthMiddleware>
|
||||||
|
<TitlePage text="Dashboard.passenger_office_page" />
|
||||||
|
<DashboardTransportationAssistanceComponent />
|
||||||
|
</WithAuthMiddleware>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps({ req, locale }) {
|
||||||
|
const { isBot } = parse(req.headers["user-agent"]);
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||||
|
isBot,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user