fixed bug

This commit is contained in:
AmirHossein Mahmoodi
2025-04-20 15:11:02 +03:30
parent fe208b2119
commit 8a7beb699c
5 changed files with 15 additions and 15 deletions

View File

@@ -184,7 +184,7 @@ const OperatorList = () => {
Cell: ({ renderedCellValue, row }) => { Cell: ({ renderedCellValue, row }) => {
return ( return (
<Stack alignItems={"center"} justifyContent={"center"}> <Stack alignItems={"center"} justifyContent={"center"}>
<ImageDialog rowId={row.getValue("id")} /> <ImageDialog rowId={row.original.id} />
</Stack> </Stack>
); );
}, },
@@ -241,7 +241,7 @@ const OperatorList = () => {
Cell: ({ renderedCellValue, row }) => { Cell: ({ renderedCellValue, row }) => {
return ( return (
<Stack alignItems={"center"} justifyContent={"center"}> <Stack alignItems={"center"} justifyContent={"center"}>
<MachinesCodeDialog rowId={row.getValue("id")} /> <MachinesCodeDialog rowId={row.original.id} />
</Stack> </Stack>
); );
}, },
@@ -268,7 +268,7 @@ const OperatorList = () => {
Cell: ({ renderedCellValue, row }) => { Cell: ({ renderedCellValue, row }) => {
return ( return (
<Stack alignItems={"center"} justifyContent={"center"}> <Stack alignItems={"center"} justifyContent={"center"}>
<RahdaranDialog rowId={row.getValue("id")} /> <RahdaranDialog rowId={row.original.id} />
</Stack> </Stack>
); );
}, },

View File

@@ -24,7 +24,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog, openEditDialog, row
try { try {
setLoadingImages(true); setLoadingImages(true);
const response = await requestServer(`${GET_IMAGES_ROAD_ITEM}/${rowId}`); const response = await requestServer(`${GET_IMAGES_ROAD_ITEM}/${rowId}`);
setImages(response.data); setImages(response.data.data);
} catch (error) { } catch (error) {
} finally { } finally {
setLoadingImages(false); setLoadingImages(false);
@@ -39,7 +39,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog, openEditDialog, row
try { try {
setLoadingCmmsMachine(true); setLoadingCmmsMachine(true);
const response = await requestServer(`${GET_CMMS_MACHINE_ROAD_ITEM}/${rowId}`); const response = await requestServer(`${GET_CMMS_MACHINE_ROAD_ITEM}/${rowId}`);
setCmmsMachine(response.data); setCmmsMachine(response.data.data);
} catch (error) { } catch (error) {
} finally { } finally {
setLoadingCmmsMachine(false); setLoadingCmmsMachine(false);
@@ -54,7 +54,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog, openEditDialog, row
try { try {
setLoadingRahdaran(true); setLoadingRahdaran(true);
const response = await requestServer(`${GET_RAHDARAN_ROAD_ITEM}/${rowId}`); const response = await requestServer(`${GET_RAHDARAN_ROAD_ITEM}/${rowId}`);
setRahdaran(response.data); setRahdaran(response.data.data);
} catch (error) { } catch (error) {
} finally { } finally {
setLoadingRahdaran(false); setLoadingRahdaran(false);
@@ -88,15 +88,15 @@ const EditController = ({ rowId, mutate, setOpenEditDialog, openEditDialog, row
setOpenEditDialog={setOpenEditDialog} setOpenEditDialog={setOpenEditDialog}
onSubmit={HandleSubmit} onSubmit={HandleSubmit}
defaultData={{ defaultData={{
before_image: images.before_image || null, before_image: images[1]?.full_path_for_fast_react || null,
after_image: images.after_image || null, after_image: images[0]?.full_path_for_fast_react || null,
item_id: row.original?.item || null, item_id: row.original?.item || null,
sub_item_id: row.original?.sub_item || null, sub_item_id: row.original?.sub_item || null,
amount: row.original?.sub_item_data || null, amount: row.original?.sub_item_data || null,
start_point: { lat: row.original?.start_lat || "", lng: row.original?.start_lng || "" }, start_point: { lat: row.original?.start_lat || "", lng: row.original?.start_lng || "" },
end_point: { lat: row.original?.end_lat || "", lng: row.original?.end_lng || "" }, end_point: { lat: row.original?.end_lat || "", lng: row.original?.end_lng || "" },
cmms_machines: cmmsMachine || null, cmms_machines: cmmsMachine || null,
rahdaran_id: rahdaran.rahdaran_id || null, rahdaran_id: rahdaran || null,
}} }}
/> />
) : ( ) : (

View File

@@ -21,12 +21,12 @@ const EditFormContent = ({ setOpenEditDialog, onSubmit, defaultData, is_gasht })
const onSubmitBase = async (data) => { const onSubmitBase = async (data) => {
let result = { ...data }; let result = { ...data };
if (result.before_image === null) { if (result.before_image === null || typeof result.before_image === "string") {
delete result.before_image; delete result.before_image;
delete data.before_image; delete data.before_image;
} }
if (result.after_image === null) { if (result.after_image === null || typeof result.after_image === "string") {
delete result.after_image; delete result.after_image;
delete data.after_image; delete data.after_image;
} }

View File

@@ -4,7 +4,7 @@ import EditForm from "./EditForm";
const RowActions = ({ row, mutate }) => { const RowActions = ({ row, mutate }) => {
return ( return (
<Box sx={{ display: "flex", gap: 1 }}> <Box sx={{ display: "flex", gap: 1 }}>
{row.original.status === 2 && <EditForm rowId={row.getValue("id")} row={row} mutate={mutate} />} {row.original.status === 2 && <EditForm rowId={row.original.id} row={row} mutate={mutate} />}
</Box> </Box>
); );
}; };

View File

@@ -281,7 +281,7 @@ const SupervisorList = () => {
Cell: ({ renderedCellValue, row }) => { Cell: ({ renderedCellValue, row }) => {
return ( return (
<Stack alignItems={"center"} justifyContent={"center"}> <Stack alignItems={"center"} justifyContent={"center"}>
<ImageDialog rowId={row.getValue("id")} /> <ImageDialog rowId={row.original.id} />
</Stack> </Stack>
); );
}, },
@@ -338,7 +338,7 @@ const SupervisorList = () => {
Cell: ({ renderedCellValue, row }) => { Cell: ({ renderedCellValue, row }) => {
return ( return (
<Stack alignItems={"center"} justifyContent={"center"}> <Stack alignItems={"center"} justifyContent={"center"}>
<MachinesCodeDialog rowId={row.getValue("id")} /> <MachinesCodeDialog rowId={row.original.id} />
</Stack> </Stack>
); );
}, },
@@ -365,7 +365,7 @@ const SupervisorList = () => {
Cell: ({ renderedCellValue, row }) => { Cell: ({ renderedCellValue, row }) => {
return ( return (
<Stack alignItems={"center"} justifyContent={"center"}> <Stack alignItems={"center"} justifyContent={"center"}>
<RahdaranDialog rowId={row.getValue("id")} /> <RahdaranDialog rowId={row.original.id} />
</Stack> </Stack>
); );
}, },