Merge pull request #4 from witelgroup/feature/privacy_office_table_actions
Feature/privacy office table actions
This commit is contained in:
@@ -1,12 +1,27 @@
|
||||
// javascript for production
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"^/*": [
|
||||
"./public/*"
|
||||
]
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"^/*": ["./public/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// typescript for local development
|
||||
// {
|
||||
// "compilerOptions": {
|
||||
// "jsx": "react-jsx",
|
||||
// "noUnusedLocals": true,
|
||||
// "noImplicitAny": false,
|
||||
// "checkJs": true,
|
||||
// "allowJs": true,
|
||||
// "strict": true,
|
||||
// "baseUrl": ".",
|
||||
// "paths": {
|
||||
// "@/*": ["./src/*"],
|
||||
// "^/*": ["./public/*"]
|
||||
// }
|
||||
// },
|
||||
// "exclude": ["node_modules"]
|
||||
// }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import TechnicalDeputy from "@/components/dashboard/inquiryPrivacy/technical-deputy";
|
||||
import WithPermission from "@/core/middlewares/withPermission";
|
||||
export const metadata = {
|
||||
title: "کارتابل معاون",
|
||||
@@ -5,7 +6,7 @@ export const metadata = {
|
||||
const Page = () => {
|
||||
return (
|
||||
<WithPermission permission_name={["all"]}>
|
||||
<h1>کارتابل معاون</h1>
|
||||
<TechnicalDeputy />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
@@ -1,18 +1,8 @@
|
||||
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";
|
||||
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";
|
||||
|
||||
const ShowPrimaryArea = ({ primaryArea }) => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import CustomSelectByDependency from "@/core/components/DataTable/filter/fieldsType/CustomSelectByDependency";
|
||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||
import { GET_PRIVACY_ADMIN_LIST } from "@/core/utils/routes";
|
||||
import useInquiryPrivacyState from "@/lib/hooks/useInquiryPrivacyState";
|
||||
import AutorenewIcon from "@mui/icons-material/Autorenew";
|
||||
import DangerousIcon from "@mui/icons-material/Dangerous";
|
||||
@@ -13,7 +14,7 @@ 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 = () => {
|
||||
@@ -28,6 +29,7 @@ const PrivacyOfficeList = () => {
|
||||
if (state_id === 10) return <DangerousIcon sx={{ color: "error.main" }} />;
|
||||
if (state_id === 12) return <AutorenewIcon sx={{ color: "#899878" }} />;
|
||||
};
|
||||
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Dialog, DialogTitle } from "@mui/material";
|
||||
import RenderActionForm from "./RenderActionForm";
|
||||
|
||||
const ActionDialog = ({ open, type, rowData, onClose, mutate }) => {
|
||||
const actionLabel = {
|
||||
reject_request: "رد درخواست",
|
||||
confirm_request: "تایید درخواست",
|
||||
refer_request: "ارجاع درخواست",
|
||||
}[type];
|
||||
|
||||
return (
|
||||
<Dialog open={open} fullWidth maxWidth="xs" onClose={onClose}>
|
||||
<DialogTitle>{actionLabel}</DialogTitle>
|
||||
|
||||
<RenderActionForm type={type} rowData={rowData} mutate={mutate} onClose={onClose} />
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default ActionDialog;
|
||||
@@ -1,15 +1,15 @@
|
||||
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);
|
||||
const ConfirmAction = ({ onClick, disabled }) => {
|
||||
return (
|
||||
<>
|
||||
<Tooltip title="تایید اقدام">
|
||||
<IconButton color="success" onClick={() => setOpenConfirmDialog(true)}>
|
||||
<ThumbUpIcon />
|
||||
</IconButton>
|
||||
<span>
|
||||
<IconButton color="success" onClick={onClick} disabled={disabled}>
|
||||
<ThumbUpIcon />
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
import { calculatePolygonMetrics } from "@/core/utils/geoCalculations";
|
||||
import { PRIVACY_ADMIN_ACTION_API } from "@/core/utils/routes";
|
||||
import { safeParsePolygon } from "@/core/utils/utils";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
DialogActions,
|
||||
FormControl,
|
||||
FormHelperText,
|
||||
InputLabel,
|
||||
MenuItem,
|
||||
Select,
|
||||
TextField,
|
||||
} from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Controller, useForm, useWatch } from "react-hook-form";
|
||||
|
||||
const formatNumber = (num) => {
|
||||
if (!num) return "";
|
||||
return Number(num).toLocaleString("en-US");
|
||||
};
|
||||
|
||||
const price_fee = 1; // TODO: Replace with real price_fee
|
||||
export default function ComputePaymentForm({ mutate, onClose, rowData }) {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const request = useRequest({ notificationSuccess: true, notificationFailed: true });
|
||||
|
||||
const coordsArea = safeParsePolygon(rowData.final_area);
|
||||
const coordsPlan = safeParsePolygon(rowData.final_plan);
|
||||
|
||||
const areaMetrics = coordsArea ? calculatePolygonMetrics(coordsArea) : { area: 0 };
|
||||
const planMetrics = coordsPlan ? calculatePolygonMetrics(coordsPlan) : { area: 0 };
|
||||
|
||||
const calculatedArea = Number(areaMetrics.area.toFixed(2) || 0);
|
||||
const calculatedPlan = Number(planMetrics.area.toFixed(2) || 0);
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
setValue,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
defaultValues: {
|
||||
expert_description: "",
|
||||
traffic: "",
|
||||
road_type: "",
|
||||
position: "",
|
||||
final_area_space: calculatedArea, // عرصه
|
||||
final_plan_space: calculatedPlan, // عیان
|
||||
payment_amount: "",
|
||||
},
|
||||
});
|
||||
|
||||
const { traffic, road_type, position } = useWatch({
|
||||
control,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const hasGeometry = calculatedArea > 0 || calculatedPlan > 0;
|
||||
|
||||
const t = parseFloat(traffic || "");
|
||||
const r = parseFloat(road_type || "");
|
||||
const p = parseFloat(position || "");
|
||||
|
||||
const inputsValid = hasGeometry && !isNaN(t) && t > 0 && !isNaN(r) && r > 0 && !isNaN(p) && p > 0;
|
||||
|
||||
if (inputsValid) {
|
||||
const resultArea = t * r * p * calculatedArea * price_fee;
|
||||
const resultPlan = t * r * p * calculatedPlan * price_fee;
|
||||
|
||||
setValue("payment_amount", Math.floor(resultArea + resultPlan).toString());
|
||||
} else {
|
||||
setValue("payment_amount", "");
|
||||
}
|
||||
}, [traffic, road_type, position, setValue, calculatedArea, calculatedPlan]);
|
||||
|
||||
const onSubmit = (data) => {
|
||||
setIsSubmitting(true);
|
||||
|
||||
try {
|
||||
request(`${PRIVACY_ADMIN_ACTION_API}/computing_payment/${rowData.id}`, "post", {
|
||||
data,
|
||||
}).then(() => {
|
||||
onClose();
|
||||
mutate();
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error submitting payment:", error);
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", gap: 3, mt: 1 }}>
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<Controller
|
||||
name="traffic"
|
||||
control={control}
|
||||
rules={{ required: "ترافیک الزامی است" }}
|
||||
render={({ field }) => (
|
||||
<FormControl fullWidth>
|
||||
<InputLabel>ترافیک</InputLabel>
|
||||
<Select {...field} error={!!errors.traffic} label="ترافیک">
|
||||
<MenuItem value={1}>سبک</MenuItem>
|
||||
<MenuItem value={1.5}>متوسط</MenuItem>
|
||||
<MenuItem value={2}>سنگین</MenuItem>
|
||||
</Select>
|
||||
{errors.traffic && (
|
||||
<FormHelperText sx={{ color: "darkred" }}>{errors.traffic.message}</FormHelperText>
|
||||
)}
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="road_type"
|
||||
control={control}
|
||||
rules={{ required: "نوع راه الزامی است" }}
|
||||
render={({ field }) => (
|
||||
<FormControl fullWidth>
|
||||
<InputLabel>نوع راه</InputLabel>
|
||||
<Select {...field} error={!!errors.road_type} label="نوع راه">
|
||||
<MenuItem value={1}>فرعی و راهآهن</MenuItem>
|
||||
<MenuItem value={1.5}>اصلی و بزرگراه</MenuItem>
|
||||
<MenuItem value={2}>آزادراه</MenuItem>
|
||||
</Select>
|
||||
{errors.road_type && (
|
||||
<FormHelperText sx={{ color: "darkred" }}>{errors.road_type.message}</FormHelperText>
|
||||
)}
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Controller
|
||||
name="position"
|
||||
control={control}
|
||||
rules={{ required: "موقعیت اقتصادی الزامی است" }}
|
||||
render={({ field }) => (
|
||||
<FormControl fullWidth>
|
||||
<InputLabel>موقعیت اقتصادی</InputLabel>
|
||||
<Select {...field} error={!!errors.position} label="موقعیت اقتصادی">
|
||||
<MenuItem value={2}>در شعاع ۱۰ کیلومتری از مراکز استان</MenuItem>
|
||||
<MenuItem value={1.5}>در شعاع ۵ کیلومتری از سایر شهرها</MenuItem>
|
||||
</Select>
|
||||
{errors.position && (
|
||||
<FormHelperText sx={{ color: "darkred" }}>{errors.position.message}</FormHelperText>
|
||||
)}
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<Controller
|
||||
name="final_area_space"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
type="number"
|
||||
InputProps={{ readOnly: true }}
|
||||
fullWidth
|
||||
label="مساحت عرصه (متر مربع)"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="final_plan_space"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
type="number"
|
||||
InputProps={{ readOnly: true }}
|
||||
fullWidth
|
||||
label="مساحت عیان (متر مربع)"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Controller
|
||||
name="payment_amount"
|
||||
control={control}
|
||||
render={({ field }) => {
|
||||
const { value } = field;
|
||||
|
||||
return (
|
||||
<TextField
|
||||
fullWidth
|
||||
label="مبلغ پرداختی (ریال)"
|
||||
value={formatNumber(value)}
|
||||
InputProps={{ readOnly: true }}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="expert_description"
|
||||
control={control}
|
||||
rules={{ required: "توضیحات ناظر اجباری است" }}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fullWidth
|
||||
error={!!errors.expert_description}
|
||||
multiline
|
||||
minRows={3}
|
||||
label="توضیحات"
|
||||
helperText={errors.expert_description?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<DialogActions>
|
||||
<Button onClick={onClose} variant="outlined" disabled={isSubmitting}>
|
||||
انصراف
|
||||
</Button>
|
||||
<Button variant="contained" onClick={handleSubmit(onSubmit)} disabled={isSubmitting}>
|
||||
انجام عملیات
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { PRIVACY_ADMIN_ACTION_API } from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { Box, Button, DialogActions, TextField } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
export default function ConfirmFileForm({ mutate, onClose, rowId }) {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const request = useRequest({ notificationSuccess: true, notificationFailed: true });
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
defaultValues: {
|
||||
expert_description: "",
|
||||
},
|
||||
});
|
||||
|
||||
const onSubmit = (data) => {
|
||||
setIsSubmitting(true);
|
||||
|
||||
try {
|
||||
request(`${PRIVACY_ADMIN_ACTION_API}/file_accepted/${rowId}`, "post", {
|
||||
data,
|
||||
}).then(() => {
|
||||
onClose();
|
||||
mutate();
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", mt: 1 }}>
|
||||
<Controller
|
||||
name="expert_description"
|
||||
control={control}
|
||||
rules={{
|
||||
required: "توضیحات الزامی است",
|
||||
}}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fullWidth
|
||||
multiline
|
||||
minRows={3}
|
||||
label="توضیحات"
|
||||
error={!!errors.expert_description}
|
||||
helperText={errors.expert_description?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<DialogActions>
|
||||
<Button onClick={onClose} variant="outlined" disabled={isSubmitting}>
|
||||
انصراف
|
||||
</Button>
|
||||
<Button variant="contained" onClick={handleSubmit(onSubmit)} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال ثبت..." : "انجام عملیات"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import { PRIVACY_ADMIN_ACTION_API } from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { Box, Button, Checkbox, DialogActions, FormControlLabel, TextField } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
export default function ConfirmRequestForm({ mutate, onClose, rowId }) {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const request = useRequest({ notificationSuccess: true, notificationFailed: true });
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
defaultValues: {
|
||||
expert_description: "",
|
||||
need_payment: false,
|
||||
needsAccessRoad: false,
|
||||
},
|
||||
});
|
||||
|
||||
const onSubmit = (data) => {
|
||||
const confirmType = data.needsAccessRoad ? "need_road_access" : "without_road_access";
|
||||
const url = `${PRIVACY_ADMIN_ACTION_API}/${confirmType}/${rowId}`;
|
||||
const body = {
|
||||
expert_description: data.expert_description,
|
||||
need_payment: data.need_payment ? 1 : 0,
|
||||
};
|
||||
|
||||
setIsSubmitting(true);
|
||||
try {
|
||||
request(url, "post", {
|
||||
data: body,
|
||||
}).then(() => {
|
||||
mutate();
|
||||
onClose();
|
||||
});
|
||||
} catch (error) {
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", mt: 1 }}>
|
||||
<Controller
|
||||
name="expert_description"
|
||||
control={control}
|
||||
rules={{ required: "توضیحات الزامی است" }}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fullWidth
|
||||
multiline
|
||||
minRows={3}
|
||||
label="توضیحات"
|
||||
error={!!errors.expert_description}
|
||||
helperText={errors.expert_description?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="need_payment"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<FormControlLabel
|
||||
control={<Checkbox {...field} checked={field.value} />}
|
||||
label="نیاز به پرداخت وجه خزانه"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="needsAccessRoad"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<FormControlLabel
|
||||
control={<Checkbox {...field} checked={field.value} />}
|
||||
label="نیاز به راه دسترسی"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<DialogActions>
|
||||
<Button onClick={onClose} variant="outlined" disabled={isSubmitting}>
|
||||
انصراف
|
||||
</Button>
|
||||
<Button variant="contained" onClick={handleSubmit(onSubmit)} disabled={isSubmitting}>
|
||||
انجام عملیات
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { PRIVACY_ADMIN_ACTION_API } from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { Box, Button, DialogActions, TextField } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
export default function ReferForm({ mutate, onClose, rowId }) {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const request = useRequest({ notificationSuccess: true, notificationFailed: true });
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
defaultValues: {
|
||||
expert_description: "",
|
||||
},
|
||||
});
|
||||
|
||||
const onSubmit = (data) => {
|
||||
setIsSubmitting(true);
|
||||
try {
|
||||
request(`${PRIVACY_ADMIN_ACTION_API}/refer_request/${rowId}`, "post", {
|
||||
data,
|
||||
}).then(() => {
|
||||
onClose();
|
||||
mutate();
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", mt: 1 }}>
|
||||
<Controller
|
||||
name="expert_description"
|
||||
control={control}
|
||||
rules={{
|
||||
required: "توضیحات الزامی است",
|
||||
}}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
error={!!errors.expert_description}
|
||||
helperText={errors.expert_description?.message}
|
||||
fullWidth
|
||||
multiline
|
||||
minRows={3}
|
||||
label="توضیحات"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<DialogActions>
|
||||
<Button onClick={onClose} variant="outlined" disabled={isSubmitting}>
|
||||
انصراف
|
||||
</Button>
|
||||
<Button variant="contained" onClick={handleSubmit(onSubmit)} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال ثبت..." : " انجام عملیات"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { PRIVACY_ADMIN_ACTION_API } from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { Box, Button, DialogActions, TextField } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
export default function RejectFileForm({ mutate, onClose, rowId }) {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const request = useRequest({ notificationSuccess: true, notificationFailed: true });
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
defaultValues: {
|
||||
expert_description: "",
|
||||
},
|
||||
});
|
||||
|
||||
const onSubmit = (data) => {
|
||||
setIsSubmitting(true);
|
||||
|
||||
try {
|
||||
request(`${PRIVACY_ADMIN_ACTION_API}/file_rejected/${rowId}`, "post", {
|
||||
data,
|
||||
}).then(() => {
|
||||
onClose();
|
||||
mutate();
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", mt: 1 }}>
|
||||
<Controller
|
||||
name="expert_description"
|
||||
control={control}
|
||||
rules={{
|
||||
required: "توضیحات الزامی است",
|
||||
}}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fullWidth
|
||||
multiline
|
||||
minRows={3}
|
||||
label="توضیحات"
|
||||
error={!!errors.expert_description}
|
||||
helperText={errors.expert_description?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<DialogActions>
|
||||
<Button onClick={onClose} variant="outlined" disabled={isSubmitting}>
|
||||
انصراف
|
||||
</Button>
|
||||
<Button variant="contained" onClick={handleSubmit(onSubmit)} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال ثبت..." : "انجام عملیات"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { PRIVACY_ADMIN_ACTION_API } from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { Box, Button, DialogActions, TextField } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
export default function RejectRequestForm({ mutate, onClose, rowId }) {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const request = useRequest({ notificationSuccess: true, notificationFailed: true });
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
defaultValues: {
|
||||
expert_description: "",
|
||||
},
|
||||
});
|
||||
|
||||
const onSubmit = (data) => {
|
||||
setIsSubmitting(true);
|
||||
|
||||
try {
|
||||
request(`${PRIVACY_ADMIN_ACTION_API}/reject_request/${rowId}`, "post", {
|
||||
data,
|
||||
}).then(() => {
|
||||
onClose();
|
||||
mutate();
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", mt: 1 }}>
|
||||
<Controller
|
||||
name="expert_description"
|
||||
control={control}
|
||||
rules={{
|
||||
required: "توضیحات الزامی است",
|
||||
}}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fullWidth
|
||||
multiline
|
||||
minRows={3}
|
||||
label="توضیحات"
|
||||
error={!!errors.expert_description}
|
||||
helperText={errors.expert_description?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<DialogActions>
|
||||
<Button onClick={onClose} variant="outlined" disabled={isSubmitting}>
|
||||
انصراف
|
||||
</Button>
|
||||
<Button variant="contained" onClick={handleSubmit(onSubmit)} disabled={isSubmitting}>
|
||||
{isSubmitting ? "در حال ثبت..." : "انجام عملیات"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Reply } from "@mui/icons-material";
|
||||
import { IconButton, Tooltip } from "@mui/material";
|
||||
|
||||
const ReferralAction = ({ onClick, disabled }) => {
|
||||
return (
|
||||
<>
|
||||
<Tooltip title="ارجاع درخواست">
|
||||
<span>
|
||||
<IconButton color="info" onClick={onClick} disabled={disabled}>
|
||||
<Reply />
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ReferralAction;
|
||||
@@ -1,15 +1,15 @@
|
||||
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);
|
||||
const RejectAction = ({ onClick, disabled }) => {
|
||||
return (
|
||||
<>
|
||||
<Tooltip title="عدم تایید اقدام">
|
||||
<IconButton color="error" onClick={() => setOpenRejectDialog(true)}>
|
||||
<ThumbDownIcon />
|
||||
</IconButton>
|
||||
<span>
|
||||
<IconButton color="error" onClick={onClick} disabled={disabled}>
|
||||
<ThumbDownIcon />
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { DialogContent } from "@mui/material";
|
||||
import ComputePaymentForm from "./Forms/ComputePaymentForm";
|
||||
import ConfirmFileForm from "./Forms/ConfirmFileForm";
|
||||
import ConfirmRequestForm from "./Forms/ConfirmRequestForm";
|
||||
import ReferForm from "./Forms/ReferForm";
|
||||
import RejectFileForm from "./Forms/RejectFileForm";
|
||||
import RejectRequestForm from "./Forms/RejectRequestForm";
|
||||
|
||||
export default function RenderActionForm({ type, rowData, mutate, onClose }) {
|
||||
const formType = `${type}_${rowData?.state_id}`;
|
||||
|
||||
function renderForm() {
|
||||
switch (formType) {
|
||||
case "refer_request_2":
|
||||
return <ReferForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
|
||||
case "reject_request_2":
|
||||
return <RejectRequestForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
|
||||
case "reject_request_5":
|
||||
return <RejectFileForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
|
||||
case "confirm_request_2":
|
||||
return <ConfirmRequestForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
|
||||
case "confirm_request_5":
|
||||
return <ConfirmFileForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
|
||||
case "confirm_request_13":
|
||||
return <ComputePaymentForm mutate={mutate} onClose={onClose} rowData={rowData} />;
|
||||
default:
|
||||
return <></>;
|
||||
}
|
||||
}
|
||||
|
||||
return <DialogContent>{renderForm()}</DialogContent>;
|
||||
}
|
||||
@@ -1,13 +1,55 @@
|
||||
import { Box } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import ActionDialog from "./ActionsDialog";
|
||||
import ConfirmAction from "./ConfirmAction";
|
||||
import ReferralAction from "./ReferralAction";
|
||||
import RejectAction from "./RejectAction";
|
||||
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
const RowActions = ({ row: { original }, mutate }) => {
|
||||
const [modal, setModal] = useState({
|
||||
open: false,
|
||||
type: null, // "reject_request" | "confirm_request" | "refer_request"
|
||||
rowData: null,
|
||||
});
|
||||
|
||||
const handleOpenModal = (type, rowData) => {
|
||||
setModal({ open: true, type, rowData });
|
||||
};
|
||||
|
||||
const handleCloseModal = () => {
|
||||
setModal({ open: false, type: null, rowData: null });
|
||||
};
|
||||
|
||||
const stateId = original.state_id;
|
||||
|
||||
const disabled = {
|
||||
referral: stateId !== 2,
|
||||
reject: stateId !== 2 && stateId !== 5,
|
||||
confirm: stateId !== 2 && stateId !== 5 && stateId !== 13,
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1, justifyContent: "Center" }}>
|
||||
<RejectAction />
|
||||
<ConfirmAction />
|
||||
</Box>
|
||||
<>
|
||||
<Box sx={{ display: "flex", gap: 1, justifyContent: "center" }}>
|
||||
<ReferralAction
|
||||
onClick={() => handleOpenModal("refer_request", original)}
|
||||
disabled={disabled.referral}
|
||||
/>
|
||||
<RejectAction onClick={() => handleOpenModal("reject_request", original)} disabled={disabled.reject} />
|
||||
<ConfirmAction
|
||||
onClick={() => handleOpenModal("confirm_request", original)}
|
||||
disabled={disabled.confirm}
|
||||
/>
|
||||
</Box>
|
||||
<ActionDialog
|
||||
open={modal.open}
|
||||
type={modal.type}
|
||||
rowData={modal.rowData}
|
||||
onClose={handleCloseModal}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default RowActions;
|
||||
|
||||
@@ -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;
|
||||
@@ -82,8 +82,8 @@ const TollHouseInfo = ({ control }) => {
|
||||
value={field.value}
|
||||
label="وضعیت"
|
||||
selectors={[
|
||||
{ id: 0, name: "فعال" },
|
||||
{ id: 1, name: "غیر فعال" },
|
||||
{ id: 1, name: "فعال" },
|
||||
{ id: 0, name: "غیر فعال" },
|
||||
]}
|
||||
schema={{ name: "name", value: "id" }}
|
||||
error={error}
|
||||
|
||||
@@ -384,7 +384,8 @@ const TollHouseList = () => {
|
||||
],
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
|
||||
accessorFn: (row) =>
|
||||
row.created_at ? moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD") : "-",
|
||||
header: "تاریخ ثبت",
|
||||
id: "created_at",
|
||||
enableColumnFilter: true,
|
||||
|
||||
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",
|
||||
label: "کارتابل معاون",
|
||||
type: "page",
|
||||
route: "/dashboard/inquiry-privacy/assistant",
|
||||
route: "/dashboard/inquiry-privacy/technical-deputy",
|
||||
icon: <ManageAccountsIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"],
|
||||
},
|
||||
|
||||
@@ -240,3 +240,5 @@ 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";
|
||||
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";
|
||||
|
||||
@@ -148,3 +148,18 @@ export const getClosedPolygonCoordinates = (polygon) => {
|
||||
|
||||
return coordinates;
|
||||
};
|
||||
|
||||
export function safeParsePolygon(polygonJson) {
|
||||
if (!polygonJson) return null;
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(polygonJson);
|
||||
if (parsed && parsed.coordinates) {
|
||||
return parsed.coordinates;
|
||||
}
|
||||
return null;
|
||||
} catch (err) {
|
||||
console.error("Invalid polygon JSON:", err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user