From e8f8ca90b687ab4338c9786ea31fc162b98aca73 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sat, 7 Dec 2024 10:36:04 +0000 Subject: [PATCH] Feature/gasht rahdari --- package.json | 1 + .../dashboard/road-patrols/operator/page.js | 12 ++ .../dashboard/road-patrols/supervisor/page.js | 11 ++ src/app/api/fake-operator-list/route.js | 24 ++++ src/app/api/fake-supervisor-list/route.js | 28 ++++ .../roadPatrols/operator/ExcelPrint/index.jsx | 59 ++++++++ .../roadPatrols/operator/OperatorList.jsx | 114 +++++++++++++++ .../operator/RowActions/ReportForm/index.jsx | 23 +++ .../roadPatrols/operator/RowActions/index.jsx | 11 ++ .../roadPatrols/operator/Toolbar.jsx | 10 ++ .../dashboard/roadPatrols/operator/index.jsx | 14 ++ .../supervisor/ExcelPrint/index.jsx | 59 ++++++++ .../RowActions/DeleteForm/DeleteContent.jsx | 68 +++++++++ .../RowActions/DeleteForm/index.jsx | 45 ++++++ .../RowActions/OfficerDescription/index.jsx | 78 +++++++++++ .../RowActions/ReportForm/index.jsx | 23 +++ .../supervisor/RowActions/index.jsx | 15 ++ .../roadPatrols/supervisor/SupervisorList.jsx | 132 ++++++++++++++++++ .../roadPatrols/supervisor/Toolbar.jsx | 10 ++ .../roadPatrols/supervisor/index.jsx | 14 ++ src/core/components/DataTable/Main.js | 4 +- src/core/utils/pageMenu.js | 6 +- src/core/utils/routes.js | 4 + 23 files changed, 761 insertions(+), 4 deletions(-) create mode 100644 src/app/(withAuth)/dashboard/road-patrols/operator/page.js create mode 100644 src/app/(withAuth)/dashboard/road-patrols/supervisor/page.js create mode 100644 src/app/api/fake-operator-list/route.js create mode 100644 src/app/api/fake-supervisor-list/route.js create mode 100644 src/components/dashboard/roadPatrols/operator/ExcelPrint/index.jsx create mode 100644 src/components/dashboard/roadPatrols/operator/OperatorList.jsx create mode 100644 src/components/dashboard/roadPatrols/operator/RowActions/ReportForm/index.jsx create mode 100644 src/components/dashboard/roadPatrols/operator/RowActions/index.jsx create mode 100644 src/components/dashboard/roadPatrols/operator/Toolbar.jsx create mode 100644 src/components/dashboard/roadPatrols/operator/index.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/ExcelPrint/index.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/DeleteContent.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/index.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/RowActions/OfficerDescription/index.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/RowActions/ReportForm/index.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/RowActions/index.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/SupervisorList.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/Toolbar.jsx create mode 100644 src/components/dashboard/roadPatrols/supervisor/index.jsx diff --git a/package.json b/package.json index 3097485..0d256e9 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "date-fns": "^3.3.1", "date-fns-jalali": "^2.13.0-0", "dayjs": "^1.11.10", + "file-saver": "^2.0.5", "formik": "^2.4.5", "jalali-moment": "^3.3.11", "lz-string": "^1.5.0", diff --git a/src/app/(withAuth)/dashboard/road-patrols/operator/page.js b/src/app/(withAuth)/dashboard/road-patrols/operator/page.js new file mode 100644 index 0000000..73fa9cf --- /dev/null +++ b/src/app/(withAuth)/dashboard/road-patrols/operator/page.js @@ -0,0 +1,12 @@ +import WithPermission from "@/core/middlewares/withPermission"; +import OperatorPage from "@/components/dashboard/roadPatrols/operator"; + +const Page = () => { + return ( + + + + ); +}; + +export default Page; diff --git a/src/app/(withAuth)/dashboard/road-patrols/supervisor/page.js b/src/app/(withAuth)/dashboard/road-patrols/supervisor/page.js new file mode 100644 index 0000000..1afb8c4 --- /dev/null +++ b/src/app/(withAuth)/dashboard/road-patrols/supervisor/page.js @@ -0,0 +1,11 @@ +import WithPermission from "@/core/middlewares/withPermission"; +import SupervisorPage from "@/components/dashboard/roadPatrols/supervisor"; +const Page = () => { + return ( + + + + ); +}; + +export default Page; diff --git a/src/app/api/fake-operator-list/route.js b/src/app/api/fake-operator-list/route.js new file mode 100644 index 0000000..3261a0b --- /dev/null +++ b/src/app/api/fake-operator-list/route.js @@ -0,0 +1,24 @@ +const data = [ + { + id: 1, + operator_name: "امین", + phone_number: "09134849737", + car_id: "33", + start_date: "2024-11-02T11:48:22.000000Z", + end_date: "2024-11-03T11:01:14.000000Z", + register_date: "2024-11-03T11:01:14.000000Z", + }, + { + id: 2, + operator_name: "امیر", + phone_number: "09134844955", + car_id: "233", + start_date: "2024-11-02T11:48:22.000000Z", + end_date: "2024-11-03T11:01:14.000000Z", + register_date: "2024-11-03T11:01:14.000000Z", + }, +]; + +export async function GET() { + return Response.json({ data }); +} diff --git a/src/app/api/fake-supervisor-list/route.js b/src/app/api/fake-supervisor-list/route.js new file mode 100644 index 0000000..8435bca --- /dev/null +++ b/src/app/api/fake-supervisor-list/route.js @@ -0,0 +1,28 @@ +const data = [ + { + id: 1, + operator_name: "امین", + phone_number: "09134849737", + province: "تهران", + office: "اداره کل", + car_id: "33", + start_date: "2024-11-02T11:48:22.000000Z", + end_date: "2024-11-03T11:01:14.000000Z", + register_date: "2024-11-03T11:01:14.000000Z", + }, + { + id: 2, + operator_name: "امیر", + phone_number: "09134844955", + province: "تهران", + office: "اداره کل", + car_id: "233", + start_date: "2024-11-02T11:48:22.000000Z", + end_date: "2024-11-03T11:01:14.000000Z", + register_date: "2024-11-03T11:01:14.000000Z", + }, +]; + +export async function GET() { + return Response.json({ data }); +} diff --git a/src/components/dashboard/roadPatrols/operator/ExcelPrint/index.jsx b/src/components/dashboard/roadPatrols/operator/ExcelPrint/index.jsx new file mode 100644 index 0000000..8fdc753 --- /dev/null +++ b/src/components/dashboard/roadPatrols/operator/ExcelPrint/index.jsx @@ -0,0 +1,59 @@ +import { Button, CircularProgress } from "@mui/material"; +import { useMemo, useState } from "react"; +import moment from "jalali-moment"; +import FileSaver from "file-saver"; +import DescriptionIcon from "@mui/icons-material/Description"; +import useRequest from "@/lib/hooks/useRequest"; +import { EXPORT_OPERATOR_LIST } from "@/core/utils/routes"; + +const PrintExcel = ({ table, filterData }) => { + const [loading, setLoading] = useState(false); + const requestServer = useRequest(); + const activeFilters = Object.entries(filterData).reduce((acc, [key, filter]) => { + if (filter.value) { + // Check if there's an active filter + acc.push({ id: key, value: filter.value }); + } + return acc; + }, []); + + const filterParams = useMemo(() => { + const params = new URLSearchParams(); + activeFilters.length > 0 && + activeFilters.map((filter, index) => { + params.set(`${filter.id}`, filter.value); + }); + return params; + }, [activeFilters]); + + const clickHandler = () => { + setLoading(true); + requestServer(`${EXPORT_OPERATOR_LIST}?${filterParams}`, "get", { + requestOptions: { responseType: "blob" }, + }) + .then((response) => { + const filename = `خروجی کارتابل عملیات تاریخ_${moment().format("jYYYY_jMM_jDD")}.xlsx`; + FileSaver.saveAs(response.data, filename); + }) + .catch(() => {}) + .finally(() => { + setLoading(false); + }); + }; + + return ( + + ); +}; + +export default PrintExcel; diff --git a/src/components/dashboard/roadPatrols/operator/OperatorList.jsx b/src/components/dashboard/roadPatrols/operator/OperatorList.jsx new file mode 100644 index 0000000..292f197 --- /dev/null +++ b/src/components/dashboard/roadPatrols/operator/OperatorList.jsx @@ -0,0 +1,114 @@ +"use client"; +import { useMemo } from "react"; +import { Box, Typography } from "@mui/material"; +import DataTableWithAuth from "@/core/components/DataTableWithAuth"; +import Toolbar from "./Toolbar"; +import { GET_OPERATOR_LIST } from "@/core/utils/routes"; +import moment from "jalali-moment"; +import RowActions from "./RowActions"; + +const OperatorList = () => { + const columns = useMemo( + () => [ + { + accessorKey: "id", + header: "کد یکتا", + id: "id", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "operator_name", + header: "نام مامور", + id: "operator_name", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "phone_number", + header: "تلفن همراه", + id: "phone_number", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "car_id", + header: "کد خودرو", + id: "car_id", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "start_date", + header: "تاریخ شروع", + id: "start_date", + enableColumnFilter: true, + datatype: "date", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + Cell: ({ renderedCellValue }) => ( + + {renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"} + + ), + }, + { + accessorKey: "end_date", + header: "تاریخ پایان", + id: "end_date", + enableColumnFilter: true, + datatype: "date", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + Cell: ({ renderedCellValue }) => ( + + {renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"} + + ), + }, + { + accessorKey: "register_date", + header: "تاریخ ثبت", + id: "register_date", + enableColumnFilter: true, + datatype: "date", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + Cell: ({ renderedCellValue }) => ( + + {renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"} + + ), + }, + ], + [] + ); + + return ( + <> + + + + + ); +}; +export default OperatorList; diff --git a/src/components/dashboard/roadPatrols/operator/RowActions/ReportForm/index.jsx b/src/components/dashboard/roadPatrols/operator/RowActions/ReportForm/index.jsx new file mode 100644 index 0000000..38c98f2 --- /dev/null +++ b/src/components/dashboard/roadPatrols/operator/RowActions/ReportForm/index.jsx @@ -0,0 +1,23 @@ +import { Tooltip, IconButton } from "@mui/material"; +import PrintIcon from "@mui/icons-material/Print"; + +const ReportForm = ({ rowId }) => { + const reportUrl = "https://rms.rmto.ir/v2/road_patrols/operator/report/97314"; // TODO replace id here + + return ( + + + + + + ); +}; + +export default ReportForm; diff --git a/src/components/dashboard/roadPatrols/operator/RowActions/index.jsx b/src/components/dashboard/roadPatrols/operator/RowActions/index.jsx new file mode 100644 index 0000000..178c0e5 --- /dev/null +++ b/src/components/dashboard/roadPatrols/operator/RowActions/index.jsx @@ -0,0 +1,11 @@ +import { Box } from "@mui/material"; +import ReportForm from "./ReportForm"; + +const RowActions = ({ row }) => { + return ( + + + + ); +}; +export default RowActions; diff --git a/src/components/dashboard/roadPatrols/operator/Toolbar.jsx b/src/components/dashboard/roadPatrols/operator/Toolbar.jsx new file mode 100644 index 0000000..32c4395 --- /dev/null +++ b/src/components/dashboard/roadPatrols/operator/Toolbar.jsx @@ -0,0 +1,10 @@ +import PrintExcel from "./ExcelPrint"; + +const Toolbar = ({ table, filterData }) => { + return ( + <> + + + ); +}; +export default Toolbar; diff --git a/src/components/dashboard/roadPatrols/operator/index.jsx b/src/components/dashboard/roadPatrols/operator/index.jsx new file mode 100644 index 0000000..7835954 --- /dev/null +++ b/src/components/dashboard/roadPatrols/operator/index.jsx @@ -0,0 +1,14 @@ +"use client"; +import PageTitle from "@/core/components/PageTitle"; +import { Stack } from "@mui/material"; +import OperatorList from "@/components/dashboard/roadPatrols/operator/OperatorList"; + +const OperatorPage = () => { + return ( + + + + + ); +}; +export default OperatorPage; diff --git a/src/components/dashboard/roadPatrols/supervisor/ExcelPrint/index.jsx b/src/components/dashboard/roadPatrols/supervisor/ExcelPrint/index.jsx new file mode 100644 index 0000000..49c05eb --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/ExcelPrint/index.jsx @@ -0,0 +1,59 @@ +import { Button, CircularProgress } from "@mui/material"; +import { useMemo, useState } from "react"; +import moment from "jalali-moment"; +import FileSaver from "file-saver"; +import DescriptionIcon from "@mui/icons-material/Description"; +import useRequest from "@/lib/hooks/useRequest"; +import { EXPORT_SUPERVISOR_LIST } from "@/core/utils/routes"; + +const PrintExcel = ({ table, filterData }) => { + const [loading, setLoading] = useState(false); + const requestServer = useRequest(); + const activeFilters = Object.entries(filterData).reduce((acc, [key, filter]) => { + if (filter.value) { + // Check if there's an active filter + acc.push({ id: key, value: filter.value }); + } + return acc; + }, []); + + const filterParams = useMemo(() => { + const params = new URLSearchParams(); + activeFilters.length > 0 && + activeFilters.map((filter, index) => { + params.set(`${filter.id}`, filter.value); + }); + return params; + }, [activeFilters]); + + const clickHandler = () => { + setLoading(true); + requestServer(`${EXPORT_SUPERVISOR_LIST}?${filterParams}`, "get", { + requestOptions: { responseType: "blob" }, + }) + .then((response) => { + const filename = `خروجی کارتابل ارزیابی تاریخ_${moment().format("jYYYY_jMM_jDD")}.xlsx`; + FileSaver.saveAs(response.data, filename); + }) + .catch(() => {}) + .finally(() => { + setLoading(false); + }); + }; + + return ( + + ); +}; + +export default PrintExcel; diff --git a/src/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/DeleteContent.jsx b/src/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/DeleteContent.jsx new file mode 100644 index 0000000..52d266c --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/DeleteContent.jsx @@ -0,0 +1,68 @@ +import { Button, DialogActions, DialogContent, Stack, Typography, List, ListItem } from "@mui/material"; +import useRequest from "@/lib/hooks/useRequest"; +import React from "react"; + +const DeleteContent = ({ rowId, mutate, setOpenDeleteDialog }) => { + const requestServer = useRequest(); + + return ( + <> + + + + لطفاً نوع حذف مورد نظر را انتخاب کنید. + + + + حذف جزئی : حذف گشت بدون اقدامات انجام شده. + + + حذف کلی : حذف گشت با اقدامات انجام شده. + + + + + + + + + + + ); +}; + +export default DeleteContent; diff --git a/src/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/index.jsx b/src/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/index.jsx new file mode 100644 index 0000000..46cad99 --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/index.jsx @@ -0,0 +1,45 @@ +import React, { useState } from "react"; +import { + Tooltip, + IconButton, + Dialog, + DialogTitle, + DialogContent, + DialogActions, + Button, + Box, + Typography, +} from "@mui/material"; +import DeleteIcon from "@mui/icons-material/Delete"; +import CloseIcon from "@mui/icons-material/Close"; +import DeleteContent from "@/components/dashboard/roadPatrols/supervisor/RowActions/DeleteForm/DeleteContent"; + +const DeleteForm = ({ rowId, mutate }) => { + const [openDeleteDialog, setOpenDeleteDialog] = useState(false); + + return ( + <> + + setOpenDeleteDialog(true)}> + + + + setOpenDeleteDialog(false)} + PaperProps={{ + sx: { + boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + }, + }} + dir="rtl" + maxWidth={"md"} + > + حذف گشت + + + + ); +}; + +export default DeleteForm; diff --git a/src/components/dashboard/roadPatrols/supervisor/RowActions/OfficerDescription/index.jsx b/src/components/dashboard/roadPatrols/supervisor/RowActions/OfficerDescription/index.jsx new file mode 100644 index 0000000..8b3675b --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/RowActions/OfficerDescription/index.jsx @@ -0,0 +1,78 @@ +import { Dialog, DialogContent, DialogTitle, IconButton, Tooltip, Typography, Card, CardContent } from "@mui/material"; +import { useState } from "react"; +import useRequest from "@/lib/hooks/useRequest"; +import RemoveRedEyeIcon from "@mui/icons-material/RemoveRedEye"; +import CloseIcon from "@mui/icons-material/Close"; + +const OfficerDescriptionForm = ({ row }) => { + const [openOfficerDescriptionDialog, setOpenOfficerDescriptionDialog] = useState(false); + const requestServer = useRequest(); + + const handleSubmit = () => { + // requestServer(`${RESERVE_PASSENGER_BOSS}/${rowId}`, "post", { description }) + // .then((response) => { + // setOpenOfficerDescriptionDialog(false); + // mutate(); + // }) + // .catch((error) => { + // console.error(error); + // }) + // .finally(() => { + // setIsSubmitting(false); + // }); + }; + + return ( + <> + + setOpenOfficerDescriptionDialog(true)}> + + + + setOpenOfficerDescriptionDialog(false)} + PaperProps={{ + sx: { + transition: "all .3s", + boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + borderRadius: 2, + padding: 1, + }, + }} + maxWidth="sm" + fullWidth + dir="rtl" + > + + + توضیحات مامور + + setOpenOfficerDescriptionDialog(false)} size="small"> + + + + + + + + توضیحات : + + + {row.original.description || "هیچ توضیحی موجود نیست"}{" "} + {/* should replace row.original.description with the back end*/} + + + + + + + ); +}; + +export default OfficerDescriptionForm; diff --git a/src/components/dashboard/roadPatrols/supervisor/RowActions/ReportForm/index.jsx b/src/components/dashboard/roadPatrols/supervisor/RowActions/ReportForm/index.jsx new file mode 100644 index 0000000..ec373f6 --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/RowActions/ReportForm/index.jsx @@ -0,0 +1,23 @@ +import { Tooltip, IconButton } from "@mui/material"; +import PrintIcon from "@mui/icons-material/Print"; + +const ReportForm = ({ rowId }) => { + const reportUrl = "https://rms.rmto.ir/v2/road_patrols/operator/report/541938"; // TODO replace id here + + return ( + + + + + + ); +}; + +export default ReportForm; diff --git a/src/components/dashboard/roadPatrols/supervisor/RowActions/index.jsx b/src/components/dashboard/roadPatrols/supervisor/RowActions/index.jsx new file mode 100644 index 0000000..d9e8362 --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/RowActions/index.jsx @@ -0,0 +1,15 @@ +import { Box } from "@mui/material"; +import ReportForm from "./ReportForm"; +import DeleteForm from "./DeleteForm"; +import OfficerDescriptionForm from "./OfficerDescription"; + +const RowActions = ({ row, mutate }) => { + return ( + + + + + + ); +}; +export default RowActions; diff --git a/src/components/dashboard/roadPatrols/supervisor/SupervisorList.jsx b/src/components/dashboard/roadPatrols/supervisor/SupervisorList.jsx new file mode 100644 index 0000000..6c249d4 --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/SupervisorList.jsx @@ -0,0 +1,132 @@ +"use client"; +import { useMemo } from "react"; +import { Box, Typography } from "@mui/material"; +import DataTableWithAuth from "@/core/components/DataTableWithAuth"; +import Toolbar from "./Toolbar"; +import { GET_SUPERVISOR_LIST } from "@/core/utils/routes"; +import moment from "jalali-moment"; +import RowActions from "./RowActions"; + +const OperatorList = () => { + const columns = useMemo( + () => [ + { + accessorKey: "id", + header: "کد یکتا", + id: "id", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "province", + header: "استان", + id: "province", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "office", + header: "اداره", + id: "office", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "operator_name", + header: "نام مامور", + id: "operator_name", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "phone_number", + header: "تلفن همراه", + id: "phone_number", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "car_id", + header: "کد خودرو", + id: "car_id", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + }, + { + accessorKey: "start_date", + header: "تاریخ شروع", + id: "start_date", + enableColumnFilter: true, + datatype: "date", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + Cell: ({ renderedCellValue }) => ( + + {renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"} + + ), + }, + { + accessorKey: "end_date", + header: "تاریخ پایان", + id: "end_date", + enableColumnFilter: true, + datatype: "date", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + Cell: ({ renderedCellValue }) => ( + + {renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"} + + ), + }, + { + accessorKey: "register_date", + header: "تاریخ ثبت", + id: "register_date", + enableColumnFilter: true, + datatype: "date", + filterFn: "equals", + columnFilterModeOptions: ["equals", "contains"], + Cell: ({ renderedCellValue }) => ( + + {renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"} + + ), + }, + ], + [] + ); + + return ( + <> + + + + + ); +}; +export default OperatorList; diff --git a/src/components/dashboard/roadPatrols/supervisor/Toolbar.jsx b/src/components/dashboard/roadPatrols/supervisor/Toolbar.jsx new file mode 100644 index 0000000..32c4395 --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/Toolbar.jsx @@ -0,0 +1,10 @@ +import PrintExcel from "./ExcelPrint"; + +const Toolbar = ({ table, filterData }) => { + return ( + <> + + + ); +}; +export default Toolbar; diff --git a/src/components/dashboard/roadPatrols/supervisor/index.jsx b/src/components/dashboard/roadPatrols/supervisor/index.jsx new file mode 100644 index 0000000..3fa490b --- /dev/null +++ b/src/components/dashboard/roadPatrols/supervisor/index.jsx @@ -0,0 +1,14 @@ +"use client"; +import PageTitle from "@/core/components/PageTitle"; +import { Stack } from "@mui/material"; +import SupervisorList from "./SupervisorList"; + +const SupervisorPage = () => { + return ( + + + + + ); +}; +export default SupervisorPage; diff --git a/src/core/components/DataTable/Main.js b/src/core/components/DataTable/Main.js index 26318ff..cdb3671 100644 --- a/src/core/components/DataTable/Main.js +++ b/src/core/components/DataTable/Main.js @@ -115,7 +115,9 @@ const DataTable_Main = (props) => { onPaginationChange: setPagination, onSortingChange: onSortingChange, rowCount: totalRowCount, - renderTopToolbarCustomActions: ({ table }) => <>{TableToolbar && }, + renderTopToolbarCustomActions: ({ table }) => ( + <>{TableToolbar && } + ), renderRowActions: ({ row }) => , ...props, }); diff --git a/src/core/utils/pageMenu.js b/src/core/utils/pageMenu.js index 8118ebf..0eb3127 100644 --- a/src/core/utils/pageMenu.js +++ b/src/core/utils/pageMenu.js @@ -186,7 +186,7 @@ export const pageMenu = [ id: "roadPatrolManagmentSupervisorCartable", label: "کارتابل", type: "page", - route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_patrols/supervisor/cartable", + route: "/dashboard/road-patrols/supervisor", permissions: [ "show-road-patrol-supervise-cartable", "show-road-patrol-supervise-cartable-province", @@ -206,14 +206,14 @@ export const pageMenu = [ id: "roadPatrolManagmentOparationCreate", label: "ثبت اقدام", type: "page", - route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_patrols/operator/create", + route: "/dashboard/road-patrols/operator/add", permissions: ["add-road-patrol"], }, { id: "roadPatrolManagmentOparationCartable", label: "کارتابل", type: "page", - route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_patrols/operator/cartable", + route: "/dashboard/road-patrols/operator", permissions: ["add-road-patrol"], }, ], diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js index 8dcba92..db24fd6 100644 --- a/src/core/utils/routes.js +++ b/src/core/utils/routes.js @@ -27,3 +27,7 @@ export const DELETE_SAMPLE_LIST = api + "/api/v3/azmayesh_samples/delete"; export const DELETE_AZMAYESH_TYPE_LIST = api + "/api/v3/azmayesh_types/delete"; export const ADD_AZMAYESH_TYPE = api + "/api/v3/azmayesh_types/store"; export const UPDATE_AZMAYESH_TYPE = api + "/api/v3/azmayesh_types/update"; +export const GET_OPERATOR_LIST = "/v3/api/fake-operator-list"; +export const EXPORT_OPERATOR_LIST = "https://rms.rmto.ir/v2/road_patrols/operator/cartable/report"; +export const GET_SUPERVISOR_LIST = "/v3/api/fake-supervisor-list"; +export const EXPORT_SUPERVISOR_LIST = "https://rms.rmto.ir/v2/road_patrols/supervisor/cartable/report";