Merge branch 'release/v1.7.0'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
HOST="rms.witel.ir"
|
||||
NEXT_PUBLIC_VERSION="1.6.1"
|
||||
NEXT_PUBLIC_VERSION="1.7.0"
|
||||
NEXT_PUBLIC_API_URL="https://rms.witel.ir"
|
||||
NEXT_PUBLIC_MAPTILE_ENDPOINT="https://rmsmap.rmto.ir/141map"
|
||||
@@ -2,7 +2,7 @@ import WithPermission from "@/core/middlewares/withPermission";
|
||||
import OperatorPage from "@/components/dashboard/roadSafety/operator";
|
||||
// import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||
export const metadata = {
|
||||
title: "کارتابل عملیات نگهداری حریم",
|
||||
title: "کارتابل عملیات نگهداری حریم راه",
|
||||
};
|
||||
const Page = () => {
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import ReportAccessRoadPage from "@/components/dashboard/roadSafety/reports/accessRoad";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
export const metadata = {
|
||||
title: "گزارش بر اساس راه دسترسی غیر مجاز",
|
||||
};
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission
|
||||
permission_name={[
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
]}
|
||||
>
|
||||
<ReportAccessRoadPage />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
export default Page;
|
||||
@@ -0,0 +1,19 @@
|
||||
import ReportConstructionActivityPage from "@/components/dashboard/roadSafety/reports/constructionActivity";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
export const metadata = {
|
||||
title: "گزارش بر اساس ساخت و ساز غیر مجاز",
|
||||
};
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission
|
||||
permission_name={[
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
]}
|
||||
>
|
||||
<ReportConstructionActivityPage />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
export default Page;
|
||||
@@ -0,0 +1,19 @@
|
||||
import ReportUtilityPassingActivityPage from "@/components/dashboard/roadSafety/reports/utilityPassingActivity";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
export const metadata = {
|
||||
title: "گزارش بر اساس عبور تاسیسات زیربنایی غیر مجاز",
|
||||
};
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission
|
||||
permission_name={[
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
]}
|
||||
>
|
||||
<ReportUtilityPassingActivityPage />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
export default Page;
|
||||
@@ -2,7 +2,7 @@ import SupervisorPage from "@/components/dashboard/roadSafety/supervisor";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
// import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||
export const metadata = {
|
||||
title: "کارتابل ارزیابی نگهداری حریم",
|
||||
title: "کارتابل ارزیابی نگهداری حریم راه",
|
||||
};
|
||||
const Page = () => {
|
||||
return (
|
||||
|
||||
@@ -206,8 +206,8 @@ const OperatorList = () => {
|
||||
{row.original.is_finished == 1
|
||||
? "خاتمه یافته"
|
||||
: row.original.is_finished == 0
|
||||
? "در جریان"
|
||||
: "-"}
|
||||
? "در جریان"
|
||||
: "-"}
|
||||
</>
|
||||
),
|
||||
},
|
||||
@@ -369,7 +369,7 @@ const OperatorList = () => {
|
||||
return (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
{row.original.judiciary_document_upload_date !== "0000-00-00 00:00:00" &&
|
||||
row.original.judiciary_document_upload_date ? (
|
||||
row.original.judiciary_document_upload_date ? (
|
||||
<JudiciaryDocumentDialog rowId={row.getValue("id")} />
|
||||
) : (
|
||||
<>-</>
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
"use client";
|
||||
import DataTableFilterDataStructure from "@/core/utils/DataTableFilterDataStructure";
|
||||
import isArrayEmpty from "@/core/utils/isArrayEmpty";
|
||||
import {
|
||||
EXPORT_COUNTRY_ROAD_SAFETY_REPORT,
|
||||
EXPORT_PROVINCE_ROAD_SAFETY_REPORT,
|
||||
EXPORT_ROAD_SAFETY_CITY_ACTIVITY_ACCESS_ROAD_REPORT,
|
||||
EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_ACCESS_ROAD_REPORTT,
|
||||
} from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import DescriptionIcon from "@mui/icons-material/Description";
|
||||
import { Button, CircularProgress, IconButton, useMediaQuery } from "@mui/material";
|
||||
import FileSaver from "file-saver";
|
||||
import moment from "jalali-moment";
|
||||
import { useState } from "react";
|
||||
|
||||
const PrintExcel = ({ table, filterData }) => {
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||
const [loading, setLoading] = useState(false);
|
||||
const requestServer = useRequest({ notificationSuccess: true });
|
||||
|
||||
const clickHandler = () => {
|
||||
setLoading(true);
|
||||
const filters = DataTableFilterDataStructure(filterData, isArrayEmpty);
|
||||
const filterParams = new URLSearchParams();
|
||||
let requestUrl;
|
||||
filterParams.set("filters", JSON.stringify(filters || []));
|
||||
if (filterData.province_id.value === "") {
|
||||
requestUrl = EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_ACCESS_ROAD_REPORTT;
|
||||
} else {
|
||||
filterParams.set("province_id", filterData.province_id.value);
|
||||
requestUrl = EXPORT_ROAD_SAFETY_CITY_ACTIVITY_ACCESS_ROAD_REPORT;
|
||||
}
|
||||
|
||||
requestServer(`${requestUrl}?${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 (
|
||||
<>
|
||||
{isMobile ? (
|
||||
<IconButton aria-label="خروجی اکسل" color="primary" onClick={clickHandler}>
|
||||
<DescriptionIcon sx={{ fontSize: "25px" }} />
|
||||
</IconButton>
|
||||
) : (
|
||||
<Button
|
||||
color="primary"
|
||||
variant="contained"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
startIcon={loading ? <CircularProgress size={18} color="inherit" /> : <DescriptionIcon />}
|
||||
onClick={clickHandler}
|
||||
>
|
||||
خروجی اکسل
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default PrintExcel;
|
||||
@@ -1,304 +1,463 @@
|
||||
"use client";
|
||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||
import { Box } from "@mui/material";
|
||||
import { useMemo } from "react";
|
||||
import Toolbar from "./Toolbar";
|
||||
|
||||
const ReportLists = ({ data, filterData, setFilterData, isLoading }) => {
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "edare_name",
|
||||
header: "اداره کل",
|
||||
id: "edare_name",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
},
|
||||
|
||||
{
|
||||
accessorKey: "sum",
|
||||
header: "تعداد کل",
|
||||
id: "sum",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "ساخت و ساز غیر مجاز",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_89",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["89"] ? row["89"]["1"] : 0),
|
||||
header: "گام اول (شناسایی)",
|
||||
id: "id_89.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["89"] ? row["89"]["2"] : 0),
|
||||
header: "گام دوم (مستندات قضایی)",
|
||||
id: "id_89.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["89"] ? row["89"]["3"] : 0),
|
||||
header: "گام سوم (برخورد)",
|
||||
id: "id_89.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "راه دسترسی غیر مجاز",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_90",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["90"] ? row["90"]["1"] : 0),
|
||||
header: "گام اول (شناسایی)",
|
||||
id: "id_90.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["90"] ? row["90"]["2"] : 0),
|
||||
header: "گام دوم (مستندات قضایی)",
|
||||
id: "id_90.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["90"] ? row["90"]["3"] : 0),
|
||||
header: "گام سوم (برخورد)",
|
||||
id: "id_90.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "عبور تاسیسات زیربنایی غیر مجاز",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_91",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["91"] ? row["91"]["1"] : 0),
|
||||
header: "گام اول (شناسایی)",
|
||||
id: "id_91.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["91"] ? row["91"]["2"] : 0),
|
||||
header: "گام دوم (مستندات قضایی)",
|
||||
id: "id_91.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["91"] ? row["91"]["3"] : 0),
|
||||
header: "گام سوم (برخورد)",
|
||||
id: "id_91.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
TableToolbar={Toolbar}
|
||||
columns={columns}
|
||||
data={data}
|
||||
page_name={"roadSafetyReport"}
|
||||
table_name={"roadSafetyReportList"}
|
||||
enablePagination={false}
|
||||
specialFilter={filterData}
|
||||
setFilterData={setFilterData}
|
||||
loading={isLoading}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ReportLists;
|
||||
"use client";
|
||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||
import { Box } from "@mui/material";
|
||||
import { useMemo } from "react";
|
||||
import Toolbar from "./Toolbar";
|
||||
|
||||
const ReportLists = ({ data, filterData, setFilterData, isLoading }) => {
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "edare_name",
|
||||
header: "اداره کل",
|
||||
id: "edare_name",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].total_sum : 0),
|
||||
header: "تعداد کل",
|
||||
id: "sum",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "آزادراه",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_1",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_1.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_1.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_1.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "بزرگراه",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_2",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_2.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_2.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_2.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "اصلی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_3",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_3.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_3.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_3.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "فرعی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_4",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_4.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_4.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_4.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "روستایی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_5",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_5.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_5.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_5.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
TableToolbar={Toolbar}
|
||||
columns={columns}
|
||||
data={data}
|
||||
page_name={"roadSafetyReportAccessRoad"}
|
||||
table_name={"roadSafetyReportAccessRoadList"}
|
||||
enablePagination={false}
|
||||
specialFilter={filterData}
|
||||
setFilterData={setFilterData}
|
||||
loading={isLoading}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ReportLists;
|
||||
@@ -1,11 +1,11 @@
|
||||
import PrintExcel from "./ExcelPrint";
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
const Toolbar = ({ table, filterData, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<PrintExcel table={table} filterData={filterData} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default Toolbar;
|
||||
import PrintExcel from "./ExcelPrint";
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
const Toolbar = ({ table, filterData, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<PrintExcel table={table} filterData={filterData} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default Toolbar;
|
||||
@@ -1,264 +1,207 @@
|
||||
"use client";
|
||||
import CustomSelectByDependency from "@/core/components/FilterDrawer/fieldsType/CustomSelectByDependency";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import DataTableFilterDataStructure from "@/core/utils/DataTableFilterDataStructure";
|
||||
import isArrayEmpty from "@/core/utils/isArrayEmpty";
|
||||
import { GET_ROAD_SAFETY_CITY_ACTIVITY_REPORT, GET_ROAD_SAFETY_PROVINCE_ACTIVITY_REPORT } from "@/core/utils/routes";
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||
import useProvinces from "@/lib/hooks/useProvince";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import useSafetyAndPrivacyGetItems from "@/lib/hooks/useSafetyAndPrivacyGetItems";
|
||||
import { LinearProgress, Stack } from "@mui/material";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import ReportLists from "./ReportLists";
|
||||
|
||||
const statusOptions = [
|
||||
{ value: "", label: "همه وضعیت ها" },
|
||||
{ value: 1, label: "گام اول (شناسایی)" },
|
||||
{ value: 2, label: "گام دوم (مستندات قضایی)" },
|
||||
{ value: 3, label: "گام سوم (برخورد)" },
|
||||
];
|
||||
const axisOptions = [
|
||||
{ value: "", label: "همه محور ها" },
|
||||
{ value: 1, label: "آزادراه" },
|
||||
{ value: 2, label: "بزرگراه" },
|
||||
{ value: 3, label: "اصلی" },
|
||||
{ value: 4, label: "فرعی" },
|
||||
{ value: 5, label: "روستایی" },
|
||||
];
|
||||
|
||||
const ReportPage = () => {
|
||||
const { data: userPermissions } = usePermissions();
|
||||
const hasProvincesPermission = userPermissions.includes("show-safety-and-privacy-operator-cartable");
|
||||
const { user } = useAuth();
|
||||
const requestServer = useRequest();
|
||||
const [data, setData] = useState(null);
|
||||
const [isLoading, setLoading] = useState(true);
|
||||
const defaultValues = useMemo(
|
||||
() => [
|
||||
{
|
||||
header: "استان",
|
||||
id: "province_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: hasProvincesPermission ? "" : user.province_id,
|
||||
enable: hasProvincesPermission,
|
||||
SelectComponent: (props) => {
|
||||
const { provinces, errorProvinces, loadingProvinces } = useProvinces();
|
||||
const getSelectOptions = useMemo(() => {
|
||||
if (loadingProvinces) {
|
||||
return [{ value: "loading", label: "در حال بارگذاری..." }];
|
||||
}
|
||||
if (errorProvinces) {
|
||||
return [{ value: "error", label: "خطا در بارگذاری" }];
|
||||
}
|
||||
return [
|
||||
{ value: "", label: "کل کشور" },
|
||||
...provinces.map((province) => ({
|
||||
value: province.id,
|
||||
label: province.name_fa,
|
||||
})),
|
||||
];
|
||||
}, [provinces, errorProvinces, loadingProvinces]);
|
||||
return (
|
||||
<CustomSelectByDependency
|
||||
{...props}
|
||||
value={loadingProvinces ? "loading" : props.filterParameters.value}
|
||||
selectOption={getSelectOptions}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "مورد مشاهده شده",
|
||||
id: "info_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: "",
|
||||
enable: true,
|
||||
SelectComponent: (props) => {
|
||||
const { itemsList, loadingItemsList, errorItemsList } = useSafetyAndPrivacyGetItems();
|
||||
|
||||
const getSelectOptions = useMemo(() => {
|
||||
if (loadingItemsList) {
|
||||
return [{ value: "loading", label: "در حال بارگذاری..." }];
|
||||
}
|
||||
if (errorItemsList) {
|
||||
return [{ value: "error", label: "خطا در بارگذاری" }];
|
||||
}
|
||||
return [
|
||||
{ value: "", label: "همه موارد" },
|
||||
...itemsList.map((item) => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
})),
|
||||
];
|
||||
}, [itemsList, loadingItemsList, errorItemsList]);
|
||||
|
||||
return (
|
||||
<CustomSelectByDependency
|
||||
{...props}
|
||||
value={loadingItemsList ? "loading" : props.filterParameters.value}
|
||||
selectOption={getSelectOptions}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "نوع محور",
|
||||
id: "axis_type_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: "",
|
||||
enable: true,
|
||||
selectOption: () => {
|
||||
return axisOptions.map((status) => ({
|
||||
value: status.value,
|
||||
label: status.label,
|
||||
}));
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "وضعیت",
|
||||
id: "step",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: "",
|
||||
enable: true,
|
||||
selectOption: () => {
|
||||
return statusOptions.map((status) => ({
|
||||
value: status.value,
|
||||
label: status.label,
|
||||
}));
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "تاریخ ثبت",
|
||||
id: "created_at",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ بازدید",
|
||||
id: "activity_date_time",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ بارگذاری مستندات",
|
||||
id: "judiciary_document_upload_date",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ اقدام",
|
||||
id: "action_date",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
],
|
||||
[hasProvincesPermission, user.province_id]
|
||||
);
|
||||
|
||||
const [filterData, setFilterData] = useState(
|
||||
defaultValues.reduce((acc, item) => {
|
||||
acc[item.id] = item;
|
||||
return acc;
|
||||
}, {})
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const filters = DataTableFilterDataStructure(filterData, isArrayEmpty);
|
||||
const params = new URLSearchParams();
|
||||
params.set("filters", JSON.stringify(filters || []));
|
||||
if (filterData.province_id.value === "") {
|
||||
try {
|
||||
const response = await requestServer(
|
||||
`${GET_ROAD_SAFETY_PROVINCE_ACTIVITY_REPORT}?${params.toString()}`
|
||||
);
|
||||
const result = response.data.data;
|
||||
const nationalReportForItem = result.activities.find((report) => report.province_id === -1);
|
||||
const nationalReport = {
|
||||
edare_name: "کل کشور",
|
||||
...nationalReportForItem,
|
||||
};
|
||||
|
||||
setData([
|
||||
nationalReport,
|
||||
...result.provinces.map((province) => {
|
||||
const filteredReports = result.activities.find(
|
||||
(report) => report.province_id === province.id
|
||||
);
|
||||
return {
|
||||
...filteredReports,
|
||||
edare_name: province.name_fa,
|
||||
};
|
||||
}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
} else {
|
||||
params.set("province_id", filterData.province_id.value);
|
||||
try {
|
||||
const response = await requestServer(
|
||||
`${GET_ROAD_SAFETY_CITY_ACTIVITY_REPORT}?${params.toString()}`
|
||||
);
|
||||
const result = response.data.data;
|
||||
const nationalReportForItem = result.activities.find(
|
||||
(report) => report.edare_shahri_id == "-1"
|
||||
);
|
||||
const nationalReport = {
|
||||
...nationalReportForItem,
|
||||
edare_name: "کل استان",
|
||||
};
|
||||
setData([
|
||||
nationalReport,
|
||||
...result.edarateShahri.map((edare) => {
|
||||
const filteredReports = result.activities.find(
|
||||
(report) => report.edare_shahri_id == edare.id
|
||||
);
|
||||
return {
|
||||
edare_name: edare.name_fa,
|
||||
...filteredReports,
|
||||
};
|
||||
}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
fetchData();
|
||||
}, [filterData]);
|
||||
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={" کارتابل گزارش نگهداری حریم راه"} />
|
||||
{!data ? (
|
||||
<LinearProgress />
|
||||
) : (
|
||||
<ReportLists filterData={filterData} setFilterData={setFilterData} isLoading={isLoading} data={data} />
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default ReportPage;
|
||||
"use client";
|
||||
import CustomSelectByDependency from "@/core/components/FilterDrawer/fieldsType/CustomSelectByDependency";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import DataTableFilterDataStructure from "@/core/utils/DataTableFilterDataStructure";
|
||||
import isArrayEmpty from "@/core/utils/isArrayEmpty";
|
||||
import {
|
||||
GET_ROAD_SAFETY_CITY_ACTIVITY_ACCESS_ROAD_REPORT,
|
||||
GET_ROAD_SAFETY_PROVINCE_ACTIVITY_ACCESS_ROAD_REPORT,
|
||||
} from "@/core/utils/routes";
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||
import useProvinces from "@/lib/hooks/useProvince";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { LinearProgress, Stack } from "@mui/material";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import ReportLists from "./ReportLists";
|
||||
import groupByProvinceAxisStep from "@/core/utils/groupByProvinceAxisStep";
|
||||
import groupByEdareAxisStep from "@/core/utils/groupByEdareAxisStep";
|
||||
|
||||
const ReportAccessRoadPage = () => {
|
||||
const { data: userPermissions } = usePermissions();
|
||||
const hasProvincesPermission = userPermissions.includes("show-safety-and-privacy-operator-cartable");
|
||||
const { user } = useAuth();
|
||||
const requestServer = useRequest();
|
||||
const [data, setData] = useState(null);
|
||||
const [isLoading, setLoading] = useState(true);
|
||||
|
||||
const defaultValues = useMemo(
|
||||
() => [
|
||||
{
|
||||
header: "استان",
|
||||
id: "province_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: hasProvincesPermission ? "" : user.province_id,
|
||||
enable: hasProvincesPermission,
|
||||
SelectComponent: (props) => {
|
||||
const { provinces, errorProvinces, loadingProvinces } = useProvinces();
|
||||
const getSelectOptions = useMemo(() => {
|
||||
if (loadingProvinces) {
|
||||
return [{ value: "loading", label: "در حال بارگذاری..." }];
|
||||
}
|
||||
if (errorProvinces) {
|
||||
return [{ value: "error", label: "خطا در بارگذاری" }];
|
||||
}
|
||||
return [
|
||||
{ value: "", label: "کل کشور" },
|
||||
...provinces.map((province) => ({
|
||||
value: province.id,
|
||||
label: province.name_fa,
|
||||
})),
|
||||
];
|
||||
}, [provinces, errorProvinces, loadingProvinces]);
|
||||
return (
|
||||
<CustomSelectByDependency
|
||||
{...props}
|
||||
value={loadingProvinces ? "loading" : props.filterParameters.value}
|
||||
selectOption={getSelectOptions}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "مورد",
|
||||
id: "info_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: "90",
|
||||
enable: false,
|
||||
},
|
||||
{
|
||||
header: "تاریخ ثبت",
|
||||
id: "created_at",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ بازدید",
|
||||
id: "activity_date_time",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ بارگذاری مستندات",
|
||||
id: "judiciary_document_upload_date",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ اقدام",
|
||||
id: "action_date",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
],
|
||||
[hasProvincesPermission, user.province_id]
|
||||
);
|
||||
|
||||
const [filterData, setFilterData] = useState(
|
||||
defaultValues.reduce((acc, item) => {
|
||||
acc[item.id] = item;
|
||||
return acc;
|
||||
}, {})
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const filters = DataTableFilterDataStructure(filterData, isArrayEmpty);
|
||||
const params = new URLSearchParams();
|
||||
params.set("filters", JSON.stringify(filters || []));
|
||||
if (filterData.province_id.value === "") {
|
||||
try {
|
||||
const response = await requestServer(
|
||||
`${GET_ROAD_SAFETY_PROVINCE_ACTIVITY_ACCESS_ROAD_REPORT}?${params.toString()}`
|
||||
);
|
||||
|
||||
const result = response.data.data;
|
||||
const grouped = groupByProvinceAxisStep(result.activities);
|
||||
|
||||
const nationalReportForItem = grouped[-1];
|
||||
const nationalReport = {
|
||||
edare_name: "کل کشور",
|
||||
...nationalReportForItem,
|
||||
};
|
||||
|
||||
setData([
|
||||
nationalReport,
|
||||
...result.provinces.map((province) => {
|
||||
const filteredReports = grouped[province.id];
|
||||
return {
|
||||
...filteredReports,
|
||||
edare_name: province.name_fa,
|
||||
};
|
||||
}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
} else {
|
||||
params.set("province_id", filterData.province_id.value);
|
||||
try {
|
||||
const response = await requestServer(
|
||||
`${GET_ROAD_SAFETY_CITY_ACTIVITY_ACCESS_ROAD_REPORT}?${params.toString()}`
|
||||
);
|
||||
const result = response.data.data;
|
||||
const grouped = groupByEdareAxisStep(result.activities);
|
||||
|
||||
const nationalReportForItem = grouped[-1];
|
||||
const nationalReport = {
|
||||
...nationalReportForItem,
|
||||
edare_name: "کل استان",
|
||||
};
|
||||
setData([
|
||||
nationalReport,
|
||||
...result.edarateShahri.map((edare) => {
|
||||
const filteredReports = grouped[edare.id];
|
||||
return {
|
||||
edare_name: edare.name_fa,
|
||||
...filteredReports,
|
||||
};
|
||||
}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
fetchData();
|
||||
}, [filterData]);
|
||||
|
||||
console.log(data);
|
||||
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"گزارش بر اساس راه دسترسی غیر مجاز"} />
|
||||
{!data ? (
|
||||
<LinearProgress />
|
||||
) : (
|
||||
<>
|
||||
<ReportLists
|
||||
filterData={filterData}
|
||||
setFilterData={setFilterData}
|
||||
isLoading={isLoading}
|
||||
data={data}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default ReportAccessRoadPage;
|
||||
@@ -1,67 +1,70 @@
|
||||
"use client";
|
||||
import DataTableFilterDataStructure from "@/core/utils/DataTableFilterDataStructure";
|
||||
import isArrayEmpty from "@/core/utils/isArrayEmpty";
|
||||
import { EXPORT_COUNTRY_ROAD_SAFETY_REPORT, EXPORT_PROVINCE_ROAD_SAFETY_REPORT } from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import DescriptionIcon from "@mui/icons-material/Description";
|
||||
import { Button, CircularProgress, IconButton, useMediaQuery } from "@mui/material";
|
||||
import FileSaver from "file-saver";
|
||||
import moment from "jalali-moment";
|
||||
import { useState } from "react";
|
||||
|
||||
const PrintExcel = ({ table, filterData }) => {
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||
const [loading, setLoading] = useState(false);
|
||||
const requestServer = useRequest({ notificationSuccess: true });
|
||||
|
||||
const clickHandler = () => {
|
||||
setLoading(true);
|
||||
const filters = DataTableFilterDataStructure(filterData, isArrayEmpty);
|
||||
const filterParams = new URLSearchParams();
|
||||
let requestUrl;
|
||||
filterParams.set("filters", JSON.stringify(filters || []));
|
||||
if (filterData.province_id.value === "") {
|
||||
requestUrl = EXPORT_COUNTRY_ROAD_SAFETY_REPORT;
|
||||
} else {
|
||||
filterParams.set("province_id", filterData.province_id.value);
|
||||
requestUrl = EXPORT_PROVINCE_ROAD_SAFETY_REPORT;
|
||||
}
|
||||
|
||||
requestServer(`${requestUrl}?${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 (
|
||||
<>
|
||||
{isMobile ? (
|
||||
<IconButton aria-label="خروجی اکسل" color="primary" onClick={clickHandler}>
|
||||
<DescriptionIcon sx={{ fontSize: "25px" }} />
|
||||
</IconButton>
|
||||
) : (
|
||||
<Button
|
||||
color="primary"
|
||||
variant="contained"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
startIcon={loading ? <CircularProgress size={18} color="inherit" /> : <DescriptionIcon />}
|
||||
onClick={clickHandler}
|
||||
>
|
||||
خروجی اکسل
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default PrintExcel;
|
||||
"use client";
|
||||
import DataTableFilterDataStructure from "@/core/utils/DataTableFilterDataStructure";
|
||||
import isArrayEmpty from "@/core/utils/isArrayEmpty";
|
||||
import {
|
||||
EXPORT_ROAD_SAFETY_CITY_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT,
|
||||
EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORTT,
|
||||
} from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import DescriptionIcon from "@mui/icons-material/Description";
|
||||
import { Button, CircularProgress, IconButton, useMediaQuery } from "@mui/material";
|
||||
import FileSaver from "file-saver";
|
||||
import moment from "jalali-moment";
|
||||
import { useState } from "react";
|
||||
|
||||
const PrintExcel = ({ table, filterData }) => {
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||
const [loading, setLoading] = useState(false);
|
||||
const requestServer = useRequest({ notificationSuccess: true });
|
||||
|
||||
const clickHandler = () => {
|
||||
setLoading(true);
|
||||
const filters = DataTableFilterDataStructure(filterData, isArrayEmpty);
|
||||
const filterParams = new URLSearchParams();
|
||||
let requestUrl;
|
||||
filterParams.set("filters", JSON.stringify(filters || []));
|
||||
if (filterData.province_id.value === "") {
|
||||
requestUrl = EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORTT;
|
||||
} else {
|
||||
filterParams.set("province_id", filterData.province_id.value);
|
||||
requestUrl = EXPORT_ROAD_SAFETY_CITY_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT;
|
||||
}
|
||||
|
||||
requestServer(`${requestUrl}?${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 (
|
||||
<>
|
||||
{isMobile ? (
|
||||
<IconButton aria-label="خروجی اکسل" color="primary" onClick={clickHandler}>
|
||||
<DescriptionIcon sx={{ fontSize: "25px" }} />
|
||||
</IconButton>
|
||||
) : (
|
||||
<Button
|
||||
color="primary"
|
||||
variant="contained"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
startIcon={loading ? <CircularProgress size={18} color="inherit" /> : <DescriptionIcon />}
|
||||
onClick={clickHandler}
|
||||
>
|
||||
خروجی اکسل
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default PrintExcel;
|
||||
@@ -0,0 +1,463 @@
|
||||
"use client";
|
||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||
import { Box } from "@mui/material";
|
||||
import { useMemo } from "react";
|
||||
import Toolbar from "./Toolbar";
|
||||
|
||||
const ReportLists = ({ data, filterData, setFilterData, isLoading }) => {
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "edare_name",
|
||||
header: "اداره کل",
|
||||
id: "edare_name",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].total_sum : 0),
|
||||
header: "تعداد کل",
|
||||
id: "sum",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "آزادراه",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_1",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_1.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_1.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_1.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "بزرگراه",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_2",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_2.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_2.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_2.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "اصلی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_3",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_3.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_3.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_3.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "فرعی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_4",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_4.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_4.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_4.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "روستایی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_5",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_5.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_5.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_5.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
TableToolbar={Toolbar}
|
||||
columns={columns}
|
||||
data={data}
|
||||
page_name={"roadSafetyReportConstructionActivity"}
|
||||
table_name={"roadSafetyReportConstructionActivityList"}
|
||||
enablePagination={false}
|
||||
specialFilter={filterData}
|
||||
setFilterData={setFilterData}
|
||||
loading={isLoading}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ReportLists;
|
||||
@@ -0,0 +1,11 @@
|
||||
import PrintExcel from "./ExcelPrint";
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
const Toolbar = ({ table, filterData, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<PrintExcel table={table} filterData={filterData} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default Toolbar;
|
||||
@@ -0,0 +1,207 @@
|
||||
"use client";
|
||||
import CustomSelectByDependency from "@/core/components/FilterDrawer/fieldsType/CustomSelectByDependency";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import DataTableFilterDataStructure from "@/core/utils/DataTableFilterDataStructure";
|
||||
import groupByEdareAxisStep from "@/core/utils/groupByEdareAxisStep";
|
||||
import groupByProvinceAxisStep from "@/core/utils/groupByProvinceAxisStep";
|
||||
import isArrayEmpty from "@/core/utils/isArrayEmpty";
|
||||
import {
|
||||
GET_ROAD_SAFETY_CITY_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT,
|
||||
GET_ROAD_SAFETY_PROVINCE_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT,
|
||||
} from "@/core/utils/routes";
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||
import useProvinces from "@/lib/hooks/useProvince";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { LinearProgress, Stack } from "@mui/material";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import ReportLists from "./ReportLists";
|
||||
|
||||
const ReportConstructionActivityPage = () => {
|
||||
const { data: userPermissions } = usePermissions();
|
||||
const hasProvincesPermission = userPermissions.includes("show-safety-and-privacy-operator-cartable");
|
||||
const { user } = useAuth();
|
||||
const requestServer = useRequest();
|
||||
const [data, setData] = useState(null);
|
||||
const [isLoading, setLoading] = useState(true);
|
||||
|
||||
const defaultValues = useMemo(
|
||||
() => [
|
||||
{
|
||||
header: "استان",
|
||||
id: "province_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: hasProvincesPermission ? "" : user.province_id,
|
||||
enable: hasProvincesPermission,
|
||||
SelectComponent: (props) => {
|
||||
const { provinces, errorProvinces, loadingProvinces } = useProvinces();
|
||||
const getSelectOptions = useMemo(() => {
|
||||
if (loadingProvinces) {
|
||||
return [{ value: "loading", label: "در حال بارگذاری..." }];
|
||||
}
|
||||
if (errorProvinces) {
|
||||
return [{ value: "error", label: "خطا در بارگذاری" }];
|
||||
}
|
||||
return [
|
||||
{ value: "", label: "کل کشور" },
|
||||
...provinces.map((province) => ({
|
||||
value: province.id,
|
||||
label: province.name_fa,
|
||||
})),
|
||||
];
|
||||
}, [provinces, errorProvinces, loadingProvinces]);
|
||||
return (
|
||||
<CustomSelectByDependency
|
||||
{...props}
|
||||
value={loadingProvinces ? "loading" : props.filterParameters.value}
|
||||
selectOption={getSelectOptions}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "مورد",
|
||||
id: "info_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: "89",
|
||||
enable: false,
|
||||
},
|
||||
{
|
||||
header: "تاریخ ثبت",
|
||||
id: "created_at",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ بازدید",
|
||||
id: "activity_date_time",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ بارگذاری مستندات",
|
||||
id: "judiciary_document_upload_date",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ اقدام",
|
||||
id: "action_date",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
],
|
||||
[hasProvincesPermission, user.province_id]
|
||||
);
|
||||
|
||||
const [filterData, setFilterData] = useState(
|
||||
defaultValues.reduce((acc, item) => {
|
||||
acc[item.id] = item;
|
||||
return acc;
|
||||
}, {})
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const filters = DataTableFilterDataStructure(filterData, isArrayEmpty);
|
||||
const params = new URLSearchParams();
|
||||
params.set("filters", JSON.stringify(filters || []));
|
||||
if (filterData.province_id.value === "") {
|
||||
try {
|
||||
const response = await requestServer(
|
||||
`${GET_ROAD_SAFETY_PROVINCE_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT}?${params.toString()}`
|
||||
);
|
||||
|
||||
const result = response.data.data;
|
||||
const grouped = groupByProvinceAxisStep(result.activities);
|
||||
|
||||
const nationalReportForItem = grouped[-1];
|
||||
const nationalReport = {
|
||||
edare_name: "کل کشور",
|
||||
...nationalReportForItem,
|
||||
};
|
||||
|
||||
setData([
|
||||
nationalReport,
|
||||
...result.provinces.map((province) => {
|
||||
const filteredReports = grouped[province.id];
|
||||
return {
|
||||
...filteredReports,
|
||||
edare_name: province.name_fa,
|
||||
};
|
||||
}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
} else {
|
||||
params.set("province_id", filterData.province_id.value);
|
||||
try {
|
||||
const response = await requestServer(
|
||||
`${GET_ROAD_SAFETY_CITY_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT}?${params.toString()}`
|
||||
);
|
||||
const result = response.data.data;
|
||||
const grouped = groupByEdareAxisStep(result.activities);
|
||||
|
||||
const nationalReportForItem = grouped[-1];
|
||||
const nationalReport = {
|
||||
...nationalReportForItem,
|
||||
edare_name: "کل استان",
|
||||
};
|
||||
setData([
|
||||
nationalReport,
|
||||
...result.edarateShahri.map((edare) => {
|
||||
const filteredReports = grouped[edare.id];
|
||||
return {
|
||||
edare_name: edare.name_fa,
|
||||
...filteredReports,
|
||||
};
|
||||
}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
fetchData();
|
||||
}, [filterData]);
|
||||
|
||||
console.log(data);
|
||||
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"گزارش بر اساس ساخت و ساز غیر مجاز"} />
|
||||
{!data ? (
|
||||
<LinearProgress />
|
||||
) : (
|
||||
<>
|
||||
<ReportLists
|
||||
filterData={filterData}
|
||||
setFilterData={setFilterData}
|
||||
isLoading={isLoading}
|
||||
data={data}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default ReportConstructionActivityPage;
|
||||
@@ -151,4 +151,4 @@ const ContentInfoItem = ({ data }) => {
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default ContentInfoItem;
|
||||
export default ContentInfoItem;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import { Controller } from "react-hook-form";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import React from "react";
|
||||
import moment from "jalali-moment";
|
||||
|
||||
const FromDateController = ({ control }) => {
|
||||
return (
|
||||
<Controller
|
||||
name="from_date"
|
||||
control={control}
|
||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||
<MuiDatePicker
|
||||
name="from_date"
|
||||
error={!!error}
|
||||
value={value}
|
||||
label={"تاریخ ثبت (از تاریخ)"}
|
||||
placeholder={"از تاریخ"}
|
||||
setFieldValue={(name, newValue) => {
|
||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||
onChange(formattedDate); // Update the field value in react-hook-form
|
||||
}}
|
||||
helperText={error ? error.message : null}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default FromDateController;
|
||||
@@ -1,49 +0,0 @@
|
||||
import { Button, Grid, LinearProgress, Typography } from "@mui/material";
|
||||
import SearchIcon from "@mui/icons-material/Search";
|
||||
import React from "react";
|
||||
import FromDateController from "./FromDateController";
|
||||
import ToDateController from "./ToDateController";
|
||||
import SelectProvince from "./SelectProvince";
|
||||
import { Controller } from "react-hook-form";
|
||||
import SelectAxisType from "./SelectAxisType";
|
||||
|
||||
const SearchReportField = ({ control, hasProvincesPermission }) => {
|
||||
return (
|
||||
<Grid container spacing={2} sx={{ py: 2 }}>
|
||||
<Grid item xs={12} md={hasProvincesPermission ? 2 : 3}>
|
||||
<FromDateController control={control} />
|
||||
</Grid>
|
||||
<Grid item xs={12} md={hasProvincesPermission ? 2 : 3}>
|
||||
<ToDateController control={control} />
|
||||
</Grid>
|
||||
{hasProvincesPermission && (
|
||||
<Grid item xs={12} md={3}>
|
||||
<SelectProvince control={control} />
|
||||
</Grid>
|
||||
)}
|
||||
<Grid item xs={12} md={hasProvincesPermission ? 2 : 3}>
|
||||
<SelectAxisType control={control} />
|
||||
</Grid>
|
||||
<Grid item xs={12} md={hasProvincesPermission ? 3 : 3}>
|
||||
<Controller
|
||||
name="submitButton"
|
||||
control={control}
|
||||
render={({ field: { value, onChange }, formState: { isSubmitting } }) => (
|
||||
<Button
|
||||
variant="contained"
|
||||
size="medium"
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
endIcon={<SearchIcon />}
|
||||
fullWidth
|
||||
>
|
||||
{isSubmitting ? "درحال دریافت اطلاعات" : "جستجو"}
|
||||
</Button>
|
||||
)}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
export default SearchReportField;
|
||||
@@ -1,45 +0,0 @@
|
||||
import { FormControl, FormHelperText, InputLabel, MenuItem, Select } from "@mui/material";
|
||||
import { Controller } from "react-hook-form";
|
||||
|
||||
const axisOptions = [
|
||||
{ value: 1, label: "آزادراه" },
|
||||
{ value: 2, label: "بزرگراه" },
|
||||
{ value: 3, label: "اصلی" },
|
||||
{ value: 4, label: "فرعی" },
|
||||
{ value: 5, label: "روستایی" },
|
||||
];
|
||||
|
||||
const SelectAxisType = ({ control }) => {
|
||||
return (
|
||||
<Controller
|
||||
name="axis_type_id"
|
||||
control={control}
|
||||
render={({ field, fieldState: { error } }) => (
|
||||
<FormControl error={!!error} size="small" fullWidth>
|
||||
<InputLabel id="axis_type_id_label">نوع محور</InputLabel>
|
||||
<Select
|
||||
{...field}
|
||||
labelId="axis_type_id_label"
|
||||
id="axis_type_id"
|
||||
value={field.value || ""}
|
||||
label="نوع محور"
|
||||
onChange={field.onChange}
|
||||
>
|
||||
{[
|
||||
<MenuItem key="-1" value={"-1"}>
|
||||
همه محور ها
|
||||
</MenuItem>,
|
||||
...axisOptions.map((axisOption, index) => (
|
||||
<MenuItem key={index} value={axisOption.value}>
|
||||
{axisOption.label}
|
||||
</MenuItem>
|
||||
)),
|
||||
]}
|
||||
</Select>
|
||||
{error && <FormHelperText>{error.message}</FormHelperText>}
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default SelectAxisType;
|
||||
@@ -1,45 +0,0 @@
|
||||
import useProvinces from "@/lib/hooks/useProvince";
|
||||
import { FormControl, FormHelperText, InputLabel, MenuItem, Select } from "@mui/material";
|
||||
import { Controller } from "react-hook-form";
|
||||
|
||||
const SelectProvince = ({ control }) => {
|
||||
const { provinces, loadingProvinces, errorProvinces } = useProvinces();
|
||||
return (
|
||||
<Controller
|
||||
name="province_id"
|
||||
control={control}
|
||||
render={({ field, fieldState: { error } }) => (
|
||||
<FormControl error={!!error} size="small" fullWidth>
|
||||
<InputLabel id="demo-error-label">استان</InputLabel>
|
||||
<Select
|
||||
{...field}
|
||||
labelId="demo-error-label"
|
||||
id="province_id"
|
||||
value={loadingProvinces ? "loading" : field.value || ""}
|
||||
label="استان"
|
||||
onChange={field.onChange}
|
||||
>
|
||||
{loadingProvinces ? (
|
||||
<MenuItem value={"loading"}>در حال بارگذاری...</MenuItem>
|
||||
) : errorProvinces ? (
|
||||
<MenuItem value={"error"}>خطا در بارگذاری</MenuItem>
|
||||
) : (
|
||||
[
|
||||
<MenuItem key="-1" value={"-1"}>
|
||||
کل کشور
|
||||
</MenuItem>,
|
||||
...provinces.map((province) => (
|
||||
<MenuItem key={province.id} value={province.id}>
|
||||
{province.name_fa}
|
||||
</MenuItem>
|
||||
)),
|
||||
]
|
||||
)}
|
||||
</Select>
|
||||
{error && <FormHelperText>{error.message}</FormHelperText>}
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default SelectProvince;
|
||||
@@ -1,30 +0,0 @@
|
||||
import { Controller, useWatch } from "react-hook-form";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import React from "react";
|
||||
import moment from "jalali-moment";
|
||||
|
||||
const ToDateController = ({ control }) => {
|
||||
const minDate = useWatch({ control, name: "from_date" });
|
||||
return (
|
||||
<Controller
|
||||
name="date_to"
|
||||
control={control}
|
||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||
<MuiDatePicker
|
||||
name="date_to"
|
||||
minDate={minDate}
|
||||
error={!!error}
|
||||
value={value}
|
||||
label={"تاریخ ثبت (تا تاریخ)"}
|
||||
placeholder={"تا تاریخ"}
|
||||
setFieldValue={(name, newValue) => {
|
||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||
onChange(formattedDate); // Update the field value in react-hook-form
|
||||
}}
|
||||
helperText={error ? error.message : null}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default ToDateController;
|
||||
@@ -1,13 +0,0 @@
|
||||
import StyledForm from "@/core/components/StyledForm";
|
||||
import SearchReportField from "./SearchReportField";
|
||||
|
||||
const SearchReportList = ({ handleSubmit, onSearchSubmit, control, hasProvincesPermission }) => {
|
||||
return (
|
||||
<>
|
||||
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
|
||||
<SearchReportField control={control} hasProvincesPermission={hasProvincesPermission} />
|
||||
</StyledForm>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default SearchReportList;
|
||||
@@ -0,0 +1,70 @@
|
||||
"use client";
|
||||
import DataTableFilterDataStructure from "@/core/utils/DataTableFilterDataStructure";
|
||||
import isArrayEmpty from "@/core/utils/isArrayEmpty";
|
||||
import {
|
||||
EXPORT_ROAD_SAFETY_CITY_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT,
|
||||
EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORTT,
|
||||
} from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import DescriptionIcon from "@mui/icons-material/Description";
|
||||
import { Button, CircularProgress, IconButton, useMediaQuery } from "@mui/material";
|
||||
import FileSaver from "file-saver";
|
||||
import moment from "jalali-moment";
|
||||
import { useState } from "react";
|
||||
|
||||
const PrintExcel = ({ table, filterData }) => {
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||
const [loading, setLoading] = useState(false);
|
||||
const requestServer = useRequest({ notificationSuccess: true });
|
||||
|
||||
const clickHandler = () => {
|
||||
setLoading(true);
|
||||
const filters = DataTableFilterDataStructure(filterData, isArrayEmpty);
|
||||
const filterParams = new URLSearchParams();
|
||||
let requestUrl;
|
||||
filterParams.set("filters", JSON.stringify(filters || []));
|
||||
if (filterData.province_id.value === "") {
|
||||
requestUrl = EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORTT;
|
||||
} else {
|
||||
filterParams.set("province_id", filterData.province_id.value);
|
||||
requestUrl = EXPORT_ROAD_SAFETY_CITY_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT;
|
||||
}
|
||||
|
||||
requestServer(`${requestUrl}?${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 (
|
||||
<>
|
||||
{isMobile ? (
|
||||
<IconButton aria-label="خروجی اکسل" color="primary" onClick={clickHandler}>
|
||||
<DescriptionIcon sx={{ fontSize: "25px" }} />
|
||||
</IconButton>
|
||||
) : (
|
||||
<Button
|
||||
color="primary"
|
||||
variant="contained"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
startIcon={loading ? <CircularProgress size={18} color="inherit" /> : <DescriptionIcon />}
|
||||
onClick={clickHandler}
|
||||
>
|
||||
خروجی اکسل
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default PrintExcel;
|
||||
@@ -0,0 +1,463 @@
|
||||
"use client";
|
||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||
import { Box } from "@mui/material";
|
||||
import { useMemo } from "react";
|
||||
import Toolbar from "./Toolbar";
|
||||
|
||||
const ReportLists = ({ data, filterData, setFilterData, isLoading }) => {
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "edare_name",
|
||||
header: "اداره کل",
|
||||
id: "edare_name",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].total_sum : 0),
|
||||
header: "تعداد کل",
|
||||
id: "sum",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "آزادراه",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_1",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_1.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_1.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["1"] ? row["1"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_1.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "بزرگراه",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_2",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_2.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_2.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["2"] ? row["2"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_2.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "اصلی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_3",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_3.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_3.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["3"] ? row["3"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_3.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "فرعی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_4",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_4.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_4.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["4"] ? row["4"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_4.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: "روستایی",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
id: "id_5",
|
||||
grow: false,
|
||||
size: 50,
|
||||
columns: [
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s1 : 0),
|
||||
header: "گام اول",
|
||||
id: "id_5.1",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s2 : 0),
|
||||
header: "گام دوم",
|
||||
id: "id_5.2",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => (row["5"] ? row["5"].s3 : 0),
|
||||
header: "گام سوم",
|
||||
id: "id_5.3",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
muiTableBodyCellProps: {
|
||||
sx: {
|
||||
textAlign: "center",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
py: 0,
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset",
|
||||
},
|
||||
},
|
||||
},
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return (renderedCellValue / 1).toLocaleString();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
TableToolbar={Toolbar}
|
||||
columns={columns}
|
||||
data={data}
|
||||
page_name={"roadSafetyReportUtilityPassingActivity"}
|
||||
table_name={"roadSafetyReportUtilityPassingActivityList"}
|
||||
enablePagination={false}
|
||||
specialFilter={filterData}
|
||||
setFilterData={setFilterData}
|
||||
loading={isLoading}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ReportLists;
|
||||
@@ -0,0 +1,11 @@
|
||||
import PrintExcel from "./ExcelPrint";
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
const Toolbar = ({ table, filterData, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<PrintExcel table={table} filterData={filterData} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default Toolbar;
|
||||
@@ -0,0 +1,207 @@
|
||||
"use client";
|
||||
import CustomSelectByDependency from "@/core/components/FilterDrawer/fieldsType/CustomSelectByDependency";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import DataTableFilterDataStructure from "@/core/utils/DataTableFilterDataStructure";
|
||||
import groupByEdareAxisStep from "@/core/utils/groupByEdareAxisStep";
|
||||
import groupByProvinceAxisStep from "@/core/utils/groupByProvinceAxisStep";
|
||||
import isArrayEmpty from "@/core/utils/isArrayEmpty";
|
||||
import {
|
||||
GET_ROAD_SAFETY_CITY_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT,
|
||||
GET_ROAD_SAFETY_PROVINCE_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT,
|
||||
} from "@/core/utils/routes";
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||
import useProvinces from "@/lib/hooks/useProvince";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { LinearProgress, Stack } from "@mui/material";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import ReportLists from "./ReportLists";
|
||||
|
||||
const ReportUtilityPassingActivityPage = () => {
|
||||
const { data: userPermissions } = usePermissions();
|
||||
const hasProvincesPermission = userPermissions.includes("show-safety-and-privacy-operator-cartable");
|
||||
const { user } = useAuth();
|
||||
const requestServer = useRequest();
|
||||
const [data, setData] = useState(null);
|
||||
const [isLoading, setLoading] = useState(true);
|
||||
|
||||
const defaultValues = useMemo(
|
||||
() => [
|
||||
{
|
||||
header: "استان",
|
||||
id: "province_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: hasProvincesPermission ? "" : user.province_id,
|
||||
enable: hasProvincesPermission,
|
||||
SelectComponent: (props) => {
|
||||
const { provinces, errorProvinces, loadingProvinces } = useProvinces();
|
||||
const getSelectOptions = useMemo(() => {
|
||||
if (loadingProvinces) {
|
||||
return [{ value: "loading", label: "در حال بارگذاری..." }];
|
||||
}
|
||||
if (errorProvinces) {
|
||||
return [{ value: "error", label: "خطا در بارگذاری" }];
|
||||
}
|
||||
return [
|
||||
{ value: "", label: "کل کشور" },
|
||||
...provinces.map((province) => ({
|
||||
value: province.id,
|
||||
label: province.name_fa,
|
||||
})),
|
||||
];
|
||||
}, [provinces, errorProvinces, loadingProvinces]);
|
||||
return (
|
||||
<CustomSelectByDependency
|
||||
{...props}
|
||||
value={loadingProvinces ? "loading" : props.filterParameters.value}
|
||||
selectOption={getSelectOptions}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "مورد",
|
||||
id: "info_id",
|
||||
filterMode: "equals",
|
||||
datatype: "numeric",
|
||||
value: "91",
|
||||
enable: false,
|
||||
},
|
||||
{
|
||||
header: "تاریخ ثبت",
|
||||
id: "created_at",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ بازدید",
|
||||
id: "activity_date_time",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ بارگذاری مستندات",
|
||||
id: "judiciary_document_upload_date",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
header: "تاریخ اقدام",
|
||||
id: "action_date",
|
||||
filterMode: "between",
|
||||
datatype: "date",
|
||||
value: ["", ""],
|
||||
enable: true,
|
||||
},
|
||||
],
|
||||
[hasProvincesPermission, user.province_id]
|
||||
);
|
||||
|
||||
const [filterData, setFilterData] = useState(
|
||||
defaultValues.reduce((acc, item) => {
|
||||
acc[item.id] = item;
|
||||
return acc;
|
||||
}, {})
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const filters = DataTableFilterDataStructure(filterData, isArrayEmpty);
|
||||
const params = new URLSearchParams();
|
||||
params.set("filters", JSON.stringify(filters || []));
|
||||
if (filterData.province_id.value === "") {
|
||||
try {
|
||||
const response = await requestServer(
|
||||
`${GET_ROAD_SAFETY_PROVINCE_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT}?${params.toString()}`
|
||||
);
|
||||
|
||||
const result = response.data.data;
|
||||
const grouped = groupByProvinceAxisStep(result.activities);
|
||||
|
||||
const nationalReportForItem = grouped[-1];
|
||||
const nationalReport = {
|
||||
edare_name: "کل کشور",
|
||||
...nationalReportForItem,
|
||||
};
|
||||
|
||||
setData([
|
||||
nationalReport,
|
||||
...result.provinces.map((province) => {
|
||||
const filteredReports = grouped[province.id];
|
||||
return {
|
||||
...filteredReports,
|
||||
edare_name: province.name_fa,
|
||||
};
|
||||
}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
} else {
|
||||
params.set("province_id", filterData.province_id.value);
|
||||
try {
|
||||
const response = await requestServer(
|
||||
`${GET_ROAD_SAFETY_CITY_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT}?${params.toString()}`
|
||||
);
|
||||
const result = response.data.data;
|
||||
const grouped = groupByEdareAxisStep(result.activities);
|
||||
|
||||
const nationalReportForItem = grouped[-1];
|
||||
const nationalReport = {
|
||||
...nationalReportForItem,
|
||||
edare_name: "کل استان",
|
||||
};
|
||||
setData([
|
||||
nationalReport,
|
||||
...result.edarateShahri.map((edare) => {
|
||||
const filteredReports = grouped[edare.id];
|
||||
return {
|
||||
edare_name: edare.name_fa,
|
||||
...filteredReports,
|
||||
};
|
||||
}),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
fetchData();
|
||||
}, [filterData]);
|
||||
|
||||
console.log(data);
|
||||
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"گزارش بر اساس عبور تاسیسات زیربنایی غیر مجاز"} />
|
||||
{!data ? (
|
||||
<LinearProgress />
|
||||
) : (
|
||||
<>
|
||||
<ReportLists
|
||||
filterData={filterData}
|
||||
setFilterData={setFilterData}
|
||||
isLoading={isLoading}
|
||||
data={data}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default ReportUtilityPassingActivityPage;
|
||||
@@ -155,8 +155,8 @@ const SupervisorList = () => {
|
||||
props.dependencyFieldValue?.value === ""
|
||||
? "empty"
|
||||
: loadingEdaratList
|
||||
? "loading"
|
||||
: props.filterParameters.value
|
||||
? "loading"
|
||||
: props.filterParameters.value
|
||||
}
|
||||
columnSelectOption={getColumnSelectOptions}
|
||||
/>
|
||||
@@ -313,8 +313,8 @@ const SupervisorList = () => {
|
||||
{row.original.is_finished == 1
|
||||
? "خاتمه یافته"
|
||||
: row.original.is_finished == 0
|
||||
? "در جریان"
|
||||
: "-"}
|
||||
? "در جریان"
|
||||
: "-"}
|
||||
</>
|
||||
),
|
||||
},
|
||||
@@ -476,7 +476,7 @@ const SupervisorList = () => {
|
||||
return (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
{row.original.judiciary_document_upload_date !== "0000-00-00 00:00:00" &&
|
||||
row.original.judiciary_document_upload_date ? (
|
||||
row.original.judiciary_document_upload_date ? (
|
||||
<JudiciaryDocumentDialog rowId={row.getValue("id")} />
|
||||
) : (
|
||||
<>-</>
|
||||
|
||||
@@ -16,7 +16,11 @@ export const errorServerToast = (toastContainer) =>
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
<Dangerous color="error" sx={{ mr: 1.6 }} />
|
||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
||||
<Typography variant="caption">{"The request failed due to an internal error."}</Typography>
|
||||
<Typography variant="caption">
|
||||
{
|
||||
"در پردازش درخواست مشکلی در سرور بهوجود آمد. لطفاً بعداً دوباره تلاش کنید یا با پشتیبانی تماس بگیرید."
|
||||
}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -46,7 +50,7 @@ export const errorUnauthorizedToast = (toastContainer) =>
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
<Dangerous color="error" sx={{ mr: 1.6 }} />
|
||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
||||
<Typography variant="caption">{"The user is not authorized to make the request."}</Typography>
|
||||
<Typography variant="caption">{"شما مجوز لازم برای انجام این عملیات را ندارید."}</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -75,7 +79,7 @@ export const errorAccessDeniedToast = (message, toastContainer) =>
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
<Dangerous color="error" sx={{ mr: 1.6 }} />
|
||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
||||
<Typography variant="caption">{message || "Access Denied"}</Typography>
|
||||
<Typography variant="caption">{message || "شما اجازه دسترسی به این بخش را ندارید."}</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -106,8 +110,7 @@ export const errorLogicToast = (message, toastContainer) =>
|
||||
<Dangerous color="error" sx={{ mr: 1.6 }} />
|
||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
||||
<Typography variant="caption">
|
||||
{message ||
|
||||
"The request was well-formed but was unable to be followed due to semantic errors."}
|
||||
{message || "درخواست شما معتبر است اما به دلیل اشکال در دادهها امکان انجام آن وجود ندارد."}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -137,8 +140,7 @@ export const errorValidationToast = (message, toastContainer) =>
|
||||
<Dangerous color="error" sx={{ mr: 1.6 }} />
|
||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
||||
<Typography variant="caption">
|
||||
{message ||
|
||||
"The request was well-formed but was unable to be followed due to semantic errors."}
|
||||
{message || "اطلاعات وارد شده قابل پردازش نیست. لطفاً دادهها را بررسی و دوباره تلاش کنید."}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -168,7 +170,7 @@ export const errorTooManyToast = (toastContainer) =>
|
||||
<Dangerous color="error" sx={{ mr: 1.6 }} />
|
||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
||||
<Typography variant="caption">
|
||||
{"Too many requests have been sent within a given time span."}
|
||||
{"تعداد درخواستهای شما بیش از حد مجاز است. لطفاً بعد از چند لحظه دوباره تلاش کنید."}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -198,9 +200,7 @@ export const errorClientToast = (toastContainer) =>
|
||||
<Dangerous color="error" sx={{ mr: 1.6 }} />
|
||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
||||
<Typography variant="caption">
|
||||
{
|
||||
"The API request is invalid or improperly formed. Consequently, the API server could not understand the request."
|
||||
}
|
||||
{"درخواست شما بهدرستی ارسال نشد. لطفاً دادههای وارد شده را بررسی کنید."}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
12
src/core/utils/groupByEdareAxisStep.js
Normal file
12
src/core/utils/groupByEdareAxisStep.js
Normal file
@@ -0,0 +1,12 @@
|
||||
export default function groupByEdareAxisStep(data) {
|
||||
return data.reduce((acc, item) => {
|
||||
const { edare_id, axis_type_id } = item;
|
||||
|
||||
if (!acc[edare_id]) acc[edare_id] = {};
|
||||
if (!acc[edare_id][axis_type_id]) acc[edare_id][axis_type_id] = {};
|
||||
|
||||
acc[edare_id][axis_type_id] = { ...item };
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
12
src/core/utils/groupByProvinceAxisStep.js
Normal file
12
src/core/utils/groupByProvinceAxisStep.js
Normal file
@@ -0,0 +1,12 @@
|
||||
export default function groupByProvinceAxisStep(data) {
|
||||
return data.reduce((acc, item) => {
|
||||
const { province_id, axis_type_id } = item;
|
||||
|
||||
if (!acc[province_id]) acc[province_id] = {};
|
||||
if (!acc[province_id][axis_type_id]) acc[province_id][axis_type_id] = {};
|
||||
|
||||
acc[province_id][axis_type_id] = { ...item };
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
@@ -387,13 +387,43 @@ export const pageMenu = [
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReport",
|
||||
label: "گزارش ها",
|
||||
type: "page",
|
||||
route: "/dashboard/road-safety/reports",
|
||||
type: "menu",
|
||||
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
hasSubitems: true,
|
||||
Subitems: [
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReportConstructionActivity",
|
||||
label: "بر اساس ساخت و ساز غیر مجاز",
|
||||
type: "page",
|
||||
route: "/dashboard/road-safety/reports/construction-activity",
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReportAccessRoad",
|
||||
label: "بر اساس راه دسترسی غیر مجاز",
|
||||
type: "page",
|
||||
route: "/dashboard/road-safety/reports/access-road",
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReportUtilityPassingActivity",
|
||||
label: "بر اساس عبور تاسیسات زیربنایی غیر مجاز",
|
||||
type: "page",
|
||||
route: "/dashboard/road-safety/reports/utility-passing-activity",
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -391,13 +391,43 @@ export const pageMenuDev = [
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReport",
|
||||
label: "گزارش ها",
|
||||
type: "page",
|
||||
route: "/dashboard/road-safety/reports",
|
||||
type: "menu",
|
||||
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
hasSubitems: true,
|
||||
Subitems: [
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReportConstructionActivity",
|
||||
label: "بر اساس ساخت و ساز غیر مجاز",
|
||||
type: "page",
|
||||
route: "/dashboard/road-safety/reports/construction-activity",
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReportAccessRoad",
|
||||
label: "بر اساس راه دسترسی غیر مجاز",
|
||||
type: "page",
|
||||
route: "/dashboard/road-safety/reports/access-road",
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReportUtilityPassingActivity",
|
||||
label: "بر اساس عبور تاسیسات زیربنایی غیر مجاز",
|
||||
type: "page",
|
||||
route: "/dashboard/road-safety/reports/utility-passing-activity",
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -161,10 +161,33 @@ export const GET_ROAD_SAFETY_CITY_ACTIVITY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy_report/operator/province_activity";
|
||||
export const GET_ROAD_SAFETY_REPORT_MAP = api + "/api/v3/safety_and_privacy/map";
|
||||
export const GET_ROAD_SAFETY_DETAILS = api + "/api/v3/safety_and_privacy/operator";
|
||||
export const EXPORT_COUNTRY_ROAD_SAFETY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy_report/operator/country_excel_activity";
|
||||
export const EXPORT_PROVINCE_ROAD_SAFETY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy_report/operator/province_excel_activity";
|
||||
|
||||
export const GET_ROAD_SAFETY_PROVINCE_ACTIVITY_ACCESS_ROAD_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/access_road/country_activity";
|
||||
export const GET_ROAD_SAFETY_CITY_ACTIVITY_ACCESS_ROAD_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/access_road/province_activity";
|
||||
export const EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_ACCESS_ROAD_REPORTT =
|
||||
api + "/api/v3/safety_and_privacy/access_road/country_excel_activity";
|
||||
export const EXPORT_ROAD_SAFETY_CITY_ACTIVITY_ACCESS_ROAD_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/access_road/province_excel_activity";
|
||||
|
||||
export const GET_ROAD_SAFETY_PROVINCE_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/construction_activity/country_activity";
|
||||
export const GET_ROAD_SAFETY_CITY_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/construction_activity/province_activity";
|
||||
export const EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORTT =
|
||||
api + "/api/v3/safety_and_privacy/construction_activity/country_excel_activity";
|
||||
export const EXPORT_ROAD_SAFETY_CITY_ACTIVITY_CONSTRUCTION_ACTIVITY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/construction_activity/province_excel_activity";
|
||||
|
||||
export const GET_ROAD_SAFETY_PROVINCE_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/utility_passing_activity/country_activity";
|
||||
export const GET_ROAD_SAFETY_CITY_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/utility_passing_activity/province_activity";
|
||||
export const EXPORT_ROAD_SAFETY_PROVINCE_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORTT =
|
||||
api + "/api/v3/safety_and_privacy/utility_passing_activity/country_excel_activity";
|
||||
export const EXPORT_ROAD_SAFETY_CITY_ACTIVITY_UTILITY_PASSING_ACTIVITY_REPORT =
|
||||
api + "/api/v3/safety_and_privacy/utility_passing_activity/province_excel_activity";
|
||||
|
||||
// permission table
|
||||
export const GET_PERMISSION_TABLE_LIST = api + "/api/v3/permissions";
|
||||
|
||||
Reference in New Issue
Block a user