change style

This commit is contained in:
AmirHossein Mahmoodi
2025-03-04 16:45:53 +03:30
parent ab2b8374ad
commit 84fdac3317
11 changed files with 37 additions and 31 deletions

View File

@@ -15,7 +15,6 @@ const RegisterAction = ({ rowId, mutate }) => {
image_after_1: null, image_after_1: null,
}; };
const onBaseSubmit = async (result) => { const onBaseSubmit = async (result) => {
console.log(result);
const formData = new FormData(); const formData = new FormData();
const rmsLatLng = `${result.start_point.lat},${result.start_point.lng}`; const rmsLatLng = `${result.start_point.lat},${result.start_point.lng}`;
if (result.rms_status === "1") { if (result.rms_status === "1") {
@@ -35,7 +34,7 @@ const RegisterAction = ({ rowId, mutate }) => {
mutate(); mutate();
setOpenRegisterActionDialog(false); setOpenRegisterActionDialog(false);
}) })
.catch(() => {}); .catch(() => { });
}; };
return ( return (
<> <>

View File

@@ -31,7 +31,6 @@ const EditController = ({ rowId, mutate, setOpenEditDialog }) => {
image_after_1: fastReactItemDetails?.image_after || null, image_after_1: fastReactItemDetails?.image_after || null,
}; };
const HandleSubmit = async (result) => { const HandleSubmit = async (result) => {
console.log("result", result);
const formData = new FormData(); const formData = new FormData();
const rmsLatLng = `${result.start_point.lat},${result.start_point.lng}`; const rmsLatLng = `${result.start_point.lat},${result.start_point.lng}`;
if (result.rms_status === "1") { if (result.rms_status === "1") {
@@ -53,7 +52,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog }) => {
mutate(); mutate();
setOpenEditDialog(false); setOpenEditDialog(false);
}) })
.catch(() => {}); .catch(() => { });
}; };
return ( return (
<> <>

View File

@@ -27,7 +27,7 @@ function TabPanel(props) {
const validationSchema = object({ const validationSchema = object({
recognize_picture: mixed().nullable().required("لطفا عکس فعالیت را بارگذاری کنید!"), recognize_picture: mixed().nullable().required("لطفا عکس فعالیت را بارگذاری کنید!"),
info_id: number().required("نوع آیتم را مشخص کنید!"), info_id: number().required("نوع آیتم را مشخص کنید!"),
axis_type_id: number().required("نوع محور را مشخص کنید!"), axis_type_id: string().required("نوع محور را مشخص کنید!"),
start_point: mixed() start_point: mixed()
.test("start-point-required", "لطفاً نقطه شروع را مشخص کنید!", function (value) { .test("start-point-required", "لطفاً نقطه شروع را مشخص کنید!", function (value) {
return !!value; // چک می‌کند که مقدار موجود است return !!value; // چک می‌کند که مقدار موجود است
@@ -42,7 +42,7 @@ const CreateFormContent = ({ setOpen, mutate }) => {
const [itemsList, setItemsList] = useState(); const [itemsList, setItemsList] = useState();
const defaultValues = { const defaultValues = {
info_id: null, info_id: null,
axis_type_id: null, axis_type_id: '',
recognize_picture: null, recognize_picture: null,
activity_date: "", activity_date: "",
activity_time: "", activity_time: "",
@@ -95,7 +95,7 @@ const CreateFormContent = ({ setOpen, mutate }) => {
mutate(); mutate();
setOpen(false); setOpen(false);
}) })
.catch((error) => {}); .catch((error) => { });
}; };
return ( return (

View File

@@ -1,8 +1,7 @@
import React from "react"; import DialogLoading from "@/core/components/DialogLoading";
import { Card, CardActionArea, Grid, LinearProgress, Typography } from "@mui/material";
import Image from "next/image";
import { Controller } from "react-hook-form";
import useSafetyAndPrivacyGetItems from "@/lib/hooks/useSafetyAndPrivacyGetItems"; import useSafetyAndPrivacyGetItems from "@/lib/hooks/useSafetyAndPrivacyGetItems";
import { Card, CardActionArea, Grid, Typography } from "@mui/material";
import { Controller } from "react-hook-form";
const GetItemInfo = ({ setItemsList, setTabState, control }) => { const GetItemInfo = ({ setItemsList, setTabState, control }) => {
const { itemsList, loadingItemsList, errorItemsList } = useSafetyAndPrivacyGetItems(); const { itemsList, loadingItemsList, errorItemsList } = useSafetyAndPrivacyGetItems();
@@ -14,7 +13,7 @@ const GetItemInfo = ({ setItemsList, setTabState, control }) => {
خطا در دریافت لیست آیتم ها خطا در دریافت لیست آیتم ها
</Typography> </Typography>
) : loadingItemsList ? ( ) : loadingItemsList ? (
<LinearProgress /> <DialogLoading />
) : ( ) : (
<Grid container sx={{ justifyContent: "center" }} spacing={2}> <Grid container sx={{ justifyContent: "center" }} spacing={2}>
<Controller <Controller

View File

@@ -34,11 +34,11 @@ const StepThreeContent = ({ setOpen, mutate, rowId }) => {
mutate(); mutate();
setOpen(false); setOpen(false);
}) })
.catch((error) => {}); .catch((error) => { });
}; };
return ( return (
<StyledForm onSubmit={handleSubmit(onSubmit)}> <StyledForm onSubmit={handleSubmit(onSubmit)}>
<DialogContent> <DialogContent dividers>
<Stack spacing={2}> <Stack spacing={2}>
<Controller <Controller
name="action_picture" name="action_picture"

View File

@@ -20,7 +20,7 @@ const StepThree = ({ mutate, rowId }) => {
}, },
}} }}
dir="rtl" dir="rtl"
maxWidth={"md"} maxWidth={"sm"}
fullWidth fullWidth
> >
<DialogTitle>بارگذاری تصویر اقدام</DialogTitle> <DialogTitle>بارگذاری تصویر اقدام</DialogTitle>

View File

@@ -53,11 +53,11 @@ const StepTwoContent = ({ setOpenStepTwoDialog, mutate, rowId }) => {
mutate(); mutate();
setOpenStepTwoDialog(false); setOpenStepTwoDialog(false);
}) })
.catch((error) => {}); .catch((error) => { });
}; };
return ( return (
<StyledForm onSubmit={handleSubmit(onSubmit)}> <StyledForm onSubmit={handleSubmit(onSubmit)}>
<DialogContent> <DialogContent dividers>
<Stack spacing={2}> <Stack spacing={2}>
<Controller <Controller
control={control} control={control}
@@ -86,7 +86,9 @@ const StepTwoContent = ({ setOpenStepTwoDialog, mutate, rowId }) => {
<Chip variant="outlined" label="لیست مستندات قضایی" /> <Chip variant="outlined" label="لیست مستندات قضایی" />
</Divider> </Divider>
{selectedDamageItemList.length === 0 && ( {selectedDamageItemList.length === 0 && (
<Box sx={{ my: 4, width: "100%", textAlign: "center" }}> <Box sx={{
my: 4, width: "100%", textAlign: "center"
}}>
<Typography variant="h6" sx={{ letterSpacing: "2px", color: "#606060" }}> <Typography variant="h6" sx={{ letterSpacing: "2px", color: "#606060" }}>
فایل موردنظر را بارگذاری کنید. فایل موردنظر را بارگذاری کنید.
</Typography> </Typography>

View File

@@ -21,7 +21,7 @@ const StepTwo = ({ mutate, rowId }) => {
}, },
}} }}
dir="rtl" dir="rtl"
maxWidth={"md"} maxWidth={"sm"}
fullWidth fullWidth
> >
<DialogTitle>بارگذاری مستندات قضایی</DialogTitle> <DialogTitle>بارگذاری مستندات قضایی</DialogTitle>

View File

@@ -133,8 +133,8 @@ const OperatorList = () => {
props.dependencyFieldValue?.value === "" props.dependencyFieldValue?.value === ""
? "empty" ? "empty"
: loadingEdaratList : loadingEdaratList
? "loading" ? "loading"
: props.filterParameters.value : props.filterParameters.value
} }
columnSelectOption={getColumnSelectOptions} columnSelectOption={getColumnSelectOptions}
/> />
@@ -181,7 +181,7 @@ const OperatorList = () => {
})); }));
}, },
Cell: ({ row }) => Cell: ({ row }) =>
row.original?.axis_type_name ? <>{row.original.axis_type_name}</> : <>بدون محور</>, row.original?.axis_type_name ? <>{row.original.axis_type_name}</> : <>-</>,
}, },
{ {
accessorKey: "location", accessorKey: "location",
@@ -244,7 +244,7 @@ const OperatorList = () => {
<RecognizePictureDialog image={renderedCellValue} /> <RecognizePictureDialog image={renderedCellValue} />
</Stack> </Stack>
) : ( ) : (
<>بدون تصویر</> <>-</>
); );
}, },
}, },
@@ -253,7 +253,7 @@ const OperatorList = () => {
row.activity_date_time ? ( row.activity_date_time ? (
moment(row.activity_date_time).locale("fa").format("HH:mm | yyyy/MM/DD") moment(row.activity_date_time).locale("fa").format("HH:mm | yyyy/MM/DD")
) : ( ) : (
<>بدون تاریخ</> <>-</>
), ),
header: "تاریخ بازدید", header: "تاریخ بازدید",
id: "activity_date_time", id: "activity_date_time",
@@ -294,7 +294,9 @@ const OperatorList = () => {
Cell: ({ row }) => { Cell: ({ row }) => {
return ( return (
<Stack alignItems={"center"} justifyContent={"center"}> <Stack alignItems={"center"} justifyContent={"center"}>
<JudiciaryDocumentDialog rowId={row.getValue("id")} /> {row.original.judiciary_document_upload_date !== "0000-00-00 00:00:00" ? (
<JudiciaryDocumentDialog rowId={row.getValue("id")} />
) : (<>-</>)}
</Stack> </Stack>
); );
}, },
@@ -303,12 +305,12 @@ const OperatorList = () => {
accessorFn: (row) => { accessorFn: (row) => {
const date = row.judiciary_document_upload_date; const date = row.judiciary_document_upload_date;
if (!date || date === "0000-00-00 00:00:00") { if (!date || date === "0000-00-00 00:00:00") {
return <>بدون تاریخ</>; return <>-</>;
} }
return moment(date, "YYYY-MM-DD HH:mm:ss").locale("fa").format("HH:mm | yyyy/MM/DD"); return moment(date, "YYYY-MM-DD HH:mm:ss").locale("fa").format("HH:mm | yyyy/MM/DD");
}, },
header: "تاریخ مستندات قضایی", header: "تاریخ بارگذاری مستندات",
id: "judiciary_document_upload_date", id: "judiciary_document_upload_date",
enableColumnFilter: true, enableColumnFilter: true,
datatype: "date", datatype: "date",
@@ -351,7 +353,7 @@ const OperatorList = () => {
<ActionPictureDialog image={renderedCellValue} /> <ActionPictureDialog image={renderedCellValue} />
</Stack> </Stack>
) : ( ) : (
<>بدون تصویر</> <>-</>
); );
}, },
}, },
@@ -362,7 +364,7 @@ const OperatorList = () => {
.locale("fa") .locale("fa")
.format("HH:mm | yyyy/MM/DD") .format("HH:mm | yyyy/MM/DD")
) : ( ) : (
<>بدون تاریخ</> <>-</>
), ),
header: "تاریخ اقدام", header: "تاریخ اقدام",
id: "action_picture_document_upload_date", id: "action_picture_document_upload_date",

View File

@@ -25,7 +25,7 @@ const JudiciaryDocumentDialog = ({ rowId }) => {
fullWidth fullWidth
> >
<DialogTitle>مشاهده مستندات قضایی</DialogTitle> <DialogTitle>مشاهده مستندات قضایی</DialogTitle>
<DialogContent> <DialogContent dividers>
<JudiciaryDocumentController rowId={rowId} /> <JudiciaryDocumentController rowId={rowId} />
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>

View File

@@ -2,13 +2,18 @@ import { Box } from "@mui/material";
import DeleteForm from "./DeleteDialog"; import DeleteForm from "./DeleteDialog";
import StepTwo from "../Form/StepTwo"; import StepTwo from "../Form/StepTwo";
import StepThree from "../Form/StepThree"; import StepThree from "../Form/StepThree";
import { usePermissions } from "@/lib/hooks/usePermissions";
const RowActions = ({ row, mutate }) => { const RowActions = ({ row, mutate }) => {
const { data: userPermissions } = usePermissions();
const hasDeletePermission = userPermissions?.includes("delete-safety-and-privacy");
return ( return (
<Box sx={{ display: "flex", gap: 1 }}> <Box sx={{ display: "flex", gap: 1 }}>
{row.original?.step === 1 && <StepTwo mutate={mutate} rowId={row.getValue("id")} />} {row.original?.step === 1 && <StepTwo mutate={mutate} rowId={row.getValue("id")} />}
{row.original?.step === 2 && <StepThree mutate={mutate} rowId={row.getValue("id")} />} {row.original?.step === 2 && <StepThree mutate={mutate} rowId={row.getValue("id")} />}
<DeleteForm rowId={row.getValue("id")} mutate={mutate} /> {hasDeletePermission && (
<DeleteForm rowId={row.getValue("id")} mutate={mutate} />
)}
</Box> </Box>
); );
}; };