diff --git a/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolDetail.jsx b/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolDetail.jsx index 24d59bb..008997b 100644 --- a/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolDetail.jsx +++ b/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolDetail.jsx @@ -1,13 +1,69 @@ "use client"; -import {Box, Button, Chip, Divider, Slide} from "@mui/material"; -import {useState} from "react"; +import { + Box, + Button, + Card, + CardContent, + Chip, + Divider, + IconButton, + InputAdornment, + Slide, + Stack, + Typography +} from "@mui/material"; +import React, {useEffect, useState} from "react"; import CarCode from "@/core/components/CarCode"; import SearchIcon from '@mui/icons-material/Search'; +import {AdapterDateFnsJalali} from "@mui/x-date-pickers/AdapterDateFnsJalali"; +import {faIR} from "@mui/x-date-pickers/locales"; +import {LocalizationProvider, MobileDateTimePicker} from "@mui/x-date-pickers"; +import ClearIcon from "@mui/icons-material/Clear"; +import moment from "jalali-moment"; +import dynamic from "next/dynamic"; +import MapLoading from "@/core/components/MapLayer/Loading"; +import LocalGasStationIcon from '@mui/icons-material/LocalGasStation'; +import DirectionsCarFilledIcon from '@mui/icons-material/DirectionsCarFilled'; +import WatchLaterIcon from '@mui/icons-material/WatchLater'; +import AddRoadIcon from '@mui/icons-material/AddRoad'; +import ShareLocationIcon from '@mui/icons-material/ShareLocation'; +import KeyboardDoubleArrowLeftIcon from "@mui/icons-material/KeyboardDoubleArrowLeft"; +import KeyboardDoubleArrowRightIcon from "@mui/icons-material/KeyboardDoubleArrowRight"; + +const MapLayer = dynamic(() => import("@/core/components/MapLayer"), { + loading: () => , + ssr: false, +}); const PatrolDetail = ({tabState, setTabState}) => { const [patrolFounded, setPatrolFounded] = useState(false); const [carCode, setCarCode] = useState(null); + const [dateFrom, setDateFrom] = useState(null); + const [dateTo, setDateTo] = useState(null); + const [readyToRequest, setReadyToRequest] = useState(false); + const [data, setData] = useState({ + machine_code: "12-213-21", + distance: "23", + time: "04:45", + stop: "2", + fuel_amount: "21" + }) + + const requestPatrolInfo = () => { + setPatrolFounded(true) + setReadyToRequest(false) + } + + useEffect(() => { + console.log("data", carCode?.id, dateFrom, dateTo) + if (carCode !== null && dateFrom !== null && dateTo !== null) { + setReadyToRequest(true); + } else { + setReadyToRequest(false); + } + }, [carCode, dateFrom, dateTo]); + return ( { my: 3 }} > - - - - + + + + + + + { + const date = new Date(dateFrom); + const formattedDate = moment(date).locale("en").format("YYYY-MM-DD HH:mm"); + setDateFrom(formattedDate); + }} + slotProps={{ + textField: { + size: "small", + placeholder: "تاریخ و ساعت شروع گشت", + InputProps: { + endAdornment: ( + + { + event.stopPropagation(); + setDateFrom(null); + }} + sx={{ + color: "#bfbfbf", + "&:hover": { + backgroundColor: "rgba(189, 189, 189, 0.1)", + color: "#363434", + }, + }} + > + + + + ), + }, + }, + }} label="تاریخ و ساعت شروع گشت" + /> + { + const date = new Date(dateTo); + const formattedDate = moment(date).locale("en").format("YYYY-MM-DD HH:mm"); + setDateTo(formattedDate); + }} + slotProps={{ + textField: { + size: "small", + placeholder: "تاریخ و ساعت پایان گشت", + InputProps: { + endAdornment: ( + + { + event.stopPropagation(); + setDateTo(null); + }} + sx={{ + color: "#bfbfbf", + "&:hover": { + backgroundColor: "rgba(189, 189, 189, 0.1)", + color: "#363434", + }, + }} + > + + + + ), + }, + }, + }} label="تاریخ و ساعت پایان گشت"/> + + + - + - - - - + {patrolFounded && + + + + + }/> + + + {data.machine_code} + + + + }/> + + + {data.time} + + + + }/> + + + {data.distance} + + + + }/> + + + {data.stop} + + + + }/> + + + {data.fuel_amount} + + + + + + + + + + + + + + + } + + + + ); }; diff --git a/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolForms.jsx b/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolForms.jsx index 4d51f65..da6690e 100644 --- a/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolForms.jsx +++ b/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolForms.jsx @@ -24,7 +24,7 @@ function TabPanel(props) { const PatrolForms = () => { const theme = useTheme(); - const isMobile = useMediaQuery(theme.breakpoints.down("sm")); + const isMobile = useMediaQuery(theme.breakpoints.down("md")); const [tabState, setTabState] = useState(0); const handleChangeTab = (event, newValue) => { @@ -71,7 +71,7 @@ const PatrolForms = () => { {!isMobile && ( - + )} diff --git a/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolTimeLine.jsx b/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolTimeLine.jsx index 5343e33..ba33a31 100644 --- a/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolTimeLine.jsx +++ b/src/components/dashboard/roadPatrols/operator/Forms/CreatePatrol/PatrolTimeLine.jsx @@ -1,6 +1,6 @@ "use client"; -import {Box, Typography} from "@mui/material"; +import {Box, CircularProgress, Typography} from "@mui/material"; import TapAndPlayIcon from '@mui/icons-material/TapAndPlay'; import TaxiAlertIcon from '@mui/icons-material/TaxiAlert'; import EngineeringIcon from '@mui/icons-material/Engineering'; @@ -17,6 +17,8 @@ import { } from "@mui/lab"; const PatrolTimeLine = ({tabState}) => { + + console.log("tabState", tabState) return ( { - : 0 ? "success" : "error"} sx={{width: "1.5rem", height: "1.5rem"}} - /> + />} @@ -47,10 +49,10 @@ const PatrolTimeLine = ({tabState}) => { - : 1 ? "success" : "error"} sx={{width: "1.5rem", height: "1.5rem"}} - /> + />} @@ -65,10 +67,10 @@ const PatrolTimeLine = ({tabState}) => { - : 2 ? "success" : "error"} sx={{width: "1.5rem", height: "1.5rem"}} - /> + />} @@ -83,10 +85,10 @@ const PatrolTimeLine = ({tabState}) => { - : 3 ? "success" : "error"} sx={{width: "1.5rem", height: "1.5rem"}} - /> + />} @@ -101,10 +103,10 @@ const PatrolTimeLine = ({tabState}) => { - : 4 ? "success" : "error"} sx={{width: "1.5rem", height: "1.5rem"}} - /> + />} diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js index 9548f91..09719e6 100644 --- a/src/core/utils/routes.js +++ b/src/core/utils/routes.js @@ -33,6 +33,8 @@ export const GET_ROAD_PATROL_OPERATOR_LIST = "/v3/api/fake-road-patrol/operator" export const EXPORT_ROAD_PATROL_OPERATOR_LIST = "https://rms.rmto.ir/v2/road_patrols/operator/cartable/report"; export const GET_ROAD_PATROL_SUPERVISOR_LIST = "/v3/api/fake-road-patrol/supervisor"; export const EXPORT_ROAD_PATROL_SUPERVISOR_LIST = "https://rms.rmto.ir/v2/road_patrols/supervisor/cartable/report"; +export const GET_OTP_TOKEN = "fake/api"; +export const VERIFY_OTP = "fake/api"; // road items export const GET_ROAD_ITEMS_SUPERVISOR_LIST = api + "/api/v3/road_items/supervisor_index"; @@ -48,4 +50,4 @@ export const REJECT_BY_SUPERVISOR = api + "/api/v3/road_items/verify_by_supervis export const DELETE_BY_SUPERVISOR = api + "/api/v3/road_items/delete"; export const RESTORE_BY_SUPERVISOR = api + "/api/v3/road_items/restore"; export const GET_CAR_LIST_SEARCH = api + "/api/v3/cmms_machines/search"; -export const GET_RAHDARANS_LIST_SEARCH = api + "/api/v3/rahdaran/search"; +export const GET_RAHDARANS_LIST_SEARCH = api + "/api/v3/rahdaran/search"; \ No newline at end of file