fixed bug
This commit is contained in:
@@ -2,7 +2,7 @@ import WithPermission from "@/core/middlewares/withPermission";
|
|||||||
import TollHousePage from "@/components/infrastructure/tollHouse";
|
import TollHousePage from "@/components/infrastructure/tollHouse";
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "فهرست راهدارخانه ها",
|
title: "لیست راهدارخانه ها",
|
||||||
};
|
};
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
|
|||||||
@@ -71,15 +71,12 @@ const OperatorList = () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Cell: ({ renderedCellValue }) => {
|
Cell: ({ renderedCellValue, row }) => {
|
||||||
if (renderedCellValue) {
|
return (
|
||||||
return (
|
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
<RahdaranDialog rowId={row.original.id} />
|
||||||
<RahdaranDialog rahdarLists={renderedCellValue} />
|
</Stack>
|
||||||
</Stack>
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
return <Typography variant="body2">-</Typography>;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,22 +1,44 @@
|
|||||||
import { DialogContent, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from "@mui/material";
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
|
import { GET_RAHDARAN_ROAD_POTROL } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import {
|
||||||
|
DialogContent,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableContainer,
|
||||||
|
TableHead,
|
||||||
|
TableRow,
|
||||||
|
Typography,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
const RahdaranContent = ({ rowId }) => {
|
||||||
|
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_RAHDARAN_ROAD_POTROL}/${rowId}`);
|
||||||
|
setData(response.data.data);
|
||||||
|
} catch (error) {
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchData();
|
||||||
|
}, [rowId]);
|
||||||
|
|
||||||
const RahdaranContent = ({ rahdarLists }) => {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Paper
|
{loading ? (
|
||||||
elevation={0}
|
<DialogLoading />
|
||||||
sx={{
|
) : data ? (
|
||||||
width: "100%",
|
|
||||||
overflow: "hidden",
|
|
||||||
"*::-webkit-scrollbar": {
|
|
||||||
width: "0.5em",
|
|
||||||
},
|
|
||||||
"*::-webkit-scrollbar-thumb": {
|
|
||||||
backgroundColor: "primary.main",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TableContainer sx={{ maxHeight: 600 }}>
|
<TableContainer sx={{ maxHeight: 600 }}>
|
||||||
<Table stickyHeader sx={{ minWidth: 800 }}>
|
<Table stickyHeader sx={{ minWidth: 800 }}>
|
||||||
<TableHead>
|
<TableHead>
|
||||||
@@ -26,7 +48,7 @@ const RahdaranContent = ({ rahdarLists }) => {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{rahdarLists.map((rahdar) => {
|
{data.map((rahdar) => {
|
||||||
return (
|
return (
|
||||||
<TableRow
|
<TableRow
|
||||||
key={rahdar.id}
|
key={rahdar.id}
|
||||||
@@ -40,7 +62,9 @@ const RahdaranContent = ({ rahdarLists }) => {
|
|||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
</TableContainer>
|
</TableContainer>
|
||||||
</Paper>
|
) : (
|
||||||
|
<Typography textAlign={"center"}>اطلاعات راهداران در سامانه یافت نشد</Typography>
|
||||||
|
)}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import GroupsIcon from "@mui/icons-material/Groups";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import RahdaranContent from "./RahdaranContent";
|
import RahdaranContent from "./RahdaranContent";
|
||||||
|
|
||||||
const RahdaranDialog = ({ rahdarLists }) => {
|
const RahdaranDialog = ({ rowId }) => {
|
||||||
const [openRahdaranDialog, setOpenRahdaranDialog] = useState(false);
|
const [openRahdaranDialog, setOpenRahdaranDialog] = useState(false);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -25,7 +25,7 @@ const RahdaranDialog = ({ rahdarLists }) => {
|
|||||||
maxWidth={"md"}
|
maxWidth={"md"}
|
||||||
>
|
>
|
||||||
<DialogTitle sx={{ fontSize: "large" }}>لیست راهداران</DialogTitle>
|
<DialogTitle sx={{ fontSize: "large" }}>لیست راهداران</DialogTitle>
|
||||||
<RahdaranContent rahdarLists={rahdarLists} />
|
{openRahdaranDialog && <RahdaranContent rowId={rowId} />}
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={() => setOpenRahdaranDialog(false)} variant="outlined" color="secondary" autoFocus>
|
<Button onClick={() => setOpenRahdaranDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||||
بستن
|
بستن
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import TollHouseList from "./TollHouseList";
|
|||||||
const TollHousePage = () => {
|
const TollHousePage = () => {
|
||||||
return (
|
return (
|
||||||
<Stack spacing={1}>
|
<Stack spacing={1}>
|
||||||
<PageTitle title={"فهرست راهدارخانه ها"} />
|
<PageTitle title={"لیست راهدارخانه ها"} />
|
||||||
<TollHouseList />
|
<TollHouseList />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ 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_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/operator/report";
|
export const GET_ROAD_PATROL_SUPERVISOR_REPORT = api + "/v2/road_patrols/operator/report";
|
||||||
|
export const GET_RAHDARAN_ROAD_POTROL = api + "/api/v3/road_patrols/rahdaran";
|
||||||
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 + "/api/v3/otp/get_token";
|
export const GET_OTP_TOKEN = api + "/api/v3/otp/get_token";
|
||||||
|
|||||||
Reference in New Issue
Block a user