Merge pull request #3 from witelgroup/feature/estelam_harim
Feature/estelam harim
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
export const metadata = {
|
||||
title: "کارتابل معاون",
|
||||
};
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission permission_name={["all"]}>
|
||||
<h1>کارتابل معاون</h1>
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
@@ -1,12 +0,0 @@
|
||||
import AssistantZaminGovComponent from "@/components/dashboard/inquiryPrivacy/assistant/zaminGov";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission>
|
||||
<AssistantZaminGovComponent />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
@@ -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 (
|
||||
<WithPermission permission_name={["all"]}>
|
||||
<CityAdminPage />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
@@ -1,12 +0,0 @@
|
||||
import CityAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission>
|
||||
<CityAdminZaminGovComponent />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
@@ -0,0 +1,13 @@
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
export const metadata = {
|
||||
title: "کارتابل مدیر",
|
||||
};
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission permission_name={["all"]}>
|
||||
<h1>کارتابل مدیر</h1>
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
@@ -1,12 +0,0 @@
|
||||
import GeneralManagerZaminGovComponent from "@/components/dashboard/inquiryPrivacy/generalManager/zaminGov";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission>
|
||||
<GeneralManagerZaminGovComponent />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
@@ -0,0 +1,14 @@
|
||||
import PrivacyOfficePage from "@/components/dashboard/inquiryPrivacy/privacy-office";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
export const metadata = {
|
||||
title: "کارتابل اداره حریم",
|
||||
};
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission permission_name={["all"]}>
|
||||
<PrivacyOfficePage />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
@@ -1,12 +0,0 @@
|
||||
import ProvinceAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission>
|
||||
<ProvinceAdminZaminGovComponent />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
@@ -1,29 +0,0 @@
|
||||
import { FormControl, FormHelperText, InputLabel, OutlinedInput, Stack } from "@mui/material";
|
||||
|
||||
const DescriptionForm = ({ errors, register }) => {
|
||||
return (
|
||||
<Stack>
|
||||
<FormControl error={!!errors.description} size="small" fullWidth variant="outlined">
|
||||
<InputLabel sx={{ pt: 1 }} htmlFor="description">
|
||||
توضیحات
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
id="description"
|
||||
label={"توضیحات"}
|
||||
multiline
|
||||
rows={6}
|
||||
{...register("description")}
|
||||
autoComplete="off"
|
||||
size="small"
|
||||
fullWidth
|
||||
sx={{ mt: 1 }}
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText id="description">
|
||||
{errors.description ? errors.description.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default DescriptionForm;
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Button } from "@mui/material";
|
||||
|
||||
const ManagerOrAssistantSubmit = ({ isSubmitting }) => {
|
||||
return (
|
||||
<>
|
||||
<Button fullWidth variant="outlined" color="secondary" disabled={isSubmitting} type={"submit"}>
|
||||
{isSubmitting ? "در حال ارسال..." : "مخالفت"}
|
||||
</Button>
|
||||
<Button fullWidth variant="contained" color="primary" type={"submit"} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال ارسال..." : "موافقت"}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ManagerOrAssistantSubmit;
|
||||
@@ -1,25 +0,0 @@
|
||||
import { Card, CardContent, CardHeader, CircularProgress, Divider, Stack, Typography } from "@mui/material";
|
||||
|
||||
const PrevCartableOpinion = ({ message, loadingMessage, errorMessage }) => {
|
||||
return (
|
||||
<Stack>
|
||||
<Card variant="outlined">
|
||||
<CardHeader sx={{ pb: 0 }} title="نظر معاون راهداری استان :" />
|
||||
<CardContent>
|
||||
{errorMessage ? (
|
||||
<Typography color={"red"}>خطا در دریافت اطلاعات !!!</Typography>
|
||||
) : loadingMessage ? (
|
||||
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||
<CircularProgress size={20} />
|
||||
درحال دریافت اطلاعات
|
||||
</Typography>
|
||||
) : (
|
||||
<Typography>{message}</Typography>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Divider sx={{ mt: 2 }} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default PrevCartableOpinion;
|
||||
@@ -1,33 +0,0 @@
|
||||
import { Card, CardContent, FormControl, FormLabel, Stack, Typography } from "@mui/material";
|
||||
|
||||
const QuestionSafetyForm = () => {
|
||||
return (
|
||||
<Stack sx={{ py: 2 }}>
|
||||
<Card
|
||||
sx={{ display: "flex", justifyContent: "center", alignItems: "center", borderColor: "primary.main" }}
|
||||
variant="outlined"
|
||||
>
|
||||
<CardContent>
|
||||
<FormControl>
|
||||
<FormLabel>
|
||||
<Typography color={"primary"} variant={"h5"} fontWeight={"bolder"}>
|
||||
آیا ایمنی راه این طرح مورد تایید است ؟
|
||||
</Typography>
|
||||
</FormLabel>
|
||||
<Stack
|
||||
sx={{ pt: 2, display: "flex", justifyContent: "center", alignItems: "center" }}
|
||||
spacing={1}
|
||||
direction={"row"}
|
||||
>
|
||||
<Typography variant={"subtitle1"}>دفتر حریم راه : </Typography>
|
||||
<Typography variant={"h5"} fontWeight={"bolder"}>
|
||||
بله
|
||||
</Typography>
|
||||
</Stack>
|
||||
</FormControl>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default QuestionSafetyForm;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<DialogContent>
|
||||
<ApplicantRequestDetail data={fakeData} />
|
||||
<Stack spacing={2}>
|
||||
<QuestionSafetyForm />
|
||||
<PrevCartableOpinion
|
||||
message={message}
|
||||
loadingMessage={loadingMessage}
|
||||
errorMessage={errorMessage}
|
||||
/>
|
||||
<DescriptionForm register={register} errors={errors} />
|
||||
<DialogActions>
|
||||
<ManagerOrAssistantSubmit isSubmitting={isSubmitting} />
|
||||
</DialogActions>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default RoadSafetyFormContext;
|
||||
@@ -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 (
|
||||
<Stack>
|
||||
<Tooltip title="فرم ایمنی راه" arrow placement="right">
|
||||
<IconButton
|
||||
color="primary"
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
onClick={() => {
|
||||
setOpenRoadSafetyForm(true);
|
||||
}}
|
||||
>
|
||||
<EngineeringIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
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",
|
||||
},
|
||||
}}
|
||||
open={openRoadSafetyForm}
|
||||
maxWidth={"lg"}
|
||||
TransitionComponent={DialogTransition}
|
||||
>
|
||||
<IconButton
|
||||
aria-label="close"
|
||||
onClick={() => setOpenRoadSafetyForm(false)}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
right: 8,
|
||||
top: 8,
|
||||
zIndex: 10,
|
||||
color: (theme) => theme.palette.grey[500],
|
||||
}}
|
||||
>
|
||||
<Close />
|
||||
</IconButton>
|
||||
<RoadSafetyFormContext rowId={rowId} mutate={mutate} setOpenRoadSafetyForm={setOpenRoadSafetyForm} />
|
||||
</Dialog>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default RoadSafetyForm;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<Dialog open={taskModal} onClose={handleClose} maxWidth="lg" fullWidth>
|
||||
<DialogContent dividers>
|
||||
<ApplicantRequestDetail data={fakeData} />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default DetailDialog;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="جزئیات طرح متقاضی" arrow placement="right">
|
||||
<IconButton color="primary" onClick={openDetailDialog}>
|
||||
<AssignmentIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<DetailDialog taskModal={taskModal} setTaskModal={setTaskModal} rowId={rowId} mutate={mutate} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default TaskDetail;
|
||||
@@ -1,13 +0,0 @@
|
||||
import TaskDetail from "./TaskDetail";
|
||||
import { Box } from "@mui/material";
|
||||
import RoadSafetyForm from "./RoadSafetyForm";
|
||||
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<TaskDetail mutate={mutate} rowId={row.getValue("id")} />
|
||||
<RoadSafetyForm mutate={mutate} rowId={row.getValue("id")} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default RowActions;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
table_title={"لیست استعلام ها"}
|
||||
need_filter={false}
|
||||
columns={columns}
|
||||
table_url={"/v3/api/fake-data"}
|
||||
page_name={"assistantZaminGov"}
|
||||
table_name={"assistantZaminGovList"}
|
||||
enableRowActions
|
||||
positionActionsColumn={"last"}
|
||||
RowActions={RowActions}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default TaskList;
|
||||
@@ -1,15 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { Stack } from "@mui/material";
|
||||
import TaskList from "./TaskList";
|
||||
|
||||
const AssistantZaminGovComponent = () => {
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"استعلام حرائم پنجره واحد"} />
|
||||
<TaskList />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default AssistantZaminGovComponent;
|
||||
@@ -0,0 +1,243 @@
|
||||
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 <MapsHomeWorkIcon sx={{ color: "#A0B9C6" }} />;
|
||||
if (state_id === 2 || state_id === 5 || state_id === 13) return <SecurityIcon sx={{ color: "#995FA3" }} />;
|
||||
if (state_id === 3 || state_id === 6 || state_id === 14)
|
||||
return <ManageAccountsIcon sx={{ color: "#9A98B5" }} />;
|
||||
if (state_id === 4 || state_id === 7 || state_id === 15) return <PsychologyAltIcon sx={{ color: "#1B9AAA" }} />;
|
||||
if (state_id === 8) return <ReceiptLongIcon sx={{ color: "#9A98B5" }} />;
|
||||
if (state_id === 9 || state_id === 11) return <WindowIcon sx={{ color: "#DDDBCB" }} />;
|
||||
if (state_id === 10) return <DangerousIcon sx={{ color: "error.main" }} />;
|
||||
if (state_id === 12) return <AutorenewIcon sx={{ color: "#899878" }} />;
|
||||
};
|
||||
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 (
|
||||
<CustomSelectByDependency
|
||||
{...props}
|
||||
value={loadingItemsList ? "loading" : props.filterParameters.value}
|
||||
columnSelectOption={getColumnSelectOptions}
|
||||
/>
|
||||
);
|
||||
},
|
||||
Cell: ({ row }) => (
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
{stateIcon(row.original.state_id)}
|
||||
<Box component="span" ml={1}>
|
||||
{row.original.state_name}
|
||||
</Box>
|
||||
</Box>
|
||||
),
|
||||
},
|
||||
{
|
||||
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 ? (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<ShowPrimaryArea primaryArea={row.original.primary_area} />
|
||||
</Stack>
|
||||
) : (
|
||||
"-"
|
||||
),
|
||||
},
|
||||
{
|
||||
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 (
|
||||
<>
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
need_filter={true}
|
||||
columns={columns}
|
||||
table_url={GET_CITY_ADMIN_LIST}
|
||||
page_name={"cityAdmin"}
|
||||
table_name={"cityAdminList"}
|
||||
enableRowActions
|
||||
positionActionsColumn={"first"}
|
||||
RowActions={RowActions}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default CityAdminList;
|
||||
@@ -0,0 +1,149 @@
|
||||
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 drawControlRef = useRef(null);
|
||||
|
||||
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]);
|
||||
|
||||
return <FeatureGroup ref={featureRef} />;
|
||||
};
|
||||
|
||||
export default DrawPolygon;
|
||||
@@ -0,0 +1,121 @@
|
||||
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: <Route />,
|
||||
onclick: (controlDispach) => {
|
||||
controlDispach({ type: "SET_STATUS", status: 1 });
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
message: "محدودهی موردنظر را با کلیک روی نقشه مشخص کنید. برای اتمام، روی نقطهی ابتدایی کلیک کنید!",
|
||||
buttons: [],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
message: "برای اصلاح محدوده، گوشهها را بکشید. برای ترسیم دوباره، آن را حذف کنید",
|
||||
buttons: [
|
||||
{
|
||||
label: "حذف",
|
||||
key: "end",
|
||||
color: "error",
|
||||
icon: <Delete />,
|
||||
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 (
|
||||
<>
|
||||
<DrawPolygon
|
||||
drawBound={drawBound}
|
||||
setDrawBound={setDrawBound}
|
||||
control={control}
|
||||
controlDispach={controlDispach}
|
||||
/>
|
||||
<Box
|
||||
direction={"row"}
|
||||
justifyContent={"center"}
|
||||
sx={{ display: "flex", position: "absolute", left: 0, top: 0, zIndex: 2000, width: "100%" }}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
background: (theme) => theme.palette.secondary.main,
|
||||
borderBottomLeftRadius: 8,
|
||||
borderBottomRightRadius: 8,
|
||||
py: 0.5,
|
||||
px: 2,
|
||||
}}
|
||||
>
|
||||
<Typography align="center" component={"div"} variant="caption" color={"#fff"}>
|
||||
{statusType.find((st) => st.id == control.status).message}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
zIndex: 2000,
|
||||
width: "100%",
|
||||
py: 1,
|
||||
background: "linear-gradient(to top, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0))",
|
||||
}}
|
||||
>
|
||||
<Box direction={"row"} justifyContent={"center"} spacing={2} sx={{ display: "flex" }}>
|
||||
{statusType
|
||||
.find((st) => st.id == control.status)
|
||||
.buttons.map((button) => (
|
||||
<Button
|
||||
size="medium"
|
||||
key={button.key}
|
||||
variant="contained"
|
||||
onClick={() => button.onclick(controlDispach)}
|
||||
color={button.color}
|
||||
startIcon={button.icon}
|
||||
>
|
||||
{button.label}
|
||||
</Button>
|
||||
))}
|
||||
</Box>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default MapDrawPolygon;
|
||||
@@ -0,0 +1,156 @@
|
||||
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 { 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]);
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { isSubmitting, errors },
|
||||
} = 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,
|
||||
};
|
||||
|
||||
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: payload,
|
||||
});
|
||||
|
||||
mutate();
|
||||
setOpenFeedbackDialog(false);
|
||||
} catch (error) {
|
||||
console.error("❌ Error submitting feedback:", error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
<Tooltip title="ارسال بازخورد">
|
||||
<IconButton color="success" onClick={() => setOpenFeedbackDialog(true)}>
|
||||
<ForumIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
open={openFeedbackDialog}
|
||||
onClose={() => 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"
|
||||
>
|
||||
<DialogTitle sx={{ display: "flex", justifyContent: "space-between" }}>
|
||||
<Typography variant="body1" sx={{ fontWeight: "bold", fontSize: "large" }}>
|
||||
توضیحات ناظر
|
||||
</Typography>
|
||||
<IconButton onClick={() => setOpenFeedbackDialog(false)} size="small">
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</DialogTitle>
|
||||
<DialogContent sx={{ display: "flex", flexDirection: "column" }}>
|
||||
<Typography variant="h6">
|
||||
منطقه ممنوعه{" "}
|
||||
<Typography variant="caption" sx={{ color: "error.main" }}>
|
||||
(در صورت وجود انتخاب کنید)
|
||||
</Typography>
|
||||
</Typography>
|
||||
<Box sx={{ width: "100%", height: "400px", mb: 2 }}>
|
||||
<MapLayer style={{ borderRadius: "4px", border: "1px solid #eeeeee" }}>
|
||||
<ShowBound bound={bound} />
|
||||
<MapDrawPolygon drawBound={drawBound} setDrawBound={setDrawBound} />
|
||||
</MapLayer>
|
||||
</Box>
|
||||
<TextField
|
||||
{...register("expert_description")}
|
||||
multiline
|
||||
rows={3}
|
||||
label="توضیحات ناظر"
|
||||
placeholder="توضیحات ناظر"
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{ mt: 1 }}
|
||||
InputLabelProps={{ shrink: true }}
|
||||
error={!!errors.expert_description}
|
||||
helperText={errors.expert_description?.message}
|
||||
/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => setOpenFeedbackDialog(false)}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={isSubmitting}
|
||||
autoFocus
|
||||
>
|
||||
بستن
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleSubmit(onSubmit)}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{isSubmitting ? "درحال ثبت تایید..." : "ثبت توضیحات"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default FeedbackAction;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Box } from "@mui/material";
|
||||
import FeedbackAction from "./FeedbackAction";
|
||||
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1, justifyContent: "Center" }}>
|
||||
{row.original.state_id === 1 ? (
|
||||
<FeedbackAction mutate={mutate} rowId={row.original.id} rowPrimaryArea={row.original.primary_area} />
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default RowActions;
|
||||
@@ -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 <FeatureGroup ref={featureRef} />;
|
||||
};
|
||||
export default ShowBound;
|
||||
@@ -0,0 +1,69 @@
|
||||
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 (
|
||||
<Box>
|
||||
<Tooltip title="نمایش پلیگان" placement="right" arrow>
|
||||
<IconButton size="small" color="primary" onClick={() => setOpenShowAreaDialog(true)}>
|
||||
<LayersIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
open={openShowAreaDialog}
|
||||
onClose={() => 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"
|
||||
>
|
||||
<DialogTitle sx={{ display: "flex", justifyContent: "space-between", padding: "16px 24px" }}>
|
||||
<Typography variant="body1" sx={{ fontWeight: "bold", fontSize: "large" }}>
|
||||
محدوده طرح
|
||||
</Typography>
|
||||
<IconButton onClick={() => setOpenShowAreaDialog(false)} size="small">
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<Box sx={{ flex: 1 }}>
|
||||
<Box sx={{ width: "100%", height: "400px" }}>
|
||||
<MapLayer style={{ borderRadius: "4px" }}>
|
||||
<ShowBound bound={bound} />
|
||||
</MapLayer>
|
||||
</Box>
|
||||
</Box>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ShowPrimaryArea;
|
||||
14
src/components/dashboard/inquiryPrivacy/city-admin/index.jsx
Normal file
14
src/components/dashboard/inquiryPrivacy/city-admin/index.jsx
Normal file
@@ -0,0 +1,14 @@
|
||||
"use client";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { Stack } from "@mui/material";
|
||||
import CityAdminList from "./CityAdminList";
|
||||
|
||||
const CityAdminPage = () => {
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"کارتابل شهرستان استعلام حریم"} />
|
||||
<CityAdminList />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default CityAdminPage;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<FormControl error={!!errors.description} size="small" fullWidth variant="outlined">
|
||||
<InputLabel sx={{ pt: 1 }} htmlFor="description">
|
||||
توضیحات
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
id="description"
|
||||
label={"توضیحات"}
|
||||
multiline
|
||||
rows={8}
|
||||
autoComplete="off"
|
||||
{...register("description")}
|
||||
size="small"
|
||||
fullWidth
|
||||
sx={{ mt: 1 }}
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText id="description">
|
||||
{errors.description ? errors.description.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Controller
|
||||
name="city"
|
||||
control={control}
|
||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||
<FormControl error={!!error} size="small" fullWidth variant="outlined">
|
||||
<InputLabel htmlFor="city" />
|
||||
{errorCities ? (
|
||||
<Typography color={"red"}>خطایی در دریافت شهرستان ها رخ داده است!</Typography>
|
||||
) : loadingCities ? (
|
||||
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||
<CircularProgress size={20} />
|
||||
درحال دریافت لیست شهرستان ها
|
||||
</Typography>
|
||||
) : (
|
||||
<Autocomplete
|
||||
id="city"
|
||||
size="small"
|
||||
value={cities.find((city) => 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) => (
|
||||
<TextField
|
||||
{...params}
|
||||
autoComplete="off"
|
||||
error={!!errors.city}
|
||||
fullWidth
|
||||
label="شهرستان"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
<FormHelperText id="city">
|
||||
{errors.city ? errors.city.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||
{"انصراف"}
|
||||
</Button>
|
||||
<Button variant="contained" color="primary" type={"submit"} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال اسال" : "ارجاع"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default ReferFormContext;
|
||||
@@ -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 (
|
||||
<Stack>
|
||||
<Tooltip title="ارجاع به شهرستان دیگر" arrow placement="right">
|
||||
<IconButton
|
||||
color="primary"
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
onClick={() => {
|
||||
setOpenReferDialog(true);
|
||||
}}
|
||||
>
|
||||
<ReplyIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
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",
|
||||
},
|
||||
}}
|
||||
open={openReferDialog}
|
||||
fullWidth
|
||||
TransitionComponent={DialogTransition}
|
||||
>
|
||||
<DialogTitle sx={{ m: 0, p: 2, borderBottom: 1, borderColor: "divider" }} id="create-dialog">
|
||||
ارجاع به شهرستان دیگر
|
||||
</DialogTitle>
|
||||
<ReferFormContext rowId={rowId} mutate={mutate} setOpenReferDialog={setOpenReferDialog} />
|
||||
</Dialog>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default ReferForm;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<Dialog open={taskModal} onClose={handleClose} maxWidth="lg" fullWidth>
|
||||
<DialogContent dividers>
|
||||
<ApplicantRequestDetail data={fakeData} />
|
||||
<FormControl error={!!errors.description} size="small" fullWidth variant="outlined">
|
||||
<InputLabel sx={{ pt: 1 }} htmlFor="description">
|
||||
توضیحات
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
id="description"
|
||||
label={"توضیحات"}
|
||||
multiline
|
||||
rows={8}
|
||||
autoComplete="off"
|
||||
{...register("description")}
|
||||
size="small"
|
||||
fullWidth
|
||||
sx={{ mt: 1 }}
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText id="description">
|
||||
{errors.description ? errors.description.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ justifyContent: "center", py: 2 }}>
|
||||
<Button size="large" variant="contained">
|
||||
ارسال به دفتر حریم
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default DetailDialog;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="جزئیات طرح متقاضی" arrow placement="right">
|
||||
<IconButton color="primary" onClick={openDetailDialog}>
|
||||
<AssignmentIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<DetailDialog taskModal={taskModal} setTaskModal={setTaskModal} rowId={rowId} mutate={mutate} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default TaskDetail;
|
||||
@@ -1,15 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import ReferForm from "./Refer";
|
||||
import TaskDetail from "./TaskDetail";
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<ReferForm mutate={mutate} rowId={row.getValue("id")} />
|
||||
<TaskDetail mutate={mutate} rowId={row.getValue("id")} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default RowActions;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
table_title={"لیست استعلام ها"}
|
||||
need_filter={false}
|
||||
columns={columns}
|
||||
table_url={"/v3/api/fake-data"}
|
||||
page_name={"cityAdminZaminGov"}
|
||||
table_name={"cityAdminZaminGovList"}
|
||||
enableRowActions
|
||||
positionActionsColumn={"last"}
|
||||
RowActions={RowActions}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default TaskList;
|
||||
@@ -1,14 +0,0 @@
|
||||
"use client";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { Stack } from "@mui/material";
|
||||
import TaskList from "./TaskList";
|
||||
|
||||
const CityAdminZaminGovComponent = () => {
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"استعلام حرائم پنجره واحد"} />
|
||||
<TaskList />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default CityAdminZaminGovComponent;
|
||||
@@ -1,29 +0,0 @@
|
||||
import { FormControl, FormHelperText, InputLabel, OutlinedInput, Stack } from "@mui/material";
|
||||
|
||||
const DescriptionForm = ({ errors, register }) => {
|
||||
return (
|
||||
<Stack>
|
||||
<FormControl error={!!errors.description} size="small" fullWidth variant="outlined">
|
||||
<InputLabel sx={{ pt: 1 }} htmlFor="description">
|
||||
توضیحات
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
id="description"
|
||||
label={"توضیحات"}
|
||||
multiline
|
||||
rows={6}
|
||||
{...register("description")}
|
||||
autoComplete="off"
|
||||
size="small"
|
||||
fullWidth
|
||||
sx={{ mt: 1 }}
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText id="description">
|
||||
{errors.description ? errors.description.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default DescriptionForm;
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Button } from "@mui/material";
|
||||
|
||||
const ManagerOrAssistantSubmit = ({ isSubmitting }) => {
|
||||
return (
|
||||
<>
|
||||
<Button fullWidth variant="outlined" color="secondary" disabled={isSubmitting} type={"submit"}>
|
||||
{isSubmitting ? "در حال ارسال..." : "مخالفت"}
|
||||
</Button>
|
||||
<Button fullWidth variant="contained" color="primary" type={"submit"} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال ارسال..." : "موافقت"}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ManagerOrAssistantSubmit;
|
||||
@@ -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 (
|
||||
<Stack>
|
||||
<Card variant="outlined">
|
||||
<CardHeader sx={{ pb: 0 }} title="نظر معاون راهداری استان :" />
|
||||
<CardContent>
|
||||
{errorMessage ? (
|
||||
<Typography color={"red"}>خطا در دریافت اطلاعات !!!</Typography>
|
||||
) : loadingMessage ? (
|
||||
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||
<CircularProgress size={20} />
|
||||
درحال دریافت اطلاعات
|
||||
</Typography>
|
||||
) : (
|
||||
<Typography>{message}</Typography>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Divider sx={{ mt: 2 }} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default PrevCartableOpinion;
|
||||
@@ -1,33 +0,0 @@
|
||||
import { Card, CardContent, FormControl, FormLabel, Stack, Typography } from "@mui/material";
|
||||
|
||||
const QuestionSafetyForm = () => {
|
||||
return (
|
||||
<Stack sx={{ py: 2 }}>
|
||||
<Card
|
||||
sx={{ display: "flex", justifyContent: "center", alignItems: "center", borderColor: "primary.main" }}
|
||||
variant="outlined"
|
||||
>
|
||||
<CardContent>
|
||||
<FormControl>
|
||||
<FormLabel>
|
||||
<Typography color={"primary"} variant={"h5"} fontWeight={"bolder"}>
|
||||
آیا ایمنی راه این طرح مورد تایید است ؟
|
||||
</Typography>
|
||||
</FormLabel>
|
||||
<Stack
|
||||
sx={{ pt: 2, display: "flex", justifyContent: "center", alignItems: "center" }}
|
||||
spacing={1}
|
||||
direction={"row"}
|
||||
>
|
||||
<Typography variant={"subtitle1"}>دفتر حریم راه : </Typography>
|
||||
<Typography variant={"h5"} fontWeight={"bolder"}>
|
||||
بله
|
||||
</Typography>
|
||||
</Stack>
|
||||
</FormControl>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default QuestionSafetyForm;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<DialogContent>
|
||||
<ApplicantRequestDetail data={fakeData} />
|
||||
<Stack spacing={2}>
|
||||
<QuestionSafetyForm />
|
||||
<PrevCartableOpinion
|
||||
message={message}
|
||||
loadingMessage={loadingMessage}
|
||||
errorMessage={errorMessage}
|
||||
/>
|
||||
<DescriptionForm register={register} errors={errors} />
|
||||
<DialogActions>
|
||||
<ManagerOrAssistantSubmit isSubmitting={isSubmitting} />
|
||||
</DialogActions>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default RoadSafetyFormContext;
|
||||
@@ -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 (
|
||||
<Stack>
|
||||
<Tooltip title="فرم ایمنی راه" arrow placement="right">
|
||||
<IconButton
|
||||
color="primary"
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
onClick={() => {
|
||||
setOpenRoadSafetyForm(true);
|
||||
}}
|
||||
>
|
||||
<EngineeringIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
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",
|
||||
},
|
||||
}}
|
||||
open={openRoadSafetyForm}
|
||||
maxWidth={"lg"}
|
||||
TransitionComponent={DialogTransition}
|
||||
>
|
||||
<IconButton
|
||||
aria-label="close"
|
||||
onClick={() => setOpenRoadSafetyForm(false)}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
right: 8,
|
||||
top: 8,
|
||||
zIndex: 10,
|
||||
color: (theme) => theme.palette.grey[500],
|
||||
}}
|
||||
>
|
||||
<Close />
|
||||
</IconButton>
|
||||
<RoadSafetyFormContext rowId={rowId} mutate={mutate} setOpenRoadSafetyForm={setOpenRoadSafetyForm} />
|
||||
</Dialog>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default RoadSafetyForm;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<Dialog open={taskModal} onClose={handleClose} maxWidth="lg" fullWidth>
|
||||
<DialogContent dividers>
|
||||
<ApplicantRequestDetail data={fakeData} />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default DetailDialog;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="جزئیات طرح متقاضی" arrow placement="right">
|
||||
<IconButton color="primary" onClick={openDetailDialog}>
|
||||
<AssignmentIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<DetailDialog taskModal={taskModal} setTaskModal={setTaskModal} rowId={rowId} mutate={mutate} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default TaskDetail;
|
||||
@@ -1,13 +0,0 @@
|
||||
import TaskDetail from "./TaskDetail";
|
||||
import { Box } from "@mui/material";
|
||||
import RoadSafetyForm from "./RoadSafetyForm";
|
||||
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<TaskDetail mutate={mutate} rowId={row.getValue("id")} />
|
||||
<RoadSafetyForm mutate={mutate} rowId={row.getValue("id")} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default RowActions;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
table_title={"لیست استعلام ها"}
|
||||
need_filter={false}
|
||||
columns={columns}
|
||||
table_url={"/v3/api/fake-data"}
|
||||
page_name={"generalManagerZaminGov"}
|
||||
table_name={"generalManagerZaminGovList"}
|
||||
enableRowActions
|
||||
positionActionsColumn={"last"}
|
||||
RowActions={RowActions}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default TaskList;
|
||||
@@ -1,15 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { Stack } from "@mui/material";
|
||||
import TaskList from "./TaskList";
|
||||
|
||||
const GeneralManagerZaminGovComponent = () => {
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"استعلام حرائم پنجره واحد"} />
|
||||
<TaskList />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default GeneralManagerZaminGovComponent;
|
||||
@@ -0,0 +1,243 @@
|
||||
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 <MapsHomeWorkIcon sx={{ color: "#A0B9C6" }} />;
|
||||
if (state_id === 2 || state_id === 5 || state_id === 13) return <SecurityIcon sx={{ color: "#995FA3" }} />;
|
||||
if (state_id === 3 || state_id === 6 || state_id === 14)
|
||||
return <ManageAccountsIcon sx={{ color: "#9A98B5" }} />;
|
||||
if (state_id === 4 || state_id === 7 || state_id === 15) return <PsychologyAltIcon sx={{ color: "#1B9AAA" }} />;
|
||||
if (state_id === 8) return <ReceiptLongIcon sx={{ color: "#9A98B5" }} />;
|
||||
if (state_id === 9 || state_id === 11) return <WindowIcon sx={{ color: "#DDDBCB" }} />;
|
||||
if (state_id === 10) return <DangerousIcon sx={{ color: "error.main" }} />;
|
||||
if (state_id === 12) return <AutorenewIcon sx={{ color: "#899878" }} />;
|
||||
};
|
||||
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 (
|
||||
<CustomSelectByDependency
|
||||
{...props}
|
||||
value={loadingItemsList ? "loading" : props.filterParameters.value}
|
||||
columnSelectOption={getColumnSelectOptions}
|
||||
/>
|
||||
);
|
||||
},
|
||||
Cell: ({ row }) => (
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
{stateIcon(row.original.state_id)}
|
||||
<Box component="span" ml={1}>
|
||||
{row.original.state_name}
|
||||
</Box>
|
||||
</Box>
|
||||
),
|
||||
},
|
||||
{
|
||||
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 ? (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<ShowPrimaryArea primaryArea={row.original.primary_area} />
|
||||
</Stack>
|
||||
) : (
|
||||
"-"
|
||||
),
|
||||
},
|
||||
{
|
||||
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 (
|
||||
<>
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
need_filter={true}
|
||||
columns={columns}
|
||||
table_url={GET_PRIVACY_ADMIN_LIST}
|
||||
page_name={"PrivacyOffice"}
|
||||
table_name={"PrivacyOfficeList"}
|
||||
enableRowActions
|
||||
positionActionsColumn={"first"}
|
||||
RowActions={RowActions}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default PrivacyOfficeList;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="تایید اقدام">
|
||||
<IconButton color="success" onClick={() => setOpenConfirmDialog(true)}>
|
||||
<ThumbUpIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ConfirmAction;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="عدم تایید اقدام">
|
||||
<IconButton color="error" onClick={() => setOpenRejectDialog(true)}>
|
||||
<ThumbDownIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default RejectAction;
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Box } from "@mui/material";
|
||||
import ConfirmAction from "./ConfirmAction";
|
||||
import RejectAction from "./RejectAction";
|
||||
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1, justifyContent: "Center" }}>
|
||||
<RejectAction />
|
||||
<ConfirmAction />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default RowActions;
|
||||
@@ -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 <FeatureGroup ref={featureRef} />;
|
||||
};
|
||||
export default ShowBound;
|
||||
@@ -0,0 +1,69 @@
|
||||
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 (
|
||||
<Box>
|
||||
<Tooltip title="نمایش پلیگان" placement="right" arrow>
|
||||
<IconButton size="small" color="primary" onClick={() => setOpenShowAreaDialog(true)}>
|
||||
<LayersIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
open={openShowAreaDialog}
|
||||
onClose={() => 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"
|
||||
>
|
||||
<DialogTitle sx={{ display: "flex", justifyContent: "space-between", padding: "16px 24px" }}>
|
||||
<Typography variant="body1" sx={{ fontWeight: "bold", fontSize: "large" }}>
|
||||
محدوده طرح
|
||||
</Typography>
|
||||
<IconButton onClick={() => setOpenShowAreaDialog(false)} size="small">
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<Box sx={{ flex: 1 }}>
|
||||
<Box sx={{ width: "100%", height: "400px" }}>
|
||||
<MapLayer style={{ borderRadius: "4px" }}>
|
||||
<ShowBound bound={bound} />
|
||||
</MapLayer>
|
||||
</Box>
|
||||
</Box>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ShowPrimaryArea;
|
||||
@@ -0,0 +1,14 @@
|
||||
"use client";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { Stack } from "@mui/material";
|
||||
import PrivacyOfficeList from "./PrivacyOfficeList";
|
||||
|
||||
const PrivacyOfficePage = () => {
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"کارتابل اداره حریم استعلام حریم"} />
|
||||
<PrivacyOfficeList />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default PrivacyOfficePage;
|
||||
@@ -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,
|
||||
}) => (
|
||||
<>
|
||||
<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 />}
|
||||
color="primary"
|
||||
disabled={disableToCreate}
|
||||
onClick={onDraw}
|
||||
>
|
||||
اصلاح
|
||||
</Button>
|
||||
<Button
|
||||
sx={{ justifyContent: "space-between" }}
|
||||
startIcon={<EditLocationAltIcon />}
|
||||
color="warning"
|
||||
disabled={disableToEditAndDelete}
|
||||
onClick={onEdit}
|
||||
>
|
||||
ویرایش
|
||||
</Button>
|
||||
<Button
|
||||
sx={{ justifyContent: "space-between" }}
|
||||
startIcon={<DeleteIcon />}
|
||||
color="error"
|
||||
disabled={disableToEditAndDelete}
|
||||
onClick={onRemove}
|
||||
>
|
||||
حذف
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
|
||||
<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 />}
|
||||
variant="outlined"
|
||||
size="small"
|
||||
color="success"
|
||||
disabled={disableToSaveAndCancel}
|
||||
onClick={onSave}
|
||||
>
|
||||
ذخیره
|
||||
</Button>
|
||||
<Button
|
||||
sx={{ justifyContent: "space-between" }}
|
||||
startIcon={<CancelIcon />}
|
||||
variant="outlined"
|
||||
size="small"
|
||||
color="error"
|
||||
disabled={disableToSaveAndCancel}
|
||||
onClick={onCancel}
|
||||
>
|
||||
لغو تغییرات
|
||||
</Button>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
|
||||
export default MapActionButtons;
|
||||
@@ -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: () => <MapLoading />,
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
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="بررسی پلیگان طرح متقاضی"
|
||||
/>
|
||||
</Divider>
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "400px",
|
||||
borderRadius: 3,
|
||||
borderBottomLeftRadius: 0,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
>
|
||||
<MapLayer>
|
||||
<PolygonForDesign />
|
||||
</MapLayer>
|
||||
</Box>
|
||||
<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="خیر" />
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
</Box>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ justifyContent: "center", py: 2 }}>
|
||||
<Button size="large" variant="outlined">
|
||||
بستن
|
||||
</Button>
|
||||
<Button size="large" variant="contained">
|
||||
ثبت
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default MapModifyDialog;
|
||||
@@ -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 (
|
||||
<>
|
||||
<FeatureGroup ref={editableFG}>
|
||||
<EditControl
|
||||
position="bottomright"
|
||||
onCreated={handlePolygonCreate}
|
||||
draw={{
|
||||
polygon: false,
|
||||
circlemarker: false,
|
||||
marker: false,
|
||||
circle: false,
|
||||
rectangle: false,
|
||||
polyline: false,
|
||||
}}
|
||||
edit={{ edit: false, remove: false }}
|
||||
/>
|
||||
</FeatureGroup>
|
||||
<MapActionButtons
|
||||
disableToCreate={disableToCreate}
|
||||
disableToEditAndDelete={disableToEditAndDelete}
|
||||
disableToSaveAndCancel={disableToSaveAndCancel}
|
||||
onDraw={handleDrawPolygon}
|
||||
onEdit={handleEditPolygon}
|
||||
onRemove={handleRemovePolygon}
|
||||
onSave={handleSavePolygon}
|
||||
onCancel={handleCancelEdit}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default PolygonForDesign;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="بررسی پلیگان طرح" arrow placement="right">
|
||||
<IconButton color="primary" onClick={openMapModifyDialog}>
|
||||
<MapIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<MapModifyDialog
|
||||
mapModifyModal={mapModifyModal}
|
||||
setMapModifyModal={setMapModifyModal}
|
||||
rowId={rowId}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default MapModify;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<FormControl error={!!errors.description} size="small" fullWidth variant="outlined">
|
||||
<InputLabel sx={{ pt: 1 }} htmlFor="description">
|
||||
توضیحات
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
id="description"
|
||||
label={"توضیحات"}
|
||||
multiline
|
||||
rows={8}
|
||||
autoComplete="off"
|
||||
{...register("description")}
|
||||
size="small"
|
||||
fullWidth
|
||||
sx={{ mt: 1 }}
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText id="description">
|
||||
{errors.description ? errors.description.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Controller
|
||||
name="province"
|
||||
control={control}
|
||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||
<FormControl error={!!error} size="small" fullWidth variant="outlined">
|
||||
<InputLabel htmlFor="province" />
|
||||
{errorProvinces ? (
|
||||
<Typography color={"red"}>خطایی در دریافت استان ها رخ داده است!</Typography>
|
||||
) : loadingProvinces ? (
|
||||
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||
<CircularProgress size={20} />
|
||||
درحال دریافت لیست استان ها
|
||||
</Typography>
|
||||
) : (
|
||||
<Autocomplete
|
||||
id="province"
|
||||
size="small"
|
||||
value={provinces.find((province) => 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) => (
|
||||
<TextField
|
||||
{...params}
|
||||
autoComplete="off"
|
||||
error={!!errors.province}
|
||||
fullWidth
|
||||
label="استان"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
<FormHelperText id="province">
|
||||
{errors.province ? errors.province.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||
{"انصراف"}
|
||||
</Button>
|
||||
<Button variant="contained" color="primary" type={"submit"} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال اسال" : "ارجاع"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default ReferFormContext;
|
||||
@@ -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 (
|
||||
<Stack>
|
||||
<Tooltip title="ارجاع به استان دیگر" arrow placement="right">
|
||||
<IconButton
|
||||
color="primary"
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
onClick={() => {
|
||||
setOpenReferDialog(true);
|
||||
}}
|
||||
>
|
||||
<ReplyIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
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",
|
||||
},
|
||||
}}
|
||||
open={openReferDialog}
|
||||
fullWidth
|
||||
TransitionComponent={DialogTransition}
|
||||
>
|
||||
<DialogTitle sx={{ m: 0, p: 2, borderBottom: 1, borderColor: "divider" }} id="create-dialog">
|
||||
ارجاع به استان دیگر
|
||||
</DialogTitle>
|
||||
<ReferFormContext rowId={rowId} mutate={mutate} setOpenReferDialog={setOpenReferDialog} />
|
||||
</Dialog>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default ReferForm;
|
||||
@@ -1,29 +0,0 @@
|
||||
import { FormControl, FormHelperText, InputLabel, OutlinedInput, Stack } from "@mui/material";
|
||||
|
||||
const DescriptionForm = ({ errors, register }) => {
|
||||
return (
|
||||
<Stack>
|
||||
<FormControl error={!!errors.description} size="small" fullWidth variant="outlined">
|
||||
<InputLabel sx={{ pt: 1 }} htmlFor="description">
|
||||
توضیحات
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
id="description"
|
||||
label={"توضیحات"}
|
||||
multiline
|
||||
rows={6}
|
||||
{...register("description")}
|
||||
autoComplete="off"
|
||||
size="small"
|
||||
fullWidth
|
||||
sx={{ mt: 1 }}
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText id="description">
|
||||
{errors.description ? errors.description.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default DescriptionForm;
|
||||
@@ -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 (
|
||||
<Stack>
|
||||
<Card variant="outlined">
|
||||
<CardHeader sx={{ pb: 0 }} title="نظر معاون راهداری استان :" />
|
||||
<CardContent>
|
||||
{errorMessage ? (
|
||||
<Typography color={"red"}>خطا در دریافت اطلاعات !!!</Typography>
|
||||
) : loadingMessage ? (
|
||||
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||
<CircularProgress size={20} />
|
||||
درحال دریافت اطلاعات
|
||||
</Typography>
|
||||
) : (
|
||||
<Typography>{message}</Typography>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Divider sx={{ mt: 2 }} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default PrevCartableOpinion;
|
||||
@@ -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 (
|
||||
<Stack sx={{ py: 2 }}>
|
||||
<Card
|
||||
variant="outlined"
|
||||
sx={{ display: "flex", justifyContent: "center", alignItems: "center", borderColor: "primary.main" }}
|
||||
>
|
||||
<CardContent>
|
||||
<FormControl error={!!errors.RadioGroup}>
|
||||
<FormLabel>
|
||||
<Typography color={"primary"} variant={"h5"} fontWeight={"bolder"}>
|
||||
آیا ایمنی راه این طرح مورد تایید است ؟
|
||||
</Typography>
|
||||
</FormLabel>
|
||||
<Stack
|
||||
sx={{ pt: 2, display: "flex", justifyContent: "center", alignItems: "center" }}
|
||||
direction={"row"}
|
||||
>
|
||||
<RadioGroup row>
|
||||
<FormControlLabel
|
||||
value="1"
|
||||
control={<Radio />}
|
||||
label="بله"
|
||||
{...register("RadioGroup")}
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="0"
|
||||
control={<Radio />}
|
||||
label="خیر"
|
||||
{...register("RadioGroup")}
|
||||
/>
|
||||
</RadioGroup>
|
||||
</Stack>
|
||||
{errors.RadioGroup && (
|
||||
<Typography textAlign={"center"} variant="body2" color="error">
|
||||
{errors.RadioGroup.message}
|
||||
</Typography>
|
||||
)}
|
||||
</FormControl>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default QuestionSafetyForm;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<DialogContent>
|
||||
<ApplicantRequestDetail data={fakeData} />
|
||||
<Stack spacing={2}>
|
||||
<QuestionSafetyForm register={register} errors={errors} />
|
||||
<PrevCartableOpinion />
|
||||
<DescriptionForm register={register} errors={errors} />
|
||||
<DialogActions>
|
||||
<SubmitButtonsAdmin isSubmitting={isSubmitting} setOpenRoadSafetyForm={setOpenRoadSafetyForm} />
|
||||
</DialogActions>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default RoadSafetyFormContext;
|
||||
@@ -1,21 +0,0 @@
|
||||
import { Button } from "@mui/material";
|
||||
|
||||
const SubmitButtonsAdmin = ({ setOpenRoadSafetyForm, isSubmitting }) => {
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
onClick={() => setOpenRoadSafetyForm(false)}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
autoFocus
|
||||
>
|
||||
{"انصراف"}
|
||||
</Button>
|
||||
<Button fullWidth variant="contained" color="primary" type={"submit"} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال ارسال..." : "ارسال"}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default SubmitButtonsAdmin;
|
||||
@@ -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 (
|
||||
<Stack>
|
||||
<Tooltip title="فرم ایمنی راه" arrow placement="right">
|
||||
<IconButton
|
||||
color="primary"
|
||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||
onClick={() => {
|
||||
setOpenRoadSafetyForm(true);
|
||||
}}
|
||||
>
|
||||
<EngineeringIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
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",
|
||||
},
|
||||
}}
|
||||
open={openRoadSafetyForm}
|
||||
maxWidth={"lg"}
|
||||
TransitionComponent={DialogTransition}
|
||||
>
|
||||
<IconButton
|
||||
aria-label="close"
|
||||
onClick={() => setOpenRoadSafetyForm(false)}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
right: 8,
|
||||
top: 8,
|
||||
zIndex: 10,
|
||||
color: (theme) => theme.palette.grey[500],
|
||||
}}
|
||||
>
|
||||
<Close />
|
||||
</IconButton>
|
||||
<RoadSafetyFormContext rowId={rowId} mutate={mutate} setOpenRoadSafetyForm={setOpenRoadSafetyForm} />
|
||||
</Dialog>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default RoadSafetyForm;
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<Dialog open={taskModal} onClose={handleClose} maxWidth="lg" fullWidth>
|
||||
<DialogContent dividers>
|
||||
<ApplicantRequestDetail data={fakeData} />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</StyledForm>
|
||||
);
|
||||
};
|
||||
export default DetailDialog;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="جزئیات طرح متقاضی" arrow placement="right">
|
||||
<IconButton color="primary" onClick={openDetailDialog}>
|
||||
<AssignmentIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<DetailDialog taskModal={taskModal} setTaskModal={setTaskModal} rowId={rowId} mutate={mutate} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default TaskDetail;
|
||||
@@ -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 (
|
||||
<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>
|
||||
);
|
||||
};
|
||||
export default RowActions;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
table_title={"لیست استعلام ها"}
|
||||
need_filter={false}
|
||||
columns={columns}
|
||||
table_url={"/v3/api/fake-data"}
|
||||
page_name={"provinceAdminZaminGov"}
|
||||
table_name={"provinceAdminZaminGovList"}
|
||||
enableRowActions
|
||||
positionActionsColumn={"last"}
|
||||
RowActions={RowActions}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default TaskList;
|
||||
@@ -1,15 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { Stack } from "@mui/material";
|
||||
import TaskList from "./TaskList";
|
||||
|
||||
const ProvinceAdminZaminGovComponent = () => {
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"استعلام حرائم پنجره واحد"} />
|
||||
<TaskList />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default ProvinceAdminZaminGovComponent;
|
||||
35
src/core/utils/geoCalculations.js
Normal file
35
src/core/utils/geoCalculations.js
Normal file
@@ -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,
|
||||
};
|
||||
};
|
||||
@@ -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 = [
|
||||
{
|
||||
@@ -295,32 +299,36 @@ 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",
|
||||
icon: <MapsHomeWorkIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
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",
|
||||
icon: <SecurityIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"],
|
||||
},
|
||||
{
|
||||
id: "assistantZaminGov",
|
||||
label: "استعلام حرائم پنجره واحد",
|
||||
id: "assistant",
|
||||
label: "کارتابل معاون",
|
||||
type: "page",
|
||||
route: "/dashboard/inquiry-privacy/assistant/zamin-gov",
|
||||
permissions: [],
|
||||
route: "/dashboard/inquiry-privacy/assistant",
|
||||
icon: <ManageAccountsIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
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",
|
||||
icon: <PsychologyAltIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -234,3 +234,9 @@ 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";
|
||||
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";
|
||||
|
||||
30
src/lib/hooks/useInquiryPrivacyState.js
Normal file
30
src/lib/hooks/useInquiryPrivacyState.js
Normal file
@@ -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;
|
||||
Reference in New Issue
Block a user