machine performance modal

This commit is contained in:
2025-01-26 17:10:38 +03:30
parent 5e94453841
commit 14fafed9dd
6 changed files with 66 additions and 109 deletions

View File

@@ -43,10 +43,10 @@ const OperatorList = () => {
},
},
},
Cell: ({ renderedCellValue }) => {
Cell: ({ renderedCellValue, row }) => {
return (
<Stack alignItems={"center"} justifyContent={"center"}>
<MachinePerformanceForm />
<MachinePerformanceForm row={row} />
</Stack>
);
},

View File

@@ -52,7 +52,7 @@ const StopsInfo = ({ selectedPoint, staticData }) => {
</Box>
<Divider sx={{ flex: 1, mx: 2 }} />
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
{staticData.mileage || ""} کیلومتر
{staticData.mileage.toLocaleString() || ""} متر
</Typography>
</Grid>
<Grid item xs={12} sm={12} sx={{ display: "flex", alignItems: "center" }}>

View File

@@ -3,34 +3,15 @@ import DirectionsCarIcon from "@mui/icons-material/DirectionsCar";
import MachinePerformanceContent from "./MachinePerformanceContent";
import { useState } from "react";
const MachinePerformanceForm = () => {
const MachinePerformanceForm = ({row}) => {
const [openMachinesCodeDialog, setOpenMachinesCodeDialog] = useState(false);
const machineData = {
cmms_machine_code: 245,
cmms_machine_code: row.original?.cmms_machines[0]?.machine_code,
resultCode: 0,
mileage: 17645,
accOnDuration: 3599,
fuelConsumption: 6.1757503,
stopPoints: [
{
startDT: "2024-12-23T13:55:40",
duration: 114,
latitude: 37.521317,
longitude: 46.103584,
},
{
startDT: "2024-12-23T14:31:11",
duration: 14,
latitude: 37.566532,
longitude: 46.17688,
},
{
startDT: "2024-12-23T14:35:36",
duration: 55,
latitude: 37.569958,
longitude: 46.18166,
},
],
mileage: row.original?.distance,
accOnDuration: row.original?.vehicle_runtime,
fuelConsumption: row.original?.fuel_consumption,
stopPoints: row.original?.stop_points,
};
return (
<>

View File

@@ -51,7 +51,7 @@ const StopsInfo = ({ selectedPoint, staticData }) => {
</Box>
<Divider sx={{ flex: 1, mx: 2 }} />
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
{staticData.mileage || ""} کیلومتر
{staticData.mileage.toLocaleString() || ""} متر
</Typography>
</Grid>
<Grid item xs={12} sm={12} sx={{ display: "flex", alignItems: "center" }}>
@@ -70,59 +70,54 @@ const StopsInfo = ({ selectedPoint, staticData }) => {
{(staticData.accOnDuration / 60)?.toFixed(2) || ""} دقیقه
</Typography>
</Grid>
{selectedPoint && (
<>
<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.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.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.duration || ""} ثانیه
</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 ? `${selectedPoint.duration} ثانیه` : "نقطه مورد نظر را انتخاب کنید"}
</Typography>
</Grid>
</Grid>
);
};

View File

@@ -3,34 +3,15 @@ import DirectionsCarIcon from "@mui/icons-material/DirectionsCar";
import MachinePerformanceContent from "./MachinePerformanceContent";
import { useState } from "react";
const MachinePerformanceForm = () => {
const MachinePerformanceForm = ({row}) => {
const [openMachinesCodeDialog, setOpenMachinesCodeDialog] = useState(false);
const machineData = {
cmms_machine_code: 245,
cmms_machine_code: row.original?.cmms_machines[0]?.machine_code,
resultCode: 0,
mileage: 17645,
accOnDuration: 3599,
fuelConsumption: 6.1757503,
stopPoints: [
{
startDT: "2024-12-23T13:55:40",
duration: 114,
latitude: 37.521317,
longitude: 46.103584,
},
{
startDT: "2024-12-23T14:31:11",
duration: 14,
latitude: 37.566532,
longitude: 46.17688,
},
{
startDT: "2024-12-23T14:35:36",
duration: 55,
latitude: 37.569958,
longitude: 46.18166,
},
],
mileage: row.original?.distance,
accOnDuration: row.original?.vehicle_runtime,
fuelConsumption: row.original?.fuel_consumption,
stopPoints: row.original?.stop_points,
};
return (
<>

View File

@@ -147,9 +147,9 @@ const SupervisorList = () => {
},
},
},
Cell: () => (
Cell: ({row}) => (
<Stack alignItems={"center"} justifyContent={"center"}>
<MachinePerformanceForm />
<MachinePerformanceForm row={row} />
</Stack>
),
},