Merge branch 'develop'
This commit is contained in:
@@ -175,7 +175,7 @@ export default function ComputePaymentForm({ mutate, onClose, rowData }) {
|
|||||||
type="number"
|
type="number"
|
||||||
InputProps={{ readOnly: true }}
|
InputProps={{ readOnly: true }}
|
||||||
fullWidth
|
fullWidth
|
||||||
label="مساحت عیان (متر مربع)"
|
label="مساحت اعیان (متر مربع)"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -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 <FeatureGroup ref={featureRef} />;
|
||||||
|
};
|
||||||
|
export default ShowForbiddenBound;
|
||||||
@@ -2,17 +2,27 @@ const { IconButton, Tooltip, Box, Dialog, DialogTitle, Typography, DialogContent
|
|||||||
import MapLayer from "@/core/components/MapLayer";
|
import MapLayer from "@/core/components/MapLayer";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
import LayersIcon from "@mui/icons-material/Layers";
|
import LayersIcon from "@mui/icons-material/Layers";
|
||||||
|
import L from "leaflet";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import ShowBound from "./ShowBound";
|
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 [openShowAreaDialog, setOpenShowAreaDialog] = useState(false);
|
||||||
const bound = useMemo(() => {
|
const bound = useMemo(() => {
|
||||||
const latLngCoords = primaryArea.coordinates.map((coord) => [coord[1], coord[0]]);
|
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]);
|
}, [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 (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Tooltip title="نمایش پلیگان" placement="right" arrow>
|
<Tooltip title="نمایش پلیگان" placement="right" arrow>
|
||||||
@@ -48,6 +58,7 @@ const ShowPrimaryArea = ({ primaryArea }) => {
|
|||||||
<Box sx={{ width: "100%", height: "400px" }}>
|
<Box sx={{ width: "100%", height: "400px" }}>
|
||||||
<MapLayer style={{ borderRadius: "4px" }}>
|
<MapLayer style={{ borderRadius: "4px" }}>
|
||||||
<ShowBound bound={bound} />
|
<ShowBound bound={bound} />
|
||||||
|
<ShowForbiddenBound bound={forbiddenBound} />
|
||||||
</MapLayer>
|
</MapLayer>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -57,4 +68,4 @@ const ShowPrimaryArea = ({ primaryArea }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ShowPrimaryArea;
|
export default ShowProjectArea;
|
||||||
@@ -6,7 +6,7 @@ import { Box, Stack } from "@mui/material";
|
|||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import RowActions from "./RowActions";
|
import RowActions from "./RowActions";
|
||||||
import ShowPrimaryArea from "./ShowPrimaryArea";
|
import ShowProjectArea from "./ShowProjectArea";
|
||||||
|
|
||||||
const TechnicalDeputyList = () => {
|
const TechnicalDeputyList = () => {
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
@@ -127,9 +127,35 @@ const TechnicalDeputyList = () => {
|
|||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
Cell: ({ row }) =>
|
Cell: ({ row }) =>
|
||||||
row.original.primary_area ? (
|
row.original.primary_area && row.original.forbidden_area ? (
|
||||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||||
<ShowPrimaryArea primaryArea={row.original.primary_area} />
|
<ShowProjectArea
|
||||||
|
primaryArea={row.original.primary_area}
|
||||||
|
forbiddenArea={row.original.forbidden_area}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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 ? (
|
||||||
|
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||||
|
<ShowProjectArea
|
||||||
|
primaryArea={row.original.final_area}
|
||||||
|
forbiddenArea={row.original.final_plan}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
) : (
|
) : (
|
||||||
"-"
|
"-"
|
||||||
|
|||||||
Reference in New Issue
Block a user