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 RowActions from "./RowActions";
|
||||
import ReportForm from "./RowActions/ReportForm";
|
||||
import RahdaranDialog from "./RowActions/RahdaranForm";
|
||||
import RahdaranDialog from "./RowActions/RahdaranForm"
|
||||
import MachinePerformanceForm from "./RowActions/MachinePerformanceForm";
|
||||
|
||||
|
||||
const OperatorList = () => {
|
||||
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 { Marker, useMap } from "react-leaflet";
|
||||
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 PinDropIcon from "@mui/icons-material/PinDrop";
|
||||
import AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
||||
import { formatSecondsToHHMMSS } from "@/core/utils/formatSecondsToHHMMSS";
|
||||
import StopsInfo from "./StopsInfo";
|
||||
const defaultIconSize = [35, 35];
|
||||
const MachinePerformanceContent = ({ machinesLists }) => {
|
||||
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 MachinePerformanceContent from "./MachinePerformanceContent";
|
||||
import { Button, Dialog, DialogActions, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import MachinePerformanceFetch from "./MachinesCodeFetch";
|
||||
|
||||
const MachinePerformanceForm = ({ row }) => {
|
||||
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 (
|
||||
<>
|
||||
<Tooltip title="عملکرد خودرو">
|
||||
@@ -33,10 +25,8 @@ const MachinePerformanceForm = ({ row }) => {
|
||||
maxWidth={"md"}
|
||||
>
|
||||
<DialogTitle sx={{ fontSize: "large" }}>عملکرد خودرو</DialogTitle>
|
||||
{row.original?.stop_points ? (
|
||||
<MachinePerformanceContent machinesLists={machineData} />
|
||||
) : (
|
||||
<Typography textAlign={"center"}>عملکردی در سامانه ثبت نشده است.</Typography>
|
||||
{openMachinesCodeDialog && (
|
||||
<MachinePerformanceFetch row={row} />
|
||||
)}
|
||||
<DialogActions>
|
||||
<Button
|
||||
|
||||
@@ -2,11 +2,11 @@ import { Box, Chip, DialogContent, Divider, Grid, Stack, Typography } from "@mui
|
||||
import React, { useEffect, useState, useRef } from "react";
|
||||
import { Marker, useMap } from "react-leaflet";
|
||||
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 PinDropIcon from "@mui/icons-material/PinDrop";
|
||||
import AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
||||
import { formatSecondsToHHMMSS } from "@/core/utils/formatSecondsToHHMMSS";
|
||||
import StopsInfo from "./StopsInfo";
|
||||
const defaultIconSize = [35, 35];
|
||||
const MachinePerformanceContent = ({ machinesLists }) => {
|
||||
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 AccessAlarmsIcon from "@mui/icons-material/AccessAlarms";
|
||||
import PinDropIcon from "@mui/icons-material/PinDrop";
|
||||
|
||||
import LocalGasStationIcon from "@mui/icons-material/LocalGasStation";
|
||||
import QrCode2Icon from "@mui/icons-material/QrCode2";
|
||||
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 ShowPlak from "@/core/components/ShowPlak";
|
||||
|
||||
const StopsInfo = ({ selectedPoint, staticData }) => {
|
||||
const StopsInfo = ({ staticData }) => {
|
||||
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" }}>
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
<Chip
|
||||
@@ -109,56 +114,6 @@ const StopsInfo = ({ selectedPoint, staticData }) => {
|
||||
{formatSecondsToHHMMSS(staticData?.accOnDuration)}
|
||||
</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.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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
import { Button, Dialog, DialogActions, DialogTitle, IconButton, Tooltip, Typography } from "@mui/material";
|
||||
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 MachinePerformanceFetch from "./MachinesCodeFetch";
|
||||
|
||||
const MachinePerformanceForm = ({ row }) => {
|
||||
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 (
|
||||
<>
|
||||
<Tooltip title="عملکرد خودرو">
|
||||
@@ -33,10 +25,8 @@ const MachinePerformanceForm = ({ row }) => {
|
||||
maxWidth={"md"}
|
||||
>
|
||||
<DialogTitle sx={{ fontSize: "large" }}>عملکرد خودرو</DialogTitle>
|
||||
{row.original?.stop_points ? (
|
||||
<MachinePerformanceContent machinesLists={machineData} />
|
||||
) : (
|
||||
<Typography textAlign={"center"}>عملکردی در سامانه ثبت نشده است.</Typography>
|
||||
{openMachinesCodeDialog && (
|
||||
<MachinePerformanceFetch row={row} />
|
||||
)}
|
||||
<DialogActions>
|
||||
<Button
|
||||
|
||||
@@ -12,9 +12,9 @@ import useEdaratLists from "@/lib/hooks/useEdaratLists";
|
||||
import OfficerDescriptionForm from "./RowActions/OfficerDescription";
|
||||
import ReportForm from "./RowActions/ReportForm";
|
||||
import RahdaranDialog from "./RowActions/RahdaranForm";
|
||||
import MachinePerformanceForm from "./RowActions/MachinePerformanceForm";
|
||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import MachinePerformanceForm from "./RowActions/MachinePerformanceForm";
|
||||
|
||||
const SupervisorList = () => {
|
||||
const { data: userPermissions } = usePermissions();
|
||||
@@ -119,8 +119,8 @@ const SupervisorList = () => {
|
||||
props.dependencyFieldValue?.value === ""
|
||||
? "empty"
|
||||
: loadingEdaratList
|
||||
? "loading"
|
||||
: props.filterParameters.value
|
||||
? "loading"
|
||||
: props.filterParameters.value
|
||||
}
|
||||
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_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 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_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 GET_FMS_DATA = api + "/api/v3/fms_vehicle/get_activity";
|
||||
export const GET_OTP_TOKEN = api + "/v2/get_otp_token";
|
||||
|
||||
Reference in New Issue
Block a user