updated violations and no_process actions
This commit is contained in:
@@ -103,9 +103,6 @@ const GetItemInfo = ({ allData, setAllData, handlePrev, setTabState }) => {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={6}>
|
|
||||||
<FastReactCode control={control} />
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} sm={6}>
|
<Grid item xs={12} sm={6}>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
import LtrTextField from "@/core/components/LtrTextField";
|
||||||
import { Close, Edit } from "@mui/icons-material";
|
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 { useState } from "react";
|
||||||
import MachinesList from "./MachineList";
|
|
||||||
|
|
||||||
const MachinesDialog = ({ setMachine, mode }) => {
|
const MachinesDialog = ({ setMachine, mode, machineCode, setShowMachineCodeDialog }) => {
|
||||||
const [openMachinesDialog, setOpenMachinesDialog] = useState(false);
|
const [openMachinesDialog, setOpenMachinesDialog] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{mode == "edit" ? (
|
{mode == "edit" ? (
|
||||||
@@ -13,7 +14,7 @@ const MachinesDialog = ({ setMachine, mode }) => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
) : (
|
) : (
|
||||||
<Button onClick={() => setOpenMachinesDialog(true)} variant="contained" fullWidth size="large">
|
<Button onClick={() => setOpenMachinesDialog(true)} variant="contained" fullWidth size="large">
|
||||||
انتخاب خودرو
|
وارد کردن کد خودرو{" "}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Dialog open={openMachinesDialog} fullWidth maxWidth="sm">
|
<Dialog open={openMachinesDialog} fullWidth maxWidth="sm">
|
||||||
@@ -31,7 +32,36 @@ const MachinesDialog = ({ setMachine, mode }) => {
|
|||||||
<Close />
|
<Close />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{openMachinesDialog && (
|
{openMachinesDialog && (
|
||||||
<MachinesList setMachine={setMachine} setOpenMachinesDialog={setOpenMachinesDialog} />
|
<Stack sx={{ p: 4, mt: 2 }} spacing={2}>
|
||||||
|
<LtrTextField
|
||||||
|
label={`کد خودرو`}
|
||||||
|
value={machineCode || ""}
|
||||||
|
type="text"
|
||||||
|
size={"small"}
|
||||||
|
inputProps={{
|
||||||
|
placeholder: "کد خودرو را وارد کنید",
|
||||||
|
inputMode: "numeric",
|
||||||
|
min: 0,
|
||||||
|
pattern: "[0-9]*",
|
||||||
|
}}
|
||||||
|
onChange={(event) => {
|
||||||
|
setMachine(event.target.value);
|
||||||
|
}}
|
||||||
|
variant="outlined"
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
setShowMachineCodeDialog(true);
|
||||||
|
setOpenMachinesDialog(false);
|
||||||
|
}}
|
||||||
|
variant="contained"
|
||||||
|
fullWidth
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
ثبت
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
)}
|
)}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { Box, Button, Chip, DialogActions, DialogContent, Divider, Stack, Typography } from "@mui/material";
|
import { Box, Button, Chip, DialogActions, DialogContent, Divider, Stack, Typography } from "@mui/material";
|
||||||
import DriversDialog from "./DriversDialog";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import DriversDialog from "./DriversDialog";
|
||||||
import MachinesDialog from "./MachinesDialog";
|
import MachinesDialog from "./MachinesDialog";
|
||||||
|
|
||||||
const MachineAndDriver = ({ setTabState, allData, setAllData, handlePrev }) => {
|
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 [driver, setDriver] = useState(allData.driver);
|
||||||
|
|
||||||
const handleNext = (data) => {
|
const handleNext = (data) => {
|
||||||
@@ -18,43 +19,44 @@ const MachineAndDriver = ({ setTabState, allData, setAllData, handlePrev }) => {
|
|||||||
<Box sx={{ flex: 1 }}>
|
<Box sx={{ flex: 1 }}>
|
||||||
<Stack sx={{ my: 1 }} spacing={2}>
|
<Stack sx={{ my: 1 }} spacing={2}>
|
||||||
<Stack direction={"row"} alignItems={"center"} spacing={1}>
|
<Stack direction={"row"} alignItems={"center"} spacing={1}>
|
||||||
{machine ? (
|
{showMachineCodeDialog ? (
|
||||||
<>
|
<>
|
||||||
<Typography variant="body2">خودرو</Typography>
|
<Typography variant="body2">خودرو</Typography>
|
||||||
<Divider sx={{ flex: 1 }} />
|
<Divider sx={{ flex: 1 }} />
|
||||||
|
<Chip label={machineCode} size="small" />
|
||||||
|
<Divider sx={{ flex: 1 }} />
|
||||||
|
<MachinesDialog
|
||||||
|
setMachine={setMachineCode}
|
||||||
|
setShowMachineCodeDialog={setShowMachineCodeDialog}
|
||||||
|
mode={"edit"}
|
||||||
|
machineCode={machineCode}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<MachinesDialog
|
||||||
|
setMachine={setMachineCode}
|
||||||
|
setShowMachineCodeDialog={setShowMachineCodeDialog}
|
||||||
|
machineCode={machineCode}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<Stack direction={"row"} alignItems={"center"} spacing={1}>
|
||||||
|
{driver ? (
|
||||||
|
<>
|
||||||
|
<Typography variant="body2">راننده</Typography>
|
||||||
|
<Divider sx={{ flex: 1 }} />
|
||||||
<Chip
|
<Chip
|
||||||
label={
|
label={driver ? `${driver.code} | ${driver.name}` : "راننده ای انتخاب نشده"}
|
||||||
machine
|
|
||||||
? `${machine.machine_code} | ${machine.car_name}`
|
|
||||||
: "خودرویی انتخاب نشده"
|
|
||||||
}
|
|
||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
<Divider sx={{ flex: 1 }} />
|
<Divider sx={{ flex: 1 }} />
|
||||||
<MachinesDialog setMachine={setMachine} mode={"edit"} />
|
<DriversDialog setDriver={setDriver} mode={"edit"} />
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<MachinesDialog setMachine={setMachine} />
|
<DriversDialog setDriver={setDriver} />
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
{machine && (
|
|
||||||
<Stack direction={"row"} alignItems={"center"} spacing={1}>
|
|
||||||
{driver ? (
|
|
||||||
<>
|
|
||||||
<Typography variant="body2">راننده</Typography>
|
|
||||||
<Divider sx={{ flex: 1 }} />
|
|
||||||
<Chip
|
|
||||||
label={driver ? `${driver.code} | ${driver.name}` : "راننده ای انتخاب نشده"}
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
<Divider sx={{ flex: 1 }} />
|
|
||||||
<DriversDialog setDriver={setDriver} mode={"edit"} />
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<DriversDialog setDriver={setDriver} />
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
@@ -64,9 +66,9 @@ const MachineAndDriver = ({ setTabState, allData, setAllData, handlePrev }) => {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
disabled={!machine || !driver}
|
disabled={!driver || !machineCode}
|
||||||
size="large"
|
size="large"
|
||||||
onClick={() => handleNext({ machine, driver })}
|
onClick={() => handleNext({ driver, machine_code: machineCode })}
|
||||||
>
|
>
|
||||||
مرحله بعد
|
مرحله بعد
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
import MapLoading from "@/core/components/MapLayer/Loading";
|
|
||||||
import { missionCategoryTypes } from "@/core/utils/missionCategoryTypes";
|
import { missionCategoryTypes } from "@/core/utils/missionCategoryTypes";
|
||||||
import { missionRegions } from "@/core/utils/missionRegions";
|
import { missionRegions } from "@/core/utils/missionRegions";
|
||||||
import { Box, Button, Chip, DialogActions, DialogContent, Divider, Stack, Typography } from "@mui/material";
|
import { Box, Button, Chip, DialogActions, DialogContent, Divider, Stack, Typography } from "@mui/material";
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
import dynamic from "next/dynamic";
|
|
||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import ShowBound from "../../../showBound";
|
|
||||||
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
|
||||||
loading: () => <MapLoading />,
|
|
||||||
ssr: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
|
const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
|
||||||
const handleNext = useCallback(() => {
|
const handleNext = useCallback(() => {
|
||||||
@@ -21,11 +14,6 @@ const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
|
|||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Box sx={{ flex: 1 }}>
|
<Box sx={{ flex: 1 }}>
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<Box sx={{ width: "100%", height: "200px" }}>
|
|
||||||
<MapLayer style={{ borderRadius: "4px" }}>
|
|
||||||
<ShowBound bound={allData.bound} />
|
|
||||||
</MapLayer>
|
|
||||||
</Box>
|
|
||||||
<Stack spacing={1}>
|
<Stack spacing={1}>
|
||||||
<Divider>
|
<Divider>
|
||||||
<Chip color="primary" variant="outlined" label="مشخصات ماموریت" />
|
<Chip color="primary" variant="outlined" label="مشخصات ماموریت" />
|
||||||
@@ -79,16 +67,20 @@ const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
<Stack spacing={1}>
|
<Stack spacing={1}>
|
||||||
<Divider>
|
<Divider>
|
||||||
<Chip color="primary" variant="outlined" label="خودرو و راننده" />
|
<Chip color="primary" variant="outlined" label="کد خودرو" />
|
||||||
</Divider>
|
</Divider>
|
||||||
|
|
||||||
<Stack direction={"row"} alignItems={"center"} spacing={1}>
|
<Stack direction={"row"} alignItems={"center"} spacing={1}>
|
||||||
<Typography variant="body2">خودرو</Typography>
|
<Typography variant="body2">کد خودرو</Typography>
|
||||||
<Divider sx={{ flex: 1 }} />
|
<Divider sx={{ flex: 1 }} />
|
||||||
<Chip
|
<Chip size="small" label={`${allData.machine_code}`} />
|
||||||
size="small"
|
|
||||||
label={`${allData.machine.machine_code} | ${allData.machine.car_name}`}
|
|
||||||
/>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
<Stack spacing={1}>
|
||||||
|
<Divider>
|
||||||
|
<Chip color="primary" variant="outlined" label="راننده" />
|
||||||
|
</Divider>
|
||||||
|
|
||||||
<Stack direction={"row"} alignItems={"center"} spacing={1}>
|
<Stack direction={"row"} alignItems={"center"} spacing={1}>
|
||||||
<Typography variant="body2">راننده</Typography>
|
<Typography variant="body2">راننده</Typography>
|
||||||
<Divider sx={{ flex: 1 }} />
|
<Divider sx={{ flex: 1 }} />
|
||||||
|
|||||||
@@ -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 { Box, Tab, Tabs } from "@mui/material";
|
||||||
import { useReducer, useState } from "react";
|
import { useReducer, useState } from "react";
|
||||||
import Area from "./Area";
|
|
||||||
import GetDateTime from "./GetDateTime";
|
import GetDateTime from "./GetDateTime";
|
||||||
import GetItemInfo from "./GetItemInfo";
|
import GetItemInfo from "./GetItemInfo";
|
||||||
|
import MachineAndDriver from "./MachineAndDriver";
|
||||||
import Rahdaran from "./Rahdaran";
|
import Rahdaran from "./Rahdaran";
|
||||||
import Verify from "./Verify";
|
import Verify from "./Verify";
|
||||||
import MachineAndDriver from "./MachineAndDriver";
|
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
const { children, value, index } = props;
|
const { children, value, index } = props;
|
||||||
@@ -61,10 +60,9 @@ 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={<LocalShipping />} label="خودرو و راننده" />
|
||||||
<Tab disabled={tabState < 3} icon={<LocalShipping />} label="خودرو و راننده" />
|
<Tab disabled={tabState < 3} icon={<Engineering />} label="همراهان" />
|
||||||
<Tab disabled={tabState < 4} icon={<Engineering />} label="همراهان" />
|
<Tab disabled={tabState < 4} icon={<Verified />} label="بررسی نهایی" />
|
||||||
<Tab disabled={tabState < 5} icon={<Verified />} label="بررسی نهایی" />
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<TabPanel value={tabState} index={0}>
|
<TabPanel value={tabState} index={0}>
|
||||||
<GetItemInfo
|
<GetItemInfo
|
||||||
@@ -87,16 +85,6 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={tabState} index={2}>
|
<TabPanel value={tabState} index={2}>
|
||||||
<Area
|
|
||||||
allData={allData}
|
|
||||||
setAllData={(data) => {
|
|
||||||
dispatch({ type: "changeData", data });
|
|
||||||
}}
|
|
||||||
handlePrev={handlePrev}
|
|
||||||
setTabState={setTabState}
|
|
||||||
/>
|
|
||||||
</TabPanel>
|
|
||||||
<TabPanel value={tabState} index={3}>
|
|
||||||
<MachineAndDriver
|
<MachineAndDriver
|
||||||
allData={allData}
|
allData={allData}
|
||||||
setAllData={(data) => {
|
setAllData={(data) => {
|
||||||
@@ -106,7 +94,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
setTabState={setTabState}
|
setTabState={setTabState}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={tabState} index={4}>
|
<TabPanel value={tabState} index={3}>
|
||||||
<Rahdaran
|
<Rahdaran
|
||||||
allData={allData}
|
allData={allData}
|
||||||
setAllData={(data) => {
|
setAllData={(data) => {
|
||||||
@@ -116,7 +104,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
setTabState={setTabState}
|
setTabState={setTabState}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={tabState} index={5}>
|
<TabPanel value={tabState} index={4}>
|
||||||
<Verify allData={allData} handlePrev={handlePrev} submitForm={submitForm} submitting={submitting} />
|
<Verify allData={allData} handlePrev={handlePrev} submitForm={submitForm} submitting={submitting} />
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -19,38 +19,18 @@ const CreateWithoutProcess = ({ mutate }) => {
|
|||||||
|
|
||||||
const submitForm = async (result) => {
|
const submitForm = async (result) => {
|
||||||
setSubmitting(true);
|
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", {
|
await requestServer(REQUEST_MISSION_WITHOUT_PROCESS, "post", {
|
||||||
data: {
|
data: {
|
||||||
explanation: result.explanation,
|
explanation: result.explanation,
|
||||||
category_id: result.category_id,
|
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) } : {}),
|
...(result.rahdaran.length != 0 ? { rahdaran: result.rahdaran.map((r) => r.id) } : {}),
|
||||||
zone: result.region,
|
zone: result.region,
|
||||||
end_point: result.end_point,
|
end_point: result.end_point,
|
||||||
start_date: `${result.start_date} ${moment(result.start_time).format("HH:mm")}`,
|
start_date: `${result.start_date} ${moment(result.start_time).format("HH:mm")}`,
|
||||||
end_date: `${result.end_date} ${moment(result.end_time).format("HH:mm")}`,
|
end_date: `${result.end_date} ${moment(result.end_time).format("HH:mm")}`,
|
||||||
machines: [result.machine.id],
|
|
||||||
driver: result.driver.id,
|
driver: result.driver.id,
|
||||||
|
machine_code: result.machine_code,
|
||||||
},
|
},
|
||||||
hasSidebarUpdate: true,
|
hasSidebarUpdate: true,
|
||||||
})
|
})
|
||||||
@@ -102,16 +82,14 @@ const CreateWithoutProcess = ({ mutate }) => {
|
|||||||
category_id: "",
|
category_id: "",
|
||||||
road_observed_id: "",
|
road_observed_id: "",
|
||||||
rahdaran: [],
|
rahdaran: [],
|
||||||
bound: null,
|
|
||||||
bound_type: "polygon",
|
|
||||||
start_date: "",
|
start_date: "",
|
||||||
start_time: null,
|
start_time: null,
|
||||||
end_date: "",
|
end_date: "",
|
||||||
end_time: null,
|
end_time: null,
|
||||||
end_point: "",
|
end_point: "",
|
||||||
region: "",
|
region: "",
|
||||||
machine: null,
|
|
||||||
driver: null,
|
driver: null,
|
||||||
|
machine_code: "",
|
||||||
}}
|
}}
|
||||||
submitForm={submitForm}
|
submitForm={submitForm}
|
||||||
submitting={submitting}
|
submitting={submitting}
|
||||||
|
|||||||
@@ -21,11 +21,6 @@ const Verify = ({ allData, handlePrev, submitForm, submitting }) => {
|
|||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Box sx={{ flex: 1 }}>
|
<Box sx={{ flex: 1 }}>
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<Box sx={{ width: "100%", height: "200px" }}>
|
|
||||||
<MapLayer style={{ borderRadius: "4px" }}>
|
|
||||||
<ShowBound bound={allData.bound} />
|
|
||||||
</MapLayer>
|
|
||||||
</Box>
|
|
||||||
<Stack spacing={1}>
|
<Stack spacing={1}>
|
||||||
<Divider>
|
<Divider>
|
||||||
<Chip color="primary" variant="outlined" label="مشخصات ماموریت" />
|
<Chip color="primary" variant="outlined" label="مشخصات ماموریت" />
|
||||||
|
|||||||
@@ -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 { Box, Tab, Tabs } from "@mui/material";
|
||||||
import { useReducer, useState } from "react";
|
import { useReducer, useState } from "react";
|
||||||
import Area from "./Area";
|
|
||||||
import GetDateTime from "./GetDateTime";
|
import GetDateTime from "./GetDateTime";
|
||||||
import GetItemInfo from "./GetItemInfo";
|
import GetItemInfo from "./GetItemInfo";
|
||||||
|
import MachineAndDriver from "./MachineAndDriver";
|
||||||
import Rahdaran from "./Rahdaran";
|
import Rahdaran from "./Rahdaran";
|
||||||
import Verify from "./Verify";
|
import Verify from "./Verify";
|
||||||
import MachineAndDriver from "./MachineAndDriver";
|
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
const { children, value, index } = props;
|
const { children, value, index } = props;
|
||||||
@@ -61,10 +60,9 @@ 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={<Person />} label="راننده" />
|
||||||
<Tab disabled={tabState < 3} icon={<Person />} label="راننده" />
|
<Tab disabled={tabState < 3} icon={<Engineering />} label="همراهان" />
|
||||||
<Tab disabled={tabState < 4} icon={<Engineering />} label="همراهان" />
|
<Tab disabled={tabState < 4} icon={<Verified />} label="بررسی نهایی" />
|
||||||
<Tab disabled={tabState < 5} icon={<Verified />} label="بررسی نهایی" />
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<TabPanel value={tabState} index={0}>
|
<TabPanel value={tabState} index={0}>
|
||||||
<GetItemInfo
|
<GetItemInfo
|
||||||
@@ -87,16 +85,6 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={tabState} index={2}>
|
<TabPanel value={tabState} index={2}>
|
||||||
<Area
|
|
||||||
allData={allData}
|
|
||||||
setAllData={(data) => {
|
|
||||||
dispatch({ type: "changeData", data });
|
|
||||||
}}
|
|
||||||
handlePrev={handlePrev}
|
|
||||||
setTabState={setTabState}
|
|
||||||
/>
|
|
||||||
</TabPanel>
|
|
||||||
<TabPanel value={tabState} index={3}>
|
|
||||||
<MachineAndDriver
|
<MachineAndDriver
|
||||||
allData={allData}
|
allData={allData}
|
||||||
setAllData={(data) => {
|
setAllData={(data) => {
|
||||||
@@ -106,7 +94,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
setTabState={setTabState}
|
setTabState={setTabState}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={tabState} index={4}>
|
<TabPanel value={tabState} index={3}>
|
||||||
<Rahdaran
|
<Rahdaran
|
||||||
allData={allData}
|
allData={allData}
|
||||||
setAllData={(data) => {
|
setAllData={(data) => {
|
||||||
@@ -116,7 +104,7 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
setTabState={setTabState}
|
setTabState={setTabState}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={tabState} index={5}>
|
<TabPanel value={tabState} index={4}>
|
||||||
<Verify allData={allData} handlePrev={handlePrev} submitForm={submitForm} submitting={submitting} />
|
<Verify allData={allData} handlePrev={handlePrev} submitForm={submitForm} submitting={submitting} />
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -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 useRequest from "@/lib/hooks/useRequest";
|
||||||
import { AddCircleOutline, Close } from "@mui/icons-material";
|
import { AddCircleOutline, Close } from "@mui/icons-material";
|
||||||
import { Dialog, IconButton, Tooltip } from "@mui/material";
|
import { Dialog, IconButton, Tooltip } from "@mui/material";
|
||||||
@@ -17,20 +17,11 @@ const CreateWithoutProcess = ({ row, mutate }) => {
|
|||||||
|
|
||||||
const submitForm = async (result) => {
|
const submitForm = async (result) => {
|
||||||
setSubmitting(true);
|
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: {
|
data: {
|
||||||
explanation: result.explanation,
|
explanation: result.explanation,
|
||||||
category_id: result.category_id,
|
category_id: result.category_id,
|
||||||
area: {
|
|
||||||
type: result.bound_type,
|
|
||||||
coordinates: area,
|
|
||||||
},
|
|
||||||
...(result.rahdaran.length != 0 ? { rahdaran: result.rahdaran.map((r) => r.id) } : {}),
|
...(result.rahdaran.length != 0 ? { rahdaran: result.rahdaran.map((r) => r.id) } : {}),
|
||||||
zone: result.region,
|
zone: result.region,
|
||||||
end_point: result.end_point,
|
end_point: result.end_point,
|
||||||
@@ -79,8 +70,6 @@ const CreateWithoutProcess = ({ row, mutate }) => {
|
|||||||
category_id: "",
|
category_id: "",
|
||||||
road_observed_id: "",
|
road_observed_id: "",
|
||||||
rahdaran: [],
|
rahdaran: [],
|
||||||
bound: null,
|
|
||||||
bound_type: "polygon",
|
|
||||||
start_date: "",
|
start_date: "",
|
||||||
start_time: null,
|
start_time: null,
|
||||||
end_date: "",
|
end_date: "",
|
||||||
|
|||||||
@@ -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_TRANSPORTATION_LIST = api + "/api/v3/missions/transportation_unit";
|
||||||
export const GET_ROAD_MISSIONS_CONTROL_LIST = api + "/api/v3/missions/control_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 = 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 REQUEST_MISSION_CONTINUE_MISSION = api + "/api/v3/missions/request_portal/continue";
|
||||||
export const UPDATE_REQUEST_MISSION = api + "/api/v3/missions/request_portal";
|
export const UPDATE_REQUEST_MISSION = api + "/api/v3/missions/request_portal";
|
||||||
export const DELETE_REQUEST_MISSION = api + "/api/v3/missions/request_portal";
|
export const DELETE_REQUEST_MISSION = api + "/api/v3/missions/request_portal";
|
||||||
|
|||||||
Reference in New Issue
Block a user