fixed bug
This commit is contained in:
@@ -7,9 +7,10 @@ import { GET_ROAD_PATROL_OPERATOR_LIST } from "@/core/utils/routes";
|
|||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
import RowActions from "./RowActions";
|
import RowActions from "./RowActions";
|
||||||
import ReportForm from "./RowActions/ReportForm";
|
import ReportForm from "./RowActions/ReportForm";
|
||||||
import RahdaranDialog from "./RowActions/RahdaranForm";
|
import RahdaranDialog from "./RowActions/RahdaranForm"
|
||||||
import MachinePerformanceForm from "./RowActions/MachinePerformanceForm";
|
import MachinePerformanceForm from "./RowActions/MachinePerformanceForm";
|
||||||
|
|
||||||
|
|
||||||
const OperatorList = () => {
|
const OperatorList = () => {
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { Box, Chip, DialogContent, Divider, Grid, Stack, Typography } from "@mui
|
|||||||
import React, { useEffect, useState, useRef } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import { Marker, useMap } from "react-leaflet";
|
import { Marker, useMap } from "react-leaflet";
|
||||||
import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png";
|
import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png";
|
||||||
import StopsInfo from "@/components/dashboard/roadPatrols/operator/RowActions/MachinePerformanceForm/StopsInfo";
|
|
||||||
import MapLayer from "@/core/components/MapLayer";
|
import MapLayer from "@/core/components/MapLayer";
|
||||||
import PinDropIcon from "@mui/icons-material/PinDrop";
|
import PinDropIcon from "@mui/icons-material/PinDrop";
|
||||||
import AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
import AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
||||||
import { formatSecondsToHHMMSS } from "@/core/utils/formatSecondsToHHMMSS";
|
import { formatSecondsToHHMMSS } from "@/core/utils/formatSecondsToHHMMSS";
|
||||||
|
import StopsInfo from "./StopsInfo";
|
||||||
const defaultIconSize = [35, 35];
|
const defaultIconSize = [35, 35];
|
||||||
const MachinePerformanceContent = ({ machinesLists }) => {
|
const MachinePerformanceContent = ({ machinesLists }) => {
|
||||||
const [selectedPoint, setSelectedPoint] = useState(null);
|
const [selectedPoint, setSelectedPoint] = useState(null);
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
|
import { GET_CMMS_MACHINE_ROAD_PATROL } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { DialogContent, Typography } from "@mui/material";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import MachinePerformanceContent from "./MachinePerformanceContent";
|
||||||
|
|
||||||
|
const MachinePerformanceFetch = ({ row }) => {
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [data, setData] = useState(null);
|
||||||
|
const request = useRequest();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await request(`${GET_CMMS_MACHINE_ROAD_PATROL}/${row.getValue('id')}`);
|
||||||
|
setData(response.data.data);
|
||||||
|
} catch (error) {
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DialogContent>
|
||||||
|
{loading ? (
|
||||||
|
<DialogLoading />
|
||||||
|
) : data && row.original?.stop_points?.length > 0 ? (
|
||||||
|
<MachinePerformanceContent machinesLists={{
|
||||||
|
stopPoints: row.original?.stop_points,
|
||||||
|
fuelConsumption: row.original?.fuel_consumption,
|
||||||
|
mileage: row.original?.distance,
|
||||||
|
accOnDuration: row.original?.vehicle_runtime,
|
||||||
|
cmms_machine_code: data[0]
|
||||||
|
|
||||||
|
}} />
|
||||||
|
) : (
|
||||||
|
<Typography textAlign={"center"}>عملکرد خودرویی در سامانه یافت نشد</Typography>
|
||||||
|
)}
|
||||||
|
</DialogContent>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default MachinePerformanceFetch
|
||||||
@@ -1,18 +1,10 @@
|
|||||||
import { Button, Dialog, DialogActions, DialogTitle, IconButton, Tooltip, Typography } from "@mui/material";
|
|
||||||
import DirectionsCarIcon from "@mui/icons-material/DirectionsCar";
|
import DirectionsCarIcon from "@mui/icons-material/DirectionsCar";
|
||||||
import MachinePerformanceContent from "./MachinePerformanceContent";
|
import { Button, Dialog, DialogActions, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import MachinePerformanceFetch from "./MachinesCodeFetch";
|
||||||
|
|
||||||
const MachinePerformanceForm = ({ row }) => {
|
const MachinePerformanceForm = ({ row }) => {
|
||||||
const [openMachinesCodeDialog, setOpenMachinesCodeDialog] = useState(false);
|
const [openMachinesCodeDialog, setOpenMachinesCodeDialog] = useState(false);
|
||||||
const machineData = {
|
|
||||||
cmms_machine_code: row.original?.cmms_machines[0],
|
|
||||||
resultCode: 0,
|
|
||||||
mileage: row.original?.distance,
|
|
||||||
accOnDuration: row.original?.vehicle_runtime,
|
|
||||||
fuelConsumption: row.original?.fuel_consumption,
|
|
||||||
stopPoints: row.original?.stop_points,
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="عملکرد خودرو">
|
<Tooltip title="عملکرد خودرو">
|
||||||
@@ -33,10 +25,8 @@ const MachinePerformanceForm = ({ row }) => {
|
|||||||
maxWidth={"md"}
|
maxWidth={"md"}
|
||||||
>
|
>
|
||||||
<DialogTitle sx={{ fontSize: "large" }}>عملکرد خودرو</DialogTitle>
|
<DialogTitle sx={{ fontSize: "large" }}>عملکرد خودرو</DialogTitle>
|
||||||
{row.original?.stop_points ? (
|
{openMachinesCodeDialog && (
|
||||||
<MachinePerformanceContent machinesLists={machineData} />
|
<MachinePerformanceFetch row={row} />
|
||||||
) : (
|
|
||||||
<Typography textAlign={"center"}>عملکردی در سامانه ثبت نشده است.</Typography>
|
|
||||||
)}
|
)}
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { Box, Chip, DialogContent, Divider, Grid, Stack, Typography } from "@mui
|
|||||||
import React, { useEffect, useState, useRef } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import { Marker, useMap } from "react-leaflet";
|
import { Marker, useMap } from "react-leaflet";
|
||||||
import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png";
|
import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png";
|
||||||
import StopsInfo from "@/components/dashboard/roadPatrols/operator/RowActions/MachinePerformanceForm/StopsInfo";
|
|
||||||
import MapLayer from "@/core/components/MapLayer";
|
import MapLayer from "@/core/components/MapLayer";
|
||||||
import PinDropIcon from "@mui/icons-material/PinDrop";
|
import PinDropIcon from "@mui/icons-material/PinDrop";
|
||||||
import AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
import AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
||||||
import { formatSecondsToHHMMSS } from "@/core/utils/formatSecondsToHHMMSS";
|
import { formatSecondsToHHMMSS } from "@/core/utils/formatSecondsToHHMMSS";
|
||||||
|
import StopsInfo from "./StopsInfo";
|
||||||
const defaultIconSize = [35, 35];
|
const defaultIconSize = [35, 35];
|
||||||
const MachinePerformanceContent = ({ machinesLists }) => {
|
const MachinePerformanceContent = ({ machinesLists }) => {
|
||||||
const [selectedPoint, setSelectedPoint] = useState(null);
|
const [selectedPoint, setSelectedPoint] = useState(null);
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
|
import { GET_CMMS_MACHINE_ROAD_PATROL } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { DialogContent, Typography } from "@mui/material";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import MachinePerformanceContent from "./MachinePerformanceContent";
|
||||||
|
|
||||||
|
const MachinePerformanceFetch = ({ row }) => {
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [data, setData] = useState(null);
|
||||||
|
const request = useRequest();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await request(`${GET_CMMS_MACHINE_ROAD_PATROL}/${row.getValue('id')}`);
|
||||||
|
setData(response.data.data);
|
||||||
|
} catch (error) {
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DialogContent>
|
||||||
|
{loading ? (
|
||||||
|
<DialogLoading />
|
||||||
|
) : data && row.original?.stop_points?.length > 0 ? (
|
||||||
|
<MachinePerformanceContent machinesLists={{
|
||||||
|
stopPoints: row.original?.stop_points,
|
||||||
|
fuelConsumption: row.original?.fuel_consumption,
|
||||||
|
mileage: row.original?.distance,
|
||||||
|
accOnDuration: row.original?.vehicle_runtime,
|
||||||
|
cmms_machine_code: data[0]
|
||||||
|
|
||||||
|
}} />
|
||||||
|
) : (
|
||||||
|
<Typography textAlign={"center"}>عملکرد خودرویی در سامانه یافت نشد</Typography>
|
||||||
|
)}
|
||||||
|
</DialogContent>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default MachinePerformanceFetch
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Box, Chip, Divider, Grid, Typography } from "@mui/material";
|
import { Box, Chip, Divider, Grid, Typography } from "@mui/material";
|
||||||
import AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
import AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
||||||
import PinDropIcon from "@mui/icons-material/PinDrop";
|
|
||||||
import LocalGasStationIcon from "@mui/icons-material/LocalGasStation";
|
import LocalGasStationIcon from "@mui/icons-material/LocalGasStation";
|
||||||
import QrCode2Icon from "@mui/icons-material/QrCode2";
|
import QrCode2Icon from "@mui/icons-material/QrCode2";
|
||||||
import AddRoadIcon from "@mui/icons-material/AddRoad";
|
import AddRoadIcon from "@mui/icons-material/AddRoad";
|
||||||
@@ -9,9 +9,14 @@ import BadgeIcon from "@mui/icons-material/Badge";
|
|||||||
import { formatSecondsToHHMMSS } from "@/core/utils/formatSecondsToHHMMSS";
|
import { formatSecondsToHHMMSS } from "@/core/utils/formatSecondsToHHMMSS";
|
||||||
import ShowPlak from "@/core/components/ShowPlak";
|
import ShowPlak from "@/core/components/ShowPlak";
|
||||||
|
|
||||||
const StopsInfo = ({ selectedPoint, staticData }) => {
|
const StopsInfo = ({ staticData }) => {
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={3} direction="row" sx={{ justifyContent: "space-between", alignItems: "center" }}>
|
<Grid
|
||||||
|
container
|
||||||
|
spacing={3}
|
||||||
|
direction="row"
|
||||||
|
sx={{ flex: 1, justifyContent: "space-between", alignItems: "center" }}
|
||||||
|
>
|
||||||
<Grid item xs={12} sm={12} sx={{ display: "flex", alignItems: "center" }}>
|
<Grid item xs={12} sm={12} sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Chip
|
<Chip
|
||||||
@@ -109,56 +114,6 @@ const StopsInfo = ({ selectedPoint, staticData }) => {
|
|||||||
{formatSecondsToHHMMSS(staticData?.accOnDuration)}
|
{formatSecondsToHHMMSS(staticData?.accOnDuration)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={12} sx={{ display: "flex", alignItems: "center" }}>
|
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
||||||
<Chip
|
|
||||||
icon={<PinDropIcon />}
|
|
||||||
label={
|
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
|
||||||
طول جغرافیایی
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Divider sx={{ flex: 1, mx: 2 }} />
|
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
|
||||||
{selectedPoint ? selectedPoint.longitude : "نقطه مورد نظر را انتخاب کنید"}
|
|
||||||
</Typography>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} sm={12} sx={{ display: "flex", alignItems: "center" }}>
|
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
||||||
<Chip
|
|
||||||
icon={<PinDropIcon />}
|
|
||||||
label={
|
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
|
||||||
عرض جغرافیایی
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Divider sx={{ flex: 1, mx: 2 }} />
|
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
|
||||||
{selectedPoint ? selectedPoint.latitude : "نقطه مورد نظر را انتخاب کنید"}
|
|
||||||
</Typography>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} sm={12} sx={{ display: "flex", alignItems: "center" }}>
|
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
||||||
<Chip
|
|
||||||
icon={<AccessAlarmsIcon />}
|
|
||||||
label={
|
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
|
||||||
مدت زمان توقف
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Divider sx={{ flex: 1, mx: 2 }} />
|
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
|
||||||
{selectedPoint
|
|
||||||
? `${formatSecondsToHHMMSS(selectedPoint.duration)} ثانیه`
|
|
||||||
: "نقطه مورد نظر را انتخاب کنید"}
|
|
||||||
</Typography>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
import { Button, Dialog, DialogActions, DialogTitle, IconButton, Tooltip, Typography } from "@mui/material";
|
|
||||||
import DirectionsCarIcon from "@mui/icons-material/DirectionsCar";
|
import DirectionsCarIcon from "@mui/icons-material/DirectionsCar";
|
||||||
import MachinePerformanceContent from "./MachinePerformanceContent";
|
import { Button, Dialog, DialogActions, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import MachinePerformanceFetch from "./MachinesCodeFetch";
|
||||||
|
|
||||||
const MachinePerformanceForm = ({ row }) => {
|
const MachinePerformanceForm = ({ row }) => {
|
||||||
const [openMachinesCodeDialog, setOpenMachinesCodeDialog] = useState(false);
|
const [openMachinesCodeDialog, setOpenMachinesCodeDialog] = useState(false);
|
||||||
const machineData = {
|
|
||||||
cmms_machine_code: row.original?.cmms_machines[0],
|
|
||||||
resultCode: 0,
|
|
||||||
mileage: row.original?.distance,
|
|
||||||
accOnDuration: row.original?.vehicle_runtime,
|
|
||||||
fuelConsumption: row.original?.fuel_consumption,
|
|
||||||
stopPoints: row.original?.stop_points,
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="عملکرد خودرو">
|
<Tooltip title="عملکرد خودرو">
|
||||||
@@ -33,10 +25,8 @@ const MachinePerformanceForm = ({ row }) => {
|
|||||||
maxWidth={"md"}
|
maxWidth={"md"}
|
||||||
>
|
>
|
||||||
<DialogTitle sx={{ fontSize: "large" }}>عملکرد خودرو</DialogTitle>
|
<DialogTitle sx={{ fontSize: "large" }}>عملکرد خودرو</DialogTitle>
|
||||||
{row.original?.stop_points ? (
|
{openMachinesCodeDialog && (
|
||||||
<MachinePerformanceContent machinesLists={machineData} />
|
<MachinePerformanceFetch row={row} />
|
||||||
) : (
|
|
||||||
<Typography textAlign={"center"}>عملکردی در سامانه ثبت نشده است.</Typography>
|
|
||||||
)}
|
)}
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import useEdaratLists from "@/lib/hooks/useEdaratLists";
|
|||||||
import OfficerDescriptionForm from "./RowActions/OfficerDescription";
|
import OfficerDescriptionForm from "./RowActions/OfficerDescription";
|
||||||
import ReportForm from "./RowActions/ReportForm";
|
import ReportForm from "./RowActions/ReportForm";
|
||||||
import RahdaranDialog from "./RowActions/RahdaranForm";
|
import RahdaranDialog from "./RowActions/RahdaranForm";
|
||||||
import MachinePerformanceForm from "./RowActions/MachinePerformanceForm";
|
|
||||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||||
import { useAuth } from "@/lib/contexts/auth";
|
import { useAuth } from "@/lib/contexts/auth";
|
||||||
|
import MachinePerformanceForm from "./RowActions/MachinePerformanceForm";
|
||||||
|
|
||||||
const SupervisorList = () => {
|
const SupervisorList = () => {
|
||||||
const { data: userPermissions } = usePermissions();
|
const { data: userPermissions } = usePermissions();
|
||||||
@@ -119,8 +119,8 @@ const SupervisorList = () => {
|
|||||||
props.dependencyFieldValue?.value === ""
|
props.dependencyFieldValue?.value === ""
|
||||||
? "empty"
|
? "empty"
|
||||||
: loadingEdaratList
|
: loadingEdaratList
|
||||||
? "loading"
|
? "loading"
|
||||||
: props.filterParameters.value
|
: props.filterParameters.value
|
||||||
}
|
}
|
||||||
columnSelectOption={getColumnSelectOptions}
|
columnSelectOption={getColumnSelectOptions}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ export const EXPORT_ROAD_PATROL_SUPERVISOR_LIST = api + "/api/v3/road_patrols/su
|
|||||||
export const EXPORT_PROVINCE_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrol_reports/province_activity_excel";
|
export const EXPORT_PROVINCE_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrol_reports/province_activity_excel";
|
||||||
export const EXPORT_COUNTRY_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrol_reports/country_activity_excel";
|
export const EXPORT_COUNTRY_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrol_reports/country_activity_excel";
|
||||||
export const DELETE_ROAD_PATROL_SUPERVISOR = api + "/api/v3/road_patrols/delete";
|
export const DELETE_ROAD_PATROL_SUPERVISOR = api + "/api/v3/road_patrols/delete";
|
||||||
|
export const GET_CMMS_MACHINE_ROAD_PATROL = api + "/api/v3/road_patrols/machines";
|
||||||
export const GET_ROAD_PATROL_OPERATOR_REPORT = api + "/v2/road_patrols/operator/report";
|
export const GET_ROAD_PATROL_OPERATOR_REPORT = api + "/v2/road_patrols/operator/report";
|
||||||
export const GET_ROAD_PATROL_SUPERVISOR_REPORT = api + "/v2/road_patrols/supervisor/report";
|
export const GET_ROAD_PATROL_SUPERVISOR_REPORT = api + "/v2/road_patrols/operator/report";
|
||||||
export const CREATE_PATROL = api + "/api/v3/road_patrols/store";
|
export const CREATE_PATROL = api + "/api/v3/road_patrols/store";
|
||||||
export const GET_FMS_DATA = api + "/api/v3/fms_vehicle/get_activity";
|
export const GET_FMS_DATA = api + "/api/v3/fms_vehicle/get_activity";
|
||||||
export const GET_OTP_TOKEN = api + "/v2/get_otp_token";
|
export const GET_OTP_TOKEN = api + "/v2/get_otp_token";
|
||||||
|
|||||||
Reference in New Issue
Block a user