Merge pull request #8 from witelgroup/feature/confirm_modal
Feature/confirm modal
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import DialogLoading from "@/core/components/DialogLoading";
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
import { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
import { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { DialogContent, Typography } from "@mui/material";
|
import { DialogContent, DialogTitle, Typography } from "@mui/material";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||||
|
|
||||||
@@ -23,20 +23,15 @@ const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchData();
|
fetchData();
|
||||||
}, [request, rowId]);
|
}, [rowId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<DialogTitle>تاییدیه ایمنی راه</DialogTitle>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<DialogLoading loadingOpen={loading} />
|
<DialogLoading loadingOpen={loading} />
|
||||||
) : data ? (
|
) : data ? (
|
||||||
<ConfirmRoadSafetyFormContext
|
<ConfirmRoadSafetyFormContext rowId={rowId} mutate={mutate} handleClose={handleClose} />
|
||||||
row={row}
|
|
||||||
rowId={rowId}
|
|
||||||
data={data}
|
|
||||||
mutate={mutate}
|
|
||||||
handleClose={handleClose}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
||||||
|
|||||||
@@ -1,86 +1,64 @@
|
|||||||
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 { useState } from "react";
|
||||||
import PrevCartableOpinion from "./PrevCartableOpinion";
|
import { Box, TextField, Button, CircularProgress, Alert, DialogContent } from "@mui/material";
|
||||||
import Questions from "./Questions";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import TabPanel from "@/core/components/TabPanel";
|
import { CONFIRM_ROAD_SAFETY_FORM } from "@/core/utils/routes";
|
||||||
|
|
||||||
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
const ConfirmRoadSafetyFormContext = ({ rowId, mutate, handleClose }) => {
|
||||||
const [tabState, setTabState] = useState(0);
|
const requestServer = useRequest({ notificationShow: true, notificationSuccess: true });
|
||||||
console.log("DATA: ", data);
|
const [description, setDescription] = useState("");
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [error, setError] = useState(null);
|
||||||
|
const [success, setSuccess] = useState(false);
|
||||||
|
|
||||||
const handleChangeTab = (event, newValue) => {
|
const handleSubmit = async () => {
|
||||||
setTabState(newValue);
|
if (!description.trim()) {
|
||||||
};
|
setError("لطفاً توضیحات را وارد کنید");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const handlePrev = () => {
|
setLoading(true);
|
||||||
if (tabState === 0) {
|
setError(null);
|
||||||
|
setSuccess(false);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await requestServer(`${CONFIRM_ROAD_SAFETY_FORM}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: description,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
setSuccess(true);
|
||||||
|
mutate();
|
||||||
|
setDescription("");
|
||||||
handleClose();
|
handleClose();
|
||||||
} else {
|
} catch (err) {
|
||||||
setTabState((t) => t - 1);
|
setError(err.message);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<DialogContent>
|
||||||
<Tabs
|
<Box sx={{ marginTop: 2 }} display="flex" flexDirection="column" gap={2}>
|
||||||
allowScrollButtonsMobile
|
{error && <Alert severity="error">{error}</Alert>}
|
||||||
value={tabState}
|
{success && <Alert severity="success">با موفقیت ثبت شد</Alert>}
|
||||||
onChange={handleChangeTab}
|
|
||||||
variant={"fullWidth"}
|
<TextField
|
||||||
sx={{
|
label="توضیحات"
|
||||||
display: "flex",
|
multiline
|
||||||
justifyContent: "center",
|
rows={3}
|
||||||
alignItems: "center",
|
value={description}
|
||||||
width: "100%",
|
onChange={(e) => setDescription(e.target.value)}
|
||||||
backgroundColor: "#efefef",
|
fullWidth
|
||||||
}}
|
/>
|
||||||
>
|
|
||||||
<Tab icon={<InsertDriveFile />} label="اطلاعات طرح متقاضی" />
|
<Button variant="contained" onClick={handleSubmit} disabled={loading}>
|
||||||
<Tab disabled={tabState < 1} icon={<Route />} label="جریان فرایند" />
|
{loading ? <CircularProgress size={22} /> : "ثبت"}
|
||||||
<Tab disabled={tabState < 2} icon={<Engineering />} label="تاییدیه ایمنی راه" />
|
</Button>
|
||||||
</Tabs>
|
</Box>
|
||||||
<TabPanel value={tabState} index={0}>
|
</DialogContent>
|
||||||
<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;
|
export default ConfirmRoadSafetyFormContext;
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import DialogLoading from "@/core/components/DialogLoading";
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
import { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
import { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { DialogContent, Typography } from "@mui/material";
|
import { DialogContent, DialogTitle, Typography } from "@mui/material";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||||
|
|
||||||
const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
const ConfirmRoadSafetyDialog = ({ handleClose, rowId, mutate }) => {
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [data, setData] = useState(null);
|
const [data, setData] = useState(null);
|
||||||
const request = useRequest();
|
const request = useRequest();
|
||||||
@@ -23,20 +23,15 @@ const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchData();
|
fetchData();
|
||||||
}, [request, rowId]);
|
}, [rowId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<DialogTitle>تاییدیه ضمانت نامه ها</DialogTitle>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<DialogLoading loadingOpen={loading} />
|
<DialogLoading loadingOpen={loading} />
|
||||||
) : data ? (
|
) : data ? (
|
||||||
<ConfirmRoadSafetyFormContext
|
<ConfirmRoadSafetyFormContext rowId={rowId} mutate={mutate} handleClose={handleClose} />
|
||||||
row={row}
|
|
||||||
rowId={rowId}
|
|
||||||
data={data}
|
|
||||||
mutate={mutate}
|
|
||||||
handleClose={handleClose}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
||||||
|
|||||||
@@ -1,85 +1,63 @@
|
|||||||
import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail";
|
import { Alert, Box, Button, CircularProgress, DialogContent, TextField } from "@mui/material";
|
||||||
import TabPanel from "@/core/components/TabPanel";
|
import { CONFIRM_VERIFY_LICENSE_FORM } from "@/core/utils/routes";
|
||||||
import { ExitToApp, InsertDriveFile, Route, ThumbUp } from "@mui/icons-material";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { Button, DialogActions, DialogContent, Stack, Tab, Tabs } from "@mui/material";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import PrevCartableOpinion from "./PrevCartableOpinion";
|
|
||||||
import Questions from "./Questions";
|
|
||||||
|
|
||||||
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
const ConfirmRoadSafetyFormContext = ({ rowId, mutate, handleClose }) => {
|
||||||
const [tabState, setTabState] = useState(0);
|
const requestServer = useRequest({ notificationShow: true, notificationSuccess: true });
|
||||||
|
const [description, setDescription] = useState("");
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [error, setError] = useState(null);
|
||||||
|
const [success, setSuccess] = useState(false);
|
||||||
|
|
||||||
const handleChangeTab = (event, newValue) => {
|
const handleSubmit = async () => {
|
||||||
setTabState(newValue);
|
if (!description.trim()) {
|
||||||
};
|
setError("لطفاً توضیحات را وارد کنید");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const handlePrev = () => {
|
setLoading(true);
|
||||||
if (tabState === 0) {
|
setError(null);
|
||||||
|
setSuccess(false);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await requestServer(`${CONFIRM_VERIFY_LICENSE_FORM}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: description,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
setSuccess(true);
|
||||||
|
mutate();
|
||||||
|
setDescription("");
|
||||||
handleClose();
|
handleClose();
|
||||||
} else {
|
} catch (err) {
|
||||||
setTabState((t) => t - 1);
|
setError(err.message);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<DialogContent>
|
||||||
<Tabs
|
<Box sx={{ marginTop: 2 }} display="flex" flexDirection="column" gap={2}>
|
||||||
allowScrollButtonsMobile
|
{error && <Alert severity="error">{error}</Alert>}
|
||||||
value={tabState}
|
{success && <Alert severity="success">با موفقیت ثبت شد</Alert>}
|
||||||
onChange={handleChangeTab}
|
|
||||||
variant={"fullWidth"}
|
<TextField
|
||||||
sx={{
|
label="توضیحات"
|
||||||
display: "flex",
|
multiline
|
||||||
justifyContent: "center",
|
rows={3}
|
||||||
alignItems: "center",
|
value={description}
|
||||||
width: "100%",
|
onChange={(e) => setDescription(e.target.value)}
|
||||||
backgroundColor: "#efefef",
|
fullWidth
|
||||||
}}
|
/>
|
||||||
>
|
|
||||||
<Tab icon={<InsertDriveFile />} label="اطلاعات طرح متقاضی" />
|
<Button variant="contained" onClick={handleSubmit} disabled={loading}>
|
||||||
<Tab disabled={tabState < 1} icon={<Route />} label="جریان فرایند" />
|
{loading ? <CircularProgress size={22} /> : "ثبت"}
|
||||||
<Tab disabled={tabState < 2} icon={<ThumbUp />} label="تاییدیه ضمانت نامه ها" />
|
</Button>
|
||||||
</Tabs>
|
</Box>
|
||||||
<TabPanel value={tabState} index={0}>
|
</DialogContent>
|
||||||
<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;
|
export default ConfirmRoadSafetyFormContext;
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import DialogLoading from "@/core/components/DialogLoading";
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
import { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
import { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { DialogContent, Typography } from "@mui/material";
|
import { DialogContent, DialogTitle, Typography } from "@mui/material";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
import ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||||
|
|
||||||
@@ -27,16 +27,11 @@ const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<DialogTitle>تاییدیه دسترسی راه</DialogTitle>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<DialogLoading loadingOpen={loading} />
|
<DialogLoading loadingOpen={loading} />
|
||||||
) : data ? (
|
) : data ? (
|
||||||
<ConfirmRoadSafetyFormContext
|
<ConfirmRoadSafetyFormContext rowId={rowId} mutate={mutate} handleClose={handleClose} />
|
||||||
row={row}
|
|
||||||
rowId={rowId}
|
|
||||||
data={data}
|
|
||||||
mutate={mutate}
|
|
||||||
handleClose={handleClose}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
<Typography textAlign={"center"}>اطلاعات درخواست در سامانه یافت نشد</Typography>
|
||||||
|
|||||||
@@ -1,85 +1,63 @@
|
|||||||
import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
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 { useState } from "react";
|
||||||
import PrevCartableOpinion from "./PrevCartableOpinion";
|
import { CONFIRM_VERIFY_ROAD_SAFETY_FORM } from "@/core/utils/routes";
|
||||||
import Questions from "./Questions";
|
import { Alert, Box, Button, CircularProgress, DialogContent, TextField } from "@mui/material";
|
||||||
|
|
||||||
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
const ConfirmRoadSafetyFormContext = ({ rowId, mutate, handleClose }) => {
|
||||||
const [tabState, setTabState] = useState(0);
|
const requestServer = useRequest({ notificationShow: true, notificationSuccess: true });
|
||||||
|
const [description, setDescription] = useState("");
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [error, setError] = useState(null);
|
||||||
|
const [success, setSuccess] = useState(false);
|
||||||
|
|
||||||
const handleChangeTab = (event, newValue) => {
|
const handleSubmit = async () => {
|
||||||
setTabState(newValue);
|
if (!description.trim()) {
|
||||||
};
|
setError("لطفاً توضیحات را وارد کنید");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const handlePrev = () => {
|
setLoading(true);
|
||||||
if (tabState === 0) {
|
setError(null);
|
||||||
|
setSuccess(false);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await requestServer(`${CONFIRM_VERIFY_ROAD_SAFETY_FORM}/${rowId}`, "post", {
|
||||||
|
data: {
|
||||||
|
expert_description: description,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
setSuccess(true);
|
||||||
|
mutate();
|
||||||
|
setDescription("");
|
||||||
handleClose();
|
handleClose();
|
||||||
} else {
|
} catch (err) {
|
||||||
setTabState((t) => t - 1);
|
setError(err.message);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<DialogContent>
|
||||||
<Tabs
|
<Box sx={{ marginTop: 2 }} display="flex" flexDirection="column" gap={2}>
|
||||||
allowScrollButtonsMobile
|
{error && <Alert severity="error">{error}</Alert>}
|
||||||
value={tabState}
|
{success && <Alert severity="success">با موفقیت ثبت شد</Alert>}
|
||||||
onChange={handleChangeTab}
|
|
||||||
variant={"fullWidth"}
|
<TextField
|
||||||
sx={{
|
label="توضیحات"
|
||||||
display: "flex",
|
multiline
|
||||||
justifyContent: "center",
|
rows={3}
|
||||||
alignItems: "center",
|
value={description}
|
||||||
width: "100%",
|
onChange={(e) => setDescription(e.target.value)}
|
||||||
backgroundColor: "#efefef",
|
fullWidth
|
||||||
}}
|
/>
|
||||||
>
|
|
||||||
<Tab icon={<InsertDriveFile />} label="اطلاعات طرح متقاضی" />
|
<Button variant="contained" onClick={handleSubmit} disabled={loading}>
|
||||||
<Tab disabled={tabState < 1} icon={<Route />} label="جریان فرایند" />
|
{loading ? <CircularProgress size={22} /> : "ثبت"}
|
||||||
<Tab disabled={tabState < 2} icon={<DoneAll />} label="تاییدیه دسترسی راه" />
|
</Button>
|
||||||
</Tabs>
|
</Box>
|
||||||
<TabPanel value={tabState} index={0}>
|
</DialogContent>
|
||||||
<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;
|
export default ConfirmRoadSafetyFormContext;
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -244,6 +244,11 @@ 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";
|
export const GET_INQUIRY_PRIVACY_TABLE_LIST = api + "/api/v3/harim/technical_deputy";
|
||||||
export const GET_GENERAL_MANAGER_LIST = api + "/api/v3/harim/general_manager";
|
export const GET_GENERAL_MANAGER_LIST = api + "/api/v3/harim/general_manager";
|
||||||
|
|
||||||
|
// technical deputy actions
|
||||||
|
export const CONFIRM_ROAD_SAFETY_FORM = api + "/api/v3/harim/technical_deputy/confirm_request";
|
||||||
|
export const CONFIRM_VERIFY_ROAD_SAFETY_FORM = api + "/api/v3/harim/technical_deputy/confirm_road_access";
|
||||||
|
export const CONFIRM_VERIFY_LICENSE_FORM = api + "/api/v3/harim/technical_deputy/confirm_payment";
|
||||||
|
|
||||||
// History
|
// History
|
||||||
export const GET_HISTORY_LIST = api + "/api/v3/harim/detail/histories";
|
export const GET_HISTORY_LIST = api + "/api/v3/harim/detail/histories";
|
||||||
export const GET_REQUEST_INQUIRY_PRIVACY = api + "/api/v3/harim/technical_deputy";
|
export const GET_REQUEST_INQUIRY_PRIVACY = api + "/api/v3/harim/technical_deputy";
|
||||||
|
|||||||
Reference in New Issue
Block a user