diff --git a/src/components/dashboard/fastReact/complaintList/Form/registerAction/RegisterActionContent.jsx b/src/components/dashboard/fastReact/complaintList/Form/registerAction/RegisterActionContent.jsx index c4830cb..131e72e 100644 --- a/src/components/dashboard/fastReact/complaintList/Form/registerAction/RegisterActionContent.jsx +++ b/src/components/dashboard/fastReact/complaintList/Form/registerAction/RegisterActionContent.jsx @@ -1,13 +1,13 @@ -import { Button, DialogActions, DialogContent, FormControlLabel, RadioGroup, Stack } from "@mui/material"; -import { Controller, useForm } from "react-hook-form"; -import Radio from "@mui/material/Radio"; import StyledForm from "@/core/components/StyledForm"; +import { yupResolver } from "@hookform/resolvers/yup"; +import BeenhereIcon from "@mui/icons-material/Beenhere"; +import { Button, DialogActions, DialogContent, FormControlLabel, RadioGroup, Stack } from "@mui/material"; +import Radio from "@mui/material/Radio"; import { useState } from "react"; +import { Controller, useForm } from "react-hook-form"; +import { mixed, object, string } from "yup"; import RegisterActionDone from "./RegisterActionDone"; import RegisterActionUndone from "./RegisterActionUndone"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { mixed, object, string } from "yup"; -import BeenhereIcon from "@mui/icons-material/Beenhere"; const RegisterActionContent = ({ setOpen, defaultValues, onBaseSubmit }) => { const [selectedOption, setSelectedOption] = useState(defaultValues?.rms_status || "1"); @@ -19,7 +19,12 @@ const RegisterActionContent = ({ setOpen, defaultValues, onBaseSubmit }) => { description: string().required("توضیحات الزامی است"), start_point: mixed().when("rms_status", { is: "1", - then: (schema) => schema.required("مکان اقدام الزامی است"), + then: (schema) => + schema + .test("start-point-required", "مکان اقدام الزامی است", function (value) { + return !!value; + }) + .required("مکان اقدام الزامی است"), otherwise: (schema) => schema.notRequired(), }), image_before_1: mixed().when("rms_status", { diff --git a/src/components/dashboard/fastReact/supervisor/RowActions/index.jsx b/src/components/dashboard/fastReact/supervisor/RowActions/index.jsx index 37d03f4..10461f2 100644 --- a/src/components/dashboard/fastReact/supervisor/RowActions/index.jsx +++ b/src/components/dashboard/fastReact/supervisor/RowActions/index.jsx @@ -6,18 +6,11 @@ import RestoreForm from "./RestoreForm"; const RowActions = ({ row, mutate }) => { const { data: userPermissions } = usePermissions(); - const hasSupervisePermission = userPermissions.some((item) => - ["supervise-fast-react", "supervise-fast-react-province"].includes(item) - ); const hasRestorePermission = userPermissions.includes("restore-fast-react"); return ( - {hasSupervisePermission && row.original?.status === 0 && ( - - )} - {hasSupervisePermission && row.original?.status === 0 && ( - - )} + {row.original?.status === 0 && } + {row.original?.status === 0 && } {hasRestorePermission && row.original?.status !== 0 && ( )}