fixed bug and change style
This commit is contained in:
@@ -115,8 +115,8 @@ const ComplaintListTable = ({ open, setOpen, mutate }) => {
|
|||||||
props.dependencyFieldValue?.value === ""
|
props.dependencyFieldValue?.value === ""
|
||||||
? "empty"
|
? "empty"
|
||||||
: loadingEdaratList
|
: loadingEdaratList
|
||||||
? "loading"
|
? "loading"
|
||||||
: props.filterParameters.value
|
: props.filterParameters.value
|
||||||
}
|
}
|
||||||
columnSelectOption={getColumnSelectOptions}
|
columnSelectOption={getColumnSelectOptions}
|
||||||
/>
|
/>
|
||||||
@@ -269,7 +269,7 @@ const ComplaintListTable = ({ open, setOpen, mutate }) => {
|
|||||||
TableToolbar={Toolbar}
|
TableToolbar={Toolbar}
|
||||||
enableRowActions
|
enableRowActions
|
||||||
positionActionsColumn={"last"}
|
positionActionsColumn={"last"}
|
||||||
RowActions={RowActions}
|
RowActions={(props) => <RowActions {...props} mutateParentTable={mutate} />}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import RegisterActionContent from "./RegisterActionContent";
|
|||||||
import AppRegistrationIcon from "@mui/icons-material/AppRegistration";
|
import AppRegistrationIcon from "@mui/icons-material/AppRegistration";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { REGISTER_COMPLAINTS_LIST } from "@/core/utils/routes";
|
import { REGISTER_COMPLAINTS_LIST } from "@/core/utils/routes";
|
||||||
const RegisterAction = ({ rowId, mutate }) => {
|
const RegisterAction = ({ rowId, mutate, mutateParentTable }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const [openRegisterActionDialog, setOpenRegisterActionDialog] = useState(false);
|
const [openRegisterActionDialog, setOpenRegisterActionDialog] = useState(false);
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
@@ -32,9 +32,10 @@ const RegisterAction = ({ rowId, mutate }) => {
|
|||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
mutate();
|
mutate();
|
||||||
|
mutateParentTable()
|
||||||
setOpenRegisterActionDialog(false);
|
setOpenRegisterActionDialog(false);
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => { });
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import ReferList from "./ReferList";
|
|||||||
import Refer from "./Refer";
|
import Refer from "./Refer";
|
||||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||||
|
|
||||||
const RowActions = ({ row, mutate }) => {
|
const RowActions = ({ row, mutate, mutateParentTable }) => {
|
||||||
const { data: userPermissions } = usePermissions();
|
const { data: userPermissions } = usePermissions();
|
||||||
const hasActionPermission = userPermissions.includes("show-fast-react-edarate-shahri");
|
const hasActionPermission = userPermissions.includes("show-fast-react-edarate-shahri");
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", gap: 1 }}>
|
<Box sx={{ display: "flex", gap: 1 }}>
|
||||||
{hasActionPermission && <RegisterAction mutate={mutate} rowId={row.getValue("road_observeds__id")} />}
|
{hasActionPermission && <RegisterAction mutate={mutate} mutateParentTable={mutateParentTable} rowId={row.getValue("road_observeds__id")} />}
|
||||||
<Refer rowId={row.getValue("road_observeds__id")} mutate={mutate} />
|
<Refer rowId={row.getValue("road_observeds__id")} mutate={mutate} />
|
||||||
<ReferList rowId={row.getValue("road_observeds__id")} />
|
<ReferList rowId={row.getValue("road_observeds__id")} />
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -246,9 +246,27 @@ const OperatorList = () => {
|
|||||||
return <Typography variant="body2">-</Typography>;
|
return <Typography variant="body2">-</Typography>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "status",
|
||||||
|
header: "وضعیت نظارت",
|
||||||
|
id: "status",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "numeric",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: true,
|
||||||
|
grow: false,
|
||||||
|
size: 100,
|
||||||
|
columnSelectOption: () => {
|
||||||
|
return statusOptions.map((status) => ({
|
||||||
|
value: status.value,
|
||||||
|
label: status.label,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
Cell: ({ row }) => <>{row.original.status_fa}</>,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "supervisor_description",
|
accessorKey: "supervisor_description",
|
||||||
header: "توضیح کارشناس",
|
header: "توضیح ناظر",
|
||||||
id: "supervisor_description",
|
id: "supervisor_description",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
@@ -272,7 +290,7 @@ const OperatorList = () => {
|
|||||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||||
<DescriptionForm
|
<DescriptionForm
|
||||||
description={renderedCellValue}
|
description={renderedCellValue}
|
||||||
title={"توضیحات کارشناس"}
|
title={"توضیحات ناظر"}
|
||||||
icon={ThreePIcon}
|
icon={ThreePIcon}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -281,24 +299,6 @@ const OperatorList = () => {
|
|||||||
return <Typography variant="body2">-</Typography>;
|
return <Typography variant="body2">-</Typography>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
accessorKey: "status",
|
|
||||||
header: "وضعیت",
|
|
||||||
id: "status",
|
|
||||||
enableColumnFilter: true,
|
|
||||||
datatype: "numeric",
|
|
||||||
filterMode: "equals",
|
|
||||||
sortDescFirst: true,
|
|
||||||
grow: false,
|
|
||||||
size: 100,
|
|
||||||
columnSelectOption: () => {
|
|
||||||
return statusOptions.map((status) => ({
|
|
||||||
value: status.value,
|
|
||||||
label: status.label,
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
Cell: ({ row }) => <>{row.original.status_fa}</>,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ const SupervisorList = () => {
|
|||||||
props.dependencyFieldValue?.value === ""
|
props.dependencyFieldValue?.value === ""
|
||||||
? "empty"
|
? "empty"
|
||||||
: loadingEdaratList
|
: loadingEdaratList
|
||||||
? "loading"
|
? "loading"
|
||||||
: props.filterParameters.value
|
: props.filterParameters.value
|
||||||
}
|
}
|
||||||
columnSelectOption={getColumnSelectOptions}
|
columnSelectOption={getColumnSelectOptions}
|
||||||
/>
|
/>
|
||||||
@@ -347,9 +347,28 @@ const SupervisorList = () => {
|
|||||||
return <Typography variant="body2">-</Typography>;
|
return <Typography variant="body2">-</Typography>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
accessorKey: "status",
|
||||||
|
header: "وضعیت نظارت",
|
||||||
|
id: "status",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "numeric",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: true,
|
||||||
|
grow: false,
|
||||||
|
size: 100,
|
||||||
|
columnSelectOption: () => {
|
||||||
|
return statusOptions.map((status) => ({
|
||||||
|
value: status.value,
|
||||||
|
label: status.label,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
Cell: ({ row }) => <>{row.original.status_fa}</>,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "supervisor_description",
|
accessorKey: "supervisor_description",
|
||||||
header: "توضیح کارشناس",
|
header: "توضیح ناظر",
|
||||||
id: "supervisor_description",
|
id: "supervisor_description",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
@@ -382,24 +401,6 @@ const SupervisorList = () => {
|
|||||||
return <Typography variant="body2">-</Typography>;
|
return <Typography variant="body2">-</Typography>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
accessorKey: "status",
|
|
||||||
header: "وضعیت",
|
|
||||||
id: "status",
|
|
||||||
enableColumnFilter: true,
|
|
||||||
datatype: "numeric",
|
|
||||||
filterMode: "equals",
|
|
||||||
sortDescFirst: true,
|
|
||||||
grow: false,
|
|
||||||
size: 100,
|
|
||||||
columnSelectOption: () => {
|
|
||||||
return statusOptions.map((status) => ({
|
|
||||||
value: status.value,
|
|
||||||
label: status.label,
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
Cell: ({ row }) => <>{row.original.status_fa}</>,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user