implemented technical deputy list table page
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import TechnicalDeputy from "@/components/dashboard/inquiryPrivacy/technical-deputy";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل معاون",
|
title: "کارتابل معاون",
|
||||||
@@ -5,7 +6,7 @@ export const metadata = {
|
|||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["all"]}>
|
<WithPermission permission_name={["all"]}>
|
||||||
<h1>کارتابل معاون</h1>
|
<TechnicalDeputy />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
|
import { GET_REQUEST_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT_DETAILS } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { DialogContent, Typography } from "@mui/material";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||||
|
|
||||||
|
const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [data, setData] = useState(null);
|
||||||
|
const request = useRequest();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await request(`${GET_REQUEST_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT_DETAILS}/${rowId}`);
|
||||||
|
setData(response.data.data);
|
||||||
|
} catch (error) {
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchData();
|
||||||
|
}, [request, rowId]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{loading ? (
|
||||||
|
<DialogLoading loadingOpen={loading} />
|
||||||
|
) : data ? (
|
||||||
|
<ConfirmRoadSafetyFormContext
|
||||||
|
row={row}
|
||||||
|
rowId={rowId}
|
||||||
|
data={data}
|
||||||
|
mutate={mutate}
|
||||||
|
handleClose={handleClose}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<DialogContent>
|
||||||
|
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
||||||
|
</DialogContent>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmRoadSafetyDialog;
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail";
|
||||||
|
import { Engineering, ExitToApp, InsertDriveFile, Route } from "@mui/icons-material";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack, Tab, Tabs } from "@mui/material";
|
||||||
|
import { useState } from "react";
|
||||||
|
import PrevCartableOpinion from "./PrevCartableOpinion";
|
||||||
|
import Questions from "./Questions";
|
||||||
|
import TabPanel from "@/core/components/TabPanel";
|
||||||
|
|
||||||
|
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
||||||
|
const [tabState, setTabState] = useState(0);
|
||||||
|
|
||||||
|
const handleChangeTab = (event, newValue) => {
|
||||||
|
setTabState(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePrev = () => {
|
||||||
|
if (tabState === 0) {
|
||||||
|
handleClose();
|
||||||
|
} else {
|
||||||
|
setTabState((t) => t - 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Tabs
|
||||||
|
allowScrollButtonsMobile
|
||||||
|
value={tabState}
|
||||||
|
onChange={handleChangeTab}
|
||||||
|
variant={"fullWidth"}
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "100%",
|
||||||
|
backgroundColor: "#efefef",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Tab icon={<InsertDriveFile />} label="اطلاعات طرح متقاضی" />
|
||||||
|
<Tab disabled={tabState < 1} icon={<Route />} label="جریان فرایند" />
|
||||||
|
<Tab disabled={tabState < 2} icon={<Engineering />} label="تاییدیه ایمنی راه" />
|
||||||
|
</Tabs>
|
||||||
|
<TabPanel value={tabState} index={0}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<ApplicantRequestDetail data={data} />
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button
|
||||||
|
onClick={handlePrev}
|
||||||
|
variant="outlined"
|
||||||
|
color="secondary"
|
||||||
|
size="large"
|
||||||
|
startIcon={<ExitToApp />}
|
||||||
|
>
|
||||||
|
{"بستن"}
|
||||||
|
</Button>
|
||||||
|
<Button variant="contained" size="large" onClick={() => setTabState((s) => s + 1)}>
|
||||||
|
مرحله بعد
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel value={tabState} index={1}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack spacing={2}>
|
||||||
|
{data.histories.map((item, index) => (
|
||||||
|
<PrevCartableOpinion item={item} key={index} />
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button onClick={handlePrev} variant="outlined" color="secondary" size="large">
|
||||||
|
مرحله قبل
|
||||||
|
</Button>
|
||||||
|
<Button variant="contained" size="large" onClick={() => setTabState((s) => s + 1)}>
|
||||||
|
مرحله بعد
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel value={tabState} index={2}>
|
||||||
|
<Questions row={row} rowId={rowId} mutate={mutate} handleClose={handleClose} handlePrev={handlePrev} />
|
||||||
|
</TabPanel>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmRoadSafetyFormContext;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
|
||||||
|
|
||||||
|
const PrevCartableOpinion = ({ item }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Card variant="outlined">
|
||||||
|
<CardContent>
|
||||||
|
<Typography variant="body2">{item.previous_state_name}: {item.action_name}</Typography>
|
||||||
|
<Typography variant="body2">توضیحات: {item.expert_description}</Typography>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default PrevCartableOpinion;
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Stack, TextField } from "@mui/material";
|
||||||
|
import { Controller } from "react-hook-form";
|
||||||
|
|
||||||
|
const DescriptionForm = ({ control }) => {
|
||||||
|
return (
|
||||||
|
<Stack sx={{ mt: 1 }}>
|
||||||
|
<Controller
|
||||||
|
name="description"
|
||||||
|
control={control}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
multiline
|
||||||
|
rows={8}
|
||||||
|
label="توضیحات"
|
||||||
|
placeholder="لطفاً توضیحات خود را توضیح دهید"
|
||||||
|
error={!!error}
|
||||||
|
helperText={error?.message}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ mt: 1 }}
|
||||||
|
InputLabelProps={{ shrink: true }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default DescriptionForm;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
Stack,
|
||||||
|
Typography
|
||||||
|
} from "@mui/material";
|
||||||
|
|
||||||
|
const QuestionVerifyNeedRoadForm = ({ row }) => {
|
||||||
|
return (
|
||||||
|
<Stack sx={{ py: 1 }}>
|
||||||
|
<Card
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ display: "flex", justifyContent: "center", alignItems: "center", borderColor: "primary.main" }}
|
||||||
|
>
|
||||||
|
<CardContent>
|
||||||
|
<Typography color={"primary"} variant={"h6"} fontWeight={"bolder"}>
|
||||||
|
آیا نیاز به راه دسترسی است؟
|
||||||
|
</Typography>
|
||||||
|
<Stack
|
||||||
|
sx={{ pt: 2, display: "flex", justifyContent: "center", alignItems: "center" }}
|
||||||
|
spacing={1}
|
||||||
|
direction={"row"}
|
||||||
|
>
|
||||||
|
<Typography variant={"subtitle2"}>دفتر حریم راه : </Typography>
|
||||||
|
<Typography variant={"h5"} fontWeight={"bolder"}>
|
||||||
|
{row.original.need_road_access == 1 ? "بله" : "خیر"}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default QuestionVerifyNeedRoadForm;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
Stack,
|
||||||
|
Typography
|
||||||
|
} from "@mui/material";
|
||||||
|
|
||||||
|
const QuestionVerifyRoadSafetyForm = ({ row }) => {
|
||||||
|
return (
|
||||||
|
<Stack sx={{ py: 1 }}>
|
||||||
|
<Card
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ display: "flex", justifyContent: "center", alignItems: "center", borderColor: "primary.main" }}
|
||||||
|
>
|
||||||
|
<CardContent>
|
||||||
|
<Typography color={"primary"} variant={"h6"} fontWeight={"bolder"}>
|
||||||
|
آیا ایمنی راه این طرح مورد تایید است؟
|
||||||
|
</Typography>
|
||||||
|
<Stack
|
||||||
|
sx={{ pt: 2, display: "flex", justifyContent: "center", alignItems: "center" }}
|
||||||
|
spacing={1}
|
||||||
|
direction={"row"}
|
||||||
|
>
|
||||||
|
<Typography variant={"subtitle2"}>دفتر حریم راه : </Typography>
|
||||||
|
<Typography variant={"h5"} fontWeight={"bolder"}>
|
||||||
|
{row.original.is_possible == 1 ? "بله" : "خیر"}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default QuestionVerifyRoadSafetyForm;
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
|
import { REFER_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack, TextField } from "@mui/material";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import { object, string } from "yup";
|
||||||
|
|
||||||
|
const validationSchema = object({
|
||||||
|
description: string().required("وارد کردن توضیحات الزامیست!"),
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
const ReferForm = ({ rowId, mutate, handleClose, setOpenReferDialog }) => {
|
||||||
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
||||||
|
|
||||||
|
const onSubmit = async (data) => {
|
||||||
|
await requestServer(`${REFER_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: data.description,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleClose();
|
||||||
|
setOpenReferDialog(false);
|
||||||
|
mutate();
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack sx={{ mt: 1 }}>
|
||||||
|
<Controller
|
||||||
|
name="description"
|
||||||
|
control={control}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
multiline
|
||||||
|
rows={4}
|
||||||
|
label="دلیل مخالفت"
|
||||||
|
placeholder="لطفاً دلیل مخالفت خود را توضیح دهید"
|
||||||
|
error={!!error}
|
||||||
|
helperText={error?.message}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ mt: 1 }}
|
||||||
|
InputLabelProps={{ shrink: true }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
size="large"
|
||||||
|
disabled={isSubmitting}
|
||||||
|
type="button"
|
||||||
|
onClick={handleSubmit(onSubmit)}
|
||||||
|
>
|
||||||
|
ثبت
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ReferForm;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { Close } from "@mui/icons-material";
|
||||||
|
import { Button, Dialog, DialogTitle, IconButton } from "@mui/material"
|
||||||
|
import { useState } from "react";
|
||||||
|
import ReferForm from "./Form";
|
||||||
|
|
||||||
|
const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
|
||||||
|
const [openReferDialog, setOpenReferDialog] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button onClick={() => setOpenReferDialog(true)} variant="contained" color="error" disabled={isSubmitting} size="large">
|
||||||
|
مخالفت
|
||||||
|
</Button>
|
||||||
|
<Dialog open={openReferDialog} onClose={() => { setOpenReferDialog(false) }} maxWidth="xs" fullWidth>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpenReferDialog(false)}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 10,
|
||||||
|
color: (theme) => theme.palette.grey[500],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Close />
|
||||||
|
</IconButton>
|
||||||
|
<DialogTitle>مخالفت و ارجاع به دفتر حریم</DialogTitle>
|
||||||
|
{openReferDialog && <ReferForm handleClose={handleClose} setOpenReferDialog={setOpenReferDialog} rowId={rowId} mutate={mutate} />}
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default Refer
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
|
import { CONFIRM_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack } from "@mui/material";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import { object, string } from "yup";
|
||||||
|
import QuestionVerifyNeedRoadForm from "./QuestionVerifyNeedRoadForm";
|
||||||
|
import QuestionVerifyRoadSafetyForm from "./QuestionVerifyRoadSafetyForm";
|
||||||
|
import Refer from "./Refer";
|
||||||
|
import DescriptionForm from "./DescriptionForm";
|
||||||
|
|
||||||
|
const validationSchema = object({
|
||||||
|
description: string().required("وارد کردن توضیحات الزامیست!"),
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
const Questions = ({ row, rowId, mutate, handleClose, handlePrev }) => {
|
||||||
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
|
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
||||||
|
|
||||||
|
const onSubmit = async (data) => {
|
||||||
|
await requestServer(`${CONFIRM_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: data.description,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleClose();
|
||||||
|
mutate();
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack>
|
||||||
|
<QuestionVerifyRoadSafetyForm row={row} />
|
||||||
|
<QuestionVerifyNeedRoadForm row={row} />
|
||||||
|
<DescriptionForm control={control} />
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "space-between" }}>
|
||||||
|
<Stack spacing={1} direction={"row"}>
|
||||||
|
<Button
|
||||||
|
onClick={handlePrev}
|
||||||
|
variant="outlined"
|
||||||
|
color="secondary"
|
||||||
|
disabled={isSubmitting}
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
{"مرحله قبلی"}
|
||||||
|
</Button>
|
||||||
|
<Refer rowId={rowId} mutate={mutate} handleClose={handleClose} isSubmitting={isSubmitting} />
|
||||||
|
</Stack>
|
||||||
|
<Button variant="contained" size="large" disabled={isSubmitting} type="submit">
|
||||||
|
موافقت و ارجاع
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</StyledForm>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default Questions;
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import { Close, Engineering } from "@mui/icons-material";
|
||||||
|
import { Dialog, IconButton, Stack, Tooltip } from "@mui/material";
|
||||||
|
import { useState } from "react";
|
||||||
|
import ConfirmRoadSafetyDialog from "./ConfirmRoadSafetyDialog";
|
||||||
|
|
||||||
|
const ConfirmRoadSafetyForm = ({ row, rowId, mutate }) => {
|
||||||
|
const [openConfirmRoadSafetyForm, setOpenConfirmRoadSafetyForm] = useState(false);
|
||||||
|
|
||||||
|
const openRoadSafetyDialog = () => {
|
||||||
|
setOpenConfirmRoadSafetyForm(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setOpenConfirmRoadSafetyForm(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Tooltip title="تاییدیه ایمنی راه" arrow placement="right">
|
||||||
|
<IconButton
|
||||||
|
color="primary"
|
||||||
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
|
onClick={() => {
|
||||||
|
openRoadSafetyDialog();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Engineering />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
<Dialog open={openConfirmRoadSafetyForm} onClose={handleClose} maxWidth="sm" fullWidth>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => handleClose()}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 10,
|
||||||
|
color: (theme) => theme.palette.grey[500],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Close />
|
||||||
|
</IconButton>
|
||||||
|
{openConfirmRoadSafetyForm && (
|
||||||
|
<ConfirmRoadSafetyDialog row={row} handleClose={handleClose} rowId={rowId} mutate={mutate} />
|
||||||
|
)}
|
||||||
|
</Dialog>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmRoadSafetyForm;
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
|
import { GET_REQUEST_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT_DETAILS } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { DialogContent, Typography } from "@mui/material";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||||
|
|
||||||
|
const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [data, setData] = useState(null);
|
||||||
|
const request = useRequest();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await request(`${GET_REQUEST_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT_DETAILS}/${rowId}`);
|
||||||
|
setData(response.data.data);
|
||||||
|
} catch (error) {
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchData();
|
||||||
|
}, [request, rowId]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{loading ? (
|
||||||
|
<div>Loading...</div>
|
||||||
|
) : // <DialogLoading />
|
||||||
|
data ? (
|
||||||
|
<ConfirmRoadSafetyFormContext
|
||||||
|
row={row}
|
||||||
|
rowId={rowId}
|
||||||
|
data={data}
|
||||||
|
mutate={mutate}
|
||||||
|
handleClose={handleClose}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<DialogContent>
|
||||||
|
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
||||||
|
</DialogContent>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmRoadSafetyDialog;
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail";
|
||||||
|
import TabPanel from "@/core/components/TabPanel";
|
||||||
|
import { ExitToApp, InsertDriveFile, Route, ThumbUp } from "@mui/icons-material";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack, Tab, Tabs } from "@mui/material";
|
||||||
|
import { useState } from "react";
|
||||||
|
import PrevCartableOpinion from "./PrevCartableOpinion";
|
||||||
|
import Questions from "./Questions";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
||||||
|
const [tabState, setTabState] = useState(0);
|
||||||
|
|
||||||
|
const handleChangeTab = (event, newValue) => {
|
||||||
|
setTabState(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePrev = () => {
|
||||||
|
if (tabState === 0) {
|
||||||
|
handleClose();
|
||||||
|
} else {
|
||||||
|
setTabState((t) => t - 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Tabs
|
||||||
|
allowScrollButtonsMobile
|
||||||
|
value={tabState}
|
||||||
|
onChange={handleChangeTab}
|
||||||
|
variant={"fullWidth"}
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "100%",
|
||||||
|
backgroundColor: "#efefef",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Tab icon={<InsertDriveFile />} label="اطلاعات طرح متقاضی" />
|
||||||
|
<Tab disabled={tabState < 1} icon={<Route />} label="جریان فرایند" />
|
||||||
|
<Tab disabled={tabState < 2} icon={<ThumbUp />} label="تاییدیه ضمانت نامه ها" />
|
||||||
|
</Tabs>
|
||||||
|
<TabPanel value={tabState} index={0}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<ApplicantRequestDetail data={data} />
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button
|
||||||
|
onClick={handlePrev}
|
||||||
|
variant="outlined"
|
||||||
|
color="secondary"
|
||||||
|
size="large"
|
||||||
|
startIcon={<ExitToApp />}
|
||||||
|
>
|
||||||
|
{"بستن"}
|
||||||
|
</Button>
|
||||||
|
<Button variant="contained" size="large" onClick={() => setTabState(s => s + 1)}>
|
||||||
|
مرحله بعد
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel value={tabState} index={1}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack spacing={2}>
|
||||||
|
{data.histories.map((item, index) => (
|
||||||
|
<PrevCartableOpinion item={item} key={index} />
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button
|
||||||
|
onClick={handlePrev}
|
||||||
|
variant="outlined"
|
||||||
|
color="secondary"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
مرحله قبل
|
||||||
|
</Button>
|
||||||
|
<Button variant="contained" size="large" onClick={() => setTabState(s => s + 1)}>
|
||||||
|
مرحله بعد
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel value={tabState} index={2}>
|
||||||
|
<Questions row={row} rowId={rowId} mutate={mutate} handleClose={handleClose} handlePrev={handlePrev} />
|
||||||
|
</TabPanel>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmRoadSafetyFormContext;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
|
||||||
|
|
||||||
|
const PrevCartableOpinion = ({ item }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Card variant="outlined">
|
||||||
|
<CardContent>
|
||||||
|
<Typography variant="body2">{item.previous_state_name}: {item.action_name}</Typography>
|
||||||
|
<Typography variant="body2">توضیحات: {item.expert_description}</Typography>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default PrevCartableOpinion;
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Stack, TextField } from "@mui/material";
|
||||||
|
import { Controller } from "react-hook-form";
|
||||||
|
|
||||||
|
const DescriptionForm = ({ control }) => {
|
||||||
|
return (
|
||||||
|
<Stack sx={{ mt: 1 }}>
|
||||||
|
<Controller
|
||||||
|
name="description"
|
||||||
|
control={control}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
multiline
|
||||||
|
rows={8}
|
||||||
|
label="توضیحات"
|
||||||
|
placeholder="لطفاً توضیحات خود را توضیح دهید"
|
||||||
|
error={!!error}
|
||||||
|
helperText={error?.message}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ mt: 1 }}
|
||||||
|
InputLabelProps={{ shrink: true }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default DescriptionForm;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
Stack,
|
||||||
|
Typography
|
||||||
|
} from "@mui/material";
|
||||||
|
|
||||||
|
const QuestionVerifyNeedRoadForm = () => {
|
||||||
|
return (
|
||||||
|
<Stack sx={{ py: 1 }}>
|
||||||
|
<Card
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ display: "flex", justifyContent: "center", alignItems: "center", borderColor: "primary.main" }}
|
||||||
|
>
|
||||||
|
<CardContent>
|
||||||
|
<Typography color={"primary"} variant={"h6"} fontWeight={"bolder"}>
|
||||||
|
آیا ضمانت نامه ها مورد تایید است؟
|
||||||
|
</Typography>
|
||||||
|
<Stack
|
||||||
|
sx={{ pt: 2, display: "flex", justifyContent: "center", alignItems: "center" }}
|
||||||
|
spacing={1}
|
||||||
|
direction={"row"}
|
||||||
|
>
|
||||||
|
<Typography variant={"subtitle2"}>دفتر حریم راه : </Typography>
|
||||||
|
<Typography variant={"h5"} fontWeight={"bolder"}>
|
||||||
|
بله
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default QuestionVerifyNeedRoadForm;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
Stack,
|
||||||
|
Typography
|
||||||
|
} from "@mui/material";
|
||||||
|
|
||||||
|
const QuestionVerifyRoadSafetyForm = ({ row }) => {
|
||||||
|
return (
|
||||||
|
<Stack sx={{ py: 1 }}>
|
||||||
|
<Card
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ display: "flex", justifyContent: "center", alignItems: "center", borderColor: "primary.main" }}
|
||||||
|
>
|
||||||
|
<CardContent>
|
||||||
|
<Typography color={"primary"} variant={"h6"} fontWeight={"bolder"}>
|
||||||
|
آیا ایمنی راه این طرح مورد تایید است؟
|
||||||
|
</Typography>
|
||||||
|
<Stack
|
||||||
|
sx={{ pt: 2, display: "flex", justifyContent: "center", alignItems: "center" }}
|
||||||
|
spacing={1}
|
||||||
|
direction={"row"}
|
||||||
|
>
|
||||||
|
<Typography variant={"subtitle2"}>دفتر حریم راه : </Typography>
|
||||||
|
<Typography variant={"h5"} fontWeight={"bolder"}>
|
||||||
|
{row.original.isSafety ? "بله" : "خیر"}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default QuestionVerifyRoadSafetyForm;
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import { REFER_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack, TextField } from "@mui/material";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import { object, string } from "yup";
|
||||||
|
const validationSchema = object({
|
||||||
|
description: string().required("وارد کردن توضیحات الزامیست!"),
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
const ReferForm = ({ rowId, mutate, handleClose, setOpenReferDialog }) => {
|
||||||
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
||||||
|
|
||||||
|
const onSubmit = async (data) => {
|
||||||
|
await requestServer(`${REFER_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: data.description
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleClose();
|
||||||
|
setOpenReferDialog(false)
|
||||||
|
mutate();
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack sx={{ mt: 1 }}>
|
||||||
|
<Controller
|
||||||
|
name="description"
|
||||||
|
control={control}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
multiline
|
||||||
|
rows={4}
|
||||||
|
label="دلیل مخالفت"
|
||||||
|
placeholder="لطفاً دلیل مخالفت خود را توضیح دهید"
|
||||||
|
error={!!error}
|
||||||
|
helperText={error?.message}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ mt: 1 }}
|
||||||
|
InputLabelProps={{ shrink: true }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button variant="contained" size="large" disabled={isSubmitting} type="button" onClick={handleSubmit(onSubmit)}>
|
||||||
|
ثبت
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default ReferForm
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { Close } from "@mui/icons-material";
|
||||||
|
import { Button, Dialog, DialogTitle, IconButton } from "@mui/material"
|
||||||
|
import { useState } from "react";
|
||||||
|
import ReferForm from "./Form";
|
||||||
|
|
||||||
|
const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
|
||||||
|
const [openReferDialog, setOpenReferDialog] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button onClick={() => setOpenReferDialog(true)} variant="contained" color="error" disabled={isSubmitting} size="large">
|
||||||
|
مخالفت
|
||||||
|
</Button>
|
||||||
|
<Dialog open={openReferDialog} onClose={() => { setOpenReferDialog(false) }} maxWidth="xs" fullWidth>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpenReferDialog(false)}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 10,
|
||||||
|
color: (theme) => theme.palette.grey[500],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Close />
|
||||||
|
</IconButton>
|
||||||
|
<DialogTitle>مخالفت و ارجاع به دفتر حریم</DialogTitle>
|
||||||
|
{openReferDialog && <ReferForm handleClose={handleClose} setOpenReferDialog={setOpenReferDialog} rowId={rowId} mutate={mutate} />}
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default Refer
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
|
import { CONFIRM_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT, CONFIRM_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack } from "@mui/material";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import { object, string } from "yup";
|
||||||
|
import QuestionVerifyNeedRoadForm from "./QuestionVerifyNeedRoadForm";
|
||||||
|
import QuestionVerifyRoadSafetyForm from "./QuestionVerifyRoadSafetyForm";
|
||||||
|
import Refer from "./Refer";
|
||||||
|
import DescriptionForm from "./DescriptionForm";
|
||||||
|
|
||||||
|
const validationSchema = object({
|
||||||
|
description: string().required("وارد کردن توضیحات الزامیست!"),
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
const Questions = ({ row, rowId, mutate, handleClose, handlePrev }) => {
|
||||||
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
|
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
||||||
|
|
||||||
|
const onSubmit = async (data) => {
|
||||||
|
await requestServer(`${CONFIRM_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: data.description
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleClose();
|
||||||
|
mutate();
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack >
|
||||||
|
<QuestionVerifyNeedRoadForm row={row} />
|
||||||
|
<DescriptionForm control={control} />
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "space-between" }}>
|
||||||
|
<Stack spacing={1} direction={'row'}>
|
||||||
|
<Button onClick={handlePrev} variant="outlined" color="secondary" disabled={isSubmitting} size="large">
|
||||||
|
{"مرحله قبلی"}
|
||||||
|
</Button>
|
||||||
|
<Refer rowId={rowId} mutate={mutate} handleClose={handleClose} isSubmitting={isSubmitting} />
|
||||||
|
</Stack>
|
||||||
|
<Button variant="contained" size="large" disabled={isSubmitting} type="submit">
|
||||||
|
موافقت و ارجاع
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</StyledForm>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default Questions
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import { Close, ThumbUp } from "@mui/icons-material";
|
||||||
|
import { Dialog, IconButton, Stack, Tooltip } from "@mui/material";
|
||||||
|
import { useState } from "react";
|
||||||
|
import ConfirmRoadSafetyDialog from "./ConfirmRoadSafetyDialog";
|
||||||
|
|
||||||
|
const ConfirmVerifyLicenseForm = ({ row, rowId, mutate }) => {
|
||||||
|
const [openConfirmVerifyLicenseForm, setOpenConfirmVerifyLicenseForm] = useState(false);
|
||||||
|
|
||||||
|
const openConfirmVerifyLicenseFormDialog = () => {
|
||||||
|
setOpenConfirmVerifyLicenseForm(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setOpenConfirmVerifyLicenseForm(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Tooltip title="تاییدیه ضمانت نامه ها" arrow placement="right">
|
||||||
|
<IconButton
|
||||||
|
color="primary"
|
||||||
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
|
onClick={() => {
|
||||||
|
openConfirmVerifyLicenseFormDialog();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ThumbUp />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
<Dialog open={openConfirmVerifyLicenseForm} onClose={handleClose} maxWidth="sm" fullWidth>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => handleClose()}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 10,
|
||||||
|
color: (theme) => theme.palette.grey[500],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Close />
|
||||||
|
</IconButton>
|
||||||
|
{openConfirmVerifyLicenseForm && (
|
||||||
|
<ConfirmRoadSafetyDialog row={row} handleClose={handleClose} rowId={rowId} mutate={mutate} />
|
||||||
|
)}
|
||||||
|
</Dialog>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmVerifyLicenseForm;
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
|
import { GET_REQUEST_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT_DETAILS } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { DialogContent, Typography } from "@mui/material";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||||
|
|
||||||
|
const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [data, setData] = useState(null);
|
||||||
|
const request = useRequest();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await request(`${GET_REQUEST_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT_DETAILS}/${rowId}`);
|
||||||
|
setData(response.data.data);
|
||||||
|
} catch (error) {
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchData();
|
||||||
|
}, [rowId]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{loading ? (
|
||||||
|
<DialogLoading />
|
||||||
|
) : data ? (
|
||||||
|
<ConfirmRoadSafetyFormContext row={row} rowId={rowId} data={data} mutate={mutate} handleClose={handleClose} />
|
||||||
|
) : (
|
||||||
|
<DialogContent>
|
||||||
|
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
||||||
|
</DialogContent>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
export default ConfirmRoadSafetyDialog
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail";
|
||||||
|
import TabPanel from "@/core/components/TabPanel";
|
||||||
|
import { DoneAll, ExitToApp, InsertDriveFile, Route } from "@mui/icons-material";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack, Tab, Tabs } from "@mui/material";
|
||||||
|
import { useState } from "react";
|
||||||
|
import PrevCartableOpinion from "./PrevCartableOpinion";
|
||||||
|
import Questions from "./Questions";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
||||||
|
const [tabState, setTabState] = useState(0);
|
||||||
|
|
||||||
|
const handleChangeTab = (event, newValue) => {
|
||||||
|
setTabState(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePrev = () => {
|
||||||
|
if (tabState === 0) {
|
||||||
|
handleClose();
|
||||||
|
} else {
|
||||||
|
setTabState((t) => t - 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Tabs
|
||||||
|
allowScrollButtonsMobile
|
||||||
|
value={tabState}
|
||||||
|
onChange={handleChangeTab}
|
||||||
|
variant={"fullWidth"}
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "100%",
|
||||||
|
backgroundColor: "#efefef",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Tab icon={<InsertDriveFile />} label="اطلاعات طرح متقاضی" />
|
||||||
|
<Tab disabled={tabState < 1} icon={<Route />} label="جریان فرایند" />
|
||||||
|
<Tab disabled={tabState < 2} icon={<DoneAll />} label="تاییدیه دسترسی راه" />
|
||||||
|
</Tabs>
|
||||||
|
<TabPanel value={tabState} index={0}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<ApplicantRequestDetail data={data} />
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button
|
||||||
|
onClick={handlePrev}
|
||||||
|
variant="outlined"
|
||||||
|
color="secondary"
|
||||||
|
size="large"
|
||||||
|
startIcon={<ExitToApp />}
|
||||||
|
>
|
||||||
|
{"بستن"}
|
||||||
|
</Button>
|
||||||
|
<Button variant="contained" size="large" onClick={() => setTabState(s => s + 1)}>
|
||||||
|
مرحله بعد
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel value={tabState} index={1}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack spacing={2}>
|
||||||
|
{data.histories.map((item, index) => (
|
||||||
|
<PrevCartableOpinion item={item} key={index} />
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button
|
||||||
|
onClick={handlePrev}
|
||||||
|
variant="outlined"
|
||||||
|
color="secondary"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
مرحله قبل
|
||||||
|
</Button>
|
||||||
|
<Button variant="contained" size="large" onClick={() => setTabState(s => s + 1)}>
|
||||||
|
مرحله بعد
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel value={tabState} index={2}>
|
||||||
|
<Questions row={row} rowId={rowId} mutate={mutate} handleClose={handleClose} handlePrev={handlePrev} />
|
||||||
|
</TabPanel>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmRoadSafetyFormContext;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
|
||||||
|
|
||||||
|
const PrevCartableOpinion = ({ item }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Card variant="outlined">
|
||||||
|
<CardContent>
|
||||||
|
<Typography variant="body2">{item.previous_state_name}: {item.action_name}</Typography>
|
||||||
|
<Typography variant="body2">توضیحات: {item.expert_description}</Typography>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default PrevCartableOpinion;
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Stack, TextField } from "@mui/material";
|
||||||
|
import { Controller } from "react-hook-form";
|
||||||
|
|
||||||
|
const DescriptionForm = ({ control }) => {
|
||||||
|
return (
|
||||||
|
<Stack sx={{ mt: 1 }}>
|
||||||
|
<Controller
|
||||||
|
name="description"
|
||||||
|
control={control}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
multiline
|
||||||
|
rows={8}
|
||||||
|
label="توضیحات"
|
||||||
|
placeholder="لطفاً توضیحات خود را توضیح دهید"
|
||||||
|
error={!!error}
|
||||||
|
helperText={error?.message}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ mt: 1 }}
|
||||||
|
InputLabelProps={{ shrink: true }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default DescriptionForm;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
Stack,
|
||||||
|
Typography
|
||||||
|
} from "@mui/material";
|
||||||
|
|
||||||
|
const QuestionVerifyNeedRoadForm = ({ row }) => {
|
||||||
|
return (
|
||||||
|
<Stack sx={{ py: 1 }}>
|
||||||
|
<Card
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ display: "flex", justifyContent: "center", alignItems: "center", borderColor: "primary.main" }}
|
||||||
|
>
|
||||||
|
<CardContent>
|
||||||
|
<Typography color={"primary"} variant={"h6"} fontWeight={"bolder"}>
|
||||||
|
آیا دسترسی به راه مورد تایید است؟
|
||||||
|
</Typography>
|
||||||
|
<Stack
|
||||||
|
sx={{ pt: 2, display: "flex", justifyContent: "center", alignItems: "center" }}
|
||||||
|
spacing={1}
|
||||||
|
direction={"row"}
|
||||||
|
>
|
||||||
|
<Typography variant={"subtitle2"}>دفتر حریم راه : </Typography>
|
||||||
|
<Typography variant={"h5"} fontWeight={"bolder"}>
|
||||||
|
{row.original.is_file_good == 1 ? "بله" : "خیر"}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default QuestionVerifyNeedRoadForm;
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import { REFER_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack, TextField } from "@mui/material";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import { object, string } from "yup";
|
||||||
|
const validationSchema = object({
|
||||||
|
description: string().required("وارد کردن توضیحات الزامیست!"),
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
const ReferForm = ({ rowId, mutate, handleClose, setOpenReferDialog }) => {
|
||||||
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
||||||
|
|
||||||
|
const onSubmit = async (data) => {
|
||||||
|
await requestServer(`${REFER_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: data.description
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleClose();
|
||||||
|
setOpenReferDialog(false)
|
||||||
|
mutate();
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack sx={{ mt: 1 }}>
|
||||||
|
<Controller
|
||||||
|
name="description"
|
||||||
|
control={control}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
multiline
|
||||||
|
rows={4}
|
||||||
|
label="دلیل مخالفت"
|
||||||
|
placeholder="لطفاً دلیل مخالفت خود را توضیح دهید"
|
||||||
|
error={!!error}
|
||||||
|
helperText={error?.message}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ mt: 1 }}
|
||||||
|
InputLabelProps={{ shrink: true }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
|
<Button variant="contained" size="large" disabled={isSubmitting} type="button" onClick={handleSubmit(onSubmit)}>
|
||||||
|
ثبت
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default ReferForm
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { Close } from "@mui/icons-material";
|
||||||
|
import { Button, Dialog, DialogTitle, IconButton } from "@mui/material"
|
||||||
|
import { useState } from "react";
|
||||||
|
import ReferForm from "./Form";
|
||||||
|
|
||||||
|
const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
|
||||||
|
const [openReferDialog, setOpenReferDialog] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button onClick={() => setOpenReferDialog(true)} variant="contained" color="error" disabled={isSubmitting} size="large">
|
||||||
|
مخالفت
|
||||||
|
</Button>
|
||||||
|
<Dialog open={openReferDialog} onClose={() => { setOpenReferDialog(false) }} maxWidth="xs" fullWidth>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpenReferDialog(false)}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 10,
|
||||||
|
color: (theme) => theme.palette.grey[500],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Close />
|
||||||
|
</IconButton>
|
||||||
|
<DialogTitle>مخالفت و ارجاع به دفتر حریم</DialogTitle>
|
||||||
|
{openReferDialog && <ReferForm handleClose={handleClose} setOpenReferDialog={setOpenReferDialog} rowId={rowId} mutate={mutate} />}
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default Refer
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
|
import { CONFIRM_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT } from "@/core/utils/routes";
|
||||||
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { Button, DialogActions, DialogContent, Stack } from "@mui/material";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import { object, string } from "yup";
|
||||||
|
import QuestionVerifyNeedRoadForm from "./QuestionVerifyNeedRoadForm";
|
||||||
|
import Refer from "./Refer";
|
||||||
|
import DescriptionForm from "./DescriptionForm";
|
||||||
|
|
||||||
|
const validationSchema = object({
|
||||||
|
description: string().required("وارد کردن توضیحات الزامیست!"),
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
const Questions = ({ row, rowId, mutate, handleClose, handlePrev }) => {
|
||||||
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
|
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
||||||
|
|
||||||
|
const onSubmit = async (data) => {
|
||||||
|
await requestServer(`${CONFIRM_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: data.description
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleClose();
|
||||||
|
mutate();
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<Stack >
|
||||||
|
<QuestionVerifyNeedRoadForm row={row} />
|
||||||
|
<DescriptionForm control={control} />
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ alignItems: "center", justifyContent: "space-between" }}>
|
||||||
|
<Stack spacing={1} direction={'row'}>
|
||||||
|
<Button onClick={handlePrev} variant="outlined" color="secondary" disabled={isSubmitting} size="large">
|
||||||
|
{"مرحله قبلی"}
|
||||||
|
</Button>
|
||||||
|
<Refer rowId={rowId} mutate={mutate} handleClose={handleClose} isSubmitting={isSubmitting} />
|
||||||
|
</Stack>
|
||||||
|
<Button variant="contained" size="large" disabled={isSubmitting} type="submit">
|
||||||
|
موافقت و ارجاع
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</StyledForm>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default Questions
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import { Close, DoneAll } from "@mui/icons-material";
|
||||||
|
import { Dialog, IconButton, Stack, Tooltip } from "@mui/material";
|
||||||
|
import { useState } from "react";
|
||||||
|
import ConfirmRoadSafetyDialog from "./ConfirmRoadSafetyDialog";
|
||||||
|
|
||||||
|
const ConfirmVerifyRoadSafetyForm = ({ row, rowId, mutate }) => {
|
||||||
|
const [openConfirmVerifyRoadSafetyForm, setOpenConfirmVerifyRoadSafetyForm] = useState(false);
|
||||||
|
|
||||||
|
const openConfirmVerifyRoadSafetyDialog = () => {
|
||||||
|
setOpenConfirmVerifyRoadSafetyForm(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setOpenConfirmVerifyRoadSafetyForm(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<Tooltip title="تاییدیه دسترسی راه" arrow placement="right">
|
||||||
|
<IconButton
|
||||||
|
color="primary"
|
||||||
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
|
onClick={() => {
|
||||||
|
openConfirmVerifyRoadSafetyDialog();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DoneAll />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
<Dialog open={openConfirmVerifyRoadSafetyForm} onClose={handleClose} maxWidth="sm" fullWidth>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => handleClose()}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 10,
|
||||||
|
color: (theme) => theme.palette.grey[500],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Close />
|
||||||
|
</IconButton>
|
||||||
|
{openConfirmVerifyRoadSafetyForm && (
|
||||||
|
<ConfirmRoadSafetyDialog row={row} handleClose={handleClose} rowId={rowId} mutate={mutate} />
|
||||||
|
)}
|
||||||
|
</Dialog>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default ConfirmVerifyRoadSafetyForm;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { Box } from "@mui/material";
|
||||||
|
import ConfirmRoadSafetyForm from "./ConfirmRoadSafetyForm";
|
||||||
|
import ConfirmVerifyRoadSafetyForm from "./ConfirmVerifyRoadSafetyForm";
|
||||||
|
import ConfirmVerifyLicenseForm from "./ConfirmVerifyLicenseForm";
|
||||||
|
|
||||||
|
const RowActions = ({ row, mutate }) => {
|
||||||
|
return (
|
||||||
|
<></>
|
||||||
|
// <Box sx={{ display: "flex", gap: 1 }}>
|
||||||
|
// {row.original.state_id == 3 && (
|
||||||
|
// <ConfirmRoadSafetyForm row={row} mutate={mutate} rowId={row.getValue("id")} />
|
||||||
|
// )}
|
||||||
|
// {row.original.state_id == 6 && (
|
||||||
|
// <ConfirmVerifyRoadSafetyForm row={row} mutate={mutate} rowId={row.getValue("id")} />
|
||||||
|
// )}
|
||||||
|
// {row.original.state_id == 14 && (
|
||||||
|
// <ConfirmVerifyLicenseForm row={row} mutate={mutate} rowId={row.getValue("id")} />
|
||||||
|
// )}
|
||||||
|
// </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,60 @@
|
|||||||
|
const { IconButton, Tooltip, Box, Dialog, DialogTitle, Typography, DialogContent } = require("@mui/material");
|
||||||
|
import MapLayer from "@/core/components/MapLayer";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
import LayersIcon from "@mui/icons-material/Layers";
|
||||||
|
import { useMemo, useState } from "react";
|
||||||
|
import ShowBound from "./ShowBound";
|
||||||
|
import L from "leaflet";
|
||||||
|
|
||||||
|
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,190 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||||
|
import { GET_INQUIRY_PRIVACY_TABLE_LIST } from "@/core/utils/routes";
|
||||||
|
import { Box, Stack } from "@mui/material";
|
||||||
|
import moment from "jalali-moment";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import RowActions from "./RowActions";
|
||||||
|
import ShowPrimaryArea from "./ShowPrimaryArea";
|
||||||
|
|
||||||
|
const TechnicalDeputyList = () => {
|
||||||
|
const columns = useMemo(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
accessorKey: "id",
|
||||||
|
header: "کد یکتا",
|
||||||
|
id: "id",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "notEquals",
|
||||||
|
size: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "panjare_vahed_id",
|
||||||
|
header: "کدرهگیری پنجره واحد",
|
||||||
|
id: "panjare_vahed_id",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: false,
|
||||||
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
|
grow: false,
|
||||||
|
size: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "national_id",
|
||||||
|
header: "کد ملی",
|
||||||
|
id: "national_id",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: false,
|
||||||
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
|
size: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "phone_number",
|
||||||
|
header: "تلفن",
|
||||||
|
id: "phone_number",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
size: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "state_name",
|
||||||
|
header: "وضعیت درخواست",
|
||||||
|
id: "state_name",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "payment_amount",
|
||||||
|
header: "مبلغ پرداختی",
|
||||||
|
id: "payment_amount",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "between",
|
||||||
|
Cell: ({ row }) => <>{row.original.payment_amount || "-"}</>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "requested_organization",
|
||||||
|
header: "دستگاه صادر کننده",
|
||||||
|
id: "requested_organization",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: false,
|
||||||
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "province_name",
|
||||||
|
header: "استان",
|
||||||
|
id: "province_name",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "city_name",
|
||||||
|
header: "شهر",
|
||||||
|
id: "city_name",
|
||||||
|
enableColumnFilter: false,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "plan_group",
|
||||||
|
header: "گروه طرح",
|
||||||
|
id: "plan_group",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: false,
|
||||||
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "plan_title",
|
||||||
|
header: "عنوان طرح",
|
||||||
|
id: "plan_title",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: false,
|
||||||
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: "worksheet_id",
|
||||||
|
header: "شناسه کاربرگ",
|
||||||
|
id: "worksheet_id",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: false,
|
||||||
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "isic",
|
||||||
|
header: "کد آیسیک",
|
||||||
|
id: "isic",
|
||||||
|
enableColumnFilter: true,
|
||||||
|
datatype: "text",
|
||||||
|
filterMode: "equals",
|
||||||
|
sortDescFirst: false,
|
||||||
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: 120,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||||
|
<DataTableWithAuth
|
||||||
|
need_filter={true}
|
||||||
|
columns={columns}
|
||||||
|
sorting={[{ id: "id", desc: true }]}
|
||||||
|
table_url={GET_INQUIRY_PRIVACY_TABLE_LIST}
|
||||||
|
page_name={"technicalDeputy"}
|
||||||
|
table_name={"technicalDeputyList"}
|
||||||
|
enableRowActions
|
||||||
|
positionActionsColumn={"first"}
|
||||||
|
RowActions={RowActions}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default TechnicalDeputyList;
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import PageTitle from "@/core/components/PageTitle";
|
||||||
|
import { Stack } from "@mui/material";
|
||||||
|
import TechnicalDeputyList from "./TechnicalDeputyList";
|
||||||
|
|
||||||
|
const TechnicalDeputy = () => {
|
||||||
|
return (
|
||||||
|
<Stack spacing={1}>
|
||||||
|
<PageTitle title={"استعلام حریم راه - پنجره واحد"} />
|
||||||
|
<TechnicalDeputyList />
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default TechnicalDeputy;
|
||||||
11
src/core/components/TabPanel.jsx
Normal file
11
src/core/components/TabPanel.jsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { Box } from "@mui/material";
|
||||||
|
|
||||||
|
const TabPanel = (props) => {
|
||||||
|
const { children, value, index } = props;
|
||||||
|
return (
|
||||||
|
<div role="tabpanel" hidden={value !== index}>
|
||||||
|
{value === index && <Box>{children}</Box>}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default TabPanel;
|
||||||
@@ -318,7 +318,7 @@ export const pageMenuDev = [
|
|||||||
id: "assistant",
|
id: "assistant",
|
||||||
label: "کارتابل معاون",
|
label: "کارتابل معاون",
|
||||||
type: "page",
|
type: "page",
|
||||||
route: "/dashboard/inquiry-privacy/assistant",
|
route: "/dashboard/inquiry-privacy/technical-deputy",
|
||||||
icon: <ManageAccountsIcon sx={{ width: "inherit", height: "inherit" }} />,
|
icon: <ManageAccountsIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
permissions: ["all"],
|
permissions: ["all"],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -241,3 +241,4 @@ 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 CITY_ADMIN_FEEDBACK = api + "/api/v3/harim/province_office/feedback";
|
||||||
export const GET_PRIVACY_ADMIN_LIST = api + "/api/v3/harim/harim_office";
|
export const GET_PRIVACY_ADMIN_LIST = api + "/api/v3/harim/harim_office";
|
||||||
export const PRIVACY_ADMIN_ACTION_API = api + "/api/v3/harim/harim_office";
|
export const PRIVACY_ADMIN_ACTION_API = api + "/api/v3/harim/harim_office";
|
||||||
|
export const GET_INQUIRY_PRIVACY_TABLE_LIST = api + "/api/v3/harim/technical_deputy";
|
||||||
|
|||||||
Reference in New Issue
Block a user