From ab3c80a0d310fa7d90d16f0fa43e48eddf43b82f Mon Sep 17 00:00:00 2001 From: mhmjalali Date: Sat, 18 Oct 2025 16:57:01 +0330 Subject: [PATCH 1/5] folder structure for estelam harim and start cartable for city admin --- .../inquiry-privacy/assistant/page.js | 13 ++ .../assistant/zamin-gov/page.js | 12 -- .../inquiry-privacy/city-admin/page.js | 14 ++ .../city-admin/zamin-gov/page.js | 12 -- .../inquiry-privacy/general-manager/page.js | 13 ++ .../general-manager/zamin-gov/page.js | 12 -- .../inquiry-privacy/privacy-office/page.js | 13 ++ .../province-admin/zamin-gov/page.js | 12 -- .../RoadSafetyForm/DescriptionForm.jsx | 29 ---- .../ManagerOrAssistantSubmit.jsx | 15 -- .../RoadSafetyForm/PrevCartableOpinion.jsx | 25 --- .../RoadSafetyForm/QuestionSafetyForm.jsx | 33 ---- .../RoadSafetyForm/RoadSafetyFormContext.jsx | 82 ---------- .../RowActions/RoadSafetyForm/index.jsx | 52 ------- .../RowActions/TaskDetail/DetailDialog.jsx | 75 --------- .../zaminGov/RowActions/TaskDetail/index.jsx | 26 ---- .../assistant/zaminGov/RowActions/index.jsx | 13 -- .../assistant/zaminGov/TaskList.jsx | 145 ------------------ .../assistant/zaminGov/index.jsx | 15 -- .../city-admin/CityAdminList.jsx | 57 +++++++ .../RowActions/ConfirmAction/index.jsx | 17 ++ .../RowActions/RejectAction/index.jsx | 17 ++ .../city-admin/RowActions/index.jsx | 14 ++ .../inquiryPrivacy/city-admin/index.jsx | 14 ++ .../RowActions/Refer/ReferFormContext.jsx | 138 ----------------- .../zaminGov/RowActions/Refer/index.jsx | 41 ----- .../RowActions/TaskDetail/DetailDialog.jsx | 109 ------------- .../zaminGov/RowActions/TaskDetail/index.jsx | 26 ---- .../cityAdmin/zaminGov/RowActions/index.jsx | 15 -- .../cityAdmin/zaminGov/TaskList.jsx | 145 ------------------ .../cityAdmin/zaminGov/index.jsx | 14 -- .../RoadSafetyForm/DescriptionForm.jsx | 29 ---- .../ManagerOrAssistantSubmit.jsx | 15 -- .../RoadSafetyForm/PrevCartableOpinion.jsx | 26 ---- .../RoadSafetyForm/QuestionSafetyForm.jsx | 33 ---- .../RoadSafetyForm/RoadSafetyFormContext.jsx | 82 ---------- .../RowActions/RoadSafetyForm/index.jsx | 52 ------- .../RowActions/TaskDetail/DetailDialog.jsx | 75 --------- .../zaminGov/RowActions/TaskDetail/index.jsx | 26 ---- .../zaminGov/RowActions/index.jsx | 13 -- .../generalManager/zaminGov/TaskList.jsx | 145 ------------------ .../generalManager/zaminGov/index.jsx | 15 -- .../RowActions/MapModify/MapActionButtons.jsx | 100 ------------ .../RowActions/MapModify/MapModifyDialog.jsx | 96 ------------ .../RowActions/MapModify/PolygonForDesign.jsx | 115 -------------- .../zaminGov/RowActions/MapModify/index.jsx | 29 ---- .../RowActions/Refer/ReferFormContext.jsx | 139 ----------------- .../zaminGov/RowActions/Refer/index.jsx | 41 ----- .../RoadSafetyForm/DescriptionForm.jsx | 29 ---- .../RoadSafetyForm/PrevCartableOpinion.jsx | 27 ---- .../RoadSafetyForm/QuestionSafetyForm.jsx | 57 ------- .../RoadSafetyForm/RoadSaftyFormContext.jsx | 80 ---------- .../RoadSafetyForm/SubmitButtonsAdmin.jsx | 21 --- .../RowActions/RoadSafetyForm/index.jsx | 52 ------- .../RowActions/TaskDetail/DetailDialog.jsx | 75 --------- .../zaminGov/RowActions/TaskDetail/index.jsx | 26 ---- .../zaminGov/RowActions/index.jsx | 17 -- .../provinceAdmin/zaminGov/TaskList.jsx | 145 ------------------ .../provinceAdmin/zaminGov/index.jsx | 15 -- src/core/utils/pageMenuDev.js | 32 ++-- src/core/utils/routes.js | 3 + 61 files changed, 191 insertions(+), 2637 deletions(-) create mode 100644 src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/assistant/page.js delete mode 100644 src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/assistant/zamin-gov/page.js create mode 100644 src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/city-admin/page.js delete mode 100644 src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/city-admin/zamin-gov/page.js create mode 100644 src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/page.js delete mode 100644 src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/zamin-gov/page.js create mode 100644 src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/privacy-office/page.js delete mode 100644 src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/province-admin/zamin-gov/page.js delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/ManagerOrAssistantSubmit.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/RoadSafetyFormContext.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/TaskDetail/DetailDialog.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/TaskDetail/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/TaskList.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/assistant/zaminGov/index.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/RowActions/ConfirmAction/index.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/RowActions/RejectAction/index.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/ReferFormContext.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/TaskDetail/DetailDialog.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/TaskDetail/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/TaskList.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/ManagerOrAssistantSubmit.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/RoadSafetyFormContext.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/TaskDetail/DetailDialog.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/TaskDetail/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/TaskList.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/MapActionButtons.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/MapModifyDialog.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/PolygonForDesign.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/Refer/ReferFormContext.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/Refer/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/RoadSaftyFormContext.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/SubmitButtonsAdmin.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/TaskDetail/DetailDialog.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/TaskDetail/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/index.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/TaskList.jsx delete mode 100644 src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/index.jsx diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/assistant/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/assistant/page.js new file mode 100644 index 0000000..c13a78d --- /dev/null +++ b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/assistant/page.js @@ -0,0 +1,13 @@ +import WithPermission from "@/core/middlewares/withPermission"; +export const metadata = { + title: "کارتابل معاون", +}; +const Page = () => { + return ( + +

کارتابل معاون

+
+ ); +}; + +export default Page; diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/assistant/zamin-gov/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/assistant/zamin-gov/page.js deleted file mode 100644 index d82631a..0000000 --- a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/assistant/zamin-gov/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import AssistantZaminGovComponent from "@/components/dashboard/inquiryPrivacy/assistant/zaminGov"; -import WithPermission from "@/core/middlewares/withPermission"; - -const Page = () => { - return ( - - - - ); -}; - -export default Page; diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/city-admin/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/city-admin/page.js new file mode 100644 index 0000000..3fd1888 --- /dev/null +++ b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/city-admin/page.js @@ -0,0 +1,14 @@ +import CityAdminPage from "@/components/dashboard/inquiryPrivacy/city-admin"; +import WithPermission from "@/core/middlewares/withPermission"; +export const metadata = { + title: "کارتابل شهرستان", +}; +const Page = () => { + return ( + + + + ); +}; + +export default Page; diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/city-admin/zamin-gov/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/city-admin/zamin-gov/page.js deleted file mode 100644 index d7631c9..0000000 --- a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/city-admin/zamin-gov/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import CityAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov"; -import WithPermission from "@/core/middlewares/withPermission"; - -const Page = () => { - return ( - - - - ); -}; - -export default Page; diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/page.js new file mode 100644 index 0000000..e24a103 --- /dev/null +++ b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/page.js @@ -0,0 +1,13 @@ +import WithPermission from "@/core/middlewares/withPermission"; +export const metadata = { + title: "کارتابل مدیر", +}; +const Page = () => { + return ( + +

کارتابل مدیر

+
+ ); +}; + +export default Page; diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/zamin-gov/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/zamin-gov/page.js deleted file mode 100644 index 9b9d446..0000000 --- a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/zamin-gov/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import GeneralManagerZaminGovComponent from "@/components/dashboard/inquiryPrivacy/generalManager/zaminGov"; -import WithPermission from "@/core/middlewares/withPermission"; - -const Page = () => { - return ( - - - - ); -}; - -export default Page; diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/privacy-office/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/privacy-office/page.js new file mode 100644 index 0000000..ed381eb --- /dev/null +++ b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/privacy-office/page.js @@ -0,0 +1,13 @@ +import WithPermission from "@/core/middlewares/withPermission"; +export const metadata = { + title: "کارتابل اداره حریم", +}; +const Page = () => { + return ( + +

کارتابل اداره حریم

+
+ ); +}; + +export default Page; diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/province-admin/zamin-gov/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/province-admin/zamin-gov/page.js deleted file mode 100644 index 0c51a47..0000000 --- a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/province-admin/zamin-gov/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import ProvinceAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov"; -import WithPermission from "@/core/middlewares/withPermission"; - -const Page = () => { - return ( - - - - ); -}; - -export default Page; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx deleted file mode 100644 index ba2cdeb..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import { FormControl, FormHelperText, InputLabel, OutlinedInput, Stack } from "@mui/material"; - -const DescriptionForm = ({ errors, register }) => { - return ( - - - - توضیحات - - - - {errors.description ? errors.description.message : null} - - - - ); -}; -export default DescriptionForm; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/ManagerOrAssistantSubmit.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/ManagerOrAssistantSubmit.jsx deleted file mode 100644 index d755b7c..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/ManagerOrAssistantSubmit.jsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Button } from "@mui/material"; - -const ManagerOrAssistantSubmit = ({ isSubmitting }) => { - return ( - <> - - - - ); -}; -export default ManagerOrAssistantSubmit; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx deleted file mode 100644 index d6df4b1..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Card, CardContent, CardHeader, CircularProgress, Divider, Stack, Typography } from "@mui/material"; - -const PrevCartableOpinion = ({ message, loadingMessage, errorMessage }) => { - return ( - - - - - {errorMessage ? ( - خطا در دریافت اطلاعات !!! - ) : loadingMessage ? ( - - - درحال دریافت اطلاعات - - ) : ( - {message} - )} - - - - - ); -}; -export default PrevCartableOpinion; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx deleted file mode 100644 index 5410d66..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Card, CardContent, FormControl, FormLabel, Stack, Typography } from "@mui/material"; - -const QuestionSafetyForm = () => { - return ( - - - - - - - آیا ایمنی راه این طرح مورد تایید است ؟ - - - - دفتر حریم راه : - - بله - - - - - - - ); -}; -export default QuestionSafetyForm; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/RoadSafetyFormContext.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/RoadSafetyFormContext.jsx deleted file mode 100644 index 75a279c..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/RoadSafetyFormContext.jsx +++ /dev/null @@ -1,82 +0,0 @@ -import { DialogActions, DialogContent, Stack } from "@mui/material"; -import StyledForm from "@/core/components/StyledForm"; -import useRequest from "@/lib/hooks/useRequest"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { object, string } from "yup"; -import { SUBMIT_ROAD_SAFETY_FORM } from "@/core/utils/routes"; -import usePrevStateOpinion from "@/lib/hooks/usePrevStateopinion"; -import QuestionSafetyForm from "./QuestionSafetyForm"; -import PrevCartableOpinion from "./PrevCartableOpinion"; -import DescriptionForm from "./DescriptionForm"; -import ManagerOrAssistantSubmit from "./ManagerOrAssistantSubmit"; -import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail"; -const fakeData = { - id: 1, - shomareh_darkhast: "2124", - ostan: "ostan", - shahr: "shahr", - shahrestan: "shahrestan", - bakhsh: "bakhsh", - roosta: "roosta", - tarikh_darkhast: "tarikh_darkhast", - sazman: "sazman", - masahat_zamin: "masahat_zamin", - masahat_tarh: "masahat_tarh", - gorooh_tarh: "gorooh_tarh", - onvane_tarh: "onvane_tarh", - address: "کرج - فلان جا - جنب پاساژ - نزدیک اونجا - اونور خیابون - زیر رو گذر - روی زیر گذر", - file_mosavab: "file", - polygon: [ - [51.515, -0.09], - [51.52, -0.1], - [51.52, -0.12], - ], -}; -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), -}); -const RoadSafetyFormContext = ({ rowId, mutate, setOpenRoadSafetyForm }) => { - const defaultValues = { - description: "", - }; - const requestServer = useRequest({ notificationSuccess: true }); - const { message, loadingMessage, errorMessage } = usePrevStateOpinion(); - const { - register, - handleSubmit, - formState: { isSubmitting, errors }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - requestServer(`${SUBMIT_ROAD_SAFETY_FORM}/${rowId}`, "post", { - data: formData, - }) - .then(() => { - setOpenRoadSafetyForm(false); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - - - - - - - - ); -}; -export default RoadSafetyFormContext; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/index.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/index.jsx deleted file mode 100644 index a4de0d7..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/RoadSafetyForm/index.jsx +++ /dev/null @@ -1,52 +0,0 @@ -import { Dialog, IconButton, Stack, Tooltip } from "@mui/material"; -import EngineeringIcon from "@mui/icons-material/Engineering"; -import DialogTransition from "@/core/components/DialogTransition"; -import { useState } from "react"; -import { Close } from "@mui/icons-material"; -import RoadSafetyFormContext from "./RoadSafetyFormContext"; - -const RoadSafetyForm = ({ rowId, mutate }) => { - const [openRoadSafetyForm, setOpenRoadSafetyForm] = useState(false); - return ( - - - { - setOpenRoadSafetyForm(true); - }} - > - - - - - setOpenRoadSafetyForm(false)} - sx={{ - position: "absolute", - right: 8, - top: 8, - zIndex: 10, - color: (theme) => theme.palette.grey[500], - }} - > - - - - - - ); -}; -export default RoadSafetyForm; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/TaskDetail/DetailDialog.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/TaskDetail/DetailDialog.jsx deleted file mode 100644 index 777eecf..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/TaskDetail/DetailDialog.jsx +++ /dev/null @@ -1,75 +0,0 @@ -"use client"; - -import { Dialog, DialogContent } from "@mui/material"; -import { object, string } from "yup"; -import useRequest from "@/lib/hooks/useRequest"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import StyledForm from "@/core/components/StyledForm"; -import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail"; - -const fakeData = { - id: 1, - shomareh_darkhast: "2124", - ostan: "ostan", - shahr: "shahr", - shahrestan: "shahrestan", - bakhsh: "bakhsh", - roosta: "roosta", - tarikh_darkhast: "tarikh_darkhast", - sazman: "sazman", - masahat_zamin: "masahat_zamin", - masahat_tarh: "masahat_tarh", - gorooh_tarh: "gorooh_tarh", - onvane_tarh: "onvane_tarh", - address: "کرج - فلان جا - جنب پاساژ - نزدیک اونجا - اونور خیابون - زیر رو گذر - روی زیر گذر", - file_mosavab: "file", - polygon: [ - [51.515, -0.09], - [51.52, -0.1], - [51.52, -0.12], - ], -}; - -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), -}); - -const DetailDialog = ({ taskModal, setTaskModal, rowId, mutate }) => { - const requestServer = useRequest({ auth: true }); - const defaultValues = { - description: "", - }; - const handleClose = () => { - setTaskModal(false); - }; - - const { - register, - handleSubmit, - formState: { isSubmitting, errors, touchedFields }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - requestServer(`api-for-send-to-harim/${rowId}`, "post", { - data: formData, - }) - .then(() => { - handleClose(); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - - ); -}; -export default DetailDialog; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/TaskDetail/index.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/TaskDetail/index.jsx deleted file mode 100644 index 1641840..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/TaskDetail/index.jsx +++ /dev/null @@ -1,26 +0,0 @@ -"use client"; - -import { IconButton, Tooltip } from "@mui/material"; -import AssignmentIcon from "@mui/icons-material/Assignment"; -import DetailDialog from "./DetailDialog"; -import { useState } from "react"; - -const TaskDetail = ({ rowId, mutate }) => { - const [taskModal, setTaskModal] = useState(false); - - const openDetailDialog = () => { - setTaskModal(true); - }; - - return ( - <> - - - - - - - - ); -}; -export default TaskDetail; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/index.jsx deleted file mode 100644 index ae4213c..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/RowActions/index.jsx +++ /dev/null @@ -1,13 +0,0 @@ -import TaskDetail from "./TaskDetail"; -import { Box } from "@mui/material"; -import RoadSafetyForm from "./RoadSafetyForm"; - -const RowActions = ({ row, mutate }) => { - return ( - - - - - ); -}; -export default RowActions; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/TaskList.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/TaskList.jsx deleted file mode 100644 index 31452f6..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/TaskList.jsx +++ /dev/null @@ -1,145 +0,0 @@ -"use client"; - -import { useMemo } from "react"; -import { Box } from "@mui/material"; -import DataTableWithAuth from "@/core/components/DataTableWithAuth"; -import RowActions from "./RowActions"; - -const TaskList = () => { - const columns = useMemo( - () => [ - { - accessorKey: "id", - header: "کد یکتا", - id: "id", - enableColumnFilter: false, - datatype: "text", - filterMode: "notEquals", - }, - { - accessorKey: "aplication_number", - header: "شماره درخواست", - id: "aplication_number", - enableColumnFilter: false, - datatype: "text", - filterMode: "notEquals", - }, - { - accessorKey: "application_date", - header: "تاریخ درخواست", - id: "application_date", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "province", - header: "استان", - id: "province", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "township", - header: "شهرستان", - id: "township", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "city", - header: "شهر", - id: "city", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "county", - header: "بخش", - id: "county", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "village", - header: "روستا", - id: "village", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "land_area", - header: "مساحت زمین", - id: "land_area", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_area", - header: "مساحت طرح", - id: "design_area", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "organization", - header: "سازمان", - id: "organization", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_group", - header: "گروه طرح", - id: "design_group", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_title", - header: "عنوان طرح", - id: "design_title", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "state", - header: "وضعیت درخواست", - id: "state", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - ], - [] - ); - - return ( - <> - - - - - ); -}; -export default TaskList; diff --git a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/index.jsx b/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/index.jsx deleted file mode 100644 index a6a53cf..0000000 --- a/src/components/dashboard/inquiryPrivacy/assistant/zaminGov/index.jsx +++ /dev/null @@ -1,15 +0,0 @@ -"use client"; - -import PageTitle from "@/core/components/PageTitle"; -import { Stack } from "@mui/material"; -import TaskList from "./TaskList"; - -const AssistantZaminGovComponent = () => { - return ( - - - - - ); -}; -export default AssistantZaminGovComponent; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx new file mode 100644 index 0000000..be14803 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx @@ -0,0 +1,57 @@ +import DataTableWithAuth from '@/core/components/DataTableWithAuth'; +import { GET_CITY_ADMIN_LIST } from '@/core/utils/routes'; +import { Box } from '@mui/material'; +import { useMemo } from 'react'; +import RowActions from './RowActions'; + +const CityAdminList = () => { + const columns = useMemo(() => { + return [ + { + accessorKey: "id", + header: "کد یکتا", + id: "panjare_vahed_id", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.panjare_vahed_id}, + }, + { + accessorKey: "national_id", + header: "کد ملی", + id: "national_id", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.national_id}, + }, + ]; + }, []); + + return ( + <> + + + + + ) +} + +export default CityAdminList \ No newline at end of file diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/ConfirmAction/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/ConfirmAction/index.jsx new file mode 100644 index 0000000..6eb22a6 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/ConfirmAction/index.jsx @@ -0,0 +1,17 @@ +import ThumbUpIcon from '@mui/icons-material/ThumbUp'; +import { IconButton, Tooltip } from "@mui/material"; +import { useState } from "react"; + +const ConfirmAction = ({ rowId, mutate }) => { + const [openConfirmDialog, setOpenConfirmDialog] = useState(false); + return ( + <> + + setOpenConfirmDialog(true)}> + + + + + ); +}; +export default ConfirmAction; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/RejectAction/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/RejectAction/index.jsx new file mode 100644 index 0000000..ccdffaf --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/RejectAction/index.jsx @@ -0,0 +1,17 @@ +import ThumbDownIcon from '@mui/icons-material/ThumbDown'; +import { IconButton, Tooltip } from "@mui/material"; +import { useState } from "react"; + +const RejectAction = ({ rowId, mutate }) => { + const [openRejectDialog, setOpenRejectDialog] = useState(false); + return ( + <> + + setOpenRejectDialog(true)}> + + + + + ); +}; +export default RejectAction; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx new file mode 100644 index 0000000..c8906f2 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx @@ -0,0 +1,14 @@ +import { Box } from "@mui/material"; +import ConfirmAction from "./ConfirmAction"; +import RejectAction from "./RejectAction"; + +const RowActions = ({ row, mutate }) => { + + return ( + + + + + ); +}; +export default RowActions; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/index.jsx new file mode 100644 index 0000000..b8d7433 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/index.jsx @@ -0,0 +1,14 @@ +"use client"; +import PageTitle from "@/core/components/PageTitle"; +import { Stack } from "@mui/material"; +import CityAdminList from "./CityAdminList"; + +const CityAdminPage = () => { + return ( + + + + + ); +}; +export default CityAdminPage; diff --git a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/ReferFormContext.jsx b/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/ReferFormContext.jsx deleted file mode 100644 index 604e141..0000000 --- a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/ReferFormContext.jsx +++ /dev/null @@ -1,138 +0,0 @@ -import { - Autocomplete, - Button, - CircularProgress, - DialogActions, - DialogContent, - FormControl, - FormHelperText, - InputLabel, - OutlinedInput, - Stack, - TextField, - Typography, -} from "@mui/material"; -import { Controller, useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { object, string } from "yup"; -import StyledForm from "@/core/components/StyledForm"; -import useCities from "@/lib/hooks/useCities"; -import useRequest from "@/lib/hooks/useRequest"; -import { REFER_ADMIN_CITY } from "@/core/utils/routes"; - -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), - city: string().required("وارد کردن شهرستان الزامیست!"), -}); - -const ReferFormContext = ({ setOpenReferDialog, rowId, mutate }) => { - const defaultValues = { - description: "", - city: "", - }; - const { cities, loadingCities, errorCities } = useCities(); - const requestServer = useRequest({ notificationSuccess: true }); - const { - control, - register, - handleSubmit, - formState: { isSubmitting, errors, touchedFields }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - formData.append("cityId", data.city); - requestServer(`${REFER_ADMIN_CITY}/${rowId}`, "post", { - data: formData, - }) - .then(() => { - setOpenReferDialog(false); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - توضیحات - - - - {errors.description ? errors.description.message : null} - - - - - ( - - - {errorCities ? ( - خطایی در دریافت شهرستان ها رخ داده است! - ) : loadingCities ? ( - - - درحال دریافت لیست شهرستان ها - - ) : ( - city.id === value) || null} - disablePortal - options={cities} - getOptionLabel={(city) => city.name} - isOptionEqualToValue={(option, value) => option.id === value.id} - onChange={(event, newValue) => { - onChange(newValue ? newValue.id : ""); - }} - renderInput={(params) => ( - - )} - /> - )} - - {errors.city ? errors.city.message : null} - - - )} - /> - - - - - - - - - ); -}; -export default ReferFormContext; diff --git a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/index.jsx b/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/index.jsx deleted file mode 100644 index a8ebdc2..0000000 --- a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/Refer/index.jsx +++ /dev/null @@ -1,41 +0,0 @@ -import { Dialog, DialogTitle, IconButton, Stack, Tooltip } from "@mui/material"; -import ReplyIcon from "@mui/icons-material/Reply"; -import DialogTransition from "@/core/components/DialogTransition"; -import ReferFormContext from "./ReferFormContext"; -import { useState } from "react"; - -const ReferForm = ({ rowId, mutate }) => { - const [openReferDialog, setOpenReferDialog] = useState(false); - return ( - - - { - setOpenReferDialog(true); - }} - > - - - - - - ارجاع به شهرستان دیگر - - - - - ); -}; -export default ReferForm; diff --git a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/TaskDetail/DetailDialog.jsx b/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/TaskDetail/DetailDialog.jsx deleted file mode 100644 index 3c25592..0000000 --- a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/TaskDetail/DetailDialog.jsx +++ /dev/null @@ -1,109 +0,0 @@ -"use client"; - -import { - Button, - Dialog, - DialogActions, - DialogContent, - FormControl, - FormHelperText, - InputLabel, - OutlinedInput, -} from "@mui/material"; -import { object, string } from "yup"; -import useRequest from "@/lib/hooks/useRequest"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import StyledForm from "@/core/components/StyledForm"; -import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail"; - -const fakeData = { - id: 1, - shomareh_darkhast: "2124", - ostan: "ostan", - shahr: "shahr", - shahrestan: "shahrestan", - bakhsh: "bakhsh", - roosta: "roosta", - tarikh_darkhast: "tarikh_darkhast", - sazman: "sazman", - masahat_zamin: "masahat_zamin", - masahat_tarh: "masahat_tarh", - gorooh_tarh: "gorooh_tarh", - onvane_tarh: "onvane_tarh", - address: "کرج - فلان جا - جنب پاساژ - نزدیک اونجا - اونور خیابون - زیر رو گذر - روی زیر گذر", - file_mosavab: "file", - polygon: [ - [51.515, -0.09], - [51.52, -0.1], - [51.52, -0.12], - ], -}; - -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), -}); - -const DetailDialog = ({ taskModal, setTaskModal, rowId, mutate }) => { - const requestServer = useRequest({ auth: true }); - const defaultValues = { - description: "", - }; - const handleClose = () => { - setTaskModal(false); - }; - - const { - register, - handleSubmit, - formState: { isSubmitting, errors, touchedFields }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - requestServer(`api-for-send-to-harim/${rowId}`, "post", { - data: formData, - }) - .then(() => { - handleClose(); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - توضیحات - - - - {errors.description ? errors.description.message : null} - - - - - - - - - ); -}; -export default DetailDialog; diff --git a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/TaskDetail/index.jsx b/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/TaskDetail/index.jsx deleted file mode 100644 index 1641840..0000000 --- a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/TaskDetail/index.jsx +++ /dev/null @@ -1,26 +0,0 @@ -"use client"; - -import { IconButton, Tooltip } from "@mui/material"; -import AssignmentIcon from "@mui/icons-material/Assignment"; -import DetailDialog from "./DetailDialog"; -import { useState } from "react"; - -const TaskDetail = ({ rowId, mutate }) => { - const [taskModal, setTaskModal] = useState(false); - - const openDetailDialog = () => { - setTaskModal(true); - }; - - return ( - <> - - - - - - - - ); -}; -export default TaskDetail; diff --git a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/index.jsx deleted file mode 100644 index 2ed70e0..0000000 --- a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/RowActions/index.jsx +++ /dev/null @@ -1,15 +0,0 @@ -"use client"; - -import ReferForm from "./Refer"; -import TaskDetail from "./TaskDetail"; -import { Box } from "@mui/material"; - -const RowActions = ({ row, mutate }) => { - return ( - - - - - ); -}; -export default RowActions; diff --git a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/TaskList.jsx b/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/TaskList.jsx deleted file mode 100644 index 14a0e35..0000000 --- a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/TaskList.jsx +++ /dev/null @@ -1,145 +0,0 @@ -"use client"; - -import { useMemo } from "react"; -import { Box } from "@mui/material"; -import DataTableWithAuth from "@/core/components/DataTableWithAuth"; -import RowActions from "./RowActions"; - -const TaskList = () => { - const columns = useMemo( - () => [ - { - accessorKey: "id", - header: "کد یکتا", - id: "id", - enableColumnFilter: false, - datatype: "text", - filterMode: "notEquals", - }, - { - accessorKey: "aplication_number", - header: "شماره درخواست", - id: "aplication_number", - enableColumnFilter: false, - datatype: "text", - filterMode: "notEquals", - }, - { - accessorKey: "application_date", - header: "تاریخ درخواست", - id: "application_date", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "province", - header: "استان", - id: "province", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "township", - header: "شهرستان", - id: "township", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "city", - header: "شهر", - id: "city", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "county", - header: "بخش", - id: "county", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "village", - header: "روستا", - id: "village", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "land_area", - header: "مساحت زمین", - id: "land_area", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_area", - header: "مساحت طرح", - id: "design_area", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "organization", - header: "سازمان", - id: "organization", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_group", - header: "گروه طرح", - id: "design_group", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_title", - header: "عنوان طرح", - id: "design_title", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "state", - header: "وضعیت درخواست", - id: "state", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - ], - [] - ); - - return ( - <> - - - - - ); -}; -export default TaskList; diff --git a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/index.jsx b/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/index.jsx deleted file mode 100644 index 4af891c..0000000 --- a/src/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov/index.jsx +++ /dev/null @@ -1,14 +0,0 @@ -"use client"; -import PageTitle from "@/core/components/PageTitle"; -import { Stack } from "@mui/material"; -import TaskList from "./TaskList"; - -const CityAdminZaminGovComponent = () => { - return ( - - - - - ); -}; -export default CityAdminZaminGovComponent; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx deleted file mode 100644 index ba2cdeb..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import { FormControl, FormHelperText, InputLabel, OutlinedInput, Stack } from "@mui/material"; - -const DescriptionForm = ({ errors, register }) => { - return ( - - - - توضیحات - - - - {errors.description ? errors.description.message : null} - - - - ); -}; -export default DescriptionForm; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/ManagerOrAssistantSubmit.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/ManagerOrAssistantSubmit.jsx deleted file mode 100644 index d755b7c..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/ManagerOrAssistantSubmit.jsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Button } from "@mui/material"; - -const ManagerOrAssistantSubmit = ({ isSubmitting }) => { - return ( - <> - - - - ); -}; -export default ManagerOrAssistantSubmit; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx deleted file mode 100644 index 365c1b4..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Card, CardContent, CardHeader, CircularProgress, Divider, Stack, Typography } from "@mui/material"; -import usePrevStateOpinion from "@/lib/hooks/usePrevStateopinion"; - -const PrevCartableOpinion = ({ message, loadingMessage, errorMessage }) => { - return ( - - - - - {errorMessage ? ( - خطا در دریافت اطلاعات !!! - ) : loadingMessage ? ( - - - درحال دریافت اطلاعات - - ) : ( - {message} - )} - - - - - ); -}; -export default PrevCartableOpinion; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx deleted file mode 100644 index 5410d66..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Card, CardContent, FormControl, FormLabel, Stack, Typography } from "@mui/material"; - -const QuestionSafetyForm = () => { - return ( - - - - - - - آیا ایمنی راه این طرح مورد تایید است ؟ - - - - دفتر حریم راه : - - بله - - - - - - - ); -}; -export default QuestionSafetyForm; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/RoadSafetyFormContext.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/RoadSafetyFormContext.jsx deleted file mode 100644 index 68ffecf..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/RoadSafetyFormContext.jsx +++ /dev/null @@ -1,82 +0,0 @@ -import { DialogActions, DialogContent, Stack } from "@mui/material"; -import StyledForm from "@/core/components/StyledForm"; -import useRequest from "@/lib/hooks/useRequest"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { object, string } from "yup"; -import { SUBMIT_ROAD_SAFETY_FORM } from "@/core/utils/routes"; -import QuestionSafetyForm from "./QuestionSafetyForm"; -import PrevCartableOpinion from "./PrevCartableOpinion"; -import DescriptionForm from "./DescriptionForm"; -import ManagerOrAssistantSubmit from "./ManagerOrAssistantSubmit"; -import usePrevStateOpinion from "@/lib/hooks/usePrevStateopinion"; -import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail"; -const fakeData = { - id: 1, - shomareh_darkhast: "2124", - ostan: "ostan", - shahr: "shahr", - shahrestan: "shahrestan", - bakhsh: "bakhsh", - roosta: "roosta", - tarikh_darkhast: "tarikh_darkhast", - sazman: "sazman", - masahat_zamin: "masahat_zamin", - masahat_tarh: "masahat_tarh", - gorooh_tarh: "gorooh_tarh", - onvane_tarh: "onvane_tarh", - address: "کرج - فلان جا - جنب پاساژ - نزدیک اونجا - اونور خیابون - زیر رو گذر - روی زیر گذر", - file_mosavab: "file", - polygon: [ - [51.515, -0.09], - [51.52, -0.1], - [51.52, -0.12], - ], -}; -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), -}); -const RoadSafetyFormContext = ({ rowId, mutate, setOpenRoadSafetyForm }) => { - const defaultValues = { - description: "", - }; - const requestServer = useRequest({ notificationSuccess: true }); - const { message, loadingMessage, errorMessage } = usePrevStateOpinion(); - const { - register, - handleSubmit, - formState: { isSubmitting, errors }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - requestServer(`${SUBMIT_ROAD_SAFETY_FORM}/${rowId}`, "post", { - data: formData, - }) - .then(() => { - setOpenRoadSafetyForm(false); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - - - - - - - - ); -}; -export default RoadSafetyFormContext; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/index.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/index.jsx deleted file mode 100644 index a4de0d7..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/RoadSafetyForm/index.jsx +++ /dev/null @@ -1,52 +0,0 @@ -import { Dialog, IconButton, Stack, Tooltip } from "@mui/material"; -import EngineeringIcon from "@mui/icons-material/Engineering"; -import DialogTransition from "@/core/components/DialogTransition"; -import { useState } from "react"; -import { Close } from "@mui/icons-material"; -import RoadSafetyFormContext from "./RoadSafetyFormContext"; - -const RoadSafetyForm = ({ rowId, mutate }) => { - const [openRoadSafetyForm, setOpenRoadSafetyForm] = useState(false); - return ( - - - { - setOpenRoadSafetyForm(true); - }} - > - - - - - setOpenRoadSafetyForm(false)} - sx={{ - position: "absolute", - right: 8, - top: 8, - zIndex: 10, - color: (theme) => theme.palette.grey[500], - }} - > - - - - - - ); -}; -export default RoadSafetyForm; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/TaskDetail/DetailDialog.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/TaskDetail/DetailDialog.jsx deleted file mode 100644 index 777eecf..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/TaskDetail/DetailDialog.jsx +++ /dev/null @@ -1,75 +0,0 @@ -"use client"; - -import { Dialog, DialogContent } from "@mui/material"; -import { object, string } from "yup"; -import useRequest from "@/lib/hooks/useRequest"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import StyledForm from "@/core/components/StyledForm"; -import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail"; - -const fakeData = { - id: 1, - shomareh_darkhast: "2124", - ostan: "ostan", - shahr: "shahr", - shahrestan: "shahrestan", - bakhsh: "bakhsh", - roosta: "roosta", - tarikh_darkhast: "tarikh_darkhast", - sazman: "sazman", - masahat_zamin: "masahat_zamin", - masahat_tarh: "masahat_tarh", - gorooh_tarh: "gorooh_tarh", - onvane_tarh: "onvane_tarh", - address: "کرج - فلان جا - جنب پاساژ - نزدیک اونجا - اونور خیابون - زیر رو گذر - روی زیر گذر", - file_mosavab: "file", - polygon: [ - [51.515, -0.09], - [51.52, -0.1], - [51.52, -0.12], - ], -}; - -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), -}); - -const DetailDialog = ({ taskModal, setTaskModal, rowId, mutate }) => { - const requestServer = useRequest({ auth: true }); - const defaultValues = { - description: "", - }; - const handleClose = () => { - setTaskModal(false); - }; - - const { - register, - handleSubmit, - formState: { isSubmitting, errors, touchedFields }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - requestServer(`api-for-send-to-harim/${rowId}`, "post", { - data: formData, - }) - .then(() => { - handleClose(); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - - ); -}; -export default DetailDialog; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/TaskDetail/index.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/TaskDetail/index.jsx deleted file mode 100644 index 1641840..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/TaskDetail/index.jsx +++ /dev/null @@ -1,26 +0,0 @@ -"use client"; - -import { IconButton, Tooltip } from "@mui/material"; -import AssignmentIcon from "@mui/icons-material/Assignment"; -import DetailDialog from "./DetailDialog"; -import { useState } from "react"; - -const TaskDetail = ({ rowId, mutate }) => { - const [taskModal, setTaskModal] = useState(false); - - const openDetailDialog = () => { - setTaskModal(true); - }; - - return ( - <> - - - - - - - - ); -}; -export default TaskDetail; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/index.jsx deleted file mode 100644 index ae4213c..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/RowActions/index.jsx +++ /dev/null @@ -1,13 +0,0 @@ -import TaskDetail from "./TaskDetail"; -import { Box } from "@mui/material"; -import RoadSafetyForm from "./RoadSafetyForm"; - -const RowActions = ({ row, mutate }) => { - return ( - - - - - ); -}; -export default RowActions; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/TaskList.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/TaskList.jsx deleted file mode 100644 index cb0bd3d..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/TaskList.jsx +++ /dev/null @@ -1,145 +0,0 @@ -"use client"; - -import { useMemo } from "react"; -import { Box } from "@mui/material"; -import DataTableWithAuth from "@/core/components/DataTableWithAuth"; -import RowActions from "./RowActions"; - -const TaskList = () => { - const columns = useMemo( - () => [ - { - accessorKey: "id", - header: "کد یکتا", - id: "id", - enableColumnFilter: false, - datatype: "text", - filterMode: "notEquals", - }, - { - accessorKey: "aplication_number", - header: "شماره درخواست", - id: "aplication_number", - enableColumnFilter: false, - datatype: "text", - filterMode: "notEquals", - }, - { - accessorKey: "application_date", - header: "تاریخ درخواست", - id: "application_date", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "province", - header: "استان", - id: "province", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "township", - header: "شهرستان", - id: "township", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "city", - header: "شهر", - id: "city", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "county", - header: "بخش", - id: "county", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "village", - header: "روستا", - id: "village", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "land_area", - header: "مساحت زمین", - id: "land_area", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_area", - header: "مساحت طرح", - id: "design_area", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "organization", - header: "سازمان", - id: "organization", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_group", - header: "گروه طرح", - id: "design_group", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_title", - header: "عنوان طرح", - id: "design_title", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "state", - header: "وضعیت درخواست", - id: "state", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - ], - [] - ); - - return ( - <> - - - - - ); -}; -export default TaskList; diff --git a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/index.jsx b/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/index.jsx deleted file mode 100644 index ef66f17..0000000 --- a/src/components/dashboard/inquiryPrivacy/generalManager/zaminGov/index.jsx +++ /dev/null @@ -1,15 +0,0 @@ -"use client"; - -import PageTitle from "@/core/components/PageTitle"; -import { Stack } from "@mui/material"; -import TaskList from "./TaskList"; - -const GeneralManagerZaminGovComponent = () => { - return ( - - - - - ); -}; -export default GeneralManagerZaminGovComponent; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/MapActionButtons.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/MapActionButtons.jsx deleted file mode 100644 index 600372d..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/MapActionButtons.jsx +++ /dev/null @@ -1,100 +0,0 @@ -import { Box, Button, ButtonGroup } from "@mui/material"; -import AutoModeIcon from "@mui/icons-material/AutoMode"; -import DeleteIcon from "@mui/icons-material/Delete"; -import EditLocationAltIcon from "@mui/icons-material/EditLocationAlt"; -import SaveIcon from "@mui/icons-material/Save"; -import CancelIcon from "@mui/icons-material/Cancel"; - -const MapActionButtons = ({ - disableToCreate, - disableToEditAndDelete, - disableToSaveAndCancel, - onDraw, - onEdit, - onRemove, - onSave, - onCancel, -}) => ( - <> - - - - - - - - - - - - - -); - -export default MapActionButtons; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/MapModifyDialog.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/MapModifyDialog.jsx deleted file mode 100644 index 218cce5..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/MapModifyDialog.jsx +++ /dev/null @@ -1,96 +0,0 @@ -"use client"; - -import { - Box, - Button, - Chip, - Dialog, - DialogActions, - DialogContent, - Divider, - FormControl, - FormControlLabel, - FormLabel, - Radio, - RadioGroup, - Typography, -} from "@mui/material"; -import dynamic from "next/dynamic"; -import MapLoading from "@/core/components/MapLayer/Loading"; -import "leaflet-draw/dist/leaflet.draw.css"; -import GppMaybeIcon from "@mui/icons-material/GppMaybe"; -import PolygonForDesign from "./PolygonForDesign"; - -const MapLayer = dynamic(() => import("@/core/components/MapLayer"), { - loading: () => , - ssr: false, -}); - -const MapModifyDialog = ({ mapModifyModal, setMapModifyModal }) => { - const handleClose = () => { - setMapModifyModal(false); - }; - - return ( - - - - - - - - - - - - - - نکته: اصلاح ننمودن طرح به منزله تایید طرح میباشد. - - - - - - آیا طرح نیاز به ایجاد راه دسترسی دارد؟ - - - } label="بله" /> - } label="خیر" /> - - - - - - - - - - ); -}; - -export default MapModifyDialog; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/PolygonForDesign.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/PolygonForDesign.jsx deleted file mode 100644 index f765e41..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/PolygonForDesign.jsx +++ /dev/null @@ -1,115 +0,0 @@ -"use client"; - -import { FeatureGroup, useMap } from "react-leaflet"; -import { EditControl } from "react-leaflet-draw"; -import { useEffect, useRef, useState } from "react"; -import MapActionButtons from "./MapActionButtons"; - -const PolygonForDesign = () => { - const map = useMap(); - const editableFG = useRef(null); - const [polygonLayer, setPolygonLayer] = useState(null); - const [disableToCreate, setDisableToCreate] = useState(false); - const [disableToEditAndDelete, setDisableToEditAndDelete] = useState(true); - const [disableToSaveAndCancel, setDisableToSaveAndCancel] = useState(true); - const [editToolbar, setEditToolbar] = useState(null); - - useEffect(() => { - const { L } = window; - L.drawLocal.draw.handlers.polygon.tooltip = { - start: "برای شروع کشیدن پلیگان، کلیک کنید.", - cont: "گوشه های دیگر پلیگان را نیز انتخاب کنید.", - end: "برای اتمام رسم پلیگان، نقطه آخر را به اول متصل نمایید.", - }; - L.drawLocal.edit.handlers.edit.tooltip = { - text: "برای ذخیر یا لغو تغییرات، از دکمه های بالا سمت چپ استفاده نمایید.", - subtext: "نقاط مشخص شده را گرفته و برای ویرایش جابجا نمایید.", - }; - }, []); - - const handleDrawPolygon = () => { - const { L } = window; - const drawControl = new L.Draw.Polygon(map); - drawControl.enable(); - setDisableToCreate(true); - }; - - const handleEditPolygon = () => { - const { L } = window; - if (editableFG.current && polygonLayer) { - const editControlInstance = new L.EditToolbar.Edit(map, { - featureGroup: editableFG.current, - }); - editControlInstance.enable(); - setEditToolbar(editControlInstance); - setDisableToEditAndDelete(true); - setDisableToSaveAndCancel(false); - } - }; - - const handleRemovePolygon = () => { - if (polygonLayer && editableFG.current) { - editableFG.current.removeLayer(polygonLayer); - setPolygonLayer(null); - setDisableToEditAndDelete(true); - setDisableToCreate(false); - } - }; - - const handleSavePolygon = () => { - if (editToolbar) { - editToolbar.save(); - editToolbar.disable(); - setDisableToEditAndDelete(false); - setDisableToSaveAndCancel(true); - } - }; - - const handleCancelEdit = () => { - if (editToolbar) { - editToolbar.revertLayers(); - editToolbar.disable(); - setDisableToEditAndDelete(false); - setDisableToSaveAndCancel(true); - } - }; - - const handlePolygonCreate = (e) => { - const layer = e.layer; - setPolygonLayer(layer); - editableFG.current.addLayer(layer); - setDisableToEditAndDelete(false); - }; - - return ( - <> - - - - - - ); -}; - -export default PolygonForDesign; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/index.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/index.jsx deleted file mode 100644 index 970f93c..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/MapModify/index.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import { IconButton, Tooltip } from "@mui/material"; -import MapIcon from "@mui/icons-material/Map"; -import { useState } from "react"; -import MapModifyDialog from "./MapModifyDialog"; - -const MapModify = ({ rowId, mutate }) => { - const [mapModifyModal, setMapModifyModal] = useState(false); - - const openMapModifyDialog = () => { - setMapModifyModal(true); - }; - - return ( - <> - - - - - - - - ); -}; -export default MapModify; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/Refer/ReferFormContext.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/Refer/ReferFormContext.jsx deleted file mode 100644 index 221e411..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/Refer/ReferFormContext.jsx +++ /dev/null @@ -1,139 +0,0 @@ -import { - Autocomplete, - Button, - CircularProgress, - DialogActions, - DialogContent, - FormControl, - FormHelperText, - InputLabel, - OutlinedInput, - Stack, - TextField, - Typography, -} from "@mui/material"; -import { Controller, useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { object, string } from "yup"; -import StyledForm from "@/core/components/StyledForm"; -import useProvinces from "@/lib/hooks/useProvince"; -import useRequest from "@/lib/hooks/useRequest"; -import { REFER_ADMIN_PROVINCE } from "@/core/utils/routes"; - -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), - province: string().required("وارد کردن استان الزامیست!"), -}); - -const ReferFormContext = ({ setOpenReferDialog, rowId, mutate }) => { - const defaultValues = { - description: "", - province: "", - }; - const { provinces, loadingProvinces, errorProvinces } = useProvinces(); - const requestServer = useRequest({ notificationSuccess: true }); - const { - control, - register, - handleSubmit, - formState: { isSubmitting, errors, touchedFields }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - formData.append("provinceId", data.province); - - requestServer(`${REFER_ADMIN_PROVINCE}/${rowId}`, "post", { - data: formData, - }) - .then(() => { - setOpenReferDialog(false); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - توضیحات - - - - {errors.description ? errors.description.message : null} - - - - - ( - - - {errorProvinces ? ( - خطایی در دریافت استان ها رخ داده است! - ) : loadingProvinces ? ( - - - درحال دریافت لیست استان ها - - ) : ( - province.id === value) || null} - disablePortal - options={provinces} - getOptionLabel={(province) => province.name_fa} - isOptionEqualToValue={(option, value) => option.id === value.id} - onChange={(event, newValue) => { - onChange(newValue ? newValue.id : ""); - }} - renderInput={(params) => ( - - )} - /> - )} - - {errors.province ? errors.province.message : null} - - - )} - /> - - - - - - - - - ); -}; -export default ReferFormContext; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/Refer/index.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/Refer/index.jsx deleted file mode 100644 index ee76b95..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/Refer/index.jsx +++ /dev/null @@ -1,41 +0,0 @@ -import { Dialog, DialogTitle, IconButton, Stack, Tooltip } from "@mui/material"; -import ReplyIcon from "@mui/icons-material/Reply"; -import DialogTransition from "@/core/components/DialogTransition"; -import { useState } from "react"; -import ReferFormContext from "./ReferFormContext"; - -const ReferForm = ({ rowId, mutate }) => { - const [openReferDialog, setOpenReferDialog] = useState(false); - return ( - - - { - setOpenReferDialog(true); - }} - > - - - - - - ارجاع به استان دیگر - - - - - ); -}; -export default ReferForm; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx deleted file mode 100644 index ba2cdeb..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/DescriptionForm.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import { FormControl, FormHelperText, InputLabel, OutlinedInput, Stack } from "@mui/material"; - -const DescriptionForm = ({ errors, register }) => { - return ( - - - - توضیحات - - - - {errors.description ? errors.description.message : null} - - - - ); -}; -export default DescriptionForm; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx deleted file mode 100644 index 74f9b45..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/PrevCartableOpinion.jsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Card, CardContent, CardHeader, CircularProgress, Divider, Stack, Typography } from "@mui/material"; -import usePrevStateOpinion from "@/lib/hooks/usePrevStateopinion"; - -const PrevCartableOpinion = () => { - const { message, loadingMessage, errorMessage } = usePrevStateOpinion(); - return ( - - - - - {errorMessage ? ( - خطا در دریافت اطلاعات !!! - ) : loadingMessage ? ( - - - درحال دریافت اطلاعات - - ) : ( - {message} - )} - - - - - ); -}; -export default PrevCartableOpinion; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx deleted file mode 100644 index ef005b8..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/QuestionSafetyForm.jsx +++ /dev/null @@ -1,57 +0,0 @@ -import { - Card, - CardContent, - FormControl, - FormControlLabel, - FormLabel, - RadioGroup, - Stack, - Typography, -} from "@mui/material"; -import Radio from "@mui/material/Radio"; - -const QuestionSafetyForm = ({ register, errors }) => { - return ( - - - - - - - آیا ایمنی راه این طرح مورد تایید است ؟ - - - - - } - label="بله" - {...register("RadioGroup")} - /> - } - label="خیر" - {...register("RadioGroup")} - /> - - - {errors.RadioGroup && ( - - {errors.RadioGroup.message} - - )} - - - - - ); -}; -export default QuestionSafetyForm; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/RoadSaftyFormContext.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/RoadSaftyFormContext.jsx deleted file mode 100644 index 8be0c6c..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/RoadSaftyFormContext.jsx +++ /dev/null @@ -1,80 +0,0 @@ -import { DialogActions, DialogContent, Stack } from "@mui/material"; -import StyledForm from "@/core/components/StyledForm"; -import useRequest from "@/lib/hooks/useRequest"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { object, string } from "yup"; -import QuestionSafetyForm from "./QuestionSafetyForm"; -import PrevCartableOpinion from "./PrevCartableOpinion"; -import DescriptionForm from "./DescriptionForm"; -import SubmitButtonsAdmin from "./SubmitButtonsAdmin"; -import { SUBMIT_ROAD_SAFETY_FORM } from "@/core/utils/routes"; -import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail"; -const fakeData = { - id: 1, - shomareh_darkhast: "2124", - ostan: "ostan", - shahr: "shahr", - shahrestan: "shahrestan", - bakhsh: "bakhsh", - roosta: "roosta", - tarikh_darkhast: "tarikh_darkhast", - sazman: "sazman", - masahat_zamin: "masahat_zamin", - masahat_tarh: "masahat_tarh", - gorooh_tarh: "gorooh_tarh", - onvane_tarh: "onvane_tarh", - address: "کرج - فلان جا - جنب پاساژ - نزدیک اونجا - اونور خیابون - زیر رو گذر - روی زیر گذر", - file_mosavab: "file", - polygon: [ - [51.515, -0.09], - [51.52, -0.1], - [51.52, -0.12], - ], -}; -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), - RadioGroup: string().required("تاییدیه ایمنی راه ضروریست!"), -}); -const RoadSafetyFormContext = ({ rowId, mutate, setOpenRoadSafetyForm }) => { - const defaultValues = { - description: "", - RadioGroup: "", - }; - const requestServer = useRequest({ notificationSuccess: true }); - const { - register, - handleSubmit, - formState: { isSubmitting, errors }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - formData.append("provinceId", data.RadioGroup); - - requestServer(`${SUBMIT_ROAD_SAFETY_FORM}/${rowId}`, "post", { - data: formData, - }) - .then(() => { - setOpenRoadSafetyForm(false); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - - - - - - - - ); -}; -export default RoadSafetyFormContext; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/SubmitButtonsAdmin.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/SubmitButtonsAdmin.jsx deleted file mode 100644 index 611457f..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/SubmitButtonsAdmin.jsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Button } from "@mui/material"; - -const SubmitButtonsAdmin = ({ setOpenRoadSafetyForm, isSubmitting }) => { - return ( - <> - - - - ); -}; -export default SubmitButtonsAdmin; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/index.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/index.jsx deleted file mode 100644 index 9787ef5..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/RoadSafetyForm/index.jsx +++ /dev/null @@ -1,52 +0,0 @@ -import { Dialog, IconButton, Stack, Tooltip } from "@mui/material"; -import EngineeringIcon from "@mui/icons-material/Engineering"; -import DialogTransition from "@/core/components/DialogTransition"; -import { useState } from "react"; -import RoadSafetyFormContext from "./RoadSaftyFormContext"; -import { Close } from "@mui/icons-material"; - -const RoadSafetyForm = ({ rowId, mutate }) => { - const [openRoadSafetyForm, setOpenRoadSafetyForm] = useState(false); - return ( - - - { - setOpenRoadSafetyForm(true); - }} - > - - - - - setOpenRoadSafetyForm(false)} - sx={{ - position: "absolute", - right: 8, - top: 8, - zIndex: 10, - color: (theme) => theme.palette.grey[500], - }} - > - - - - - - ); -}; -export default RoadSafetyForm; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/TaskDetail/DetailDialog.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/TaskDetail/DetailDialog.jsx deleted file mode 100644 index 777eecf..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/TaskDetail/DetailDialog.jsx +++ /dev/null @@ -1,75 +0,0 @@ -"use client"; - -import { Dialog, DialogContent } from "@mui/material"; -import { object, string } from "yup"; -import useRequest from "@/lib/hooks/useRequest"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import StyledForm from "@/core/components/StyledForm"; -import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail"; - -const fakeData = { - id: 1, - shomareh_darkhast: "2124", - ostan: "ostan", - shahr: "shahr", - shahrestan: "shahrestan", - bakhsh: "bakhsh", - roosta: "roosta", - tarikh_darkhast: "tarikh_darkhast", - sazman: "sazman", - masahat_zamin: "masahat_zamin", - masahat_tarh: "masahat_tarh", - gorooh_tarh: "gorooh_tarh", - onvane_tarh: "onvane_tarh", - address: "کرج - فلان جا - جنب پاساژ - نزدیک اونجا - اونور خیابون - زیر رو گذر - روی زیر گذر", - file_mosavab: "file", - polygon: [ - [51.515, -0.09], - [51.52, -0.1], - [51.52, -0.12], - ], -}; - -const validationSchema = object({ - description: string().required("وارد کردن توضیحات الزامیست!"), -}); - -const DetailDialog = ({ taskModal, setTaskModal, rowId, mutate }) => { - const requestServer = useRequest({ auth: true }); - const defaultValues = { - description: "", - }; - const handleClose = () => { - setTaskModal(false); - }; - - const { - register, - handleSubmit, - formState: { isSubmitting, errors, touchedFields }, - } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" }); - - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("description", data.description); - requestServer(`api-for-send-to-harim/${rowId}`, "post", { - data: formData, - }) - .then(() => { - handleClose(); - mutate(); - }) - .catch(() => {}); - }; - return ( - - - - - - - - ); -}; -export default DetailDialog; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/TaskDetail/index.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/TaskDetail/index.jsx deleted file mode 100644 index 1641840..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/TaskDetail/index.jsx +++ /dev/null @@ -1,26 +0,0 @@ -"use client"; - -import { IconButton, Tooltip } from "@mui/material"; -import AssignmentIcon from "@mui/icons-material/Assignment"; -import DetailDialog from "./DetailDialog"; -import { useState } from "react"; - -const TaskDetail = ({ rowId, mutate }) => { - const [taskModal, setTaskModal] = useState(false); - - const openDetailDialog = () => { - setTaskModal(true); - }; - - return ( - <> - - - - - - - - ); -}; -export default TaskDetail; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/index.jsx deleted file mode 100644 index 2d324bc..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/RowActions/index.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import ReferForm from "./Refer"; -import TaskDetail from "./TaskDetail"; -import { Box } from "@mui/material"; -import RoadSafetyForm from "./RoadSafetyForm"; -import MapModify from "./MapModify"; - -const RowActions = ({ row, mutate }) => { - return ( - - - - - - - ); -}; -export default RowActions; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/TaskList.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/TaskList.jsx deleted file mode 100644 index 188c1d6..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/TaskList.jsx +++ /dev/null @@ -1,145 +0,0 @@ -"use client"; - -import { useMemo } from "react"; -import { Box } from "@mui/material"; -import DataTableWithAuth from "@/core/components/DataTableWithAuth"; -import RowActions from "./RowActions"; - -const TaskList = () => { - const columns = useMemo( - () => [ - { - accessorKey: "id", - header: "کد یکتا", - id: "id", - enableColumnFilter: false, - datatype: "text", - filterMode: "notEquals", - }, - { - accessorKey: "aplication_number", - header: "شماره درخواست", - id: "aplication_number", - enableColumnFilter: false, - datatype: "text", - filterMode: "notEquals", - }, - { - accessorKey: "application_date", - header: "تاریخ درخواست", - id: "application_date", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "province", - header: "استان", - id: "province", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "township", - header: "شهرستان", - id: "township", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "city", - header: "شهر", - id: "city", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "county", - header: "بخش", - id: "county", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "village", - header: "روستا", - id: "village", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "land_area", - header: "مساحت زمین", - id: "land_area", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_area", - header: "مساحت طرح", - id: "design_area", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "organization", - header: "سازمان", - id: "organization", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_group", - header: "گروه طرح", - id: "design_group", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "design_title", - header: "عنوان طرح", - id: "design_title", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - { - accessorKey: "state", - header: "وضعیت درخواست", - id: "state", - enableColumnFilter: false, - datatype: "text", - filterMode: "equals", - }, - ], - [] - ); - - return ( - <> - - - - - ); -}; -export default TaskList; diff --git a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/index.jsx b/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/index.jsx deleted file mode 100644 index 936d610..0000000 --- a/src/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov/index.jsx +++ /dev/null @@ -1,15 +0,0 @@ -"use client"; - -import PageTitle from "@/core/components/PageTitle"; -import { Stack } from "@mui/material"; -import TaskList from "./TaskList"; - -const ProvinceAdminZaminGovComponent = () => { - return ( - - - - - ); -}; -export default ProvinceAdminZaminGovComponent; diff --git a/src/core/utils/pageMenuDev.js b/src/core/utils/pageMenuDev.js index 5fda757..68c6537 100644 --- a/src/core/utils/pageMenuDev.js +++ b/src/core/utils/pageMenuDev.js @@ -295,32 +295,32 @@ export const pageMenuDev = [ hasSubitems: true, Subitems: [ { - id: "cityAdminZaminGov", - label: "استعلام حرائم پنجره واحد", + id: "cityAdmin", + label: "کارتابل شهرستان", type: "page", - route: "/dashboard/inquiry-privacy/city-admin/zamin-gov", - permissions: [], + route: "/dashboard/inquiry-privacy/city-admin", + permissions: ["all"], }, { - id: "provinceAdminZaminGov", - label: "استعلام حرائم پنجره واحد", + id: "privacyOffice", + label: "کارتابل اداره حریم", type: "page", - route: "/dashboard/inquiry-privacy/province-admin/zamin-gov", - permissions: [], + route: "/dashboard/inquiry-privacy/privacy-office", + permissions: ["all"], }, { - id: "assistantZaminGov", - label: "استعلام حرائم پنجره واحد", + id: "assistant", + label: "کارتابل معاون", type: "page", - route: "/dashboard/inquiry-privacy/assistant/zamin-gov", - permissions: [], + route: "/dashboard/inquiry-privacy/assistant", + permissions: ["all"], }, { - id: "generalManagerZaminGov", - label: "استعلام حرائم پنجره واحد", + id: "generalManager", + label: "کارتابل مدیر", type: "page", - route: "/dashboard/inquiry-privacy/general-manager/zamin-gov", - permissions: [], + route: "/dashboard/inquiry-privacy/general-manager", + permissions: ["all"], }, ], }, diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js index 1ddf8dc..780cd12 100644 --- a/src/core/utils/routes.js +++ b/src/core/utils/routes.js @@ -234,3 +234,6 @@ export const GET_RAHDARAN_TABLE_LIST = api + "/api/v3/rahdaran"; export const DELETE_RAHDARAN_ITEM = api + "/api/v3/rahdaran"; export const UPDATE_RAHDARAN_ITEM = api + "/api/v3/rahdaran"; export const CREATE_RAHDARAN_ITEM = api + "/api/v3/rahdaran"; + +// estelam harim +export const GET_CITY_ADMIN_LIST = api + "/api/v3/harim/province_office"; \ No newline at end of file From 7f1122233058271ba9c09b64c8da7c002255bea4 Mon Sep 17 00:00:00 2001 From: mhmjalali Date: Sun, 2 Nov 2025 10:33:35 +0330 Subject: [PATCH 2/5] solve bug of two polygon editable --- src/assets/scss/leaflet-measure.scss | 170 ++++++++++++++++ .../city-admin/CityAdminList.jsx | 188 +++++++++++++++++- .../MapDrawPolygon/DrawBound.jsx | 114 +++++++++++ .../FeedbackAction/MapDrawPolygon/index.jsx | 116 +++++++++++ .../RowActions/FeedbackAction/index.jsx | 135 +++++++++++++ .../city-admin/RowActions/index.jsx | 9 +- .../city-admin/ShowPrimaryArea/ShowBound.jsx | 29 +++ .../city-admin/ShowPrimaryArea/index.jsx | 61 ++++++ .../RowActions/ConfirmAction/index.jsx | 0 .../RowActions/RejectAction/index.jsx | 0 .../privacy-office/RowActions/index.jsx | 14 ++ .../inquiryPrivacy/privacy-office/index.jsx | 0 src/core/utils/pageMenuDev.js | 8 + src/core/utils/routes.js | 4 +- src/lib/hooks/useInquiryPrivacyState.js | 30 +++ 15 files changed, 868 insertions(+), 10 deletions(-) create mode 100644 src/assets/scss/leaflet-measure.scss create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/index.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/ShowBound.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/index.jsx rename src/components/dashboard/inquiryPrivacy/{city-admin => privacy-office}/RowActions/ConfirmAction/index.jsx (100%) rename src/components/dashboard/inquiryPrivacy/{city-admin => privacy-office}/RowActions/RejectAction/index.jsx (100%) create mode 100644 src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/privacy-office/index.jsx create mode 100644 src/lib/hooks/useInquiryPrivacyState.js diff --git a/src/assets/scss/leaflet-measure.scss b/src/assets/scss/leaflet-measure.scss new file mode 100644 index 0000000..97e3bc1 --- /dev/null +++ b/src/assets/scss/leaflet-measure.scss @@ -0,0 +1,170 @@ +// leaflet-measure.scss + +$color-divider: #ddd; +$color-button: #5e66cc; +$color-lightertext: #999; + +$spacing-external: 12px; +$spacing-internal: 10px; + +$max-width: 280px; + +$button-icon-size: 12px; +$button-icon-spacing: 4px; + +@mixin hoverbutton { + color: $color-button; + text-decoration: none; + &:hover { + opacity: 0.5; + text-decoration: none; + } +} + +@mixin button ($icon) { + display: inline; + width: auto; + height: auto; + padding-left: 20px; + margin-right: $button-icon-spacing; + line-height: 1em; + border: 0; + text-align: left; + color: $color-button; + &, + &:hover { + background-color: transparent; + } + background: { + image: url('assets/#{ $icon }.png'); + repeat: no-repeat; + position: 0% 50%; + size: $button-icon-size $button-icon-size; + } + .leaflet-retina & { + background-image: url('assets/#{ $icon }_@2X.png'); + } + + @include hoverbutton; +} + +.leaflet-control-measure, +.leaflet-measure-resultpopup { + h3 { + margin: 0 0 $spacing-external 0; + padding-bottom: $spacing-internal; + border-bottom: solid 1px $color-divider; + } + p { + margin: $spacing-internal 0 0 0; + line-height: 1.5em; + &:first-child { + margin-top: 0; + } + } + .tasks { + margin: $spacing-external 0 0 0; + padding: $spacing-internal 0 0 0; + border-top: solid 1px $color-divider; + text-align: right; + + list-style: none; + list-style-image: none; + + li { + display: inline; + margin: 0 $spacing-internal 0 0; + &:last-child { + margin-right: 0; + } + } + } + + .coorddivider { + color: $color-lightertext; + } +} + +.leaflet-control-measure { + max-width: $max-width; + background: #fff; + + .leaflet-control-measure-toggle, + .leaflet-control-measure-toggle:hover { + background: { + size: 14px 14px; + image: url(assets/rulers.png); + } + border: 0; + border-radius: 4px; + .leaflet-touch & { + border-radius: 2px; + } + + // Hide text + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + + .leaflet-retina & { + background-image: url(assets/rulers_@2X.png); + } + + .leaflet-touch & { + background-size: 16px 16px; + } + } + + // Special styling because start prompt has no content, just header and tasks + .startprompt { + h3 { + margin-bottom: $spacing-internal; + } + .tasks { + margin-top: 0; + padding-top: 0; + border-top: 0; + text-align: left; + } + } + + .leaflet-control-measure-interaction { + padding: $spacing-internal $spacing-external; + } + + .results { + .group { + margin-top: $spacing-internal; + padding-top: $spacing-internal; + border-top: dotted 1px lighten($color-divider, 5); + &:first-child { + margin-top: 0; + padding-top: 0; + border-top: 0; + } + } + .heading { + margin-right: $spacing-internal * 0.5; + color: $color-lightertext; + } + } + + a.start { + @include button(start); + } + a.cancel { + @include button(cancel); + } + a.finish { + @include button(check); + } +} + +.leaflet-measure-resultpopup { + a.zoomto { + @include button(focus); + } + a.deletemarkup { + @include button(trash); + } +} \ No newline at end of file diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx index be14803..14b18ec 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx @@ -1,15 +1,37 @@ +import CustomSelectByDependency from '@/core/components/DataTable/filter/fieldsType/CustomSelectByDependency'; import DataTableWithAuth from '@/core/components/DataTableWithAuth'; import { GET_CITY_ADMIN_LIST } from '@/core/utils/routes'; -import { Box } from '@mui/material'; +import useInquiryPrivacyState from '@/lib/hooks/useInquiryPrivacyState'; +import { Box, Stack } from '@mui/material'; +import moment from 'jalali-moment'; import { useMemo } from 'react'; +import MapsHomeWorkIcon from '@mui/icons-material/MapsHomeWork'; +import SecurityIcon from '@mui/icons-material/Security'; +import ManageAccountsIcon from '@mui/icons-material/ManageAccounts'; +import PsychologyAltIcon from '@mui/icons-material/PsychologyAlt'; +import ReceiptLongIcon from '@mui/icons-material/ReceiptLong'; +import WindowIcon from '@mui/icons-material/Window'; +import DangerousIcon from '@mui/icons-material/Dangerous'; +import AutorenewIcon from '@mui/icons-material/Autorenew'; import RowActions from './RowActions'; +import ShowPrimaryArea from './ShowPrimaryArea'; const CityAdminList = () => { + const stateIcon = (state_id) => { + if (state_id === 1) return ; + if (state_id === 2 || state_id === 5 || state_id === 13) return ; + if (state_id === 3 || state_id === 6 || state_id === 14) return ; + if (state_id === 4 || state_id === 7 || state_id === 15) return ; + if (state_id === 8) return ; + if (state_id === 9 || state_id === 11) return ; + if (state_id === 10) return ; + if (state_id === 12) return ; + }; const columns = useMemo(() => { return [ { - accessorKey: "id", - header: "کد یکتا", + accessorKey: "panjare_vahed_id", + header: "کدرهگیری درخواست", id: "panjare_vahed_id", enableColumnFilter: true, datatype: "text", @@ -33,6 +55,166 @@ const CityAdminList = () => { size: 100, Cell: ({ row }) => <>{row.original.national_id}, }, + { + accessorKey: "state_id", + header: "وضعیت", + id: "state_id", + enableColumnFilter: true, + datatype: "numeric", + filterMode: "equals", + sortDescFirst: false, + grow: false, + size: 100, + ColumnSelectComponent: (props) => { + const { itemsList, loadingItemsList, errorItemsList } = useInquiryPrivacyState(); + + const getColumnSelectOptions = useMemo(() => { + if (loadingItemsList) { + return [{ value: "loading", label: "در حال بارگذاری..." }]; + } + if (errorItemsList) { + return [{ value: "error", label: "خطا در بارگذاری" }]; + } + return [ + { value: "", label: "همه موارد" }, + ...itemsList.map((item) => ({ + value: item.id, + label: item.name, + })), + ]; + }, [itemsList, loadingItemsList, errorItemsList]); + + return ( + + ); + }, + Cell: ({ row }) => ( + + {stateIcon(row.original.state_id)} + + {row.original.state_name} + + + ), + }, + { + accessorKey: "plan_title", + header: "عنوان طرح", + id: "plan_title", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.plan_title}, + }, + { + accessorKey: "plan_group", + header: "گروه طرح", + id: "plan_group", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.plan_group}, + }, + { + accessorKey: "requested_organization", + header: "دستگاه صادر کننده", + id: "requested_organization", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.requested_organization}, + }, + { + accessorKey: "worksheet_id", + header: "شناسه کاربرگ", + id: "worksheet_id", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.worksheet_id}, + }, + { + accessorKey: "primary_area", + header: "نمایش محدوده طرح", + id: "primary_area", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => row.original.primary_area ? ( + + + + ) : ("-"), + }, + { + accessorKey: "province_id", + header: "استان", + id: "province_id", + enableColumnFilter: false, + datatype: "numeric", + sortDescFirst: false, + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.province_name}, + }, + { + accessorKey: "city_id", + header: "شهر", + id: "city_id", + enableColumnFilter: false, + datatype: "numeric", + sortDescFirst: false, + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.city_name}, + }, + { + accessorKey: "isic", + header: "کد آیسیک", + id: "isic", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.isic}, + }, + { + accessorFn: (row) => moment(row.request_date).locale("fa").format("YYYY/MM/DD"), + header: "تاریخ درخواست", + id: "request_date", + enableColumnFilter: true, + datatype: "date", + filterMode: "between", + grow: false, + size: 100, + }, ]; }, []); diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx new file mode 100644 index 0000000..e715f3e --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx @@ -0,0 +1,114 @@ +import React, { useCallback, useEffect, useRef, useState } from "react"; +import L from "leaflet"; +import { FeatureGroup, useMap } from "react-leaflet"; +import "leaflet-draw"; + +const DrawPolygon = ({ control, controlDispach, drawBound, setDrawBound }) => { + const map = useMap(); + const featureRef = useRef(null); + const [area, setArea] = useState(); + const drawControlRef = useRef(null); + + const safeFitBounds = (layer) => { + if (!layer || !map) return; + try { + const latLngs = layer.getLatLngs(); + map.fitBounds(latLngs, { + paddingTopLeft: [20, 35], + paddingBottomRight: [20, 55], + }); + } catch (e) { + console.warn("fitBounds failed:", e); + } + }; + + const bindEditEvent = (layer) => { + if (!layer) return; + layer.on("edit", function (e) { + const editedLayer = e.target; + setArea(editedLayer); + setDrawBound(editedLayer); + }); + }; + + const handlerCreatedBound = useCallback((event) => { + const { layer } = event; + layer.editing.enable(); + featureRef.current.addLayer(layer); + setArea(layer); + setDrawBound(layer); + bindEditEvent(layer); + controlDispach({ type: "SET_STATUS", status: 2 }); + }, []); + + useEffect(() => { + if ( + control.status === 1 && + drawControlRef.current && + drawControlRef.current._toolbars?.draw?._modes?.polygon?.handler + ) { + drawControlRef.current._toolbars.draw._modes.polygon.handler.enable(); + } + }, [control.status]); + + useEffect(() => { + if (control.status === 0 && area && featureRef.current) { + featureRef.current.removeLayer(area); + setArea(null); + setDrawBound(null); + } + }, [control.status, area]); + + useEffect(() => { + if (control.status === 2 && drawBound && featureRef.current) { + setArea(drawBound); + featureRef.current.addLayer(drawBound); + drawBound.editing.enable(); + safeFitBounds(drawBound); + bindEditEvent(drawBound); + } + }, [control.status, drawBound]); + + useEffect(() => { + if (!featureRef.current) return; + + L.drawLocal.draw.handlers.polygon.tooltip.start = "برای شروع ترسیم محدوده، روی نقشه کلیک کنید"; + L.drawLocal.draw.handlers.polygon.tooltip.cont = "برای ادامه ترسیم، نقاط بعدی را کلیک کنید"; + L.drawLocal.draw.handlers.polygon.tooltip.end = "برای بستن محدوده، روی نقطه‌ی شروع کلیک کنید"; + + const drawControl = new L.Control.Draw({ + draw: { + polygon: { + shapeOptions: { + color: "red", + weight: 3, + clickable: true, + }, + }, + polyline: false, + rectangle: false, + circle: false, + marker: false, + circlemarker: false, + }, + edit: { + featureGroup: featureRef.current, + edit: true, + remove: false, + }, + }); + + drawControlRef.current = drawControl; + map.addControl(drawControl); + map.on(L.Draw.Event.CREATED, handlerCreatedBound); + + return () => { + map.off(L.Draw.Event.CREATED, handlerCreatedBound); + map.removeControl(drawControl); + }; + }, [map, handlerCreatedBound]); + + return ; +}; + +export default DrawPolygon; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx new file mode 100644 index 0000000..bef1529 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx @@ -0,0 +1,116 @@ +import { Delete, Route } from "@mui/icons-material"; +import { Box, Button, Stack, Typography } from "@mui/material"; +import { useReducer } from "react"; +import DrawPolygon from "./DrawBound"; + +const statusType = [ + { + id: 0, + message: "برای آغاز ترسیم محدوده، کلیک کنید!", + buttons: [ + { + label: "شروع ترسیم محدوده", + key: "start", + color: "warning", + icon: , + onclick: (controlDispach) => { + controlDispach({ type: "SET_STATUS", status: 1 }); + }, + }, + ], + }, + { + id: 1, + message: "محدوده‌ی موردنظر را با کلیک روی نقشه مشخص کنید. برای اتمام، روی نقطه‌ی ابتدایی کلیک کنید!", + buttons: [], + }, + { + id: 2, + message: "برای اصلاح محدوده، گوشه‌ها را بکشید. برای ترسیم دوباره، آن را حذف کنید", + buttons: [ + { + label: "حذف", + key: "end", + color: "error", + icon: , + onclick: (controlDispach) => { + controlDispach({ type: "SET_STATUS", status: 0 }); + }, + }, + ], + }, +]; + +const createInitialState = (drawBound) => { + if (drawBound) { + return { status: 2 }; + } + return { status: 0 }; +}; + +const reducer = (state, action) => { + switch (action.type) { + case "SET_STATUS": + return { ...state, status: action.status }; + default: + return state; + } +}; + +const MapDrawPolygon = ({ drawBound, setDrawBound }) => { + const [control, controlDispach] = useReducer(reducer, drawBound, createInitialState); + + return ( + <> + + + theme.palette.secondary.main, + borderBottomLeftRadius: 8, + borderBottomRightRadius: 8, + py: 0.5, + px: 2, + }} + > + + {statusType.find((st) => st.id == control.status).message} + + + + + + {statusType + .find((st) => st.id == control.status) + .buttons.map((button) => ( + + ))} + + + + ); +}; +export default MapDrawPolygon; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/index.jsx new file mode 100644 index 0000000..e954aeb --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/index.jsx @@ -0,0 +1,135 @@ +import MapLayer from "@/core/components/MapLayer"; +import { CITY_ADMIN_FEEDBACK } from "@/core/utils/routes"; +import useRequest from "@/lib/hooks/useRequest"; +import { yupResolver } from "@hookform/resolvers/yup"; +import CloseIcon from "@mui/icons-material/Close"; +import ForumIcon from '@mui/icons-material/Forum'; +import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, TextField, Tooltip, Typography } from '@mui/material'; +import { useEffect, useMemo, useState } from 'react'; +import { useForm } from "react-hook-form"; +import { object, string } from 'yup'; +import ShowBound from "../../ShowPrimaryArea/ShowBound"; +import MapDrawPolygon from "./MapDrawPolygon"; + +const validationSchema = object({ + expert_description: string().required("توضیحات ناظر اجباری است!"), +}); + +const FeedbackAction = ({rowId, mutate, rowPrimaryArea}) => { + const requestServer = useRequest({ notificationSuccess: true }); + const [openFeedbackDialog, setOpenFeedbackDialog] = useState(false); + const [drawBound, setDrawBound] = useState(null); + const bound = useMemo(() => { + const latLngCoords = rowPrimaryArea.coordinates.map(coord => [coord[1], coord[0]]); + return rowPrimaryArea.type === "polygon" + ? L.polygon(latLngCoords) + : L.polyline(latLngCoords); + }, [rowPrimaryArea]); + + + useEffect(() => { + console.log("drawBound", drawBound); + + }, [drawBound]) + + + const { + control, + register, + handleSubmit, + setValue, + formState: { isSubmitting, errors }, + } = useForm({ + defaultValues: {expert_description: "", forbidden_area: ""}, + resolver: yupResolver(validationSchema), + mode: "all" + }); + + + const onSubmit = async (data) => { + const formData = new FormData(); + formData.append("expert_description", data.expert_description); + + try { + await requestServer(`${CITY_ADMIN_FEEDBACK}/${rowId}`, "post", { + data: formData, + }); + mutate(); + setOpenFeedbackDialog(false); + } catch (error) {} + }; + + + return ( + <> + + + setOpenFeedbackDialog(true)}> + + + + setOpenFeedbackDialog(false)} + PaperProps={{ + sx: { + transition: "all .3s", + boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + borderRadius: 2, + }, + }} + maxWidth="sm" + fullWidth + dir="rtl" + > + + + توضیحات ناظر + + setOpenFeedbackDialog(false)} size="small"> + + + + + منطقه ممنوعه (در صورت وجود انتخاب کنید) + + + + + + + + + + + + + + + + ) +} + +export default FeedbackAction \ No newline at end of file diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx index c8906f2..a823158 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx @@ -1,13 +1,10 @@ import { Box } from "@mui/material"; -import ConfirmAction from "./ConfirmAction"; -import RejectAction from "./RejectAction"; +import FeedbackAction from "./FeedbackAction"; const RowActions = ({ row, mutate }) => { - return ( - - - + + ); }; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/ShowBound.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/ShowBound.jsx new file mode 100644 index 0000000..24db476 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/ShowBound.jsx @@ -0,0 +1,29 @@ +import { useEffect, useRef } from "react"; +import { FeatureGroup, useMap } from "react-leaflet"; + +const ShowBound = ({ bound }) => { + const map = useMap(); + const featureRef = useRef(null); + + const safeFitBounds = (layer) => { + if (!layer || !map) return; + try { + const latLngs = layer.getLatLngs(); + map.fitBounds(latLngs, { + paddingTopLeft: [20, 20], + paddingBottomRight: [20, 20], + }); + } catch (e) { + console.warn("fitBounds failed:", e); + } + }; + + useEffect(() => { + bound?.editing?.disable(); + featureRef.current.addLayer(bound); + safeFitBounds(bound); + }, []); + + return ; +}; +export default ShowBound; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/index.jsx new file mode 100644 index 0000000..7300a1f --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/index.jsx @@ -0,0 +1,61 @@ +const { Button, IconButton, Tooltip, Box, Dialog, DialogTitle, Typography, DialogContent, DialogActions } = require("@mui/material"); +import LayersIcon from '@mui/icons-material/Layers'; +import CloseIcon from "@mui/icons-material/Close"; +import { useMemo, useState } from 'react'; +import MapLayer from '@/core/components/MapLayer'; +import ShowBound from './ShowBound'; + +const ShowPrimaryArea = ({primaryArea}) => { + const [openShowAreaDialog, setOpenShowAreaDialog] = useState(false); + const bound = useMemo(() => { + const latLngCoords = primaryArea.coordinates.map(coord => [coord[1], coord[0]]); + return primaryArea.type === "polygon" + ? L.polygon(latLngCoords) + : L.polyline(latLngCoords); + }, [primaryArea]); + + return ( + + + setOpenShowAreaDialog(true)}> + + + + setOpenShowAreaDialog(false)} + PaperProps={{ + sx: { + transition: "all .3s", + boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + borderRadius: 2, + padding: 1, + }, + }} + maxWidth="sm" + fullWidth + dir="rtl" + > + + + محدوده طرح + + setOpenShowAreaDialog(false)} size="small"> + + + + + + + + + + + + + + + ) +} + +export default ShowPrimaryArea \ No newline at end of file diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/ConfirmAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx similarity index 100% rename from src/components/dashboard/inquiryPrivacy/city-admin/RowActions/ConfirmAction/index.jsx rename to src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/RejectAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx similarity index 100% rename from src/components/dashboard/inquiryPrivacy/city-admin/RowActions/RejectAction/index.jsx rename to src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx new file mode 100644 index 0000000..45e1693 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx @@ -0,0 +1,14 @@ +import { Box } from "@mui/material"; +import ConfirmAction from "./ConfirmAction"; +import RejectAction from "./RejectAction"; + +const RowActions = ({ row, mutate }) => { + + return ( + + + + + ); +}; +export default RowActions; diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/index.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/core/utils/pageMenuDev.js b/src/core/utils/pageMenuDev.js index 68c6537..67b05dc 100644 --- a/src/core/utils/pageMenuDev.js +++ b/src/core/utils/pageMenuDev.js @@ -24,6 +24,10 @@ import RouteIcon from "@mui/icons-material/Route"; import ScienceIcon from "@mui/icons-material/Science"; import SpaceDashboardIcon from "@mui/icons-material/SpaceDashboard"; import SpeedIcon from "@mui/icons-material/Speed"; +import PsychologyAltIcon from '@mui/icons-material/PsychologyAlt'; +import MapsHomeWorkIcon from '@mui/icons-material/MapsHomeWork'; +import SecurityIcon from '@mui/icons-material/Security'; +import ManageAccountsIcon from '@mui/icons-material/ManageAccounts'; export const pageMenuDev = [ { @@ -299,6 +303,7 @@ export const pageMenuDev = [ label: "کارتابل شهرستان", type: "page", route: "/dashboard/inquiry-privacy/city-admin", + icon: , permissions: ["all"], }, { @@ -306,6 +311,7 @@ export const pageMenuDev = [ label: "کارتابل اداره حریم", type: "page", route: "/dashboard/inquiry-privacy/privacy-office", + icon: , permissions: ["all"], }, { @@ -313,6 +319,7 @@ export const pageMenuDev = [ label: "کارتابل معاون", type: "page", route: "/dashboard/inquiry-privacy/assistant", + icon: , permissions: ["all"], }, { @@ -320,6 +327,7 @@ export const pageMenuDev = [ label: "کارتابل مدیر", type: "page", route: "/dashboard/inquiry-privacy/general-manager", + icon: , permissions: ["all"], }, ], diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js index 780cd12..0a3ee79 100644 --- a/src/core/utils/routes.js +++ b/src/core/utils/routes.js @@ -236,4 +236,6 @@ export const UPDATE_RAHDARAN_ITEM = api + "/api/v3/rahdaran"; export const CREATE_RAHDARAN_ITEM = api + "/api/v3/rahdaran"; // estelam harim -export const GET_CITY_ADMIN_LIST = api + "/api/v3/harim/province_office"; \ No newline at end of file +export const GET_CITY_ADMIN_LIST = api + "/api/v3/harim/province_office"; +export const GET_INQUIRY_PRIVACY_STATE_LIST = api + "/api/v3/harim/detail/states"; +export const CITY_ADMIN_FEEDBACK = api + "/api/v3/harim/province_office/feedback"; \ No newline at end of file diff --git a/src/lib/hooks/useInquiryPrivacyState.js b/src/lib/hooks/useInquiryPrivacyState.js new file mode 100644 index 0000000..a66d83f --- /dev/null +++ b/src/lib/hooks/useInquiryPrivacyState.js @@ -0,0 +1,30 @@ +import { GET_INQUIRY_PRIVACY_STATE_LIST } from "@/core/utils/routes"; +import useRequest from "@/lib/hooks/useRequest"; +import { useEffect, useState } from "react"; + +const useInquiryPrivacyState = () => { + const requestServer = useRequest(); + const [itemsList, setItemsList] = useState([]); + const [loadingItemsList, setLoadingItemsList] = useState(true); + const [errorItemsList, setErrorItemsList] = useState(null); + + useEffect(() => { + const fetchItems = async () => { + try { + const response = await requestServer(`${GET_INQUIRY_PRIVACY_STATE_LIST}`); + setItemsList(response.data.data); + setLoadingItemsList(false); + setErrorItemsList(false); + } catch (e) { + setErrorItemsList(e); + setLoadingItemsList(false); + } + }; + + fetchItems(); + }, []); + + return { itemsList, loadingItemsList, errorItemsList }; +}; + +export default useInquiryPrivacyState; From 26924102f742e1e0047b20b9359a5529d7efb8cb Mon Sep 17 00:00:00 2001 From: mhmjalali Date: Tue, 4 Nov 2025 09:06:04 +0330 Subject: [PATCH 3/5] work on privacy_office --- package.json | 1 + .../inquiry-privacy/privacy-office/page.js | 3 +- .../MapDrawPolygon/DrawBound.jsx | 242 ++++++++++-------- .../FeedbackAction/MapDrawPolygon/index.jsx | 10 +- .../RowActions/FeedbackAction/index.jsx | 37 +-- .../city-admin/RowActions/index.jsx | 2 +- .../privacy-office/PrivacyOfficeList.jsx | 239 +++++++++++++++++ .../RowActions/RejectAction/index.jsx | 2 +- .../ShowPrimaryArea/ShowBound.jsx | 29 +++ .../privacy-office/ShowPrimaryArea/index.jsx | 61 +++++ .../inquiryPrivacy/privacy-office/index.jsx | 14 + src/core/utils/geoCalculations.js | 35 +++ src/core/utils/routes.js | 3 +- 13 files changed, 550 insertions(+), 128 deletions(-) create mode 100644 src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/ShowBound.jsx create mode 100644 src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/index.jsx create mode 100644 src/core/utils/geoCalculations.js diff --git a/package.json b/package.json index a4532cb..8a2e759 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@mui/material-nextjs": "^5.16.6", "@mui/x-date-pickers": "^6.19.5", "@mui/x-tree-view": "^7.11.0", + "@turf/turf": "^7.2.0", "axios": "^1.7.2", "date-fns": "^3.3.1", "date-fns-jalali": "^2.13.0-0", diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/privacy-office/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/privacy-office/page.js index ed381eb..c0de9c5 100644 --- a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/privacy-office/page.js +++ b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/privacy-office/page.js @@ -1,3 +1,4 @@ +import PrivacyOfficePage from "@/components/dashboard/inquiryPrivacy/privacy-office"; import WithPermission from "@/core/middlewares/withPermission"; export const metadata = { title: "کارتابل اداره حریم", @@ -5,7 +6,7 @@ export const metadata = { const Page = () => { return ( -

کارتابل اداره حریم

+
); }; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx index e715f3e..31b9706 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx @@ -2,113 +2,151 @@ import React, { useCallback, useEffect, useRef, useState } from "react"; import L from "leaflet"; import { FeatureGroup, useMap } from "react-leaflet"; import "leaflet-draw"; +import { calculatePolygonMetrics } from "@/core/utils/geoCalculations"; const DrawPolygon = ({ control, controlDispach, drawBound, setDrawBound }) => { - const map = useMap(); - const featureRef = useRef(null); - const [area, setArea] = useState(); - const drawControlRef = useRef(null); + const map = useMap(); + const featureRef = useRef(null); + const drawControlRef = useRef(null); - const safeFitBounds = (layer) => { - if (!layer || !map) return; - try { - const latLngs = layer.getLatLngs(); - map.fitBounds(latLngs, { - paddingTopLeft: [20, 35], - paddingBottomRight: [20, 55], - }); - } catch (e) { - console.warn("fitBounds failed:", e); - } + const [area, setArea] = useState(0); + const [sideLengths, setSideLengths] = useState([]); + + const calculatePolygonMetricsForLayer = useCallback( + (layer) => { + if (!layer) return; + + const latlngs = layer.getLatLngs()[0]; + if (!latlngs || latlngs.length < 3) return; + + const coordinates = latlngs.map((p) => [p.lat, p.lng]); + + const metrics = calculatePolygonMetrics(coordinates, true); + + setArea(metrics.area); + setSideLengths(metrics.sides); + + setDrawBound({ + layer, + metrics, + }); + }, + [setDrawBound] + ); + + const safeFitBounds = (layer) => { + if (!layer || !map) return; + try { + const latLngs = layer.getLatLngs(); + map.fitBounds(latLngs, { + paddingTopLeft: [20, 35], + paddingBottomRight: [20, 55], + }); + } catch (e) { + console.warn("fitBounds failed:", e); + } + }; + + const bindEditEvent = useCallback( + (layer) => { + if (!layer) return; + layer.on("edit", function (e) { + const editedLayer = e.target; + calculatePolygonMetricsForLayer(editedLayer); + }); + }, + [calculatePolygonMetricsForLayer] + ); + + const handlerCreatedBound = useCallback( + (event) => { + const { layer } = event; + layer.editing.enable(); + featureRef.current.addLayer(layer); + + calculatePolygonMetricsForLayer(layer); + bindEditEvent(layer); + + controlDispach({ type: "SET_STATUS", status: 2 }); + }, + [calculatePolygonMetricsForLayer, bindEditEvent, controlDispach] + ); + + useEffect(() => { + if ( + control.status === 1 && + drawControlRef.current && + drawControlRef.current._toolbars?.draw?._modes?.polygon?.handler + ) { + drawControlRef.current._toolbars.draw._modes.polygon.handler.enable(); + } + }, [control.status]); + + useEffect(() => { + if (control.status === 0 && featureRef.current) { + featureRef.current.clearLayers(); + setArea(0); + setSideLengths([]); + setDrawBound(null); + } + }, [control.status, setDrawBound]); + + useEffect(() => { + if (control.status === 2 && drawBound && featureRef.current) { + const { layer, metrics } = drawBound; + featureRef.current.addLayer(layer); + layer.editing.enable(); + safeFitBounds(layer); + bindEditEvent(layer); + + setArea(metrics?.area || 0); + setSideLengths(metrics?.sides || []); + } + }, [control.status, drawBound, bindEditEvent]); + + useEffect(() => { + if (!featureRef.current) return; + + L.drawLocal.draw.handlers.polygon.tooltip.start = + "برای شروع ترسیم محدوده، روی نقشه کلیک کنید"; + L.drawLocal.draw.handlers.polygon.tooltip.cont = + "برای ادامه ترسیم، نقاط بعدی را کلیک کنید"; + L.drawLocal.draw.handlers.polygon.tooltip.end = + "برای بستن محدوده، روی نقطه‌ی شروع کلیک کنید"; + + const drawControl = new L.Control.Draw({ + draw: { + polygon: { + shapeOptions: { + color: "red", + weight: 3, + clickable: true, + }, + }, + polyline: false, + rectangle: false, + circle: false, + marker: false, + circlemarker: false, + }, + edit: { + featureGroup: featureRef.current, + edit: true, + remove: true, + }, + }); + + drawControlRef.current = drawControl; + map.addControl(drawControl); + map.on(L.Draw.Event.CREATED, handlerCreatedBound); + + return () => { + map.off(L.Draw.Event.CREATED, handlerCreatedBound); + map.removeControl(drawControl); }; + }, [map, handlerCreatedBound]); - const bindEditEvent = (layer) => { - if (!layer) return; - layer.on("edit", function (e) { - const editedLayer = e.target; - setArea(editedLayer); - setDrawBound(editedLayer); - }); - }; - - const handlerCreatedBound = useCallback((event) => { - const { layer } = event; - layer.editing.enable(); - featureRef.current.addLayer(layer); - setArea(layer); - setDrawBound(layer); - bindEditEvent(layer); - controlDispach({ type: "SET_STATUS", status: 2 }); - }, []); - - useEffect(() => { - if ( - control.status === 1 && - drawControlRef.current && - drawControlRef.current._toolbars?.draw?._modes?.polygon?.handler - ) { - drawControlRef.current._toolbars.draw._modes.polygon.handler.enable(); - } - }, [control.status]); - - useEffect(() => { - if (control.status === 0 && area && featureRef.current) { - featureRef.current.removeLayer(area); - setArea(null); - setDrawBound(null); - } - }, [control.status, area]); - - useEffect(() => { - if (control.status === 2 && drawBound && featureRef.current) { - setArea(drawBound); - featureRef.current.addLayer(drawBound); - drawBound.editing.enable(); - safeFitBounds(drawBound); - bindEditEvent(drawBound); - } - }, [control.status, drawBound]); - - useEffect(() => { - if (!featureRef.current) return; - - L.drawLocal.draw.handlers.polygon.tooltip.start = "برای شروع ترسیم محدوده، روی نقشه کلیک کنید"; - L.drawLocal.draw.handlers.polygon.tooltip.cont = "برای ادامه ترسیم، نقاط بعدی را کلیک کنید"; - L.drawLocal.draw.handlers.polygon.tooltip.end = "برای بستن محدوده، روی نقطه‌ی شروع کلیک کنید"; - - const drawControl = new L.Control.Draw({ - draw: { - polygon: { - shapeOptions: { - color: "red", - weight: 3, - clickable: true, - }, - }, - polyline: false, - rectangle: false, - circle: false, - marker: false, - circlemarker: false, - }, - edit: { - featureGroup: featureRef.current, - edit: true, - remove: false, - }, - }); - - drawControlRef.current = drawControl; - map.addControl(drawControl); - map.on(L.Draw.Event.CREATED, handlerCreatedBound); - - return () => { - map.off(L.Draw.Event.CREATED, handlerCreatedBound); - map.removeControl(drawControl); - }; - }, [map, handlerCreatedBound]); - - return ; + return ; }; export default DrawPolygon; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx index bef1529..41ebf0f 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx @@ -63,10 +63,10 @@ const MapDrawPolygon = ({ drawBound, setDrawBound }) => { return ( <> - { {statusType.find((st) => st.id == control.status).message} - +
{ background: "linear-gradient(to top, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0))", }} > - + {statusType .find((st) => st.id == control.status) .buttons.map((button) => ( @@ -108,7 +108,7 @@ const MapDrawPolygon = ({ drawBound, setDrawBound }) => { {button.label} ))} - + ); diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/index.jsx index e954aeb..d20160a 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/index.jsx @@ -5,7 +5,7 @@ import { yupResolver } from "@hookform/resolvers/yup"; import CloseIcon from "@mui/icons-material/Close"; import ForumIcon from '@mui/icons-material/Forum'; import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, TextField, Tooltip, Typography } from '@mui/material'; -import { useEffect, useMemo, useState } from 'react'; +import { useMemo, useState } from 'react'; import { useForm } from "react-hook-form"; import { object, string } from 'yup'; import ShowBound from "../../ShowPrimaryArea/ShowBound"; @@ -25,38 +25,41 @@ const FeedbackAction = ({rowId, mutate, rowPrimaryArea}) => { ? L.polygon(latLngCoords) : L.polyline(latLngCoords); }, [rowPrimaryArea]); - - - useEffect(() => { - console.log("drawBound", drawBound); - - }, [drawBound]) const { - control, register, handleSubmit, - setValue, formState: { isSubmitting, errors }, } = useForm({ - defaultValues: {expert_description: "", forbidden_area: ""}, + defaultValues: {expert_description: "", forbidden_area: "", forbidden_area_space: ""}, resolver: yupResolver(validationSchema), mode: "all" }); - const onSubmit = async (data) => { - const formData = new FormData(); - formData.append("expert_description", data.expert_description); - try { + const payload = { + expert_description: data.expert_description, + }; + + if (drawBound && drawBound.metrics) { + const { metrics } = drawBound; + payload.forbidden_area = { + type: "polygon", + coordinates: metrics.coordinates, + }; + payload.forbidden_area_space = metrics.area.toFixed(2); + } await requestServer(`${CITY_ADMIN_FEEDBACK}/${rowId}`, "post", { - data: formData, + data: payload, }); + mutate(); setOpenFeedbackDialog(false); - } catch (error) {} + } catch (error) { + console.error("❌ Error submitting feedback:", error); + } }; @@ -64,7 +67,7 @@ const FeedbackAction = ({rowId, mutate, rowPrimaryArea}) => { <> - setOpenFeedbackDialog(true)}> + setOpenFeedbackDialog(true)}> diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx index a823158..69d588a 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx @@ -4,7 +4,7 @@ import FeedbackAction from "./FeedbackAction"; const RowActions = ({ row, mutate }) => { return ( - + {row.original.state_id === 1 ? : "-"} ); }; diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx new file mode 100644 index 0000000..20fe52d --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx @@ -0,0 +1,239 @@ +import CustomSelectByDependency from '@/core/components/DataTable/filter/fieldsType/CustomSelectByDependency'; +import DataTableWithAuth from '@/core/components/DataTableWithAuth'; +import useInquiryPrivacyState from '@/lib/hooks/useInquiryPrivacyState'; +import AutorenewIcon from '@mui/icons-material/Autorenew'; +import DangerousIcon from '@mui/icons-material/Dangerous'; +import ManageAccountsIcon from '@mui/icons-material/ManageAccounts'; +import MapsHomeWorkIcon from '@mui/icons-material/MapsHomeWork'; +import PsychologyAltIcon from '@mui/icons-material/PsychologyAlt'; +import ReceiptLongIcon from '@mui/icons-material/ReceiptLong'; +import SecurityIcon from '@mui/icons-material/Security'; +import WindowIcon from '@mui/icons-material/Window'; +import { Box, Stack } from '@mui/material'; +import moment from 'jalali-moment'; +import { useMemo } from 'react'; +import RowActions from './RowActions'; +import { GET_PRIVACY_ADMIN_LIST } from '@/core/utils/routes'; +import ShowPrimaryArea from './ShowPrimaryArea'; + +const PrivacyOfficeList = () => { + const stateIcon = (state_id) => { + if (state_id === 1) return ; + if (state_id === 2 || state_id === 5 || state_id === 13) return ; + if (state_id === 3 || state_id === 6 || state_id === 14) return ; + if (state_id === 4 || state_id === 7 || state_id === 15) return ; + if (state_id === 8) return ; + if (state_id === 9 || state_id === 11) return ; + if (state_id === 10) return ; + if (state_id === 12) return ; + }; + const columns = useMemo(() => { + return [ + { + accessorKey: "panjare_vahed_id", + header: "کدرهگیری درخواست", + id: "panjare_vahed_id", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.panjare_vahed_id}, + }, + { + accessorKey: "national_id", + header: "کد ملی", + id: "national_id", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.national_id}, + }, + { + accessorKey: "state_id", + header: "وضعیت", + id: "state_id", + enableColumnFilter: true, + datatype: "numeric", + filterMode: "equals", + sortDescFirst: false, + grow: false, + size: 100, + ColumnSelectComponent: (props) => { + const { itemsList, loadingItemsList, errorItemsList } = useInquiryPrivacyState(); + + const getColumnSelectOptions = useMemo(() => { + if (loadingItemsList) { + return [{ value: "loading", label: "در حال بارگذاری..." }]; + } + if (errorItemsList) { + return [{ value: "error", label: "خطا در بارگذاری" }]; + } + return [ + { value: "", label: "همه موارد" }, + ...itemsList.map((item) => ({ + value: item.id, + label: item.name, + })), + ]; + }, [itemsList, loadingItemsList, errorItemsList]); + + return ( + + ); + }, + Cell: ({ row }) => ( + + {stateIcon(row.original.state_id)} + + {row.original.state_name} + + + ), + }, + { + accessorKey: "plan_title", + header: "عنوان طرح", + id: "plan_title", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.plan_title}, + }, + { + accessorKey: "plan_group", + header: "گروه طرح", + id: "plan_group", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.plan_group}, + }, + { + accessorKey: "requested_organization", + header: "دستگاه صادر کننده", + id: "requested_organization", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.requested_organization}, + }, + { + accessorKey: "worksheet_id", + header: "شناسه کاربرگ", + id: "worksheet_id", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.worksheet_id}, + }, + { + accessorKey: "primary_area", + header: "نمایش محدوده طرح", + id: "primary_area", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => row.original.primary_area ? ( + + + + ) : ("-"), + }, + { + accessorKey: "province_id", + header: "استان", + id: "province_id", + enableColumnFilter: false, + datatype: "numeric", + sortDescFirst: false, + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.province_name}, + }, + { + accessorKey: "city_id", + header: "شهر", + id: "city_id", + enableColumnFilter: false, + datatype: "numeric", + sortDescFirst: false, + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.city_name}, + }, + { + accessorKey: "isic", + header: "کد آیسیک", + id: "isic", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => <>{row.original.isic}, + }, + { + accessorFn: (row) => moment(row.request_date).locale("fa").format("YYYY/MM/DD"), + header: "تاریخ درخواست", + id: "request_date", + enableColumnFilter: true, + datatype: "date", + filterMode: "between", + grow: false, + size: 100, + }, + ]; + }, []); + + return ( + <> + + + + + ) +} + +export default PrivacyOfficeList \ No newline at end of file diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx index ccdffaf..c8a7e96 100644 --- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx @@ -6,7 +6,7 @@ const RejectAction = ({ rowId, mutate }) => { const [openRejectDialog, setOpenRejectDialog] = useState(false); return ( <> - + setOpenRejectDialog(true)}> diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/ShowBound.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/ShowBound.jsx new file mode 100644 index 0000000..24db476 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/ShowBound.jsx @@ -0,0 +1,29 @@ +import { useEffect, useRef } from "react"; +import { FeatureGroup, useMap } from "react-leaflet"; + +const ShowBound = ({ bound }) => { + const map = useMap(); + const featureRef = useRef(null); + + const safeFitBounds = (layer) => { + if (!layer || !map) return; + try { + const latLngs = layer.getLatLngs(); + map.fitBounds(latLngs, { + paddingTopLeft: [20, 20], + paddingBottomRight: [20, 20], + }); + } catch (e) { + console.warn("fitBounds failed:", e); + } + }; + + useEffect(() => { + bound?.editing?.disable(); + featureRef.current.addLayer(bound); + safeFitBounds(bound); + }, []); + + return ; +}; +export default ShowBound; diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/index.jsx new file mode 100644 index 0000000..7300a1f --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/index.jsx @@ -0,0 +1,61 @@ +const { Button, IconButton, Tooltip, Box, Dialog, DialogTitle, Typography, DialogContent, DialogActions } = require("@mui/material"); +import LayersIcon from '@mui/icons-material/Layers'; +import CloseIcon from "@mui/icons-material/Close"; +import { useMemo, useState } from 'react'; +import MapLayer from '@/core/components/MapLayer'; +import ShowBound from './ShowBound'; + +const ShowPrimaryArea = ({primaryArea}) => { + const [openShowAreaDialog, setOpenShowAreaDialog] = useState(false); + const bound = useMemo(() => { + const latLngCoords = primaryArea.coordinates.map(coord => [coord[1], coord[0]]); + return primaryArea.type === "polygon" + ? L.polygon(latLngCoords) + : L.polyline(latLngCoords); + }, [primaryArea]); + + return ( + + + setOpenShowAreaDialog(true)}> + + + + setOpenShowAreaDialog(false)} + PaperProps={{ + sx: { + transition: "all .3s", + boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + borderRadius: 2, + padding: 1, + }, + }} + maxWidth="sm" + fullWidth + dir="rtl" + > + + + محدوده طرح + + setOpenShowAreaDialog(false)} size="small"> + + + + + + + + + + + + + + + ) +} + +export default ShowPrimaryArea \ No newline at end of file diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/index.jsx index e69de29..ce52276 100644 --- a/src/components/dashboard/inquiryPrivacy/privacy-office/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/index.jsx @@ -0,0 +1,14 @@ +"use client"; +import PageTitle from "@/core/components/PageTitle"; +import { Stack } from "@mui/material"; +import PrivacyOfficeList from "./PrivacyOfficeList"; + +const PrivacyOfficePage = () => { + return ( + + + + + ); +}; +export default PrivacyOfficePage; diff --git a/src/core/utils/geoCalculations.js b/src/core/utils/geoCalculations.js new file mode 100644 index 0000000..f0f9f03 --- /dev/null +++ b/src/core/utils/geoCalculations.js @@ -0,0 +1,35 @@ +import * as turf from "@turf/turf"; + +export const calculatePolygonMetrics = (coordinates, isLatLngOrder = true) => { + if (!coordinates || coordinates.length < 3) { + return { area: 0, sides: [], coordinates: [] }; + } + + const geoCoords = isLatLngOrder + ? coordinates.map(([lat, lng]) => [lng, lat]) + : coordinates.map(([lng, lat]) => [lng, lat]); + + if ( + geoCoords[0][0] !== geoCoords[geoCoords.length - 1][0] || + geoCoords[0][1] !== geoCoords[geoCoords.length - 1][1] + ) { + geoCoords.push(geoCoords[0]); + } + + const polygon = turf.polygon([geoCoords]); + + const area = turf.area(polygon); + + const sides = []; + for (let i = 0; i < geoCoords.length - 1; i++) { + const line = turf.lineString([geoCoords[i], geoCoords[i + 1]]); + const length = turf.length(line, { units: "meters" }); + sides.push(length); + } + + return { + area, + sides, + coordinates: geoCoords, + }; +}; \ No newline at end of file diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js index 0a3ee79..d51af49 100644 --- a/src/core/utils/routes.js +++ b/src/core/utils/routes.js @@ -238,4 +238,5 @@ export const CREATE_RAHDARAN_ITEM = api + "/api/v3/rahdaran"; // estelam harim export const GET_CITY_ADMIN_LIST = api + "/api/v3/harim/province_office"; export const GET_INQUIRY_PRIVACY_STATE_LIST = api + "/api/v3/harim/detail/states"; -export const CITY_ADMIN_FEEDBACK = api + "/api/v3/harim/province_office/feedback"; \ No newline at end of file +export const CITY_ADMIN_FEEDBACK = api + "/api/v3/harim/province_office/feedback"; +export const GET_PRIVACY_ADMIN_LIST = api + "/api/v3/harim/harim_office" \ No newline at end of file From 5b61380550a8ef5c2e3e47618169cb2735221902 Mon Sep 17 00:00:00 2001 From: mhmjalali Date: Tue, 4 Nov 2025 09:08:32 +0330 Subject: [PATCH 4/5] formatting --- src/assets/scss/leaflet-measure.scss | 254 ++++++++--------- .../city-admin/CityAdminList.jsx | 72 ++--- .../MapDrawPolygon/DrawBound.jsx | 259 +++++++++--------- .../FeedbackAction/MapDrawPolygon/index.jsx | 9 +- .../RowActions/FeedbackAction/index.jsx | 72 +++-- .../city-admin/RowActions/index.jsx | 6 +- .../city-admin/ShowPrimaryArea/index.jsx | 104 +++---- .../privacy-office/PrivacyOfficeList.jsx | 72 ++--- .../RowActions/ConfirmAction/index.jsx | 2 +- .../RowActions/RejectAction/index.jsx | 2 +- .../privacy-office/RowActions/index.jsx | 1 - .../privacy-office/ShowPrimaryArea/index.jsx | 104 +++---- src/core/utils/geoCalculations.js | 52 ++-- src/core/utils/pageMenuDev.js | 8 +- src/core/utils/routes.js | 2 +- 15 files changed, 533 insertions(+), 486 deletions(-) diff --git a/src/assets/scss/leaflet-measure.scss b/src/assets/scss/leaflet-measure.scss index 97e3bc1..6cc4efa 100644 --- a/src/assets/scss/leaflet-measure.scss +++ b/src/assets/scss/leaflet-measure.scss @@ -13,158 +13,158 @@ $button-icon-size: 12px; $button-icon-spacing: 4px; @mixin hoverbutton { - color: $color-button; - text-decoration: none; - &:hover { - opacity: 0.5; + color: $color-button; text-decoration: none; - } + &:hover { + opacity: 0.5; + text-decoration: none; + } } -@mixin button ($icon) { - display: inline; - width: auto; - height: auto; - padding-left: 20px; - margin-right: $button-icon-spacing; - line-height: 1em; - border: 0; - text-align: left; - color: $color-button; - &, - &:hover { - background-color: transparent; - } - background: { - image: url('assets/#{ $icon }.png'); - repeat: no-repeat; - position: 0% 50%; - size: $button-icon-size $button-icon-size; - } - .leaflet-retina & { - background-image: url('assets/#{ $icon }_@2X.png'); - } +@mixin button($icon) { + display: inline; + width: auto; + height: auto; + padding-left: 20px; + margin-right: $button-icon-spacing; + line-height: 1em; + border: 0; + text-align: left; + color: $color-button; + &, + &:hover { + background-color: transparent; + } + background: { + image: url("assets/#{ $icon }.png"); + repeat: no-repeat; + position: 0% 50%; + size: $button-icon-size $button-icon-size; + } + .leaflet-retina & { + background-image: url("assets/#{ $icon }_@2X.png"); + } - @include hoverbutton; + @include hoverbutton; } .leaflet-control-measure, .leaflet-measure-resultpopup { - h3 { - margin: 0 0 $spacing-external 0; - padding-bottom: $spacing-internal; - border-bottom: solid 1px $color-divider; - } - p { - margin: $spacing-internal 0 0 0; - line-height: 1.5em; - &:first-child { - margin-top: 0; + h3 { + margin: 0 0 $spacing-external 0; + padding-bottom: $spacing-internal; + border-bottom: solid 1px $color-divider; } - } - .tasks { - margin: $spacing-external 0 0 0; - padding: $spacing-internal 0 0 0; - border-top: solid 1px $color-divider; - text-align: right; - - list-style: none; - list-style-image: none; - - li { - display: inline; - margin: 0 $spacing-internal 0 0; - &:last-child { - margin-right: 0; - } + p { + margin: $spacing-internal 0 0 0; + line-height: 1.5em; + &:first-child { + margin-top: 0; + } } - } + .tasks { + margin: $spacing-external 0 0 0; + padding: $spacing-internal 0 0 0; + border-top: solid 1px $color-divider; + text-align: right; - .coorddivider { - color: $color-lightertext; - } + list-style: none; + list-style-image: none; + + li { + display: inline; + margin: 0 $spacing-internal 0 0; + &:last-child { + margin-right: 0; + } + } + } + + .coorddivider { + color: $color-lightertext; + } } .leaflet-control-measure { - max-width: $max-width; - background: #fff; + max-width: $max-width; + background: #fff; - .leaflet-control-measure-toggle, - .leaflet-control-measure-toggle:hover { - background: { - size: 14px 14px; - image: url(assets/rulers.png); - } - border: 0; - border-radius: 4px; - .leaflet-touch & { - border-radius: 2px; + .leaflet-control-measure-toggle, + .leaflet-control-measure-toggle:hover { + background: { + size: 14px 14px; + image: url(assets/rulers.png); + } + border: 0; + border-radius: 4px; + .leaflet-touch & { + border-radius: 2px; + } + + // Hide text + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + + .leaflet-retina & { + background-image: url(assets/rulers_@2X.png); + } + + .leaflet-touch & { + background-size: 16px 16px; + } } - // Hide text - text-indent: 100%; - white-space: nowrap; - overflow: hidden; - - .leaflet-retina & { - background-image: url(assets/rulers_@2X.png); + // Special styling because start prompt has no content, just header and tasks + .startprompt { + h3 { + margin-bottom: $spacing-internal; + } + .tasks { + margin-top: 0; + padding-top: 0; + border-top: 0; + text-align: left; + } } - .leaflet-touch & { - background-size: 16px 16px; + .leaflet-control-measure-interaction { + padding: $spacing-internal $spacing-external; } - } - // Special styling because start prompt has no content, just header and tasks - .startprompt { - h3 { - margin-bottom: $spacing-internal; + .results { + .group { + margin-top: $spacing-internal; + padding-top: $spacing-internal; + border-top: dotted 1px lighten($color-divider, 5); + &:first-child { + margin-top: 0; + padding-top: 0; + border-top: 0; + } + } + .heading { + margin-right: $spacing-internal * 0.5; + color: $color-lightertext; + } } - .tasks { - margin-top: 0; - padding-top: 0; - border-top: 0; - text-align: left; - } - } - .leaflet-control-measure-interaction { - padding: $spacing-internal $spacing-external; - } - - .results { - .group { - margin-top: $spacing-internal; - padding-top: $spacing-internal; - border-top: dotted 1px lighten($color-divider, 5); - &:first-child { - margin-top: 0; - padding-top: 0; - border-top: 0; - } + a.start { + @include button(start); } - .heading { - margin-right: $spacing-internal * 0.5; - color: $color-lightertext; + a.cancel { + @include button(cancel); + } + a.finish { + @include button(check); } - } - - a.start { - @include button(start); - } - a.cancel { - @include button(cancel); - } - a.finish { - @include button(check); - } } .leaflet-measure-resultpopup { - a.zoomto { - @include button(focus); - } - a.deletemarkup { - @include button(trash); - } -} \ No newline at end of file + a.zoomto { + @include button(focus); + } + a.deletemarkup { + @include button(trash); + } +} diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx index 14b18ec..b732d9b 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/CityAdminList.jsx @@ -1,31 +1,32 @@ -import CustomSelectByDependency from '@/core/components/DataTable/filter/fieldsType/CustomSelectByDependency'; -import DataTableWithAuth from '@/core/components/DataTableWithAuth'; -import { GET_CITY_ADMIN_LIST } from '@/core/utils/routes'; -import useInquiryPrivacyState from '@/lib/hooks/useInquiryPrivacyState'; -import { Box, Stack } from '@mui/material'; -import moment from 'jalali-moment'; -import { useMemo } from 'react'; -import MapsHomeWorkIcon from '@mui/icons-material/MapsHomeWork'; -import SecurityIcon from '@mui/icons-material/Security'; -import ManageAccountsIcon from '@mui/icons-material/ManageAccounts'; -import PsychologyAltIcon from '@mui/icons-material/PsychologyAlt'; -import ReceiptLongIcon from '@mui/icons-material/ReceiptLong'; -import WindowIcon from '@mui/icons-material/Window'; -import DangerousIcon from '@mui/icons-material/Dangerous'; -import AutorenewIcon from '@mui/icons-material/Autorenew'; -import RowActions from './RowActions'; -import ShowPrimaryArea from './ShowPrimaryArea'; +import CustomSelectByDependency from "@/core/components/DataTable/filter/fieldsType/CustomSelectByDependency"; +import DataTableWithAuth from "@/core/components/DataTableWithAuth"; +import { GET_CITY_ADMIN_LIST } from "@/core/utils/routes"; +import useInquiryPrivacyState from "@/lib/hooks/useInquiryPrivacyState"; +import { Box, Stack } from "@mui/material"; +import moment from "jalali-moment"; +import { useMemo } from "react"; +import MapsHomeWorkIcon from "@mui/icons-material/MapsHomeWork"; +import SecurityIcon from "@mui/icons-material/Security"; +import ManageAccountsIcon from "@mui/icons-material/ManageAccounts"; +import PsychologyAltIcon from "@mui/icons-material/PsychologyAlt"; +import ReceiptLongIcon from "@mui/icons-material/ReceiptLong"; +import WindowIcon from "@mui/icons-material/Window"; +import DangerousIcon from "@mui/icons-material/Dangerous"; +import AutorenewIcon from "@mui/icons-material/Autorenew"; +import RowActions from "./RowActions"; +import ShowPrimaryArea from "./ShowPrimaryArea"; const CityAdminList = () => { const stateIcon = (state_id) => { - if (state_id === 1) return ; - if (state_id === 2 || state_id === 5 || state_id === 13) return ; - if (state_id === 3 || state_id === 6 || state_id === 14) return ; - if (state_id === 4 || state_id === 7 || state_id === 15) return ; - if (state_id === 8) return ; - if (state_id === 9 || state_id === 11) return ; - if (state_id === 10) return ; - if (state_id === 12) return ; + if (state_id === 1) return ; + if (state_id === 2 || state_id === 5 || state_id === 13) return ; + if (state_id === 3 || state_id === 6 || state_id === 14) + return ; + if (state_id === 4 || state_id === 7 || state_id === 15) return ; + if (state_id === 8) return ; + if (state_id === 9 || state_id === 11) return ; + if (state_id === 10) return ; + if (state_id === 12) return ; }; const columns = useMemo(() => { return [ @@ -96,7 +97,7 @@ const CityAdminList = () => { {stateIcon(row.original.state_id)} - {row.original.state_name} + {row.original.state_name} ), @@ -164,11 +165,14 @@ const CityAdminList = () => { columnFilterModeOptions: ["equals", "contains"], grow: false, size: 100, - Cell: ({ row }) => row.original.primary_area ? ( - - - - ) : ("-"), + Cell: ({ row }) => + row.original.primary_area ? ( + + + + ) : ( + "-" + ), }, { accessorKey: "province_id", @@ -233,7 +237,7 @@ const CityAdminList = () => { /> - ) -} + ); +}; -export default CityAdminList \ No newline at end of file +export default CityAdminList; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx index 31b9706..02b567f 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/DrawBound.jsx @@ -5,148 +5,145 @@ import "leaflet-draw"; import { calculatePolygonMetrics } from "@/core/utils/geoCalculations"; const DrawPolygon = ({ control, controlDispach, drawBound, setDrawBound }) => { - const map = useMap(); - const featureRef = useRef(null); - const drawControlRef = useRef(null); + const map = useMap(); + const featureRef = useRef(null); + const drawControlRef = useRef(null); - const [area, setArea] = useState(0); - const [sideLengths, setSideLengths] = useState([]); + const [area, setArea] = useState(0); + const [sideLengths, setSideLengths] = useState([]); - const calculatePolygonMetricsForLayer = useCallback( - (layer) => { - if (!layer) return; + const calculatePolygonMetricsForLayer = useCallback( + (layer) => { + if (!layer) return; - const latlngs = layer.getLatLngs()[0]; - if (!latlngs || latlngs.length < 3) return; + const latlngs = layer.getLatLngs()[0]; + if (!latlngs || latlngs.length < 3) return; - const coordinates = latlngs.map((p) => [p.lat, p.lng]); + const coordinates = latlngs.map((p) => [p.lat, p.lng]); - const metrics = calculatePolygonMetrics(coordinates, true); + const metrics = calculatePolygonMetrics(coordinates, true); - setArea(metrics.area); - setSideLengths(metrics.sides); + setArea(metrics.area); + setSideLengths(metrics.sides); - setDrawBound({ - layer, - metrics, - }); - }, - [setDrawBound] - ); - - const safeFitBounds = (layer) => { - if (!layer || !map) return; - try { - const latLngs = layer.getLatLngs(); - map.fitBounds(latLngs, { - paddingTopLeft: [20, 35], - paddingBottomRight: [20, 55], - }); - } catch (e) { - console.warn("fitBounds failed:", e); - } - }; - - const bindEditEvent = useCallback( - (layer) => { - if (!layer) return; - layer.on("edit", function (e) { - const editedLayer = e.target; - calculatePolygonMetricsForLayer(editedLayer); - }); - }, - [calculatePolygonMetricsForLayer] - ); - - const handlerCreatedBound = useCallback( - (event) => { - const { layer } = event; - layer.editing.enable(); - featureRef.current.addLayer(layer); - - calculatePolygonMetricsForLayer(layer); - bindEditEvent(layer); - - controlDispach({ type: "SET_STATUS", status: 2 }); - }, - [calculatePolygonMetricsForLayer, bindEditEvent, controlDispach] - ); - - useEffect(() => { - if ( - control.status === 1 && - drawControlRef.current && - drawControlRef.current._toolbars?.draw?._modes?.polygon?.handler - ) { - drawControlRef.current._toolbars.draw._modes.polygon.handler.enable(); - } - }, [control.status]); - - useEffect(() => { - if (control.status === 0 && featureRef.current) { - featureRef.current.clearLayers(); - setArea(0); - setSideLengths([]); - setDrawBound(null); - } - }, [control.status, setDrawBound]); - - useEffect(() => { - if (control.status === 2 && drawBound && featureRef.current) { - const { layer, metrics } = drawBound; - featureRef.current.addLayer(layer); - layer.editing.enable(); - safeFitBounds(layer); - bindEditEvent(layer); - - setArea(metrics?.area || 0); - setSideLengths(metrics?.sides || []); - } - }, [control.status, drawBound, bindEditEvent]); - - useEffect(() => { - if (!featureRef.current) return; - - L.drawLocal.draw.handlers.polygon.tooltip.start = - "برای شروع ترسیم محدوده، روی نقشه کلیک کنید"; - L.drawLocal.draw.handlers.polygon.tooltip.cont = - "برای ادامه ترسیم، نقاط بعدی را کلیک کنید"; - L.drawLocal.draw.handlers.polygon.tooltip.end = - "برای بستن محدوده، روی نقطه‌ی شروع کلیک کنید"; - - const drawControl = new L.Control.Draw({ - draw: { - polygon: { - shapeOptions: { - color: "red", - weight: 3, - clickable: true, - }, + setDrawBound({ + layer, + metrics, + }); }, - polyline: false, - rectangle: false, - circle: false, - marker: false, - circlemarker: false, - }, - edit: { - featureGroup: featureRef.current, - edit: true, - remove: true, - }, - }); + [setDrawBound] + ); - drawControlRef.current = drawControl; - map.addControl(drawControl); - map.on(L.Draw.Event.CREATED, handlerCreatedBound); - - return () => { - map.off(L.Draw.Event.CREATED, handlerCreatedBound); - map.removeControl(drawControl); + const safeFitBounds = (layer) => { + if (!layer || !map) return; + try { + const latLngs = layer.getLatLngs(); + map.fitBounds(latLngs, { + paddingTopLeft: [20, 35], + paddingBottomRight: [20, 55], + }); + } catch (e) { + console.warn("fitBounds failed:", e); + } }; - }, [map, handlerCreatedBound]); - return ; + const bindEditEvent = useCallback( + (layer) => { + if (!layer) return; + layer.on("edit", function (e) { + const editedLayer = e.target; + calculatePolygonMetricsForLayer(editedLayer); + }); + }, + [calculatePolygonMetricsForLayer] + ); + + const handlerCreatedBound = useCallback( + (event) => { + const { layer } = event; + layer.editing.enable(); + featureRef.current.addLayer(layer); + + calculatePolygonMetricsForLayer(layer); + bindEditEvent(layer); + + controlDispach({ type: "SET_STATUS", status: 2 }); + }, + [calculatePolygonMetricsForLayer, bindEditEvent, controlDispach] + ); + + useEffect(() => { + if ( + control.status === 1 && + drawControlRef.current && + drawControlRef.current._toolbars?.draw?._modes?.polygon?.handler + ) { + drawControlRef.current._toolbars.draw._modes.polygon.handler.enable(); + } + }, [control.status]); + + useEffect(() => { + if (control.status === 0 && featureRef.current) { + featureRef.current.clearLayers(); + setArea(0); + setSideLengths([]); + setDrawBound(null); + } + }, [control.status, setDrawBound]); + + useEffect(() => { + if (control.status === 2 && drawBound && featureRef.current) { + const { layer, metrics } = drawBound; + featureRef.current.addLayer(layer); + layer.editing.enable(); + safeFitBounds(layer); + bindEditEvent(layer); + + setArea(metrics?.area || 0); + setSideLengths(metrics?.sides || []); + } + }, [control.status, drawBound, bindEditEvent]); + + useEffect(() => { + if (!featureRef.current) return; + + L.drawLocal.draw.handlers.polygon.tooltip.start = "برای شروع ترسیم محدوده، روی نقشه کلیک کنید"; + L.drawLocal.draw.handlers.polygon.tooltip.cont = "برای ادامه ترسیم، نقاط بعدی را کلیک کنید"; + L.drawLocal.draw.handlers.polygon.tooltip.end = "برای بستن محدوده، روی نقطه‌ی شروع کلیک کنید"; + + const drawControl = new L.Control.Draw({ + draw: { + polygon: { + shapeOptions: { + color: "red", + weight: 3, + clickable: true, + }, + }, + polyline: false, + rectangle: false, + circle: false, + marker: false, + circlemarker: false, + }, + edit: { + featureGroup: featureRef.current, + edit: true, + remove: true, + }, + }); + + drawControlRef.current = drawControl; + map.addControl(drawControl); + map.on(L.Draw.Event.CREATED, handlerCreatedBound); + + return () => { + map.off(L.Draw.Event.CREATED, handlerCreatedBound); + map.removeControl(drawControl); + }; + }, [map, handlerCreatedBound]); + + return ; }; export default DrawPolygon; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx index 41ebf0f..ab4c1f4 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/FeedbackAction/MapDrawPolygon/index.jsx @@ -62,11 +62,16 @@ const MapDrawPolygon = ({ drawBound, setDrawBound }) => { return ( <> - + { +const FeedbackAction = ({ rowId, mutate, rowPrimaryArea }) => { const requestServer = useRequest({ notificationSuccess: true }); const [openFeedbackDialog, setOpenFeedbackDialog] = useState(false); const [drawBound, setDrawBound] = useState(null); const bound = useMemo(() => { - const latLngCoords = rowPrimaryArea.coordinates.map(coord => [coord[1], coord[0]]); - return rowPrimaryArea.type === "polygon" - ? L.polygon(latLngCoords) - : L.polyline(latLngCoords); - }, [rowPrimaryArea]); - + const latLngCoords = rowPrimaryArea.coordinates.map((coord) => [coord[1], coord[0]]); + return rowPrimaryArea.type === "polygon" ? L.polygon(latLngCoords) : L.polyline(latLngCoords); + }, [rowPrimaryArea]); const { register, handleSubmit, formState: { isSubmitting, errors }, - } = useForm({ - defaultValues: {expert_description: "", forbidden_area: "", forbidden_area_space: ""}, - resolver: yupResolver(validationSchema), - mode: "all" - }); + } = useForm({ + defaultValues: { expert_description: "", forbidden_area: "", forbidden_area_space: "" }, + resolver: yupResolver(validationSchema), + mode: "all", + }); const onSubmit = async (data) => { try { const payload = { - expert_description: data.expert_description, + expert_description: data.expert_description, }; if (drawBound && drawBound.metrics) { @@ -62,7 +70,6 @@ const FeedbackAction = ({rowId, mutate, rowPrimaryArea}) => { } }; - return ( <> @@ -77,7 +84,8 @@ const FeedbackAction = ({rowId, mutate, rowPrimaryArea}) => { PaperProps={{ sx: { transition: "all .3s", - boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + boxShadow: + "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", borderRadius: 2, }, }} @@ -93,12 +101,17 @@ const FeedbackAction = ({rowId, mutate, rowPrimaryArea}) => { - - منطقه ممنوعه (در صورت وجود انتخاب کنید) + + + منطقه ممنوعه{" "} + + (در صورت وجود انتخاب کنید) + + - - + + { > بستن - - ) -} + ); +}; -export default FeedbackAction \ No newline at end of file +export default FeedbackAction; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx index 69d588a..cb1517b 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx @@ -4,7 +4,11 @@ import FeedbackAction from "./FeedbackAction"; const RowActions = ({ row, mutate }) => { return ( - {row.original.state_id === 1 ? : "-"} + {row.original.state_id === 1 ? ( + + ) : ( + "-" + )} ); }; diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/index.jsx index 7300a1f..98e24d0 100644 --- a/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/city-admin/ShowPrimaryArea/index.jsx @@ -1,61 +1,69 @@ -const { Button, IconButton, Tooltip, Box, Dialog, DialogTitle, Typography, DialogContent, DialogActions } = require("@mui/material"); -import LayersIcon from '@mui/icons-material/Layers'; +const { + Button, + IconButton, + Tooltip, + Box, + Dialog, + DialogTitle, + Typography, + DialogContent, + DialogActions, +} = require("@mui/material"); +import LayersIcon from "@mui/icons-material/Layers"; import CloseIcon from "@mui/icons-material/Close"; -import { useMemo, useState } from 'react'; -import MapLayer from '@/core/components/MapLayer'; -import ShowBound from './ShowBound'; +import { useMemo, useState } from "react"; +import MapLayer from "@/core/components/MapLayer"; +import ShowBound from "./ShowBound"; -const ShowPrimaryArea = ({primaryArea}) => { +const ShowPrimaryArea = ({ primaryArea }) => { const [openShowAreaDialog, setOpenShowAreaDialog] = useState(false); const bound = useMemo(() => { - const latLngCoords = primaryArea.coordinates.map(coord => [coord[1], coord[0]]); - return primaryArea.type === "polygon" - ? L.polygon(latLngCoords) - : L.polyline(latLngCoords); + const latLngCoords = primaryArea.coordinates.map((coord) => [coord[1], coord[0]]); + return primaryArea.type === "polygon" ? L.polygon(latLngCoords) : L.polyline(latLngCoords); }, [primaryArea]); - - return ( - - - setOpenShowAreaDialog(true)}> - - - - setOpenShowAreaDialog(false)} - PaperProps={{ - sx: { - transition: "all .3s", - boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", - borderRadius: 2, - padding: 1, - }, - }} - maxWidth="sm" - fullWidth - dir="rtl" - > - - - محدوده طرح - - setOpenShowAreaDialog(false)} size="small"> - + + return ( + + + setOpenShowAreaDialog(true)}> + - - - + + setOpenShowAreaDialog(false)} + PaperProps={{ + sx: { + transition: "all .3s", + boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + borderRadius: 2, + padding: 1, + }, + }} + maxWidth="sm" + fullWidth + dir="rtl" + > + + + محدوده طرح + + setOpenShowAreaDialog(false)} size="small"> + + + + + - - - - ) -} + + + + ); +}; -export default ShowPrimaryArea \ No newline at end of file +export default ShowPrimaryArea; diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx index 20fe52d..913c803 100644 --- a/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx @@ -1,31 +1,32 @@ -import CustomSelectByDependency from '@/core/components/DataTable/filter/fieldsType/CustomSelectByDependency'; -import DataTableWithAuth from '@/core/components/DataTableWithAuth'; -import useInquiryPrivacyState from '@/lib/hooks/useInquiryPrivacyState'; -import AutorenewIcon from '@mui/icons-material/Autorenew'; -import DangerousIcon from '@mui/icons-material/Dangerous'; -import ManageAccountsIcon from '@mui/icons-material/ManageAccounts'; -import MapsHomeWorkIcon from '@mui/icons-material/MapsHomeWork'; -import PsychologyAltIcon from '@mui/icons-material/PsychologyAlt'; -import ReceiptLongIcon from '@mui/icons-material/ReceiptLong'; -import SecurityIcon from '@mui/icons-material/Security'; -import WindowIcon from '@mui/icons-material/Window'; -import { Box, Stack } from '@mui/material'; -import moment from 'jalali-moment'; -import { useMemo } from 'react'; -import RowActions from './RowActions'; -import { GET_PRIVACY_ADMIN_LIST } from '@/core/utils/routes'; -import ShowPrimaryArea from './ShowPrimaryArea'; +import CustomSelectByDependency from "@/core/components/DataTable/filter/fieldsType/CustomSelectByDependency"; +import DataTableWithAuth from "@/core/components/DataTableWithAuth"; +import useInquiryPrivacyState from "@/lib/hooks/useInquiryPrivacyState"; +import AutorenewIcon from "@mui/icons-material/Autorenew"; +import DangerousIcon from "@mui/icons-material/Dangerous"; +import ManageAccountsIcon from "@mui/icons-material/ManageAccounts"; +import MapsHomeWorkIcon from "@mui/icons-material/MapsHomeWork"; +import PsychologyAltIcon from "@mui/icons-material/PsychologyAlt"; +import ReceiptLongIcon from "@mui/icons-material/ReceiptLong"; +import SecurityIcon from "@mui/icons-material/Security"; +import WindowIcon from "@mui/icons-material/Window"; +import { Box, Stack } from "@mui/material"; +import moment from "jalali-moment"; +import { useMemo } from "react"; +import RowActions from "./RowActions"; +import { GET_PRIVACY_ADMIN_LIST } from "@/core/utils/routes"; +import ShowPrimaryArea from "./ShowPrimaryArea"; const PrivacyOfficeList = () => { const stateIcon = (state_id) => { - if (state_id === 1) return ; - if (state_id === 2 || state_id === 5 || state_id === 13) return ; - if (state_id === 3 || state_id === 6 || state_id === 14) return ; - if (state_id === 4 || state_id === 7 || state_id === 15) return ; - if (state_id === 8) return ; - if (state_id === 9 || state_id === 11) return ; - if (state_id === 10) return ; - if (state_id === 12) return ; + if (state_id === 1) return ; + if (state_id === 2 || state_id === 5 || state_id === 13) return ; + if (state_id === 3 || state_id === 6 || state_id === 14) + return ; + if (state_id === 4 || state_id === 7 || state_id === 15) return ; + if (state_id === 8) return ; + if (state_id === 9 || state_id === 11) return ; + if (state_id === 10) return ; + if (state_id === 12) return ; }; const columns = useMemo(() => { return [ @@ -96,7 +97,7 @@ const PrivacyOfficeList = () => { {stateIcon(row.original.state_id)} - {row.original.state_name} + {row.original.state_name} ), @@ -164,11 +165,14 @@ const PrivacyOfficeList = () => { columnFilterModeOptions: ["equals", "contains"], grow: false, size: 100, - Cell: ({ row }) => row.original.primary_area ? ( - - - - ) : ("-"), + Cell: ({ row }) => + row.original.primary_area ? ( + + + + ) : ( + "-" + ), }, { accessorKey: "province_id", @@ -233,7 +237,7 @@ const PrivacyOfficeList = () => { /> - ) -} + ); +}; -export default PrivacyOfficeList \ No newline at end of file +export default PrivacyOfficeList; diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx index 6eb22a6..c2a0cfc 100644 --- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx @@ -1,4 +1,4 @@ -import ThumbUpIcon from '@mui/icons-material/ThumbUp'; +import ThumbUpIcon from "@mui/icons-material/ThumbUp"; import { IconButton, Tooltip } from "@mui/material"; import { useState } from "react"; diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx index c8a7e96..c16a405 100644 --- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx @@ -1,4 +1,4 @@ -import ThumbDownIcon from '@mui/icons-material/ThumbDown'; +import ThumbDownIcon from "@mui/icons-material/ThumbDown"; import { IconButton, Tooltip } from "@mui/material"; import { useState } from "react"; diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx index 45e1693..06ea132 100644 --- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx @@ -3,7 +3,6 @@ import ConfirmAction from "./ConfirmAction"; import RejectAction from "./RejectAction"; const RowActions = ({ row, mutate }) => { - return ( diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/index.jsx index 7300a1f..98e24d0 100644 --- a/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/ShowPrimaryArea/index.jsx @@ -1,61 +1,69 @@ -const { Button, IconButton, Tooltip, Box, Dialog, DialogTitle, Typography, DialogContent, DialogActions } = require("@mui/material"); -import LayersIcon from '@mui/icons-material/Layers'; +const { + Button, + IconButton, + Tooltip, + Box, + Dialog, + DialogTitle, + Typography, + DialogContent, + DialogActions, +} = require("@mui/material"); +import LayersIcon from "@mui/icons-material/Layers"; import CloseIcon from "@mui/icons-material/Close"; -import { useMemo, useState } from 'react'; -import MapLayer from '@/core/components/MapLayer'; -import ShowBound from './ShowBound'; +import { useMemo, useState } from "react"; +import MapLayer from "@/core/components/MapLayer"; +import ShowBound from "./ShowBound"; -const ShowPrimaryArea = ({primaryArea}) => { +const ShowPrimaryArea = ({ primaryArea }) => { const [openShowAreaDialog, setOpenShowAreaDialog] = useState(false); const bound = useMemo(() => { - const latLngCoords = primaryArea.coordinates.map(coord => [coord[1], coord[0]]); - return primaryArea.type === "polygon" - ? L.polygon(latLngCoords) - : L.polyline(latLngCoords); + const latLngCoords = primaryArea.coordinates.map((coord) => [coord[1], coord[0]]); + return primaryArea.type === "polygon" ? L.polygon(latLngCoords) : L.polyline(latLngCoords); }, [primaryArea]); - - return ( - - - setOpenShowAreaDialog(true)}> - - - - setOpenShowAreaDialog(false)} - PaperProps={{ - sx: { - transition: "all .3s", - boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", - borderRadius: 2, - padding: 1, - }, - }} - maxWidth="sm" - fullWidth - dir="rtl" - > - - - محدوده طرح - - setOpenShowAreaDialog(false)} size="small"> - + + return ( + + + setOpenShowAreaDialog(true)}> + - - - + + setOpenShowAreaDialog(false)} + PaperProps={{ + sx: { + transition: "all .3s", + boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + borderRadius: 2, + padding: 1, + }, + }} + maxWidth="sm" + fullWidth + dir="rtl" + > + + + محدوده طرح + + setOpenShowAreaDialog(false)} size="small"> + + + + + - - - - ) -} + + + + ); +}; -export default ShowPrimaryArea \ No newline at end of file +export default ShowPrimaryArea; diff --git a/src/core/utils/geoCalculations.js b/src/core/utils/geoCalculations.js index f0f9f03..ebf8a96 100644 --- a/src/core/utils/geoCalculations.js +++ b/src/core/utils/geoCalculations.js @@ -1,35 +1,35 @@ import * as turf from "@turf/turf"; export const calculatePolygonMetrics = (coordinates, isLatLngOrder = true) => { - if (!coordinates || coordinates.length < 3) { - return { area: 0, sides: [], coordinates: [] }; - } + if (!coordinates || coordinates.length < 3) { + return { area: 0, sides: [], coordinates: [] }; + } - const geoCoords = isLatLngOrder - ? coordinates.map(([lat, lng]) => [lng, lat]) - : coordinates.map(([lng, lat]) => [lng, lat]); + const geoCoords = isLatLngOrder + ? coordinates.map(([lat, lng]) => [lng, lat]) + : coordinates.map(([lng, lat]) => [lng, lat]); - if ( - geoCoords[0][0] !== geoCoords[geoCoords.length - 1][0] || - geoCoords[0][1] !== geoCoords[geoCoords.length - 1][1] - ) { - geoCoords.push(geoCoords[0]); - } + if ( + geoCoords[0][0] !== geoCoords[geoCoords.length - 1][0] || + geoCoords[0][1] !== geoCoords[geoCoords.length - 1][1] + ) { + geoCoords.push(geoCoords[0]); + } - const polygon = turf.polygon([geoCoords]); + const polygon = turf.polygon([geoCoords]); - const area = turf.area(polygon); + const area = turf.area(polygon); - const sides = []; - for (let i = 0; i < geoCoords.length - 1; i++) { - const line = turf.lineString([geoCoords[i], geoCoords[i + 1]]); - const length = turf.length(line, { units: "meters" }); - sides.push(length); - } + const sides = []; + for (let i = 0; i < geoCoords.length - 1; i++) { + const line = turf.lineString([geoCoords[i], geoCoords[i + 1]]); + const length = turf.length(line, { units: "meters" }); + sides.push(length); + } - return { - area, - sides, - coordinates: geoCoords, - }; -}; \ No newline at end of file + return { + area, + sides, + coordinates: geoCoords, + }; +}; diff --git a/src/core/utils/pageMenuDev.js b/src/core/utils/pageMenuDev.js index 67b05dc..23c42d7 100644 --- a/src/core/utils/pageMenuDev.js +++ b/src/core/utils/pageMenuDev.js @@ -24,10 +24,10 @@ import RouteIcon from "@mui/icons-material/Route"; import ScienceIcon from "@mui/icons-material/Science"; import SpaceDashboardIcon from "@mui/icons-material/SpaceDashboard"; import SpeedIcon from "@mui/icons-material/Speed"; -import PsychologyAltIcon from '@mui/icons-material/PsychologyAlt'; -import MapsHomeWorkIcon from '@mui/icons-material/MapsHomeWork'; -import SecurityIcon from '@mui/icons-material/Security'; -import ManageAccountsIcon from '@mui/icons-material/ManageAccounts'; +import PsychologyAltIcon from "@mui/icons-material/PsychologyAlt"; +import MapsHomeWorkIcon from "@mui/icons-material/MapsHomeWork"; +import SecurityIcon from "@mui/icons-material/Security"; +import ManageAccountsIcon from "@mui/icons-material/ManageAccounts"; export const pageMenuDev = [ { diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js index d51af49..8572b6f 100644 --- a/src/core/utils/routes.js +++ b/src/core/utils/routes.js @@ -239,4 +239,4 @@ export const CREATE_RAHDARAN_ITEM = api + "/api/v3/rahdaran"; export const GET_CITY_ADMIN_LIST = api + "/api/v3/harim/province_office"; export const GET_INQUIRY_PRIVACY_STATE_LIST = api + "/api/v3/harim/detail/states"; export const CITY_ADMIN_FEEDBACK = api + "/api/v3/harim/province_office/feedback"; -export const GET_PRIVACY_ADMIN_LIST = api + "/api/v3/harim/harim_office" \ No newline at end of file +export const GET_PRIVACY_ADMIN_LIST = api + "/api/v3/harim/harim_office"; From b76214574b4f12264a368be25892a931074f75df Mon Sep 17 00:00:00 2001 From: mhmjalali Date: Tue, 4 Nov 2025 09:11:26 +0330 Subject: [PATCH 5/5] remove unused file --- src/assets/scss/leaflet-measure.scss | 170 --------------------------- 1 file changed, 170 deletions(-) delete mode 100644 src/assets/scss/leaflet-measure.scss diff --git a/src/assets/scss/leaflet-measure.scss b/src/assets/scss/leaflet-measure.scss deleted file mode 100644 index 6cc4efa..0000000 --- a/src/assets/scss/leaflet-measure.scss +++ /dev/null @@ -1,170 +0,0 @@ -// leaflet-measure.scss - -$color-divider: #ddd; -$color-button: #5e66cc; -$color-lightertext: #999; - -$spacing-external: 12px; -$spacing-internal: 10px; - -$max-width: 280px; - -$button-icon-size: 12px; -$button-icon-spacing: 4px; - -@mixin hoverbutton { - color: $color-button; - text-decoration: none; - &:hover { - opacity: 0.5; - text-decoration: none; - } -} - -@mixin button($icon) { - display: inline; - width: auto; - height: auto; - padding-left: 20px; - margin-right: $button-icon-spacing; - line-height: 1em; - border: 0; - text-align: left; - color: $color-button; - &, - &:hover { - background-color: transparent; - } - background: { - image: url("assets/#{ $icon }.png"); - repeat: no-repeat; - position: 0% 50%; - size: $button-icon-size $button-icon-size; - } - .leaflet-retina & { - background-image: url("assets/#{ $icon }_@2X.png"); - } - - @include hoverbutton; -} - -.leaflet-control-measure, -.leaflet-measure-resultpopup { - h3 { - margin: 0 0 $spacing-external 0; - padding-bottom: $spacing-internal; - border-bottom: solid 1px $color-divider; - } - p { - margin: $spacing-internal 0 0 0; - line-height: 1.5em; - &:first-child { - margin-top: 0; - } - } - .tasks { - margin: $spacing-external 0 0 0; - padding: $spacing-internal 0 0 0; - border-top: solid 1px $color-divider; - text-align: right; - - list-style: none; - list-style-image: none; - - li { - display: inline; - margin: 0 $spacing-internal 0 0; - &:last-child { - margin-right: 0; - } - } - } - - .coorddivider { - color: $color-lightertext; - } -} - -.leaflet-control-measure { - max-width: $max-width; - background: #fff; - - .leaflet-control-measure-toggle, - .leaflet-control-measure-toggle:hover { - background: { - size: 14px 14px; - image: url(assets/rulers.png); - } - border: 0; - border-radius: 4px; - .leaflet-touch & { - border-radius: 2px; - } - - // Hide text - text-indent: 100%; - white-space: nowrap; - overflow: hidden; - - .leaflet-retina & { - background-image: url(assets/rulers_@2X.png); - } - - .leaflet-touch & { - background-size: 16px 16px; - } - } - - // Special styling because start prompt has no content, just header and tasks - .startprompt { - h3 { - margin-bottom: $spacing-internal; - } - .tasks { - margin-top: 0; - padding-top: 0; - border-top: 0; - text-align: left; - } - } - - .leaflet-control-measure-interaction { - padding: $spacing-internal $spacing-external; - } - - .results { - .group { - margin-top: $spacing-internal; - padding-top: $spacing-internal; - border-top: dotted 1px lighten($color-divider, 5); - &:first-child { - margin-top: 0; - padding-top: 0; - border-top: 0; - } - } - .heading { - margin-right: $spacing-internal * 0.5; - color: $color-lightertext; - } - } - - a.start { - @include button(start); - } - a.cancel { - @include button(cancel); - } - a.finish { - @include button(check); - } -} - -.leaflet-measure-resultpopup { - a.zoomto { - @include button(focus); - } - a.deletemarkup { - @include button(trash); - } -}