4 Commits

Author SHA1 Message Date
b0a0facea8 release v1.8.8 2026-05-23 11:00:40 +03:30
58fc9135ac Merge pull request 'added end_km, fixed time picker & typos' (#1) from feature/road_missions_changes into develop
Reviewed-on: #1
2026-05-23 07:25:47 +00:00
3a28da9b39 build & format 2026-05-23 10:55:02 +03:30
80da9a1e40 added end_km, fixed time picker & typos
- road missions table
2026-05-23 10:46:17 +03:30
13 changed files with 145 additions and 163 deletions

View File

@@ -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.7" NEXT_PUBLIC_VERSION="1.8.8"
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"

View File

@@ -1,18 +0,0 @@
<svg width="20" height="23" viewBox="0 0 20 23" fill="none" xmlns="http://www.w3.org/2000/svg">
<foreignObject x="-63" y="-64" width="146" height="149"><div xmlns="http://www.w3.org/1999/xhtml" style="backdrop-filter:blur(32.5px);clip-path:url(#bgblur_0_2302_1310_clip_path);height:100%;width:100%"></div></foreignObject><g filter="url(#filter0_d_2302_1310)" data-figma-bg-blur-radius="65">
<path d="M9.38305 1.02444C15.543 0.551472 19.9197 7.03396 17.1518 12.6025C15.8547 15.2112 13.6759 15.7958 11.9558 17.881C11.6271 18.2796 10.7507 19.7126 10.4472 19.8829C9.98265 20.1439 9.56634 19.9365 9.25987 19.5758C8.76416 18.992 8.37012 18.2543 7.83732 17.6549C6.56763 16.2249 4.84751 15.4187 3.69508 13.9418C-0.231962 8.90724 3.07767 1.50856 9.38305 1.02444ZM9.55002 5.15175C6.61587 5.45517 5.13915 8.92434 6.86743 11.3212C8.38571 13.4272 11.6293 13.425 13.1468 11.3212C15.1415 8.554 12.925 4.80298 9.55076 5.15175H9.55002Z" fill="#EF4444"/>
</g>
<defs>
<filter id="filter0_d_2302_1310" x="-63" y="-64" width="146" height="149" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.235294 0 0 0 0 0.25098 0 0 0 0 0.262745 0 0 0 0.3 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2302_1310"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2302_1310" result="shape"/>
</filter>
<clipPath id="bgblur_0_2302_1310_clip_path" transform="translate(63 64)"><path d="M9.38305 1.02444C15.543 0.551472 19.9197 7.03396 17.1518 12.6025C15.8547 15.2112 13.6759 15.7958 11.9558 17.881C11.6271 18.2796 10.7507 19.7126 10.4472 19.8829C9.98265 20.1439 9.56634 19.9365 9.25987 19.5758C8.76416 18.992 8.37012 18.2543 7.83732 17.6549C6.56763 16.2249 4.84751 15.4187 3.69508 13.9418C-0.231962 8.90724 3.07767 1.50856 9.38305 1.02444ZM9.55002 5.15175C6.61587 5.45517 5.13915 8.92434 6.86743 11.3212C8.38571 13.4272 11.6293 13.425 13.1468 11.3212C15.1415 8.554 12.925 4.80298 9.55076 5.15175H9.55002Z"/>
</clipPath></defs>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,18 +0,0 @@
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
<foreignObject x="-42.6271" y="-43.6271" width="105.045" height="105.045"><div xmlns="http://www.w3.org/1999/xhtml" style="backdrop-filter:blur(22.31px);clip-path:url(#bgblur_0_2302_1307_clip_path);height:100%;width:100%"></div></foreignObject><g filter="url(#filter0_d_2302_1307)" data-figma-bg-blur-radius="44.6271">
<path d="M10.3018 1.00977C14.4733 1.22136 17.7908 4.67141 17.791 8.89551C17.7908 13.2559 14.2559 16.7908 9.89551 16.791C5.67141 16.7908 2.22136 13.4733 2.00977 9.30176L2 8.89551L2.00977 8.48926C2.22119 4.31755 5.6713 1.00017 9.89551 1L10.3018 1.00977ZM9.89551 5.80566C8.18945 5.80584 6.80584 7.18945 6.80566 8.89551L6.80957 9.05371C6.89208 10.6863 8.2425 11.9842 9.89551 11.9844C11.5485 11.9842 12.898 10.6863 12.9805 9.05371L12.9844 8.89551L12.9805 8.73633C12.9003 7.1565 11.6336 5.88942 10.0537 5.80957L9.89551 5.80566Z" fill="#16A795"/>
</g>
<defs>
<filter id="filter0_d_2302_1307" x="-42.6271" y="-43.6271" width="105.045" height="105.045" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="0.686571"/>
<feGaussianBlur stdDeviation="0.686571"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.235294 0 0 0 0 0.25098 0 0 0 0 0.262745 0 0 0 0.3 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2302_1307"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2302_1307" result="shape"/>
</filter>
<clipPath id="bgblur_0_2302_1307_clip_path" transform="translate(42.6271 43.6271)"><path d="M10.3018 1.00977C14.4733 1.22136 17.7908 4.67141 17.791 8.89551C17.7908 13.2559 14.2559 16.7908 9.89551 16.791C5.67141 16.7908 2.22136 13.4733 2.00977 9.30176L2 8.89551L2.00977 8.48926C2.22119 4.31755 5.6713 1.00017 9.89551 1L10.3018 1.00977ZM9.89551 5.80566C8.18945 5.80584 6.80584 7.18945 6.80566 8.89551L6.80957 9.05371C6.89208 10.6863 8.2425 11.9842 9.89551 11.9844C11.5485 11.9842 12.898 10.6863 12.9805 9.05371L12.9844 8.89551L12.9805 8.73633C12.9003 7.1565 11.6336 5.88942 10.0537 5.80957L9.89551 5.80566Z"/>
</clipPath></defs>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -14,6 +14,7 @@ import useCities from "@/lib/hooks/useCities";
const ControlList = () => { const ControlList = () => {
const columns = useMemo(() => { const columns = useMemo(() => {
const dynamicColumns = { const dynamicColumns = {
accessorKey: "province_id",
header: "استان", header: "استان",
id: "province_id", id: "province_id",
enableColumnFilter: true, enableColumnFilter: true,

View File

@@ -1,3 +1,4 @@
import LtrTextField from "@/core/components/LtrTextField";
import MuiDatePicker from "@/core/components/MuiDatePicker"; import MuiDatePicker from "@/core/components/MuiDatePicker";
import MuiTimePicker from "@/core/components/MuiTimePicker"; import MuiTimePicker from "@/core/components/MuiTimePicker";
import { FINISH_MISSION } from "@/core/utils/routes"; import { FINISH_MISSION } from "@/core/utils/routes";
@@ -14,6 +15,7 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
const requestServer = useRequest({ notificationSuccess: true }); const requestServer = useRequest({ notificationSuccess: true });
const validationSchema = object().shape({ const validationSchema = object().shape({
end_km: string().required("لطفاً کیلومتر را وارد کنید."),
start_date: mixed().required("تاریخ خروج خودرو را مشخص کنید."), start_date: mixed().required("تاریخ خروج خودرو را مشخص کنید."),
start_time: mixed().required("ساعت خروج خودرو را مشخص کنید."), start_time: mixed().required("ساعت خروج خودرو را مشخص کنید."),
}); });
@@ -24,6 +26,7 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
formState: { isSubmitting }, formState: { isSubmitting },
} = useForm({ } = useForm({
defaultValues: { defaultValues: {
end_km: "",
start_date: null, start_date: null,
start_time: null, start_time: null,
}, },
@@ -36,6 +39,7 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
const formattedTime = format(values.start_time, "HH:mm"); const formattedTime = format(values.start_time, "HH:mm");
requestServer(`${FINISH_MISSION}/${rowId}`, "post", { requestServer(`${FINISH_MISSION}/${rowId}`, "post", {
data: { data: {
end_km: values.end_km,
time: `${formattedDate} ${formattedTime}`, time: `${formattedDate} ${formattedTime}`,
}, },
hasSidebarUpdate: true, hasSidebarUpdate: true,
@@ -55,6 +59,27 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
<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={"end_km"}
render={({ field, fieldState: { error } }) => (
<LtrTextField
autoComplete="off"
type="tel"
value={field.value}
onChange={(e) => {
if (isNaN(Number(e.target.value))) return;
field.onChange(e.target.value);
}}
size="small"
fullWidth
label="کیلومتر خودرو / ساعت کار"
InputLabelProps={{ shrink: true }}
/>
)}
/>
</Stack>
<Stack> <Stack>
<Controller <Controller
control={control} control={control}
@@ -65,8 +90,8 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
error={error} error={error}
value={field.value || null} value={field.value || null}
disableFuture={false} disableFuture={false}
placeholder={"تاریخ شروع ماموریت را وارد کنید"} placeholder={"تاریخ پایان ماموریت را وارد کنید"}
label={"تاریخ شروع ماموریت"} label={"تاریخ پایان ماموریت"}
setFieldValue={(name, value) => field.onChange(value || null)} setFieldValue={(name, value) => field.onChange(value || null)}
helperText={error ? error.message : null} helperText={error ? error.message : null}
/> />
@@ -83,8 +108,8 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
error={error} error={error}
value={field.value || null} value={field.value || null}
views={["hours", "minutes"]} views={["hours", "minutes"]}
placeholder={"زمان شروع ماموریت را وارد کنید"} placeholder={"زمان پایان ماموریت را وارد کنید"}
label={"زمان شروع ماموریت"} label={"زمان پایان ماموریت"}
setFieldValue={(name, value) => field.onChange(value || null)} setFieldValue={(name, value) => field.onChange(value || null)}
helperText={error ? error.message : null} helperText={error ? error.message : null}
/> />

View File

@@ -1,113 +1,116 @@
"use client"; import { Delete, Route } from "@mui/icons-material";
import { Box, Button, Stack, Typography } from "@mui/material";
import { useReducer } from "react";
import DrawBound from "./DrawBound";
import { useEffect, useState } from "react"; const statusType = [
import { Marker, Polyline, useMap } from "react-leaflet"; {
import L from "leaflet"; id: 0,
message: "برای آغاز ترسیم مسیر، کلیک کنید!",
buttons: [
{
label: "شروع ترسیم مسیر",
key: "start",
color: "primary",
icon: <Route />,
onclick: (controlDispach) => {
controlDispach({ type: "SET_STATUS", status: 1 });
},
},
],
},
{
id: 1,
message: "مسیر موردنظر را با کلیک روی نقشه مشخص کنید. برای اتمام، روی نقطه‌ی پایانی کلیک کنید!",
buttons: [],
},
{
id: 2,
message: "برای اصلاح مسیر، گوشه‌ها را بکشید. برای ترسیم دوباره، آن را حذف کنید",
buttons: [
{
label: "حذف",
key: "end",
color: "error",
icon: <Delete />,
onclick: (controlDispach) => {
controlDispach({ type: "SET_STATUS", status: 0 });
},
},
],
},
];
// ===== Icons ===== const createInitialState = (bound) => {
const originIcon = new L.Icon({ if (bound) {
iconUrl: "/icons/origin-marker.png", return { status: 2 };
iconSize: [32, 32], }
iconAnchor: [16, 32], return { status: 0 };
}); };
const destinationIcon = new L.Icon({ const reducer = (state, action) => {
iconUrl: "/icons/destination-marker.png", switch (action.type) {
iconSize: [32, 32], case "SET_STATUS":
iconAnchor: [16, 32], return { ...state, status: action.status };
}); default:
return state;
}
};
// ===== Track Center ===== const MapControlPolyline = ({ bound, setBound }) => {
function MapCenterTracker({ setCenter }) { const [control, controlDispach] = useReducer(reducer, bound, createInitialState);
const map = useMap();
useEffect(() => {
const updateCenter = () => {
setCenter(map.getCenter());
};
updateCenter();
map.on("move", updateCenter);
return () => {
map.off("move", updateCenter);
};
}, [map, setCenter]);
return null;
}
// ===== Fixed Center Marker =====
function FixedCenterMarker() {
return (
<div
style={{
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -100%)",
zIndex: 1000,
pointerEvents: "none",
}}
>
<img src="/icons/pin-center.png" width={40} height={40} alt="center" />
</div>
);
}
export default function Example() {
const [center, setCenter] = useState(null);
const [origin, setOrigin] = useState(null);
const [destination, setDestination] = useState(null);
const [step, setStep] = useState("origin");
const handleOk = () => {
if (!center) return;
if (step === "origin") {
setOrigin(center);
setStep("destination");
return;
}
if (step === "destination") {
setDestination(center);
setStep("done");
}
};
return ( return (
<div> <>
<div <DrawBound bound={bound} setBound={setBound} control={control} controlDispach={controlDispach} />
style={{ <Stack
position: "relative", direction={"row"}
height: "400px", justifyContent={"center"}
sx={{ position: "absolute", left: 0, top: 0, zIndex: 2000, width: "100%" }}
>
<Box
sx={{
background: (theme) => theme.palette.info.main,
borderBottomLeftRadius: 8,
borderBottomRightRadius: 8,
py: 0.5,
px: 2,
}}
>
<Typography align="center" component={"div"} variant="caption" color={"#fff"}>
{statusType.find((st) => st.id == control.status).message}
</Typography>
</Box>
</Stack>
<Box
sx={{
position: "absolute",
left: 0,
bottom: 0,
zIndex: 2000,
width: "100%",
py: 1,
background: "linear-gradient(to top, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0))",
}} }}
> >
<MapCenterTracker setCenter={setCenter} /> <Stack direction={"row"} justifyContent={"center"} spacing={2}>
{statusType
{/* saved markers */} .find((st) => st.id == control.status)
{origin && <Marker position={origin} icon={originIcon} />} .buttons.map((button) => (
<Button
{destination && <Marker position={destination} icon={destinationIcon} />} size="small"
key={button.key}
{/* route line */} variant="contained"
{origin && destination && <Polyline positions={[origin, destination]} />} onClick={() => button.onclick(controlDispach)}
color={button.color}
{/* fixed center pin */} startIcon={button.icon}
{step !== "done" && <FixedCenterMarker />} >
</div> {button.label}
</Button>
<div style={{ marginTop: 16, position: "absolute", z : 50, top : 5 }}> ))}
<button onClick={handleOk}> </Stack>
{step === "origin" && "Set Origin"} </Box>
{step === "destination" && "Set Destination"} </>
{step === "done" && "Completed"}
</button>
</div>
</div>
); );
} };
export default MapControlPolyline;

View File

@@ -3,7 +3,6 @@ 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 MapControlPolyline from "./MapControlPolyline"; import MapControlPolyline from "./MapControlPolyline";
import Example from "./MapControlPolyline";
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), { const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
loading: () => <MapLoading />, loading: () => <MapLoading />,
ssr: false, ssr: false,
@@ -23,7 +22,7 @@ const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
<Stack spacing={2}> <Stack spacing={2}>
<Box sx={{ width: "100%", height: "400px" }}> <Box sx={{ width: "100%", height: "400px" }}>
<MapLayer style={{ borderRadius: "4px" }}> <MapLayer style={{ borderRadius: "4px" }}>
<Example /> <MapControlPolyline bound={bound} setBound={setBound} boundType={"polyline"} />
</MapLayer> </MapLayer>
</Box> </Box>
</Stack> </Stack>

View File

@@ -51,7 +51,6 @@ const MissionDates = ({ control }) => {
name="start_time" name="start_time"
error={error} error={error}
value={field.value} value={field.value}
views={["hours"]}
minTime={ minTime={
start_date && new Date(start_date).toDateString() === now.toDateString() start_date && new Date(start_date).toDateString() === now.toDateString()
? now ? now
@@ -100,7 +99,6 @@ const MissionDates = ({ control }) => {
name="end_time" name="end_time"
error={error} error={error}
value={field.value} value={field.value}
views={["hours"]}
minTime={startDateTime ?? null} minTime={startDateTime ?? null}
placeholder={"زمان پایان ماموریت را وارد کنید"} placeholder={"زمان پایان ماموریت را وارد کنید"}
label={"زمان پایان ماموریت"} label={"زمان پایان ماموریت"}

View File

@@ -24,7 +24,7 @@ const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
<Stack spacing={2}> <Stack spacing={2}>
<Box sx={{ width: "100%", height: "400px" }}> <Box sx={{ width: "100%", height: "400px" }}>
<MapLayer style={{ borderRadius: "4px" }}> <MapLayer style={{ borderRadius: "4px" }}>
<MapControlPolygon bound={bound} setBound={setBound} boundType={"polyline"} /> <MapControlPolygon bound={bound} setBound={setBound} boundType={"polyline"} />
</MapLayer> </MapLayer>
</Box> </Box>
</Stack> </Stack>

View File

@@ -15,7 +15,7 @@ const ToDateController = ({ control }) => {
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");

View File

@@ -5,10 +5,7 @@ const SearchReportList = ({ handleSubmit, onSearchSubmit, control, hasProvincesP
return ( return (
<> <>
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}> <StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
<SearchReportField <SearchReportField control={control} hasProvincesPermission={hasProvincesPermission} />
control={control}
hasProvincesPermission={hasProvincesPermission}
/>
</StyledForm> </StyledForm>
</> </>
); );

View File

@@ -5,10 +5,7 @@ const SearchReportList = ({ handleSubmit, onSearchSubmit, control, hasProvincesP
return ( return (
<> <>
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}> <StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
<SearchReportField <SearchReportField control={control} hasProvincesPermission={hasProvincesPermission} />
control={control}
hasProvincesPermission={hasProvincesPermission}
/>
</StyledForm> </StyledForm>
</> </>
); );

View File

@@ -47,10 +47,8 @@ export const GET_COUNTRY_ACTIVITY_REPORT = api + "/api/v3/missions/report/countr
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 = export const GET_MISSIONS_REPORT_TARADOD_COUNTRY_ACTIVITY = api + "/api/v3/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 GET_MISSIONS_REPORT_TARADOD_PROVINCE_ACTIVITY =
api + "/api/v3/missions/report_taradod/province_activity";
export const EXPORT_MISSIONS_REPORT_TARADOD_COUNTRY_EXCEL_ACTIVITY = export const EXPORT_MISSIONS_REPORT_TARADOD_COUNTRY_EXCEL_ACTIVITY =
api + "/api/v3/missions/report_taradod/country_excel_activity"; api + "/api/v3/missions/report_taradod/country_excel_activity";
export const EXPORT_MISSIONS_REPORT_TARADOD_PROVINCE_EXCEL_ACTIVITY = export const EXPORT_MISSIONS_REPORT_TARADOD_PROVINCE_EXCEL_ACTIVITY =