add area to no process
This commit is contained in:
@@ -3,6 +3,14 @@ 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 { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
|
// import ShowBound from "../../../showBound";
|
||||||
|
// import MapLoading from "@/core/components/MapLayer/Loading";
|
||||||
|
// import dynamic from "next/dynamic";
|
||||||
|
//
|
||||||
|
// 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(() => {
|
||||||
@@ -14,6 +22,11 @@ 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,4 +1,4 @@
|
|||||||
import { AccessTime, Engineering, InsertDriveFile, LocalShipping, 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";
|
||||||
import GetDateTime from "./GetDateTime";
|
import GetDateTime from "./GetDateTime";
|
||||||
@@ -6,6 +6,7 @@ import GetItemInfo from "./GetItemInfo";
|
|||||||
import MachineAndDriver from "./MachineAndDriver";
|
import MachineAndDriver from "./MachineAndDriver";
|
||||||
import Rahdaran from "./Rahdaran";
|
import Rahdaran from "./Rahdaran";
|
||||||
import Verify from "./Verify";
|
import Verify from "./Verify";
|
||||||
|
import Area from "@/components/dashboard/roadMissions/operator/Actions/Create/Form/Area";
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
const { children, value, index } = props;
|
const { children, value, index } = props;
|
||||||
@@ -60,6 +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={<LocalShipping />} label="خودرو و راننده" />
|
<Tab disabled={tabState < 2} icon={<LocalShipping />} 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="بررسی نهایی" />
|
||||||
@@ -84,6 +86,16 @@ const CreateForm = ({ defaultValues, submitForm, setOpen, submitting }) => {
|
|||||||
setTabState={setTabState}
|
setTabState={setTabState}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
{/*<TabPanel value={tabState} index={2}>*/}
|
||||||
|
{/* <Area*/}
|
||||||
|
{/* allData={allData}*/}
|
||||||
|
{/* setAllData={(data) => {*/}
|
||||||
|
{/* dispatch({ type: "changeData", data });*/}
|
||||||
|
{/* }}*/}
|
||||||
|
{/* handlePrev={handlePrev}*/}
|
||||||
|
{/* setTabState={setTabState}*/}
|
||||||
|
{/* />*/}
|
||||||
|
{/*</TabPanel>*/}
|
||||||
<TabPanel value={tabState} index={2}>
|
<TabPanel value={tabState} index={2}>
|
||||||
<MachineAndDriver
|
<MachineAndDriver
|
||||||
allData={allData}
|
allData={allData}
|
||||||
|
|||||||
@@ -19,6 +19,17 @@ 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: {
|
||||||
@@ -27,6 +38,10 @@ const CreateWithoutProcess = ({ mutate }) => {
|
|||||||
...(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,
|
||||||
|
// area: {
|
||||||
|
// type: result.bound_type,
|
||||||
|
// coordinates: area,
|
||||||
|
// },
|
||||||
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")}`,
|
||||||
driver: result.driver.id,
|
driver: result.driver.id,
|
||||||
@@ -85,6 +100,8 @@ const CreateWithoutProcess = ({ mutate }) => {
|
|||||||
start_date: "",
|
start_date: "",
|
||||||
start_time: null,
|
start_time: null,
|
||||||
end_date: "",
|
end_date: "",
|
||||||
|
// bound: null,
|
||||||
|
// bound_type: "polyline",
|
||||||
end_time: null,
|
end_time: null,
|
||||||
end_point: "",
|
end_point: "",
|
||||||
region: "",
|
region: "",
|
||||||
|
|||||||
Reference in New Issue
Block a user