diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/Forms/ComputePaymentForm.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/Forms/ComputePaymentForm.jsx index eb0fa47..0df367b 100644 --- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/Forms/ComputePaymentForm.jsx +++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/Forms/ComputePaymentForm.jsx @@ -175,7 +175,7 @@ export default function ComputePaymentForm({ mutate, onClose, rowData }) { type="number" InputProps={{ readOnly: true }} fullWidth - label="مساحت عیان (متر مربع)" + label="مساحت اعیان (متر مربع)" /> )} /> diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowPrimaryArea/ShowBound.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowProjectArea/ShowBound.jsx similarity index 100% rename from src/components/dashboard/inquiryPrivacy/technical-deputy/ShowPrimaryArea/ShowBound.jsx rename to src/components/dashboard/inquiryPrivacy/technical-deputy/ShowProjectArea/ShowBound.jsx diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowProjectArea/ShowForbiddenBound.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowProjectArea/ShowForbiddenBound.jsx new file mode 100644 index 0000000..c8d28d1 --- /dev/null +++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowProjectArea/ShowForbiddenBound.jsx @@ -0,0 +1,29 @@ +import { useEffect, useRef } from "react"; +import { FeatureGroup, useMap } from "react-leaflet"; + +const ShowForbiddenBound = ({ 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 ShowForbiddenBound; diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowPrimaryArea/index.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowProjectArea/index.jsx similarity index 78% rename from src/components/dashboard/inquiryPrivacy/technical-deputy/ShowPrimaryArea/index.jsx rename to src/components/dashboard/inquiryPrivacy/technical-deputy/ShowProjectArea/index.jsx index e4714de..e7386fc 100644 --- a/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowPrimaryArea/index.jsx +++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/ShowProjectArea/index.jsx @@ -2,17 +2,27 @@ const { IconButton, Tooltip, Box, Dialog, DialogTitle, Typography, DialogContent import MapLayer from "@/core/components/MapLayer"; import CloseIcon from "@mui/icons-material/Close"; import LayersIcon from "@mui/icons-material/Layers"; +import L from "leaflet"; import { useMemo, useState } from "react"; import ShowBound from "./ShowBound"; -import L from "leaflet"; +import ShowForbiddenBound from "./ShowForbiddenBound"; -const ShowPrimaryArea = ({ primaryArea }) => { +const ShowProjectArea = ({ primaryArea, forbiddenArea }) => { 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); + return primaryArea.type === "polygon" + ? L.polygon(latLngCoords, { + color: "#ff5555", + }) + : L.polyline(latLngCoords); }, [primaryArea]); + const forbiddenBound = useMemo(() => { + const latLngCoords = forbiddenArea.coordinates.map((coord) => [coord[1], coord[0]]); + return forbiddenArea.type === "polygon" ? L.polygon(latLngCoords) : L.polyline(latLngCoords); + }, [forbiddenArea]); + return ( @@ -48,6 +58,7 @@ const ShowPrimaryArea = ({ primaryArea }) => { + @@ -57,4 +68,4 @@ const ShowPrimaryArea = ({ primaryArea }) => { ); }; -export default ShowPrimaryArea; +export default ShowProjectArea; diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/TechnicalDeputyList.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/TechnicalDeputyList.jsx index bb3ec27..cb3a82f 100644 --- a/src/components/dashboard/inquiryPrivacy/technical-deputy/TechnicalDeputyList.jsx +++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/TechnicalDeputyList.jsx @@ -6,7 +6,7 @@ import { Box, Stack } from "@mui/material"; import moment from "jalali-moment"; import { useMemo } from "react"; import RowActions from "./RowActions"; -import ShowPrimaryArea from "./ShowPrimaryArea"; +import ShowProjectArea from "./ShowProjectArea"; const TechnicalDeputyList = () => { const columns = useMemo( @@ -127,9 +127,35 @@ const TechnicalDeputyList = () => { grow: false, size: 100, Cell: ({ row }) => - row.original.primary_area ? ( + row.original.primary_area && row.original.forbidden_area ? ( - + + + ) : ( + "-" + ), + }, + { + accessorKey: "final_area", + header: "نمایش محدوده عرصه و اعیان", + id: "final_area", + enableColumnFilter: true, + datatype: "text", + filterMode: "equals", + sortDescFirst: false, + columnFilterModeOptions: ["equals", "contains"], + grow: false, + size: 100, + Cell: ({ row }) => + row.original.final_area && row.original.final_plan ? ( + + ) : ( "-"