fixed bug
This commit is contained in:
@@ -184,7 +184,7 @@ const OperatorList = () => {
|
||||
Cell: ({ renderedCellValue, row }) => {
|
||||
return (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<ImageDialog rowId={row.getValue("id")} />
|
||||
<ImageDialog rowId={row.original.id} />
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
@@ -241,7 +241,7 @@ const OperatorList = () => {
|
||||
Cell: ({ renderedCellValue, row }) => {
|
||||
return (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<MachinesCodeDialog rowId={row.getValue("id")} />
|
||||
<MachinesCodeDialog rowId={row.original.id} />
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
@@ -268,7 +268,7 @@ const OperatorList = () => {
|
||||
Cell: ({ renderedCellValue, row }) => {
|
||||
return (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<RahdaranDialog rowId={row.getValue("id")} />
|
||||
<RahdaranDialog rowId={row.original.id} />
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog, openEditDialog, row
|
||||
try {
|
||||
setLoadingImages(true);
|
||||
const response = await requestServer(`${GET_IMAGES_ROAD_ITEM}/${rowId}`);
|
||||
setImages(response.data);
|
||||
setImages(response.data.data);
|
||||
} catch (error) {
|
||||
} finally {
|
||||
setLoadingImages(false);
|
||||
@@ -39,7 +39,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog, openEditDialog, row
|
||||
try {
|
||||
setLoadingCmmsMachine(true);
|
||||
const response = await requestServer(`${GET_CMMS_MACHINE_ROAD_ITEM}/${rowId}`);
|
||||
setCmmsMachine(response.data);
|
||||
setCmmsMachine(response.data.data);
|
||||
} catch (error) {
|
||||
} finally {
|
||||
setLoadingCmmsMachine(false);
|
||||
@@ -54,7 +54,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog, openEditDialog, row
|
||||
try {
|
||||
setLoadingRahdaran(true);
|
||||
const response = await requestServer(`${GET_RAHDARAN_ROAD_ITEM}/${rowId}`);
|
||||
setRahdaran(response.data);
|
||||
setRahdaran(response.data.data);
|
||||
} catch (error) {
|
||||
} finally {
|
||||
setLoadingRahdaran(false);
|
||||
@@ -88,15 +88,15 @@ const EditController = ({ rowId, mutate, setOpenEditDialog, openEditDialog, row
|
||||
setOpenEditDialog={setOpenEditDialog}
|
||||
onSubmit={HandleSubmit}
|
||||
defaultData={{
|
||||
before_image: images.before_image || null,
|
||||
after_image: images.after_image || null,
|
||||
before_image: images[1]?.full_path_for_fast_react || null,
|
||||
after_image: images[0]?.full_path_for_fast_react || null,
|
||||
item_id: row.original?.item || null,
|
||||
sub_item_id: row.original?.sub_item || null,
|
||||
amount: row.original?.sub_item_data || null,
|
||||
start_point: { lat: row.original?.start_lat || "", lng: row.original?.start_lng || "" },
|
||||
end_point: { lat: row.original?.end_lat || "", lng: row.original?.end_lng || "" },
|
||||
cmms_machines: cmmsMachine || null,
|
||||
rahdaran_id: rahdaran.rahdaran_id || null,
|
||||
rahdaran_id: rahdaran || null,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
|
||||
@@ -21,12 +21,12 @@ const EditFormContent = ({ setOpenEditDialog, onSubmit, defaultData, is_gasht })
|
||||
|
||||
const onSubmitBase = async (data) => {
|
||||
let result = { ...data };
|
||||
if (result.before_image === null) {
|
||||
if (result.before_image === null || typeof result.before_image === "string") {
|
||||
delete result.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 data.after_image;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import EditForm from "./EditForm";
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -281,7 +281,7 @@ const SupervisorList = () => {
|
||||
Cell: ({ renderedCellValue, row }) => {
|
||||
return (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<ImageDialog rowId={row.getValue("id")} />
|
||||
<ImageDialog rowId={row.original.id} />
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
@@ -338,7 +338,7 @@ const SupervisorList = () => {
|
||||
Cell: ({ renderedCellValue, row }) => {
|
||||
return (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<MachinesCodeDialog rowId={row.getValue("id")} />
|
||||
<MachinesCodeDialog rowId={row.original.id} />
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
@@ -365,7 +365,7 @@ const SupervisorList = () => {
|
||||
Cell: ({ renderedCellValue, row }) => {
|
||||
return (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<RahdaranDialog rowId={row.getValue("id")} />
|
||||
<RahdaranDialog rowId={row.original.id} />
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user