fixed bug and formatting
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Box, Button, ButtonGroup} from "@mui/material";
|
||||
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";
|
||||
@@ -6,31 +6,33 @@ import SaveIcon from "@mui/icons-material/Save";
|
||||
import CancelIcon from "@mui/icons-material/Cancel";
|
||||
|
||||
const MapActionButtons = ({
|
||||
disableToCreate,
|
||||
disableToEditAndDelete,
|
||||
disableToSaveAndCancel,
|
||||
onDraw,
|
||||
onEdit,
|
||||
onRemove,
|
||||
onSave,
|
||||
onCancel,
|
||||
}) => (
|
||||
disableToCreate,
|
||||
disableToEditAndDelete,
|
||||
disableToSaveAndCancel,
|
||||
onDraw,
|
||||
onEdit,
|
||||
onRemove,
|
||||
onSave,
|
||||
onCancel,
|
||||
}) => (
|
||||
<>
|
||||
<Box sx={{
|
||||
background: "#ffffff",
|
||||
position: "absolute",
|
||||
zIndex: "1999",
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
p: 2,
|
||||
pl: 0.5,
|
||||
pb: 0.5,
|
||||
borderTopRightRadius: 8,
|
||||
}}>
|
||||
<Box
|
||||
sx={{
|
||||
background: "#ffffff",
|
||||
position: "absolute",
|
||||
zIndex: "1999",
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
p: 2,
|
||||
pl: 0.5,
|
||||
pb: 0.5,
|
||||
borderTopRightRadius: 8,
|
||||
}}
|
||||
>
|
||||
<ButtonGroup variant="contained" orientation="vertical" aria-label="map action group button">
|
||||
<Button
|
||||
sx={{justifyContent: "space-between"}}
|
||||
startIcon={<AutoModeIcon/>}
|
||||
sx={{ justifyContent: "space-between" }}
|
||||
startIcon={<AutoModeIcon />}
|
||||
color="primary"
|
||||
disabled={disableToCreate}
|
||||
onClick={onDraw}
|
||||
@@ -38,8 +40,8 @@ const MapActionButtons = ({
|
||||
اصلاح
|
||||
</Button>
|
||||
<Button
|
||||
sx={{justifyContent: "space-between"}}
|
||||
startIcon={<EditLocationAltIcon/>}
|
||||
sx={{ justifyContent: "space-between" }}
|
||||
startIcon={<EditLocationAltIcon />}
|
||||
color="warning"
|
||||
disabled={disableToEditAndDelete}
|
||||
onClick={onEdit}
|
||||
@@ -47,8 +49,8 @@ const MapActionButtons = ({
|
||||
ویرایش
|
||||
</Button>
|
||||
<Button
|
||||
sx={{justifyContent: "space-between"}}
|
||||
startIcon={<DeleteIcon/>}
|
||||
sx={{ justifyContent: "space-between" }}
|
||||
startIcon={<DeleteIcon />}
|
||||
color="error"
|
||||
disabled={disableToEditAndDelete}
|
||||
onClick={onRemove}
|
||||
@@ -58,18 +60,20 @@ const MapActionButtons = ({
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
|
||||
<Box sx={{
|
||||
position: "absolute",
|
||||
zIndex: "1999",
|
||||
right: 10,
|
||||
top: 10,
|
||||
background: "#fff",
|
||||
borderRadius: 1,
|
||||
padding: 0.5,
|
||||
}}>
|
||||
<Box
|
||||
sx={{
|
||||
position: "absolute",
|
||||
zIndex: "1999",
|
||||
right: 10,
|
||||
top: 10,
|
||||
background: "#fff",
|
||||
borderRadius: 1,
|
||||
padding: 0.5,
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
sx={{justifyContent: "space-between", mr: 1}}
|
||||
startIcon={<SaveIcon/>}
|
||||
sx={{ justifyContent: "space-between", mr: 1 }}
|
||||
startIcon={<SaveIcon />}
|
||||
variant="outlined"
|
||||
size="small"
|
||||
color="success"
|
||||
@@ -79,8 +83,8 @@ const MapActionButtons = ({
|
||||
ذخیره
|
||||
</Button>
|
||||
<Button
|
||||
sx={{justifyContent: "space-between"}}
|
||||
startIcon={<CancelIcon/>}
|
||||
sx={{ justifyContent: "space-between" }}
|
||||
startIcon={<CancelIcon />}
|
||||
variant="outlined"
|
||||
size="small"
|
||||
color="error"
|
||||
@@ -93,4 +97,4 @@ const MapActionButtons = ({
|
||||
</>
|
||||
);
|
||||
|
||||
export default MapActionButtons;
|
||||
export default MapActionButtons;
|
||||
|
||||
@@ -22,67 +22,72 @@ import GppMaybeIcon from "@mui/icons-material/GppMaybe";
|
||||
import PolygonForDesign from "./PolygonForDesign";
|
||||
|
||||
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
||||
loading: () => <MapLoading/>,
|
||||
loading: () => <MapLoading />,
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
const MapModifyDialog = ({mapModifyModal, setMapModifyModal}) => {
|
||||
const MapModifyDialog = ({ mapModifyModal, setMapModifyModal }) => {
|
||||
const handleClose = () => {
|
||||
setMapModifyModal(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={mapModifyModal} onClose={handleClose} maxWidth="lg" fullWidth>
|
||||
<DialogContent sx={{p: 2}} dividers>
|
||||
<Divider sx={{my: 3}}>
|
||||
<Chip color="primary" sx={{mx: 1, fontSize: "13px", fontWeight: 500}}
|
||||
label="بررسی پلیگان طرح متقاضی"/>
|
||||
<DialogContent sx={{ p: 2 }} dividers>
|
||||
<Divider sx={{ my: 3 }}>
|
||||
<Chip
|
||||
color="primary"
|
||||
sx={{ mx: 1, fontSize: "13px", fontWeight: 500 }}
|
||||
label="بررسی پلیگان طرح متقاضی"
|
||||
/>
|
||||
</Divider>
|
||||
<Box sx={{
|
||||
width: "100%",
|
||||
height: "400px",
|
||||
borderRadius: 3,
|
||||
borderBottomLeftRadius: 0,
|
||||
overflow: "hidden",
|
||||
}}>
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "400px",
|
||||
borderRadius: 3,
|
||||
borderBottomLeftRadius: 0,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
>
|
||||
<MapLayer>
|
||||
<PolygonForDesign/>
|
||||
<PolygonForDesign />
|
||||
</MapLayer>
|
||||
</Box>
|
||||
<Box sx={{display: "flex", my: 2, alignItems: "center"}}>
|
||||
<GppMaybeIcon color="warning"/>
|
||||
<Typography variant="button" sx={{color: "warning.main", ml: 1}}>
|
||||
<Box sx={{ display: "flex", my: 2, alignItems: "center" }}>
|
||||
<GppMaybeIcon color="warning" />
|
||||
<Typography variant="button" sx={{ color: "warning.main", ml: 1 }}>
|
||||
نکته: اصلاح ننمودن طرح به منزله تایید طرح میباشد.
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box sx={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
border: "1px solid #e1e1e1",
|
||||
p: 2,
|
||||
borderRadius: 1,
|
||||
}}>
|
||||
<FormControl sx={{flexDirection: "row", alignItems: "center", gap: 2}}>
|
||||
<FormLabel id="way-status" sx={{fontWeight: 500, fontSize: "16px", color: "warning.main"}}>آیا
|
||||
طرح نیاز به ایجاد راه
|
||||
دسترسی
|
||||
دارد؟</FormLabel>
|
||||
<RadioGroup
|
||||
row
|
||||
aria-labelledby="way-status"
|
||||
defaultValue={0}
|
||||
name="radio-buttons-group"
|
||||
>
|
||||
<FormControlLabel value={1} control={<Radio color="warning"/>} label="بله"/>
|
||||
<FormControlLabel value={0} control={<Radio color="warning"/>} label="خیر"/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
border: "1px solid #e1e1e1",
|
||||
p: 2,
|
||||
borderRadius: 1,
|
||||
}}
|
||||
>
|
||||
<FormControl sx={{ flexDirection: "row", alignItems: "center", gap: 2 }}>
|
||||
<FormLabel id="way-status" sx={{ fontWeight: 500, fontSize: "16px", color: "warning.main" }}>
|
||||
آیا طرح نیاز به ایجاد راه دسترسی دارد؟
|
||||
</FormLabel>
|
||||
<RadioGroup row aria-labelledby="way-status" defaultValue={0} name="radio-buttons-group">
|
||||
<FormControlLabel value={1} control={<Radio color="warning" />} label="بله" />
|
||||
<FormControlLabel value={0} control={<Radio color="warning" />} label="خیر" />
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
</Box>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{justifyContent: "center", py: 2}}>
|
||||
<Button size="large" variant="outlined">بستن</Button>
|
||||
<Button size="large" variant="contained">ثبت</Button>
|
||||
<DialogActions sx={{ justifyContent: "center", py: 2 }}>
|
||||
<Button size="large" variant="outlined">
|
||||
بستن
|
||||
</Button>
|
||||
<Button size="large" variant="contained">
|
||||
ثبت
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import "leaflet-draw/dist/leaflet.draw.css";
|
||||
import "@/assets/scss/map-styles.scss"
|
||||
import {FeatureGroup, useMap} from "react-leaflet";
|
||||
import {EditControl} from "react-leaflet-draw";
|
||||
import {useEffect, useRef, useState} from "react";
|
||||
import "@/assets/scss/map-styles.scss";
|
||||
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);
|
||||
@@ -18,7 +17,7 @@ const PolygonForDesign = () => {
|
||||
const [editToolbar, setEditToolbar] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const {L} = window;
|
||||
const { L } = window;
|
||||
L.drawLocal.draw.handlers.polygon.tooltip = {
|
||||
start: "برای شروع کشیدن پلیگان، کلیک کنید.",
|
||||
cont: "گوشه های دیگر پلیگان را نیز انتخاب کنید.",
|
||||
@@ -31,14 +30,14 @@ const PolygonForDesign = () => {
|
||||
}, []);
|
||||
|
||||
const handleDrawPolygon = () => {
|
||||
const {L} = window;
|
||||
const { L } = window;
|
||||
const drawControl = new L.Draw.Polygon(map);
|
||||
drawControl.enable();
|
||||
setDisableToCreate(true);
|
||||
};
|
||||
|
||||
const handleEditPolygon = () => {
|
||||
const {L} = window;
|
||||
const { L } = window;
|
||||
if (editableFG.current && polygonLayer) {
|
||||
const editControlInstance = new L.EditToolbar.Edit(map, {
|
||||
featureGroup: editableFG.current,
|
||||
@@ -98,7 +97,7 @@ const PolygonForDesign = () => {
|
||||
rectangle: false,
|
||||
polyline: false,
|
||||
}}
|
||||
edit={{edit: false, remove: false}}
|
||||
edit={{ edit: false, remove: false }}
|
||||
/>
|
||||
</FeatureGroup>
|
||||
<MapActionButtons
|
||||
@@ -115,4 +114,4 @@ const PolygonForDesign = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default PolygonForDesign;
|
||||
export default PolygonForDesign;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {IconButton, Tooltip} from "@mui/material";
|
||||
import { IconButton, Tooltip } from "@mui/material";
|
||||
import MapIcon from "@mui/icons-material/Map";
|
||||
import {useState} from "react";
|
||||
import { useState } from "react";
|
||||
import MapModifyDialog from "./MapModifyDialog";
|
||||
|
||||
const MapModify = ({rowId, mutate}) => {
|
||||
const MapModify = ({ rowId, mutate }) => {
|
||||
const [mapModifyModal, setMapModifyModal] = useState(false);
|
||||
|
||||
const openMapModifyDialog = () => {
|
||||
@@ -14,11 +14,15 @@ const MapModify = ({rowId, mutate}) => {
|
||||
<>
|
||||
<Tooltip title="بررسی پلیگان طرح" arrow placement="right">
|
||||
<IconButton color="primary" onClick={openMapModifyDialog}>
|
||||
<MapIcon/>
|
||||
<MapIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<MapModifyDialog mapModifyModal={mapModifyModal} setMapModifyModal={setMapModifyModal} rowId={rowId}
|
||||
mutate={mutate}/>
|
||||
<MapModifyDialog
|
||||
mapModifyModal={mapModifyModal}
|
||||
setMapModifyModal={setMapModifyModal}
|
||||
rowId={rowId}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import ReferForm from "./Refer";
|
||||
import TaskDetail from "./TaskDetail";
|
||||
import {Box} from "@mui/material";
|
||||
import { Box } from "@mui/material";
|
||||
import RoadSafetyForm from "./RoadSafetyForm";
|
||||
import MapModify from "./MapModify";
|
||||
|
||||
const RowActions = ({row, mutate}) => {
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{display: "flex", gap: 1}}>
|
||||
<MapModify mutate={mutate} rowId={row.getValue("id")}/>
|
||||
<ReferForm mutate={mutate} rowId={row.getValue("id")}/>
|
||||
<TaskDetail mutate={mutate} rowId={row.getValue("id")}/>
|
||||
<RoadSafetyForm rowId={row.getValue("id")} mutate={mutate}/>
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<MapModify mutate={mutate} rowId={row.getValue("id")} />
|
||||
<ReferForm mutate={mutate} rowId={row.getValue("id")} />
|
||||
<TaskDetail mutate={mutate} rowId={row.getValue("id")} />
|
||||
<RoadSafetyForm rowId={row.getValue("id")} mutate={mutate} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user