diff --git a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/MachineAndDriver/MachinesDialog/index.jsx b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/MachineAndDriver/MachinesDialog/index.jsx
index 33e13f7..b85b6f6 100644
--- a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/MachineAndDriver/MachinesDialog/index.jsx
+++ b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/MachineAndDriver/MachinesDialog/index.jsx
@@ -1,10 +1,11 @@
+import LtrTextField from "@/core/components/LtrTextField";
import { Close, Edit } from "@mui/icons-material";
-import { Button, Dialog, IconButton } from "@mui/material";
+import { Button, Dialog, IconButton, Stack } from "@mui/material";
import { useState } from "react";
-import MachinesList from "./MachineList";
-const MachinesDialog = ({ setMachine, mode }) => {
+const MachinesDialog = ({ setMachine, mode, machineCode, setShowMachineCodeDialog }) => {
const [openMachinesDialog, setOpenMachinesDialog] = useState(false);
+
return (
<>
{mode == "edit" ? (
@@ -13,7 +14,7 @@ const MachinesDialog = ({ setMachine, mode }) => {
) : (
)}
>
diff --git a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/MachineAndDriver/index.jsx b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/MachineAndDriver/index.jsx
index 951fd83..03ce25e 100644
--- a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/MachineAndDriver/index.jsx
+++ b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/MachineAndDriver/index.jsx
@@ -1,10 +1,11 @@
import { Box, Button, Chip, DialogActions, DialogContent, Divider, Stack, Typography } from "@mui/material";
-import DriversDialog from "./DriversDialog";
import { useState } from "react";
+import DriversDialog from "./DriversDialog";
import MachinesDialog from "./MachinesDialog";
const MachineAndDriver = ({ setTabState, allData, setAllData, handlePrev }) => {
- const [machine, setMachine] = useState(allData.machine);
+ const [showMachineCodeDialog, setShowMachineCodeDialog] = useState(allData.machine_code ? true : false);
+ const [machineCode, setMachineCode] = useState(allData.machine_code);
const [driver, setDriver] = useState(allData.driver);
const handleNext = (data) => {
@@ -18,43 +19,44 @@ const MachineAndDriver = ({ setTabState, allData, setAllData, handlePrev }) => {
- {machine ? (
+ {showMachineCodeDialog ? (
<>
خودرو
+
+
+
+ >
+ ) : (
+
+ )}
+
+
+
+ {driver ? (
+ <>
+ راننده
+
-
+
>
) : (
-
+
)}
- {machine && (
-
- {driver ? (
- <>
- راننده
-
-
-
-
- >
- ) : (
-
- )}
-
- )}
@@ -64,9 +66,9 @@ const MachineAndDriver = ({ setTabState, allData, setAllData, handlePrev }) => {
diff --git a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/Verify/index.jsx b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/Verify/index.jsx
index 039ff75..48516b0 100644
--- a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/Verify/index.jsx
+++ b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/Verify/index.jsx
@@ -1,15 +1,8 @@
-import MapLoading from "@/core/components/MapLayer/Loading";
import { missionCategoryTypes } from "@/core/utils/missionCategoryTypes";
import { missionRegions } from "@/core/utils/missionRegions";
import { Box, Button, Chip, DialogActions, DialogContent, Divider, Stack, Typography } from "@mui/material";
import moment from "jalali-moment";
-import dynamic from "next/dynamic";
import { useCallback } from "react";
-import ShowBound from "../../../showBound";
-const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
- loading: () => ,
- ssr: false,
-});
const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
const handleNext = useCallback(() => {
@@ -21,11 +14,6 @@ const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
-
-
-
-
-
@@ -79,16 +67,20 @@ const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
-
+
+
- خودرو
+ کد خودرو
-
+
+
+
+
+
+
+
راننده
diff --git a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/index.jsx b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/index.jsx
index 00c4297..0d60270 100644
--- a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/index.jsx
+++ b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/Form/index.jsx
@@ -1,12 +1,11 @@
-import { AccessTime, Engineering, InsertDriveFile, LocalShipping, Route, Verified } from "@mui/icons-material";
+import { AccessTime, Engineering, InsertDriveFile, LocalShipping, Verified } from "@mui/icons-material";
import { Box, Tab, Tabs } from "@mui/material";
import { useReducer, useState } from "react";
-import Area from "./Area";
import GetDateTime from "./GetDateTime";
import GetItemInfo from "./GetItemInfo";
+import MachineAndDriver from "./MachineAndDriver";
import Rahdaran from "./Rahdaran";
import Verify from "./Verify";
-import MachineAndDriver from "./MachineAndDriver";
function TabPanel(props) {
const { children, value, index } = props;
@@ -61,10 +60,9 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
>
} label="مشخصات" />
} label="زمانبندی" />
- } label="منطقه عملیاتی" />
- } label="خودرو و راننده" />
- } label="همراهان" />
- } label="بررسی نهایی" />
+ } label="خودرو و راننده" />
+ } label="همراهان" />
+ } label="بررسی نهایی" />
{
/>
- {
- dispatch({ type: "changeData", data });
- }}
- handlePrev={handlePrev}
- setTabState={setTabState}
- />
-
-
{
@@ -106,7 +94,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
setTabState={setTabState}
/>
-
+
{
@@ -116,7 +104,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
setTabState={setTabState}
/>
-
+
>
diff --git a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/index.jsx b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/index.jsx
index 2d9ca12..f5a4a8a 100644
--- a/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/index.jsx
+++ b/src/components/dashboard/roadMissions/operator/Actions/CreateWithoutProcess/index.jsx
@@ -19,38 +19,18 @@ const CreateWithoutProcess = ({ mutate }) => {
const submitForm = async (result) => {
setSubmitting(true);
- const bound = result.bound.getLatLngs();
- let area =
- 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", {
data: {
explanation: result.explanation,
category_id: result.category_id,
- ...(result.category_id == 3
- ? {
- road_observed_id: result.road_observed_id,
- }
- : {}),
- area: {
- type: result.bound_type,
- coordinates: area,
- },
...(result.rahdaran.length != 0 ? { rahdaran: result.rahdaran.map((r) => r.id) } : {}),
zone: result.region,
end_point: result.end_point,
start_date: `${result.start_date} ${moment(result.start_time).format("HH:mm")}`,
end_date: `${result.end_date} ${moment(result.end_time).format("HH:mm")}`,
- machines: [result.machine.id],
driver: result.driver.id,
+ machine_code: result.machine_code,
},
hasSidebarUpdate: true,
})
@@ -102,16 +82,14 @@ const CreateWithoutProcess = ({ mutate }) => {
category_id: "",
road_observed_id: "",
rahdaran: [],
- bound: null,
- bound_type: "polyline",
start_date: "",
start_time: null,
end_date: "",
end_time: null,
end_point: "",
region: "",
- machine: null,
driver: null,
+ machine_code: "",
}}
submitForm={submitForm}
submitting={submitting}
diff --git a/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/Form/Verify/index.jsx b/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/Form/Verify/index.jsx
index 805e5d2..09f865f 100644
--- a/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/Form/Verify/index.jsx
+++ b/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/Form/Verify/index.jsx
@@ -21,11 +21,6 @@ const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
-
-
-
-
-
diff --git a/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/Form/index.jsx b/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/Form/index.jsx
index 45ec88e..96de65d 100644
--- a/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/Form/index.jsx
+++ b/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/Form/index.jsx
@@ -1,12 +1,11 @@
-import { AccessTime, Engineering, InsertDriveFile, Route, Verified, Person } from "@mui/icons-material";
+import { AccessTime, Engineering, InsertDriveFile, Person, Verified } from "@mui/icons-material";
import { Box, Tab, Tabs } from "@mui/material";
import { useReducer, useState } from "react";
-import Area from "./Area";
import GetDateTime from "./GetDateTime";
import GetItemInfo from "./GetItemInfo";
+import MachineAndDriver from "./MachineAndDriver";
import Rahdaran from "./Rahdaran";
import Verify from "./Verify";
-import MachineAndDriver from "./MachineAndDriver";
function TabPanel(props) {
const { children, value, index } = props;
@@ -61,10 +60,9 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
>
} label="مشخصات" />
} label="زمانبندی" />
- } label="منطقه عملیاتی" />
- } label="راننده" />
- } label="همراهان" />
- } label="بررسی نهایی" />
+ } label="راننده" />
+ } label="همراهان" />
+ } label="بررسی نهایی" />
{
/>
- {
- dispatch({ type: "changeData", data });
- }}
- handlePrev={handlePrev}
- setTabState={setTabState}
- />
-
-
{
@@ -106,7 +94,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
setTabState={setTabState}
/>
-
+
{
@@ -116,7 +104,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
setTabState={setTabState}
/>
-
+
>
diff --git a/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/index.jsx b/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/index.jsx
index 5bc7492..0e1f42b 100644
--- a/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/index.jsx
+++ b/src/components/dashboard/roadMissions/violations/Actions/CreateWithoutProcess/index.jsx
@@ -1,4 +1,4 @@
-import { REQUEST_MISSION_WITHOUT_PROCESS } from "@/core/utils/routes";
+import { REQUEST_MISSION_VIOLATIONS_PROCESS } from "@/core/utils/routes";
import useRequest from "@/lib/hooks/useRequest";
import { AddCircleOutline, Close } from "@mui/icons-material";
import { Dialog, IconButton, Tooltip } from "@mui/material";
@@ -17,20 +17,11 @@ const CreateWithoutProcess = ({ row, mutate }) => {
const submitForm = async (result) => {
setSubmitting(true);
- const bound = result.bound.getLatLngs();
- let area =
- result.bound_type == "polygon"
- ? bound.map((ring) => ring.map((latlng) => [latlng.lat, latlng.lng]))[0]
- : bound.map((latlng) => [latlng.lat, latlng.lng]);
- await requestServer(`${REQUEST_MISSION_WITHOUT_PROCESS}/${row.original.id}`, "post", {
+ await requestServer(`${REQUEST_MISSION_VIOLATIONS_PROCESS}/${row.original.id}`, "post", {
data: {
explanation: result.explanation,
category_id: result.category_id,
- area: {
- type: result.bound_type,
- coordinates: area,
- },
...(result.rahdaran.length != 0 ? { rahdaran: result.rahdaran.map((r) => r.id) } : {}),
zone: result.region,
end_point: result.end_point,
@@ -79,8 +70,6 @@ const CreateWithoutProcess = ({ row, mutate }) => {
category_id: "",
road_observed_id: "",
rahdaran: [],
- bound: null,
- bound_type: "polygon",
start_date: "",
start_time: null,
end_date: "",
diff --git a/src/core/utils/pageMenu.js b/src/core/utils/pageMenu.js
index 08f09f0..97c7001 100644
--- a/src/core/utils/pageMenu.js
+++ b/src/core/utils/pageMenu.js
@@ -159,15 +159,15 @@ export const pageMenu = [
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
permissions: ["all"],
},
- {
- id: "roadMissionsReports",
- label: "گزارشات",
- type: "page",
- route: "/dashboard/road-missions/reports",
- icon: ,
- // badges: [{ key: "mission.control" }], // TODO: add badge and permission
- permissions: ["all"],
- },
+ // {
+ // id: "roadMissionsReports",
+ // label: "گزارشات",
+ // type: "page",
+ // route: "/dashboard/road-missions/reports",
+ // icon: ,
+ // // badges: [{ key: "mission.control" }], // TODO: add badge and permission
+ // permissions: ["all"],
+ // },
],
},
{
diff --git a/src/core/utils/pageMenuDev.js b/src/core/utils/pageMenuDev.js
index f78fffe..90ae25f 100644
--- a/src/core/utils/pageMenuDev.js
+++ b/src/core/utils/pageMenuDev.js
@@ -158,15 +158,15 @@ export const pageMenuDev = [
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
permissions: ["all"],
},
- {
- id: "roadMissionsReports",
- label: "گزارشات",
- type: "page",
- route: "/dashboard/road-missions/reports",
- icon: ,
- // badges: [{ key: "mission.control" }], // TODO: add badge and permission
- permissions: ["all"],
- },
+ // {
+ // id: "roadMissionsReports",
+ // label: "گزارشات",
+ // type: "page",
+ // route: "/dashboard/road-missions/reports",
+ // icon: ,
+ // // badges: [{ key: "mission.control" }], // TODO: add badge and permission
+ // permissions: ["all"],
+ // },
],
},
{
diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js
index 1c9160d..0c1a32c 100644
--- a/src/core/utils/routes.js
+++ b/src/core/utils/routes.js
@@ -217,7 +217,8 @@ export const GET_ROAD_MISSIONS_OPERATOR_LIST = api + "/api/v3/missions/request_p
export const GET_ROAD_MISSIONS_TRANSPORTATION_LIST = api + "/api/v3/missions/transportation_unit";
export const GET_ROAD_MISSIONS_CONTROL_LIST = api + "/api/v3/missions/control_unit";
export const REQUEST_MISSION = api + "/api/v3/missions/request_portal";
-export const REQUEST_MISSION_WITHOUT_PROCESS = api + "/api/v3/missions/violation_management/no_process";
+export const REQUEST_MISSION_WITHOUT_PROCESS = api + "/api/v3/missions/request_portal/no_process";
+export const REQUEST_MISSION_VIOLATIONS_PROCESS = api + "/api/v3/missions/violation_management/no_process";
export const REQUEST_MISSION_CONTINUE_MISSION = api + "/api/v3/missions/request_portal/continue";
export const UPDATE_REQUEST_MISSION = api + "/api/v3/missions/request_portal";
export const DELETE_REQUEST_MISSION = api + "/api/v3/missions/request_portal";