Merge branch 'release/v1.8.7'
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
HOST="rms.witel.ir"
|
HOST="rms.witel.ir"
|
||||||
HOST_RMTO="rms.rmto.ir"
|
HOST_RMTO="rms.rmto.ir"
|
||||||
NEXT_PUBLIC_VERSION="1.8.6"
|
NEXT_PUBLIC_VERSION="1.8.7"
|
||||||
NEXT_PUBLIC_API_URL="https://rms.witel.ir"
|
NEXT_PUBLIC_API_URL="https://rms.witel.ir"
|
||||||
NEXT_PUBLIC_MAPTILE_ENDPOINT="https://rmsmap.rmto.ir/141map"
|
NEXT_PUBLIC_MAPTILE_ENDPOINT="https://rmsmap.rmto.ir/141map"
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import ReportPage from "@/components/dashboard/roadMissions/reports";
|
import MissionsReportPage from "@/components/dashboard/roadMissions/reports/taradodReports";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل گزارش ماموریت",
|
title: "کارتابل گزارش ترددها",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission
|
<WithPermission
|
||||||
permission_name={[
|
permission_name={[
|
||||||
"all", // TODO : change permission
|
"all", // TODO : change permission
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<ReportPage />
|
<MissionsReportPage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import ViolationsReportsPage from "@/components/dashboard/roadMissions/reports/violationsReports";
|
||||||
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: "کارتابل گزارش تخلفات",
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return (
|
||||||
|
<WithPermission
|
||||||
|
permission_name={[
|
||||||
|
"all", // TODO : change permission
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<ViolationsReportsPage />
|
||||||
|
</WithPermission>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,14 +1,43 @@
|
|||||||
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
|
import MuiTimePicker from "@/core/components/MuiTimePicker";
|
||||||
import { FINISH_MISSION } from "@/core/utils/routes";
|
import { FINISH_MISSION } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import { Button, DialogActions, DialogContent, Stack, Typography } from "@mui/material";
|
import { Button, DialogActions, DialogContent, Stack, Typography } from "@mui/material";
|
||||||
|
import { format } from "date-fns-jalali";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import { mixed, object, string } from "yup";
|
||||||
|
|
||||||
const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) => {
|
const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) => {
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const handleClick = () => {
|
|
||||||
setSubmitting(true);
|
const validationSchema = object().shape({
|
||||||
|
start_date: mixed().required("تاریخ خروج خودرو را مشخص کنید."),
|
||||||
|
start_time: mixed().required("ساعت خروج خودرو را مشخص کنید."),
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = useForm({
|
||||||
|
defaultValues: {
|
||||||
|
start_date: null,
|
||||||
|
start_time: null,
|
||||||
|
},
|
||||||
|
resolver: yupResolver(validationSchema),
|
||||||
|
mode: "all",
|
||||||
|
});
|
||||||
|
|
||||||
|
const onSubmit = (values) => {
|
||||||
|
const formattedDate = values.start_date;
|
||||||
|
const formattedTime = format(values.start_time, "HH:mm");
|
||||||
requestServer(`${FINISH_MISSION}/${rowId}`, "post", {
|
requestServer(`${FINISH_MISSION}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
time: `${formattedDate} ${formattedTime}`,
|
||||||
|
},
|
||||||
hasSidebarUpdate: true,
|
hasSidebarUpdate: true,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -20,18 +49,55 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
|
|||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Stack alignItems="center" spacing={2}>
|
<Stack alignItems="center" spacing={2}>
|
||||||
<Typography mt={2}>آیا از ورود خودرو و پایان ماموریت اطمینان دارید؟</Typography>
|
<Typography mt={2}>آیا از ورود خودرو و پایان ماموریت اطمینان دارید؟</Typography>
|
||||||
|
<Stack>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name={"start_date"}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<MuiDatePicker
|
||||||
|
name="start_date"
|
||||||
|
error={error}
|
||||||
|
value={field.value || null}
|
||||||
|
disableFuture={false}
|
||||||
|
placeholder={"تاریخ شروع ماموریت را وارد کنید"}
|
||||||
|
label={"تاریخ شروع ماموریت"}
|
||||||
|
setFieldValue={(name, value) => field.onChange(value || null)}
|
||||||
|
helperText={error ? error.message : null}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<Stack>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name={"start_time"}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<MuiTimePicker
|
||||||
|
name="start_time"
|
||||||
|
error={error}
|
||||||
|
value={field.value || null}
|
||||||
|
views={["hours", "minutes"]}
|
||||||
|
placeholder={"زمان شروع ماموریت را وارد کنید"}
|
||||||
|
label={"زمان شروع ماموریت"}
|
||||||
|
setFieldValue={(name, value) => field.onChange(value || null)}
|
||||||
|
helperText={error ? error.message : null}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions sx={{ justifyContent: "center", paddingBottom: 2, width: "100%" }}>
|
<DialogActions sx={{ justifyContent: "center", paddingBottom: 2, width: "100%" }}>
|
||||||
<Button onClick={() => setOpenFinishMissionDialog(false)} variant="outlined" color="secondary">
|
<Button onClick={() => setOpenFinishMissionDialog(false)} variant="outlined" color="secondary">
|
||||||
خیر !
|
خیر !
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleClick} variant="contained" color="primary" disabled={submitting}>
|
<Button onClick={handleSubmit(onSubmit)} variant="contained" color="primary" disabled={submitting}>
|
||||||
{submitting ? "درحال ثبت..." : "بله اطمینان دارم"}
|
{submitting ? "درحال ثبت..." : "بله اطمینان دارم"}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
import LtrTextField from "@/core/components/LtrTextField";
|
import LtrTextField from "@/core/components/LtrTextField";
|
||||||
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
|
import MuiTimePicker from "@/core/components/MuiTimePicker";
|
||||||
import { START_MISSION } from "@/core/utils/routes";
|
import { START_MISSION } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import { Button, DialogActions, DialogContent, Stack, Typography } from "@mui/material";
|
import { Button, DialogActions, DialogContent, Stack, Typography } from "@mui/material";
|
||||||
|
import { format } from "date-fns-jalali";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { object, string } from "yup";
|
import { mixed, object, string } from "yup";
|
||||||
|
|
||||||
const StartMissionContent = ({ rowId, mutate, setOpenStartMissionDialog }) => {
|
const StartMissionContent = ({ rowId, mutate, setOpenStartMissionDialog }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
|
const now = new Date();
|
||||||
|
|
||||||
const validationSchema = object().shape({
|
const validationSchema = object().shape({
|
||||||
code: string().length(6, "کد خروج باید 6 رقم باشد").required("لطفاً کد خروج را وارد کنید."),
|
code: string().length(6, "کد خروج باید 6 رقم باشد").required("لطفاً کد خروج را وارد کنید."),
|
||||||
km: string().required("لطفاً کیلومتر را وارد کنید."),
|
km: string().required("لطفاً کیلومتر را وارد کنید."),
|
||||||
|
start_date: mixed().required("تاریخ خروج خودرو را مشخص کنید."),
|
||||||
|
start_time: mixed().required("ساعت خروج خودرو را مشخص کنید."),
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -22,16 +28,23 @@ const StartMissionContent = ({ rowId, mutate, setOpenStartMissionDialog }) => {
|
|||||||
defaultValues: {
|
defaultValues: {
|
||||||
code: "",
|
code: "",
|
||||||
km: "",
|
km: "",
|
||||||
|
start_date: null,
|
||||||
|
start_time: null,
|
||||||
},
|
},
|
||||||
resolver: yupResolver(validationSchema),
|
resolver: yupResolver(validationSchema),
|
||||||
mode: "all",
|
mode: "all",
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = (values) => {
|
const onSubmit = (values) => {
|
||||||
|
const formattedDate = values.start_date;
|
||||||
|
const formattedTime = format(values.start_time, "HH:mm");
|
||||||
|
console.log(formattedDate, formattedTime);
|
||||||
|
|
||||||
requestServer(`${START_MISSION}/${rowId}`, "post", {
|
requestServer(`${START_MISSION}/${rowId}`, "post", {
|
||||||
data: {
|
data: {
|
||||||
code: values.code,
|
code: values.code,
|
||||||
km: values.km,
|
km: values.km,
|
||||||
|
time: `${formattedDate} ${formattedTime}`,
|
||||||
},
|
},
|
||||||
hasSidebarUpdate: true,
|
hasSidebarUpdate: true,
|
||||||
})
|
})
|
||||||
@@ -93,6 +106,43 @@ const StartMissionContent = ({ rowId, mutate, setOpenStartMissionDialog }) => {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<Stack>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name={"start_date"}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<MuiDatePicker
|
||||||
|
name="start_date"
|
||||||
|
error={error}
|
||||||
|
value={field.value || null}
|
||||||
|
disableFuture={false}
|
||||||
|
minDate={now}
|
||||||
|
placeholder={"تاریخ شروع ماموریت را وارد کنید"}
|
||||||
|
label={"تاریخ شروع ماموریت"}
|
||||||
|
setFieldValue={(name, value) => field.onChange(value || null)}
|
||||||
|
helperText={error ? error.message : null}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<Stack>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name={"start_time"}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<MuiTimePicker
|
||||||
|
name="start_time"
|
||||||
|
error={error}
|
||||||
|
value={field.value || null}
|
||||||
|
views={["hours", "minutes"]}
|
||||||
|
placeholder={"زمان شروع ماموریت را وارد کنید"}
|
||||||
|
label={"زمان شروع ماموریت"}
|
||||||
|
setFieldValue={(name, value) => field.onChange(value || null)}
|
||||||
|
helperText={error ? error.message : null}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions sx={{ justifyContent: "center", paddingBottom: 2, width: "100%" }}>
|
<DialogActions sx={{ justifyContent: "center", paddingBottom: 2, width: "100%" }}>
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ import MapLoading from "@/core/components/MapLayer/Loading";
|
|||||||
import { Box, Button, DialogActions, DialogContent, Stack } from "@mui/material";
|
import { Box, Button, DialogActions, DialogContent, Stack } from "@mui/material";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import MapControlPolygon from "./MapControlPolygon";
|
|
||||||
import MapControlPolyline from "./MapControlPolyline";
|
import MapControlPolyline from "./MapControlPolyline";
|
||||||
import SelectBoundType from "./SelectBoundType";
|
|
||||||
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
||||||
loading: () => <MapLoading />,
|
loading: () => <MapLoading />,
|
||||||
ssr: false,
|
ssr: false,
|
||||||
@@ -12,7 +10,6 @@ const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
|||||||
|
|
||||||
const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
|
const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
|
||||||
const [bound, setBound] = useState(allData.bound);
|
const [bound, setBound] = useState(allData.bound);
|
||||||
const [boundType, setBoundType] = useState(allData.bound_type);
|
|
||||||
|
|
||||||
const handleNext = useCallback(() => {
|
const handleNext = useCallback(() => {
|
||||||
setAllData({ bound: bound });
|
setAllData({ bound: bound });
|
||||||
@@ -23,19 +20,9 @@ const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
|
|||||||
<>
|
<>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<SelectBoundType
|
|
||||||
boundType={boundType}
|
|
||||||
setBoundType={setBoundType}
|
|
||||||
setBound={setBound}
|
|
||||||
setAllData={setAllData}
|
|
||||||
/>
|
|
||||||
<Box sx={{ width: "100%", height: "400px" }}>
|
<Box sx={{ width: "100%", height: "400px" }}>
|
||||||
<MapLayer style={{ borderRadius: "4px" }}>
|
<MapLayer style={{ borderRadius: "4px" }}>
|
||||||
{boundType == "polygon" ? (
|
<MapControlPolyline bound={bound} setBound={setBound} boundType={"polyline"} />
|
||||||
<MapControlPolygon bound={bound} setBound={setBound} boundType={boundType} />
|
|
||||||
) : (
|
|
||||||
<MapControlPolyline bound={bound} setBound={setBound} boundType={boundType} />
|
|
||||||
)}
|
|
||||||
</MapLayer>
|
</MapLayer>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
>
|
>
|
||||||
<Tab icon={<InsertDriveFile />} label="مشخصات" />
|
<Tab icon={<InsertDriveFile />} label="مشخصات" />
|
||||||
<Tab disabled={tabState < 1} icon={<AccessTime />} label="زمانبندی" />
|
<Tab disabled={tabState < 1} icon={<AccessTime />} label="زمانبندی" />
|
||||||
<Tab disabled={tabState < 2} icon={<Route />} label="منطقه عملیاتی" />
|
<Tab disabled={tabState < 2} icon={<Route />} label="مسیر عملیاتی" />
|
||||||
<Tab disabled={tabState < 3} icon={<Engineering />} label="همراهان" />
|
<Tab disabled={tabState < 3} icon={<Engineering />} label="همراهان" />
|
||||||
<Tab disabled={tabState < 4} icon={<Verified />} label="بررسی نهایی" />
|
<Tab disabled={tabState < 4} icon={<Verified />} label="بررسی نهایی" />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
@@ -20,16 +20,8 @@ const Create = ({ mutate }) => {
|
|||||||
const submitForm = async (result) => {
|
const submitForm = async (result) => {
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
const bound = result.bound.getLatLngs();
|
const bound = result.bound.getLatLngs();
|
||||||
let area =
|
let area = bound.map((latlng) => [latlng.lng, latlng.lat]);
|
||||||
result.bound_type === "polygon"
|
|
||||||
? bound.map((ring) => ring.map((latlng) => [latlng.lng, latlng.lat]))[0]
|
|
||||||
: bound.map((latlng) => [latlng.lng, latlng.lat]);
|
|
||||||
|
|
||||||
// بستن polygon
|
|
||||||
if (result.bound_type === "polygon" && area.length > 0) {
|
|
||||||
const firstPoint = area[0];
|
|
||||||
area.push({ ...firstPoint });
|
|
||||||
}
|
|
||||||
await requestServer(REQUEST_MISSION, "post", {
|
await requestServer(REQUEST_MISSION, "post", {
|
||||||
data: {
|
data: {
|
||||||
explanation: result.explanation,
|
explanation: result.explanation,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
|||||||
|
|
||||||
const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
|
const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
|
||||||
const [bound, setBound] = useState(allData.bound);
|
const [bound, setBound] = useState(allData.bound);
|
||||||
const [boundType, setBoundType] = useState(allData.bound_type);
|
|
||||||
|
|
||||||
const handleNext = useCallback(() => {
|
const handleNext = useCallback(() => {
|
||||||
setAllData({ bound: bound });
|
setAllData({ bound: bound });
|
||||||
@@ -23,19 +22,9 @@ const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
|
|||||||
<>
|
<>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<SelectBoundType
|
|
||||||
boundType={boundType}
|
|
||||||
setBoundType={setBoundType}
|
|
||||||
setBound={setBound}
|
|
||||||
setAllData={setAllData}
|
|
||||||
/>
|
|
||||||
<Box sx={{ width: "100%", height: "400px" }}>
|
<Box sx={{ width: "100%", height: "400px" }}>
|
||||||
<MapLayer style={{ borderRadius: "4px" }}>
|
<MapLayer style={{ borderRadius: "4px" }}>
|
||||||
{boundType == "polygon" ? (
|
<MapControlPolygon bound={bound} setBound={setBound} boundType={"polyline"} />
|
||||||
<MapControlPolygon bound={bound} setBound={setBound} boundType={boundType} />
|
|
||||||
) : (
|
|
||||||
<MapControlPolyline bound={bound} setBound={setBound} boundType={boundType} />
|
|
||||||
)}
|
|
||||||
</MapLayer>
|
</MapLayer>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import Area from "@/components/dashboard/roadMissions/operator/Actions/Create/Form/Area";
|
import Area from "./Area";
|
||||||
import { AccessTime, Engineering, InsertDriveFile, LocalShipping, Route, Verified } from "@mui/icons-material";
|
import { AccessTime, Engineering, InsertDriveFile, LocalShipping, Route, Verified } from "@mui/icons-material";
|
||||||
import { Box, Tab, Tabs } from "@mui/material";
|
import { Box, Tab, Tabs } from "@mui/material";
|
||||||
import { useReducer, useState } from "react";
|
import { useReducer, useState } from "react";
|
||||||
@@ -61,7 +61,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
>
|
>
|
||||||
<Tab icon={<InsertDriveFile />} label="مشخصات" />
|
<Tab icon={<InsertDriveFile />} label="مشخصات" />
|
||||||
<Tab disabled={tabState < 1} icon={<AccessTime />} label="زمانبندی" />
|
<Tab disabled={tabState < 1} icon={<AccessTime />} label="زمانبندی" />
|
||||||
<Tab disabled={tabState < 2} icon={<Route />} label="منطقه عملیاتی" />
|
<Tab disabled={tabState < 2} icon={<Route />} label="مسیر عملیاتی" />
|
||||||
<Tab disabled={tabState < 3} icon={<LocalShipping />} label="خودرو و راننده" />
|
<Tab disabled={tabState < 3} icon={<LocalShipping />} label="خودرو و راننده" />
|
||||||
<Tab disabled={tabState < 4} icon={<Engineering />} label="همراهان" />
|
<Tab disabled={tabState < 4} icon={<Engineering />} label="همراهان" />
|
||||||
<Tab disabled={tabState < 5} icon={<Verified />} label="بررسی نهایی" />
|
<Tab disabled={tabState < 5} icon={<Verified />} label="بررسی نهایی" />
|
||||||
|
|||||||
@@ -20,16 +20,7 @@ const CreateWithoutProcess = ({ mutate }) => {
|
|||||||
const submitForm = async (result) => {
|
const submitForm = async (result) => {
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
const bound = result.bound.getLatLngs();
|
const bound = result.bound.getLatLngs();
|
||||||
let area =
|
let area = bound.map((latlng) => [latlng.lng, latlng.lat]);
|
||||||
result.bound_type === "polygon"
|
|
||||||
? bound.map((ring) => ring.map((latlng) => [latlng.lng, latlng.lat]))[0]
|
|
||||||
: bound.map((latlng) => [latlng.lng, latlng.lat]);
|
|
||||||
|
|
||||||
// بستن polygon
|
|
||||||
if (result.bound_type === "polygon" && area.length > 0) {
|
|
||||||
const firstPoint = area[0];
|
|
||||||
area.push({ ...firstPoint });
|
|
||||||
}
|
|
||||||
|
|
||||||
await requestServer(REQUEST_MISSION_WITHOUT_PROCESS, "post", {
|
await requestServer(REQUEST_MISSION_WITHOUT_PROCESS, "post", {
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
"use client";
|
|
||||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
|
||||||
import { Box } from "@mui/material";
|
|
||||||
import { useMemo } from "react";
|
|
||||||
import Toolbar from "./Toolbar";
|
|
||||||
|
|
||||||
const ReportLists = ({ data, specialFilter }) => {
|
|
||||||
const columns = useMemo(() => {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
accessorKey: "province_name",
|
|
||||||
header: "اداره کل",
|
|
||||||
id: "province_name",
|
|
||||||
enableColumnFilter: false,
|
|
||||||
enableSorting: false,
|
|
||||||
datatype: "text",
|
|
||||||
grow: false,
|
|
||||||
size: 50,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: "no_mission_count",
|
|
||||||
header: "تردد بدون ماموریت",
|
|
||||||
id: "no_mission_count",
|
|
||||||
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;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: "out_of_area_count",
|
|
||||||
header: "تردد خارج محدوده",
|
|
||||||
id: "out_of_area_count",
|
|
||||||
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;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
|
||||||
<DataTableWithAuth
|
|
||||||
TableToolbar={Toolbar}
|
|
||||||
columns={columns}
|
|
||||||
data={data.data}
|
|
||||||
page_name={"roadMissionReport"}
|
|
||||||
table_name={"roadMissionReportList"}
|
|
||||||
enablePagination={false}
|
|
||||||
specialFilter={specialFilter}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ReportLists;
|
|
||||||
@@ -1,72 +1,77 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { Button, CircularProgress, IconButton, useMediaQuery } from "@mui/material";
|
import {
|
||||||
import { useMemo, useState } from "react";
|
EXPORT_MISSIONS_REPORT_TARADOD_COUNTRY_EXCEL_ACTIVITY,
|
||||||
import moment from "jalali-moment";
|
EXPORT_MISSIONS_REPORT_TARADOD_PROVINCE_EXCEL_ACTIVITY,
|
||||||
import FileSaver from "file-saver";
|
} from "@/core/utils/routes";
|
||||||
import DescriptionIcon from "@mui/icons-material/Description";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useTheme } from "@emotion/react";
|
import DescriptionIcon from "@mui/icons-material/Description";
|
||||||
import { EXPORT_COUNTRY_ROAD_PATROL_REPORTS, EXPORT_PROVINCE_ROAD_PATROL_REPORTS } from "@/core/utils/routes";
|
import { Button, CircularProgress, IconButton, useMediaQuery } from "@mui/material";
|
||||||
|
import FileSaver from "file-saver";
|
||||||
const PrintExcel = ({ table, filterData }) => {
|
import moment from "jalali-moment";
|
||||||
const theme = useTheme();
|
import { useMemo, useState } from "react";
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
||||||
const [loading, setLoading] = useState(false);
|
const PrintExcel = ({ table, filterData }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const theme = useTheme();
|
||||||
const activeFilters = Object.entries(filterData).reduce((acc, [key, filter]) => {
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||||
if (filter.value) {
|
const [loading, setLoading] = useState(false);
|
||||||
acc.push({ id: filter.id, value: filter.value });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
}
|
const activeFilters = Object.entries(filterData).reduce((acc, [key, filter]) => {
|
||||||
return acc;
|
if (filter.value) {
|
||||||
}, []);
|
acc.push({ id: filter.id, value: filter.value });
|
||||||
|
}
|
||||||
const filterParams = useMemo(() => {
|
return acc;
|
||||||
const params = new URLSearchParams();
|
}, []);
|
||||||
activeFilters.length > 0 &&
|
|
||||||
activeFilters.map((filter, index) => {
|
const filterParams = useMemo(() => {
|
||||||
params.set(`${filter.id}`, filter.value);
|
const params = new URLSearchParams();
|
||||||
});
|
activeFilters.length > 0 &&
|
||||||
return params;
|
activeFilters.map((filter, index) => {
|
||||||
}, [activeFilters]);
|
params.set(`${filter.id}`, filter.value);
|
||||||
|
});
|
||||||
const clickHandler = () => {
|
return params;
|
||||||
setLoading(true);
|
}, [activeFilters]);
|
||||||
const CountryOrProvince = activeFilters.find((item) => item.id === "province_id");
|
|
||||||
const requestUrl =
|
const clickHandler = () => {
|
||||||
CountryOrProvince.value === "-1" ? EXPORT_COUNTRY_ROAD_PATROL_REPORTS : EXPORT_PROVINCE_ROAD_PATROL_REPORTS;
|
setLoading(true);
|
||||||
requestServer(`${requestUrl}?${filterParams}`, "get", {
|
const CountryOrProvince = activeFilters.find((item) => item.id === "province_id");
|
||||||
requestOptions: { responseType: "blob" },
|
const requestUrl =
|
||||||
})
|
CountryOrProvince.value === "-1"
|
||||||
.then((response) => {
|
? EXPORT_MISSIONS_REPORT_TARADOD_COUNTRY_EXCEL_ACTIVITY
|
||||||
const filename = `خروجی کارتابل گزارشات گشت راهداری تاریخ_${moment().format("jYYYY_jMM_jDD")}.xlsx`;
|
: EXPORT_MISSIONS_REPORT_TARADOD_PROVINCE_EXCEL_ACTIVITY;
|
||||||
FileSaver.saveAs(response.data, filename);
|
requestServer(`${requestUrl}?${filterParams}`, "get", {
|
||||||
})
|
requestOptions: { responseType: "blob" },
|
||||||
.catch(() => {})
|
})
|
||||||
.finally(() => {
|
.then((response) => {
|
||||||
setLoading(false);
|
const filename = `خروجی کارتابل گزارشات گشت راهداری تاریخ_${moment().format("jYYYY_jMM_jDD")}.xlsx`;
|
||||||
});
|
FileSaver.saveAs(response.data, filename);
|
||||||
};
|
})
|
||||||
|
.catch(() => {})
|
||||||
return (
|
.finally(() => {
|
||||||
<>
|
setLoading(false);
|
||||||
{isMobile ? (
|
});
|
||||||
<IconButton aria-label="خروجی اکسل" color="success" onClick={clickHandler}>
|
};
|
||||||
<DescriptionIcon sx={{ fontSize: "25px" }} />
|
|
||||||
</IconButton>
|
return (
|
||||||
) : (
|
<>
|
||||||
<Button
|
{isMobile ? (
|
||||||
color="success"
|
<IconButton aria-label="خروجی اکسل" color="success" onClick={clickHandler}>
|
||||||
variant="contained"
|
<DescriptionIcon sx={{ fontSize: "25px" }} />
|
||||||
size="small"
|
</IconButton>
|
||||||
disabled={loading}
|
) : (
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
<Button
|
||||||
startIcon={loading ? <CircularProgress size={18} color="inherit" /> : <DescriptionIcon />}
|
color="success"
|
||||||
onClick={clickHandler}
|
variant="contained"
|
||||||
>
|
size="small"
|
||||||
خروجی اکسل
|
disabled={loading}
|
||||||
</Button>
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
)}
|
startIcon={loading ? <CircularProgress size={18} color="inherit" /> : <DescriptionIcon />}
|
||||||
</>
|
onClick={clickHandler}
|
||||||
);
|
>
|
||||||
};
|
خروجی اکسل
|
||||||
export default PrintExcel;
|
</Button>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default PrintExcel;
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
"use client";
|
||||||
|
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||||
|
import { Box } from "@mui/material";
|
||||||
|
import { useEffect, useMemo } from "react";
|
||||||
|
import Toolbar from "./Toolbar";
|
||||||
|
|
||||||
|
const TaradodReportLists = ({ data, specialFilter }) => {
|
||||||
|
const columns = useMemo(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
accessorKey: "edare_name",
|
||||||
|
header: "اداره کل",
|
||||||
|
id: "edare_name",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "text",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "total",
|
||||||
|
header: "کل ماموریت ها",
|
||||||
|
id: "total",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "khareg_mahdode",
|
||||||
|
header: "تردد خارج از محدوده",
|
||||||
|
id: "khareg_mahdode",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "durations",
|
||||||
|
header: "جمع ساعات ماموریت",
|
||||||
|
id: "duration",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "gps",
|
||||||
|
header: "جمع ساعات gps",
|
||||||
|
id: "gps",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "far_h",
|
||||||
|
header: "با فرایند ساعتی",
|
||||||
|
id: "far_h",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "far_d",
|
||||||
|
header: "با فرایند روزانه",
|
||||||
|
id: "far_d",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "un_far_h",
|
||||||
|
header: "بدون فرایند ساعتی",
|
||||||
|
id: "un_far_h",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "un_far_d",
|
||||||
|
header: "بدون فرایند روزانه",
|
||||||
|
id: "un_far_d",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "item",
|
||||||
|
header: "فعالیت روزانه",
|
||||||
|
id: "item",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "text",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "patrol",
|
||||||
|
header: "گشت راهداری",
|
||||||
|
id: "patrol",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "text",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||||
|
<DataTableWithAuth
|
||||||
|
TableToolbar={Toolbar}
|
||||||
|
columns={columns}
|
||||||
|
data={data.data}
|
||||||
|
page_name={"roadMissionReport"}
|
||||||
|
table_name={"roadMissionReportList"}
|
||||||
|
enablePagination={false}
|
||||||
|
specialFilter={specialFilter}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TaradodReportLists;
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
import { Controller } from "react-hook-form";
|
import { Controller } from "react-hook-form";
|
||||||
|
|
||||||
const FromDateController = ({ control }) => {
|
const FromDateController = ({ control }) => {
|
||||||
return (
|
return (
|
||||||
<Controller
|
<Controller
|
||||||
name="from_date"
|
name="from_date"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<MuiDatePicker
|
<MuiDatePicker
|
||||||
name="from_date"
|
name="from_date"
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={"تاریخ شروع (از تاریخ)"}
|
label={"تاریخ شروع (از تاریخ)"}
|
||||||
placeholder={"از تاریخ"}
|
placeholder={"از تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
onChange(formattedDate); // Update the field value in react-hook-form
|
onChange(formattedDate); // Update the field value in react-hook-form
|
||||||
}}
|
}}
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default FromDateController;
|
export default FromDateController;
|
||||||
@@ -1,44 +1,44 @@
|
|||||||
import SearchIcon from "@mui/icons-material/Search";
|
import SearchIcon from "@mui/icons-material/Search";
|
||||||
import { Button, Grid } from "@mui/material";
|
import { Button, Grid } from "@mui/material";
|
||||||
import { Controller } from "react-hook-form";
|
import { Controller } from "react-hook-form";
|
||||||
import FromDateController from "./FromDateController";
|
import FromDateController from "./FromDateController";
|
||||||
import SelectProvince from "./SelectProvince";
|
import SelectProvince from "./SelectProvince";
|
||||||
import ToDateController from "./ToDateController";
|
import ToDateController from "./ToDateController";
|
||||||
|
|
||||||
const SearchReportField = ({ control, hasProvincesPermission }) => {
|
const SearchReportField = ({ control, hasProvincesPermission }) => {
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={2} sx={{ py: 2 }}>
|
<Grid container spacing={2} sx={{ py: 2 }}>
|
||||||
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
||||||
<FromDateController control={control} />
|
<FromDateController control={control} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
||||||
<ToDateController control={control} />
|
<ToDateController control={control} />
|
||||||
</Grid>
|
</Grid>
|
||||||
{hasProvincesPermission && (
|
{hasProvincesPermission && (
|
||||||
<Grid item xs={12} md={3}>
|
<Grid item xs={12} md={3}>
|
||||||
<SelectProvince control={control} />
|
<SelectProvince control={control} />
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
||||||
<Controller
|
<Controller
|
||||||
name="submitButton"
|
name="submitButton"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { value, onChange }, formState: { isSubmitting } }) => (
|
render={({ field: { value, onChange }, formState: { isSubmitting } }) => (
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
size="medium"
|
size="medium"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
endIcon={<SearchIcon />}
|
endIcon={<SearchIcon />}
|
||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
{isSubmitting ? "درحال دریافت اطلاعات" : "جستجو"}
|
{isSubmitting ? "درحال دریافت اطلاعات" : "جستجو"}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SearchReportField;
|
export default SearchReportField;
|
||||||
@@ -1,45 +1,45 @@
|
|||||||
import useProvinces from "@/lib/hooks/useProvince";
|
import useProvinces from "@/lib/hooks/useProvince";
|
||||||
import { FormControl, FormHelperText, InputLabel, MenuItem, Select } from "@mui/material";
|
import { FormControl, FormHelperText, InputLabel, MenuItem, Select } from "@mui/material";
|
||||||
import { Controller } from "react-hook-form";
|
import { Controller } from "react-hook-form";
|
||||||
|
|
||||||
const SelectProvince = ({ control }) => {
|
const SelectProvince = ({ control }) => {
|
||||||
const { provinces, loadingProvinces, errorProvinces } = useProvinces();
|
const { provinces, loadingProvinces, errorProvinces } = useProvinces();
|
||||||
return (
|
return (
|
||||||
<Controller
|
<Controller
|
||||||
name="province_id"
|
name="province_id"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field, fieldState: { error } }) => (
|
render={({ field, fieldState: { error } }) => (
|
||||||
<FormControl error={!!error} size="small" fullWidth>
|
<FormControl error={!!error} size="small" fullWidth>
|
||||||
<InputLabel id="demo-error-label">استان</InputLabel>
|
<InputLabel id="demo-error-label">استان</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
{...field}
|
{...field}
|
||||||
labelId="demo-error-label"
|
labelId="demo-error-label"
|
||||||
id="province_id"
|
id="province_id"
|
||||||
value={loadingProvinces ? "loading" : field.value || ""}
|
value={loadingProvinces ? "loading" : field.value || ""}
|
||||||
label="استان"
|
label="استان"
|
||||||
onChange={field.onChange}
|
onChange={field.onChange}
|
||||||
>
|
>
|
||||||
{loadingProvinces ? (
|
{loadingProvinces ? (
|
||||||
<MenuItem value={"loading"}>در حال بارگذاری...</MenuItem>
|
<MenuItem value={"loading"}>در حال بارگذاری...</MenuItem>
|
||||||
) : errorProvinces ? (
|
) : errorProvinces ? (
|
||||||
<MenuItem value={"error"}>خطا در بارگذاری</MenuItem>
|
<MenuItem value={"error"}>خطا در بارگذاری</MenuItem>
|
||||||
) : (
|
) : (
|
||||||
[
|
[
|
||||||
<MenuItem key="-1" value={"-1"}>
|
<MenuItem key="-1" value={"-1"}>
|
||||||
کل کشور
|
کل کشور
|
||||||
</MenuItem>,
|
</MenuItem>,
|
||||||
...provinces.map((province) => (
|
...provinces.map((province) => (
|
||||||
<MenuItem key={province.id} value={province.id}>
|
<MenuItem key={province.id} value={province.id}>
|
||||||
{province.name_fa}
|
{province.name_fa}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)),
|
)),
|
||||||
]
|
]
|
||||||
)}
|
)}
|
||||||
</Select>
|
</Select>
|
||||||
{error && <FormHelperText>{error.message}</FormHelperText>}
|
{error && <FormHelperText>{error.message}</FormHelperText>}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default SelectProvince;
|
export default SelectProvince;
|
||||||
@@ -1,30 +1,30 @@
|
|||||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
import { Controller, useWatch } from "react-hook-form";
|
import { Controller, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
const ToDateController = ({ control }) => {
|
const ToDateController = ({ control }) => {
|
||||||
const minDate = useWatch({ control, name: "from_date" });
|
const minDate = useWatch({ control, name: "from_date" });
|
||||||
return (
|
return (
|
||||||
<Controller
|
<Controller
|
||||||
name="date_to"
|
name="date_to"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<MuiDatePicker
|
<MuiDatePicker
|
||||||
name="date_to"
|
name="date_to"
|
||||||
minDate={minDate}
|
minDate={minDate}
|
||||||
maxDate={new Date()}
|
maxDate={new Date()}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={"تاریخ شروع (تا تاریخ)"}
|
label={"تاریخ شروع (تا تاریخ)"}
|
||||||
placeholder={"تا تاریخ"}
|
placeholder={"تا تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
onChange(formattedDate); // Update the field value in react-hook-form
|
onChange(formattedDate); // Update the field value in react-hook-form
|
||||||
}}
|
}}
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default ToDateController;
|
export default ToDateController;
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
import StyledForm from "@/core/components/StyledForm";
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
import SearchReportField from "./SearchReportField";
|
import SearchReportField from "./SearchReportField";
|
||||||
|
|
||||||
const SearchReportList = ({ handleSubmit, onSearchSubmit, control, hasProvincesPermission }) => {
|
const SearchReportList = ({ handleSubmit, onSearchSubmit, control, hasProvincesPermission }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
|
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
|
||||||
<SearchReportField control={control} hasProvincesPermission={hasProvincesPermission} />
|
<SearchReportField
|
||||||
</StyledForm>
|
control={control}
|
||||||
</>
|
hasProvincesPermission={hasProvincesPermission}
|
||||||
);
|
/>
|
||||||
};
|
</StyledForm>
|
||||||
export default SearchReportList;
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default SearchReportList;
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
import PrintExcel from "./ExcelPrint";
|
import { Box } from "@mui/material";
|
||||||
import { Box } from "@mui/material";
|
import PrintExcel from "./ExcelPrint";
|
||||||
|
|
||||||
const Toolbar = ({ table, filterData, mutate }) => {
|
const Toolbar = ({ table, filterData, mutate }) => {
|
||||||
return <Box sx={{ display: "flex", gap: 1 }}>{/* <PrintExcel table={table} filterData={filterData} /> */}</Box>;
|
return (
|
||||||
};
|
<Box sx={{ display: "flex", gap: 1 }}>
|
||||||
export default Toolbar;
|
<PrintExcel table={table} filterData={filterData} />
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default Toolbar;
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
"use client";
|
||||||
|
import PageTitle from "@/core/components/PageTitle";
|
||||||
|
import {
|
||||||
|
GET_MISSIONS_REPORT_TARADOD_COUNTRY_ACTIVITY,
|
||||||
|
GET_MISSIONS_REPORT_TARADOD_PROVINCE_ACTIVITY,
|
||||||
|
} from "@/core/utils/routes";
|
||||||
|
import { useAuth } from "@/lib/contexts/auth";
|
||||||
|
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { LinearProgress, Stack } from "@mui/material";
|
||||||
|
import moment from "jalali-moment";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import * as yup from "yup";
|
||||||
|
import TaradodReportLists from "./MissionsReportLists";
|
||||||
|
import SearchReportList from "./Search";
|
||||||
|
|
||||||
|
const TaradodReportPage = () => {
|
||||||
|
const [data, setData] = useState(null);
|
||||||
|
const { data: userPermissions } = usePermissions();
|
||||||
|
const { user } = useAuth();
|
||||||
|
const requestServer = useRequest();
|
||||||
|
const [provinceId, setProvinceId] = useState(user.province_id || "-1");
|
||||||
|
const hasProvincesPermission = userPermissions?.includes("mission-report-country");
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
from_date: moment(new Date()).format("YYYY-MM-DD"),
|
||||||
|
date_to: moment(new Date()).format("YYYY-MM-DD"),
|
||||||
|
province_id: provinceId,
|
||||||
|
};
|
||||||
|
const defaultFilter = [
|
||||||
|
{ value: `${defaultValues.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
||||||
|
{ value: `${defaultValues.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
||||||
|
{ value: `${defaultValues.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
||||||
|
];
|
||||||
|
const [specialFilter, setSpecialFilter] = useState(defaultFilter);
|
||||||
|
|
||||||
|
const onSearchSubmit = async (data) => {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
params.set("from_date", `${data.from_date}`);
|
||||||
|
params.set("date_to", `${data.date_to}`);
|
||||||
|
setSpecialFilter([
|
||||||
|
{ value: `${data.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
||||||
|
{ value: `${data.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
||||||
|
{ value: `${data.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
||||||
|
]);
|
||||||
|
if (data.province_id === "-1") {
|
||||||
|
try {
|
||||||
|
// params.set("province_id", `${data.province_id}`);
|
||||||
|
const response = await requestServer(`${GET_MISSIONS_REPORT_TARADOD_COUNTRY_ACTIVITY}?${params}`);
|
||||||
|
const result = response.data.data;
|
||||||
|
const nationalReportForItem = result.activities.find((report) => report.province_id === "-1");
|
||||||
|
const nationalReport = {
|
||||||
|
edare_name: "کل کشور",
|
||||||
|
...nationalReportForItem,
|
||||||
|
};
|
||||||
|
|
||||||
|
setData({
|
||||||
|
data: [
|
||||||
|
nationalReport,
|
||||||
|
...result.provinces.map((province) => {
|
||||||
|
const filteredReports = result.activities.find(
|
||||||
|
(report) => report.province_id == province.id
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...filteredReports,
|
||||||
|
edare_name: province.name_fa,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
filters: data,
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
params.set("province_id", `${data.province_id}`);
|
||||||
|
const response = await requestServer(`${GET_MISSIONS_REPORT_TARADOD_PROVINCE_ACTIVITY}?${params}`);
|
||||||
|
const result = response.data.data;
|
||||||
|
|
||||||
|
const nationalReportForItem = result.activities.find((report) => report.city_id === "-1");
|
||||||
|
|
||||||
|
const nationalReport = {
|
||||||
|
...nationalReportForItem,
|
||||||
|
edare_name: "کل استان",
|
||||||
|
};
|
||||||
|
setData({
|
||||||
|
data: [
|
||||||
|
nationalReport,
|
||||||
|
...result.city.map((city) => {
|
||||||
|
const filteredReports = result.activities.find((report) => report.city_id == city.id);
|
||||||
|
return {
|
||||||
|
edare_name: city.name_fa,
|
||||||
|
...filteredReports,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
filters: data,
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!userPermissions) return;
|
||||||
|
onSearchSubmit(defaultValues);
|
||||||
|
}, [userPermissions]);
|
||||||
|
|
||||||
|
const validationSchema = yup.object().shape({
|
||||||
|
from_date: yup
|
||||||
|
.string()
|
||||||
|
.required("تاریخ شروع الزامی است!")
|
||||||
|
.matches(/^\d{4}-\d{2}-\d{2}$/, "تاریخ شروع الزامی است!")
|
||||||
|
.test("is-valid-date", "تاریخ شروع معتبر نیست!", (value) => moment(value, "YYYY-MM-DD", true).isValid()),
|
||||||
|
date_to: yup
|
||||||
|
.string()
|
||||||
|
.required("تاریخ پایان الزامی است!")
|
||||||
|
.matches(/^\d{4}-\d{2}-\d{2}$/, "تاریخ پایان الزامی است!")
|
||||||
|
.test("is-valid-date", "تاریخ پایان معتبر نیست!", (value) => moment(value, "YYYY-MM-DD", true).isValid()),
|
||||||
|
province_id: yup.string().nullable(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const { control, handleSubmit } = useForm({
|
||||||
|
defaultValues,
|
||||||
|
resolver: yupResolver(validationSchema),
|
||||||
|
mode: "all",
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack spacing={1}>
|
||||||
|
<PageTitle title={"کارتابل گزارش تردد ها"} />
|
||||||
|
<SearchReportList
|
||||||
|
control={control}
|
||||||
|
hasProvincesPermission={hasProvincesPermission}
|
||||||
|
handleSubmit={handleSubmit}
|
||||||
|
onSearchSubmit={onSearchSubmit}
|
||||||
|
/>
|
||||||
|
{!data ? <LinearProgress /> : <TaradodReportLists specialFilter={specialFilter} data={data} />}
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default TaradodReportPage;
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
"use client";
|
||||||
|
import {
|
||||||
|
EXPORT_MISSIONS_REPORT_VIOLATION_COUNTRY_EXCEL_ACTIVITY,
|
||||||
|
EXPORT_MISSIONS_REPORT_VIOLATION_PROVINCE_EXCEL_ACTIVITY,
|
||||||
|
} 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 { useMemo, 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 activeFilters = Object.entries(filterData).reduce((acc, [key, filter]) => {
|
||||||
|
if (filter.value) {
|
||||||
|
acc.push({ id: filter.id, value: filter.value });
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const filterParams = useMemo(() => {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
activeFilters.length > 0 &&
|
||||||
|
activeFilters.map((filter, index) => {
|
||||||
|
params.set(`${filter.id}`, filter.value);
|
||||||
|
});
|
||||||
|
return params;
|
||||||
|
}, [activeFilters]);
|
||||||
|
|
||||||
|
const clickHandler = () => {
|
||||||
|
setLoading(true);
|
||||||
|
const CountryOrProvince = activeFilters.find((item) => item.id === "province_id");
|
||||||
|
const requestUrl =
|
||||||
|
CountryOrProvince.value === "-1"
|
||||||
|
? EXPORT_MISSIONS_REPORT_VIOLATION_COUNTRY_EXCEL_ACTIVITY
|
||||||
|
: EXPORT_MISSIONS_REPORT_VIOLATION_PROVINCE_EXCEL_ACTIVITY;
|
||||||
|
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="success" onClick={clickHandler}>
|
||||||
|
<DescriptionIcon sx={{ fontSize: "25px" }} />
|
||||||
|
</IconButton>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
color="success"
|
||||||
|
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,27 @@
|
|||||||
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
|
import moment from "jalali-moment";
|
||||||
|
import { Controller } from "react-hook-form";
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import SearchIcon from "@mui/icons-material/Search";
|
||||||
|
import { Button, Grid } from "@mui/material";
|
||||||
|
import { Controller } from "react-hook-form";
|
||||||
|
import FromDateController from "./FromDateController";
|
||||||
|
import SelectProvince from "./SelectProvince";
|
||||||
|
import ToDateController from "./ToDateController";
|
||||||
|
|
||||||
|
const SearchReportField = ({ control, hasProvincesPermission }) => {
|
||||||
|
return (
|
||||||
|
<Grid container spacing={2} sx={{ py: 2 }}>
|
||||||
|
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
||||||
|
<FromDateController control={control} />
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
||||||
|
<ToDateController control={control} />
|
||||||
|
</Grid>
|
||||||
|
{hasProvincesPermission && (
|
||||||
|
<Grid item xs={12} md={3}>
|
||||||
|
<SelectProvince control={control} />
|
||||||
|
</Grid>
|
||||||
|
)}
|
||||||
|
<Grid item xs={12} md={hasProvincesPermission ? 3 : 4}>
|
||||||
|
<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;
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
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;
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
|
import moment from "jalali-moment";
|
||||||
|
import { Controller, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
|
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}
|
||||||
|
maxDate={new 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 ToDateController;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
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,11 @@
|
|||||||
|
import { Box } from "@mui/material";
|
||||||
|
import PrintExcel from "./ExcelPrint";
|
||||||
|
|
||||||
|
const Toolbar = ({ table, filterData, mutate }) => {
|
||||||
|
return (
|
||||||
|
<Box sx={{ display: "flex", gap: 1 }}>
|
||||||
|
<PrintExcel table={table} filterData={filterData} />
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default Toolbar;
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
"use client";
|
||||||
|
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||||
|
import { Box } from "@mui/material";
|
||||||
|
import { useEffect, useMemo } from "react";
|
||||||
|
import Toolbar from "./Toolbar";
|
||||||
|
|
||||||
|
const ViolationsReportsList = ({ data, specialFilter }) => {
|
||||||
|
const columns = useMemo(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
accessorKey: "edare_name",
|
||||||
|
header: "اداره کل",
|
||||||
|
id: "edare_name",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "text",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "total",
|
||||||
|
header: "کل تخلفات",
|
||||||
|
id: "total",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "done",
|
||||||
|
header: "اقدام شده",
|
||||||
|
id: "done",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "undone",
|
||||||
|
header: "اقدام نشده",
|
||||||
|
id: "un_done",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "gps",
|
||||||
|
header: "GPS",
|
||||||
|
id: "gps",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "herasat",
|
||||||
|
header: "ثبت حراست",
|
||||||
|
id: "herasat",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "mil_gps",
|
||||||
|
header: "کیلومتر GPS",
|
||||||
|
id: "mil_gps",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
datatype: "numeric",
|
||||||
|
grow: false,
|
||||||
|
size: 50,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||||
|
<DataTableWithAuth
|
||||||
|
TableToolbar={Toolbar}
|
||||||
|
columns={columns}
|
||||||
|
data={data.data}
|
||||||
|
page_name={"roadMissionReport"}
|
||||||
|
table_name={"roadMissionReportList"}
|
||||||
|
enablePagination={false}
|
||||||
|
specialFilter={specialFilter}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ViolationsReportsList;
|
||||||
@@ -1,135 +1,141 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import PageTitle from "@/core/components/PageTitle";
|
import PageTitle from "@/core/components/PageTitle";
|
||||||
import { LinearProgress, Stack } from "@mui/material";
|
import {
|
||||||
import SearchReportList from "./Search";
|
GET_MISSIONS_REPORT_VIOLATION_COUNTRY_ACTIVITY,
|
||||||
import { useEffect, useState } from "react";
|
GET_MISSIONS_REPORT_VIOLATION_PROVINCE_ACTIVITY,
|
||||||
import ReportLists from "./ReportLists";
|
} from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import { useAuth } from "@/lib/contexts/auth";
|
||||||
import { GET_CITY_ACTIVITY_REPORT, GET_MISSION_CITY_ACTIVITY_REPORT } from "@/core/utils/routes";
|
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||||
import moment from "jalali-moment";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import * as yup from "yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import { useForm } from "react-hook-form";
|
import { LinearProgress, Stack } from "@mui/material";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import moment from "jalali-moment";
|
||||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
import { useEffect, useState } from "react";
|
||||||
import { useAuth } from "@/lib/contexts/auth";
|
import { useForm } from "react-hook-form";
|
||||||
|
import * as yup from "yup";
|
||||||
const ReportPage = () => {
|
import ViolationsReportsList from "./ViolationsReportsList";
|
||||||
const [data, setData] = useState(null);
|
import SearchReportList from "./Search";
|
||||||
const { data: userPermissions } = usePermissions();
|
|
||||||
const { user } = useAuth();
|
const ViolationsReportsPage = () => {
|
||||||
const requestServer = useRequest();
|
const [data, setData] = useState(null);
|
||||||
const hasProvincesPermission = userPermissions?.includes("mission-report-country");
|
const { data: userPermissions } = usePermissions();
|
||||||
|
const { user } = useAuth();
|
||||||
const defaultValues = {
|
const requestServer = useRequest();
|
||||||
from_date: moment(new Date()).format("YYYY-MM-DD"),
|
const hasProvincesPermission = userPermissions?.includes("mission-report-country");
|
||||||
date_to: moment(new Date()).format("YYYY-MM-DD"),
|
|
||||||
province_id: hasProvincesPermission ? "-1" : user.province_id,
|
const defaultValues = {
|
||||||
};
|
from_date: moment(new Date()).format("YYYY-MM-DD"),
|
||||||
const defaultFilter = [
|
date_to: moment(new Date()).format("YYYY-MM-DD"),
|
||||||
{ value: `${defaultValues.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
province_id: user.province_id || "-1",
|
||||||
{ value: `${defaultValues.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
};
|
||||||
{ value: `${defaultValues.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
const defaultFilter = [
|
||||||
];
|
{ value: `${defaultValues.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
||||||
const [specialFilter, setSpecialFilter] = useState(defaultFilter);
|
{ value: `${defaultValues.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
||||||
|
{ value: `${defaultValues.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
||||||
const onSearchSubmit = async (data) => {
|
];
|
||||||
const params = new URLSearchParams();
|
const [specialFilter, setSpecialFilter] = useState(defaultFilter);
|
||||||
params.set("from_date", `${data.from_date}`);
|
|
||||||
params.set("date_to", `${data.date_to}`);
|
const onSearchSubmit = async (data) => {
|
||||||
setSpecialFilter([
|
const params = new URLSearchParams();
|
||||||
{ value: `${data.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
params.set("from_date", `${data.from_date}`);
|
||||||
{ value: `${data.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
params.set("date_to", `${data.date_to}`);
|
||||||
{ value: `${data.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
setSpecialFilter([
|
||||||
]);
|
{ value: `${data.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
||||||
// if (data.province_id === "-1") {
|
{ value: `${data.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
||||||
try {
|
{ value: `${data.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
||||||
params.set("province_id", `${data.province_id}`);
|
]);
|
||||||
const response = await requestServer(`${GET_CITY_ACTIVITY_REPORT}?${params}`);
|
if (data.province_id === "-1") {
|
||||||
const result = response.data.data;
|
try {
|
||||||
const nationalReportForItem = result.activities.find((report) => report.province_id === "-1");
|
// params.set("province_id", `${data.province_id}`);
|
||||||
const nationalReport = {
|
const response = await requestServer(`${GET_MISSIONS_REPORT_VIOLATION_COUNTRY_ACTIVITY}?${params}`);
|
||||||
edare_name: "کل کشور",
|
const result = response.data.data;
|
||||||
...nationalReportForItem,
|
const nationalReportForItem = result.activities.find((report) => report.province_id === "-1");
|
||||||
};
|
const nationalReport = {
|
||||||
|
edare_name: "کل کشور",
|
||||||
setData({
|
...nationalReportForItem,
|
||||||
data: [
|
};
|
||||||
nationalReport,
|
|
||||||
...result.provinces.map((province) => {
|
setData({
|
||||||
const filteredReports = result.activities.find((report) => report.province_id == province.id);
|
data: [
|
||||||
console.log(filteredReports);
|
nationalReport,
|
||||||
return {
|
...result.provinces.map((province) => {
|
||||||
...filteredReports,
|
const filteredReports = result.activities.find(
|
||||||
edare_name: province.name_fa,
|
(report) => report.province_id == province.id
|
||||||
};
|
);
|
||||||
}),
|
return {
|
||||||
],
|
...filteredReports,
|
||||||
filters: data,
|
edare_name: province.name_fa,
|
||||||
});
|
};
|
||||||
} catch (e) {}
|
}),
|
||||||
// } else {
|
],
|
||||||
// try {
|
filters: data,
|
||||||
// params.set("province_id", `${data.province_id}`);
|
});
|
||||||
// const response = await requestServer(`${GET_MISSION_CITY_ACTIVITY_REPORT}?${params}`);
|
} catch (e) {}
|
||||||
// const result = response.data.data;
|
} else {
|
||||||
// const nationalReportForItem = result.activities.find((report) => report.edare_id === "-1");
|
try {
|
||||||
// const nationalReport = {
|
params.set("province_id", `${data.province_id}`);
|
||||||
// ...nationalReportForItem,
|
const response = await requestServer(`${GET_MISSIONS_REPORT_VIOLATION_PROVINCE_ACTIVITY}?${params}`);
|
||||||
// edare_name: "کل استان",
|
const result = response.data.data;
|
||||||
// };
|
|
||||||
// setData({
|
const nationalReportForItem = result.activities.find((report) => report.city_id === "-1");
|
||||||
// data: [
|
|
||||||
// nationalReport,
|
const nationalReport = {
|
||||||
// ...result.edarateShahri.map((edare) => {
|
...nationalReportForItem,
|
||||||
// const filteredReports = result.activities.find((report) => report.edare_id == edare.id);
|
edare_name: "کل استان",
|
||||||
// return {
|
};
|
||||||
// edare_name: edare.name_fa,
|
setData({
|
||||||
// ...filteredReports,
|
data: [
|
||||||
// };
|
nationalReport,
|
||||||
// }),
|
...result.city.map((city) => {
|
||||||
// ],
|
const filteredReports = result.activities.find((report) => report.city_id == city.id);
|
||||||
// filters: data,
|
return {
|
||||||
// });
|
edare_name: city.name_fa,
|
||||||
// } catch (e) {}
|
...filteredReports,
|
||||||
// }
|
};
|
||||||
};
|
}),
|
||||||
|
],
|
||||||
useEffect(() => {
|
filters: data,
|
||||||
if (!userPermissions) return;
|
});
|
||||||
onSearchSubmit(defaultValues);
|
} catch (e) {}
|
||||||
}, [userPermissions]);
|
}
|
||||||
|
};
|
||||||
const validationSchema = yup.object().shape({
|
|
||||||
from_date: yup
|
useEffect(() => {
|
||||||
.string()
|
if (!userPermissions) return;
|
||||||
.required("تاریخ شروع الزامی است!")
|
onSearchSubmit(defaultValues);
|
||||||
.matches(/^\d{4}-\d{2}-\d{2}$/, "تاریخ شروع الزامی است!")
|
}, [userPermissions]);
|
||||||
.test("is-valid-date", "تاریخ شروع معتبر نیست!", (value) => moment(value, "YYYY-MM-DD", true).isValid()),
|
|
||||||
date_to: yup
|
const validationSchema = yup.object().shape({
|
||||||
.string()
|
from_date: yup
|
||||||
.required("تاریخ پایان الزامی است!")
|
.string()
|
||||||
.matches(/^\d{4}-\d{2}-\d{2}$/, "تاریخ پایان الزامی است!")
|
.required("تاریخ شروع الزامی است!")
|
||||||
.test("is-valid-date", "تاریخ پایان معتبر نیست!", (value) => moment(value, "YYYY-MM-DD", true).isValid()),
|
.matches(/^\d{4}-\d{2}-\d{2}$/, "تاریخ شروع الزامی است!")
|
||||||
province_id: yup.string().nullable(),
|
.test("is-valid-date", "تاریخ شروع معتبر نیست!", (value) => moment(value, "YYYY-MM-DD", true).isValid()),
|
||||||
});
|
date_to: yup
|
||||||
|
.string()
|
||||||
const { control, handleSubmit } = useForm({
|
.required("تاریخ پایان الزامی است!")
|
||||||
defaultValues,
|
.matches(/^\d{4}-\d{2}-\d{2}$/, "تاریخ پایان الزامی است!")
|
||||||
resolver: yupResolver(validationSchema),
|
.test("is-valid-date", "تاریخ پایان معتبر نیست!", (value) => moment(value, "YYYY-MM-DD", true).isValid()),
|
||||||
mode: "all",
|
province_id: yup.string().nullable(),
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
const { control, handleSubmit } = useForm({
|
||||||
<Stack spacing={1}>
|
defaultValues,
|
||||||
<PageTitle title={"کارتابل گزارش ماموریت"} />
|
resolver: yupResolver(validationSchema),
|
||||||
<SearchReportList
|
mode: "all",
|
||||||
control={control}
|
});
|
||||||
hasProvincesPermission={hasProvincesPermission}
|
|
||||||
handleSubmit={handleSubmit}
|
return (
|
||||||
onSearchSubmit={onSearchSubmit}
|
<Stack spacing={1}>
|
||||||
/>
|
<PageTitle title={"کارتابل گزارش ماموریت"} />
|
||||||
{!data ? <LinearProgress /> : <ReportLists specialFilter={specialFilter} data={data} />}
|
<SearchReportList
|
||||||
</Stack>
|
control={control}
|
||||||
);
|
hasProvincesPermission={hasProvincesPermission}
|
||||||
};
|
handleSubmit={handleSubmit}
|
||||||
export default ReportPage;
|
onSearchSubmit={onSearchSubmit}
|
||||||
|
/>
|
||||||
|
{!data ? <LinearProgress /> : <ViolationsReportsList specialFilter={specialFilter} data={data} />}
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ViolationsReportsPage;
|
||||||
@@ -115,5 +115,6 @@ export const machineType = [
|
|||||||
{ id: "تجهیزات ثابت", name_fa: "تجهیزات ثابت" },
|
{ id: "تجهیزات ثابت", name_fa: "تجهیزات ثابت" },
|
||||||
{ id: "دریل واگن", name_fa: "دریل واگن" },
|
{ id: "دریل واگن", name_fa: "دریل واگن" },
|
||||||
{ id: "کامیون سرویس سیار", name_fa: "کامیون سرویس سیار" },
|
{ id: "کامیون سرویس سیار", name_fa: "کامیون سرویس سیار" },
|
||||||
|
{ id: "کامیون سوخت رسان", name_fa: "کامیون سوخت رسان" },
|
||||||
{ id: "میکسر آب نمک", name_fa: "میکسر آب نمک" },
|
{ id: "میکسر آب نمک", name_fa: "میکسر آب نمک" },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import ContactPageIcon from "@mui/icons-material/ContactPage";
|
|||||||
import DirectionsBusIcon from "@mui/icons-material/DirectionsBus";
|
import DirectionsBusIcon from "@mui/icons-material/DirectionsBus";
|
||||||
import SupervisedUserCircleIcon from "@mui/icons-material/SupervisedUserCircle";
|
import SupervisedUserCircleIcon from "@mui/icons-material/SupervisedUserCircle";
|
||||||
import RemoveRoadIcon from "@mui/icons-material/RemoveRoad";
|
import RemoveRoadIcon from "@mui/icons-material/RemoveRoad";
|
||||||
|
import { ReportProblem, RvHookup } from "@mui/icons-material";
|
||||||
|
|
||||||
export const pageMenu = [
|
export const pageMenu = [
|
||||||
{
|
{
|
||||||
@@ -167,11 +168,31 @@ export const pageMenu = [
|
|||||||
{
|
{
|
||||||
id: "roadMissionsReports",
|
id: "roadMissionsReports",
|
||||||
label: "گزارشات",
|
label: "گزارشات",
|
||||||
type: "page",
|
type: "menu",
|
||||||
route: "/dashboard/road-missions/reports",
|
|
||||||
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||||
permissions: ["all"],
|
permissions: ["all"],
|
||||||
|
hasSubitems: true,
|
||||||
|
Subitems: [
|
||||||
|
{
|
||||||
|
id: "missionsReports",
|
||||||
|
label: "ترددها",
|
||||||
|
icon: <RvHookup sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
|
type: "page",
|
||||||
|
route: "/dashboard/road-missions/reports/missionsReports",
|
||||||
|
badges: [{ key: "mission.request_portal" }],
|
||||||
|
permissions: ["all"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "violationsReports",
|
||||||
|
label: "تخلفات",
|
||||||
|
icon: <ReportProblem sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
|
type: "page",
|
||||||
|
route: "/dashboard/road-missions/reports/violationsReports",
|
||||||
|
badges: [{ key: "mission.request_portal" }],
|
||||||
|
permissions: ["all"],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Mediation } from "@mui/icons-material";
|
import { Mediation, ReportProblem, RvHookup } from "@mui/icons-material";
|
||||||
import AccountTreeIcon from "@mui/icons-material/AccountTree";
|
import AccountTreeIcon from "@mui/icons-material/AccountTree";
|
||||||
import AdminPanelSettingsIcon from "@mui/icons-material/AdminPanelSettings";
|
import AdminPanelSettingsIcon from "@mui/icons-material/AdminPanelSettings";
|
||||||
import AssessmentIcon from "@mui/icons-material/Assessment";
|
import AssessmentIcon from "@mui/icons-material/Assessment";
|
||||||
@@ -6,7 +6,9 @@ import AssignmentLateIcon from "@mui/icons-material/AssignmentLate";
|
|||||||
import AssistantIcon from "@mui/icons-material/Assistant";
|
import AssistantIcon from "@mui/icons-material/Assistant";
|
||||||
import BallotIcon from "@mui/icons-material/Ballot";
|
import BallotIcon from "@mui/icons-material/Ballot";
|
||||||
import BiotechIcon from "@mui/icons-material/Biotech";
|
import BiotechIcon from "@mui/icons-material/Biotech";
|
||||||
|
import ContactPageIcon from "@mui/icons-material/ContactPage";
|
||||||
import CottageIcon from "@mui/icons-material/Cottage";
|
import CottageIcon from "@mui/icons-material/Cottage";
|
||||||
|
import DirectionsBusIcon from "@mui/icons-material/DirectionsBus";
|
||||||
import DoorbellIcon from "@mui/icons-material/Doorbell";
|
import DoorbellIcon from "@mui/icons-material/Doorbell";
|
||||||
import DriveEtaIcon from "@mui/icons-material/DriveEta";
|
import DriveEtaIcon from "@mui/icons-material/DriveEta";
|
||||||
import ElectricBoltIcon from "@mui/icons-material/ElectricBolt";
|
import ElectricBoltIcon from "@mui/icons-material/ElectricBolt";
|
||||||
@@ -19,19 +21,17 @@ import GroupsIcon from "@mui/icons-material/Groups";
|
|||||||
import HandymanIcon from "@mui/icons-material/Handyman";
|
import HandymanIcon from "@mui/icons-material/Handyman";
|
||||||
import LineAxisIcon from "@mui/icons-material/LineAxis";
|
import LineAxisIcon from "@mui/icons-material/LineAxis";
|
||||||
import LockPersonIcon from "@mui/icons-material/LockPerson";
|
import LockPersonIcon from "@mui/icons-material/LockPerson";
|
||||||
|
import ManageAccountsIcon from "@mui/icons-material/ManageAccounts";
|
||||||
import MapIcon from "@mui/icons-material/Map";
|
import MapIcon from "@mui/icons-material/Map";
|
||||||
|
import MapsHomeWorkIcon from "@mui/icons-material/MapsHomeWork";
|
||||||
|
import PsychologyAltIcon from "@mui/icons-material/PsychologyAlt";
|
||||||
|
import RemoveRoadIcon from "@mui/icons-material/RemoveRoad";
|
||||||
import RouteIcon from "@mui/icons-material/Route";
|
import RouteIcon from "@mui/icons-material/Route";
|
||||||
import ScienceIcon from "@mui/icons-material/Science";
|
import ScienceIcon from "@mui/icons-material/Science";
|
||||||
|
import SecurityIcon from "@mui/icons-material/Security";
|
||||||
import SpaceDashboardIcon from "@mui/icons-material/SpaceDashboard";
|
import SpaceDashboardIcon from "@mui/icons-material/SpaceDashboard";
|
||||||
import SpeedIcon from "@mui/icons-material/Speed";
|
import SpeedIcon from "@mui/icons-material/Speed";
|
||||||
import PsychologyAltIcon from "@mui/icons-material/PsychologyAlt";
|
|
||||||
import MapsHomeWorkIcon from "@mui/icons-material/MapsHomeWork";
|
|
||||||
import SecurityIcon from "@mui/icons-material/Security";
|
|
||||||
import ManageAccountsIcon from "@mui/icons-material/ManageAccounts";
|
|
||||||
import DirectionsBusIcon from "@mui/icons-material/DirectionsBus";
|
|
||||||
import ContactPageIcon from "@mui/icons-material/ContactPage";
|
|
||||||
import SupervisedUserCircleIcon from "@mui/icons-material/SupervisedUserCircle";
|
import SupervisedUserCircleIcon from "@mui/icons-material/SupervisedUserCircle";
|
||||||
import RemoveRoadIcon from "@mui/icons-material/RemoveRoad";
|
|
||||||
|
|
||||||
export const pageMenuDev = [
|
export const pageMenuDev = [
|
||||||
{
|
{
|
||||||
@@ -166,11 +166,31 @@ export const pageMenuDev = [
|
|||||||
{
|
{
|
||||||
id: "roadMissionsReports",
|
id: "roadMissionsReports",
|
||||||
label: "گزارشات",
|
label: "گزارشات",
|
||||||
type: "page",
|
type: "menu",
|
||||||
route: "/dashboard/road-missions/reports",
|
|
||||||
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||||
permissions: ["all"],
|
permissions: ["all"],
|
||||||
|
hasSubitems: true,
|
||||||
|
Subitems: [
|
||||||
|
{
|
||||||
|
id: "missionsReports",
|
||||||
|
label: "ترددها",
|
||||||
|
icon: <RvHookup sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
|
type: "page",
|
||||||
|
route: "/dashboard/road-missions/reports/missionsReports",
|
||||||
|
badges: [{ key: "mission.request_portal" }],
|
||||||
|
permissions: ["all"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "violationsReports",
|
||||||
|
label: "تخلفات",
|
||||||
|
icon: <ReportProblem sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
|
type: "page",
|
||||||
|
route: "/dashboard/road-missions/reports/violationsReports",
|
||||||
|
badges: [{ key: "mission.request_portal" }],
|
||||||
|
permissions: ["all"],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -42,11 +42,29 @@ export const CREATE_PATROL = api + "/api/v3/road_patrols/operator/store";
|
|||||||
export const GET_FMS_DATA = api + "/api/v3/fms_vehicle/get_activity";
|
export const GET_FMS_DATA = api + "/api/v3/fms_vehicle/get_activity";
|
||||||
export const GET_OTP_TOKEN = api + "/api/v3/otp/get_token";
|
export const GET_OTP_TOKEN = api + "/api/v3/otp/get_token";
|
||||||
|
|
||||||
export const GET_PROVINCE_ACTIVITY_REPORT = api + "/api/v3/road_patrols/report/country_activity";
|
export const GET_PROVINCE_ACTIVITY_REPORT = api + "/api/v3/missions/report/province_activity";
|
||||||
export const GET_CITY_ACTIVITY_REPORT = api + "/api/v3/missions/report/country_activity";
|
export const GET_COUNTRY_ACTIVITY_REPORT = api + "/api/v3/missions/report/country_activity";
|
||||||
export const EXPORT_COUNTRY_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrols/report/country_activity_excel";
|
export const EXPORT_COUNTRY_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrols/report/country_activity_excel";
|
||||||
export const EXPORT_PROVINCE_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrols/report/province_activity_excel";
|
export const EXPORT_PROVINCE_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrols/report/province_activity_excel";
|
||||||
|
|
||||||
|
export const GET_MISSIONS_REPORT_TARADOD_COUNTRY_ACTIVITY =
|
||||||
|
api + "/api/v3/missions/report_taradod/country_activity";
|
||||||
|
export const GET_MISSIONS_REPORT_TARADOD_PROVINCE_ACTIVITY =
|
||||||
|
api + "/api/v3/missions/report_taradod/province_activity";
|
||||||
|
export const EXPORT_MISSIONS_REPORT_TARADOD_COUNTRY_EXCEL_ACTIVITY =
|
||||||
|
api + "/api/v3/missions/report_taradod/country_excel_activity";
|
||||||
|
export const EXPORT_MISSIONS_REPORT_TARADOD_PROVINCE_EXCEL_ACTIVITY =
|
||||||
|
api + "/api/v3/missions/report_taradod/province_excel_activity";
|
||||||
|
|
||||||
|
export const GET_MISSIONS_REPORT_VIOLATION_COUNTRY_ACTIVITY =
|
||||||
|
api + "/api/v3/missions/report_violation/country_activity";
|
||||||
|
export const GET_MISSIONS_REPORT_VIOLATION_PROVINCE_ACTIVITY =
|
||||||
|
api + "/api/v3/missions/report_violation/province_activity";
|
||||||
|
export const EXPORT_MISSIONS_REPORT_VIOLATION_COUNTRY_EXCEL_ACTIVITY =
|
||||||
|
api + "/api/v3/missions/report_violation/country_excel_activity";
|
||||||
|
export const EXPORT_MISSIONS_REPORT_VIOLATION_PROVINCE_EXCEL_ACTIVITY =
|
||||||
|
api + "/api/v3/missions/report_violation/province_excel_activity";
|
||||||
|
|
||||||
// road items
|
// road items
|
||||||
export const GET_ROAD_ITEMS_SUPERVISOR_LIST = api + "/api/v3/road_items/supervisor";
|
export const GET_ROAD_ITEMS_SUPERVISOR_LIST = api + "/api/v3/road_items/supervisor";
|
||||||
export const EXPORT_ROAD_ITEMS_SUPERVISOR_LIST = api + "/api/v3/road_items/supervisor/excel";
|
export const EXPORT_ROAD_ITEMS_SUPERVISOR_LIST = api + "/api/v3/road_items/supervisor/excel";
|
||||||
@@ -233,6 +251,8 @@ export const GET_MISSION_PROVINCE_ACTIVITY_REPORT = api + "/api/v3/missions/repo
|
|||||||
export const GET_MISSION_CITY_ACTIVITY_REPORT = api + "/api/v3/missions/report/country_activity";
|
export const GET_MISSION_CITY_ACTIVITY_REPORT = api + "/api/v3/missions/report/country_activity";
|
||||||
export const CREATE_VIOLATION = api + "/api/v3/missions/violation_management";
|
export const CREATE_VIOLATION = api + "/api/v3/missions/violation_management";
|
||||||
export const EDIT_VIOLATION = api + "/api/v3/missions/violation_management";
|
export const EDIT_VIOLATION = api + "/api/v3/missions/violation_management";
|
||||||
|
export const EXPORT_COUNTRY_ROAD_MISSIONS_REPORTS = api + "/api/v3/missions/report/country_excel_activity";
|
||||||
|
export const EXPORT_PROVINCE_ROAD_MISSIONS_REPORTS = api + "/api/v3/missions/report/province_excel_activity";
|
||||||
|
|
||||||
export const GET_MACHINES_TABLE_LIST = api + "/api/v3/cmms_machines";
|
export const GET_MACHINES_TABLE_LIST = api + "/api/v3/cmms_machines";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user