confirm modal of technical deputy
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import DialogLoading from "@/core/components/DialogLoading";
|
||||
import { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
||||
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 ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||
|
||||
@@ -23,17 +23,16 @@ const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
||||
};
|
||||
|
||||
fetchData();
|
||||
}, [request, rowId]);
|
||||
}, [rowId]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogTitle>تاییدیه ایمنی راه</DialogTitle>
|
||||
{loading ? (
|
||||
<DialogLoading loadingOpen={loading} />
|
||||
) : data ? (
|
||||
<ConfirmRoadSafetyFormContext
|
||||
row={row}
|
||||
rowId={rowId}
|
||||
data={data}
|
||||
mutate={mutate}
|
||||
handleClose={handleClose}
|
||||
/>
|
||||
|
||||
@@ -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 PrevCartableOpinion from "./PrevCartableOpinion";
|
||||
import Questions from "./Questions";
|
||||
import TabPanel from "@/core/components/TabPanel";
|
||||
import { Box, TextField, Button, CircularProgress, Alert, DialogContent } from "@mui/material";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { CONFIRM_ROAD_SAFETY_FORM } from "@/core/utils/routes";
|
||||
|
||||
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
||||
const [tabState, setTabState] = useState(0);
|
||||
console.log("DATA: ", data);
|
||||
const ConfirmRoadSafetyFormContext = ({ rowId, mutate, handleClose }) => {
|
||||
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) => {
|
||||
setTabState(newValue);
|
||||
};
|
||||
const handleSubmit = async () => {
|
||||
if (!description.trim()) {
|
||||
setError("لطفاً توضیحات را وارد کنید");
|
||||
return;
|
||||
}
|
||||
|
||||
const handlePrev = () => {
|
||||
if (tabState === 0) {
|
||||
handleClose();
|
||||
} else {
|
||||
setTabState((t) => t - 1);
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
setSuccess(false);
|
||||
|
||||
try {
|
||||
const res = await requestServer(`${CONFIRM_ROAD_SAFETY_FORM}/${rowId}`, "post", {
|
||||
data: {
|
||||
expert_description: description,
|
||||
},
|
||||
});
|
||||
|
||||
setSuccess(true);
|
||||
mutate();
|
||||
setDescription("");
|
||||
handleClose()
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
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>
|
||||
</>
|
||||
<DialogContent>
|
||||
<Box sx={{ marginTop: 2 }} display="flex" flexDirection="column" gap={2}>
|
||||
{error && <Alert severity="error">{error}</Alert>}
|
||||
{success && <Alert severity="success">با موفقیت ثبت شد</Alert>}
|
||||
|
||||
<TextField
|
||||
label="توضیحات"
|
||||
multiline
|
||||
rows={3}
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
fullWidth
|
||||
/>
|
||||
|
||||
<Button variant="contained" onClick={handleSubmit} disabled={loading}>
|
||||
{loading ? <CircularProgress size={22} /> : "ثبت"}
|
||||
</Button>
|
||||
</Box>
|
||||
</DialogContent>
|
||||
);
|
||||
};
|
||||
|
||||
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 { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
||||
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 ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||
|
||||
const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
||||
const ConfirmRoadSafetyDialog = ({ handleClose, rowId, mutate }) => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [data, setData] = useState(null);
|
||||
const request = useRequest();
|
||||
@@ -23,17 +23,16 @@ const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
||||
};
|
||||
|
||||
fetchData();
|
||||
}, [request, rowId]);
|
||||
}, [rowId]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogTitle>تاییدیه ضمانت نامه ها</DialogTitle>
|
||||
{loading ? (
|
||||
<DialogLoading loadingOpen={loading} />
|
||||
) : data ? (
|
||||
<ConfirmRoadSafetyFormContext
|
||||
row={row}
|
||||
rowId={rowId}
|
||||
data={data}
|
||||
mutate={mutate}
|
||||
handleClose={handleClose}
|
||||
/>
|
||||
|
||||
@@ -1,85 +1,63 @@
|
||||
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 { Alert, Box, Button, CircularProgress, DialogContent, TextField } from "@mui/material";
|
||||
import { CONFIRM_VERIFY_LICENSE_FORM } from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
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 ConfirmRoadSafetyFormContext = ({ rowId, mutate, handleClose }) => {
|
||||
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) => {
|
||||
setTabState(newValue);
|
||||
};
|
||||
const handleSubmit = async () => {
|
||||
if (!description.trim()) {
|
||||
setError("لطفاً توضیحات را وارد کنید");
|
||||
return;
|
||||
}
|
||||
|
||||
const handlePrev = () => {
|
||||
if (tabState === 0) {
|
||||
handleClose();
|
||||
} else {
|
||||
setTabState((t) => t - 1);
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
setSuccess(false);
|
||||
|
||||
try {
|
||||
const res = await requestServer(`${CONFIRM_VERIFY_LICENSE_FORM}/${rowId}`, "post", {
|
||||
data: {
|
||||
expert_description: description,
|
||||
},
|
||||
});
|
||||
|
||||
setSuccess(true);
|
||||
mutate();
|
||||
setDescription("");
|
||||
handleClose()
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
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>
|
||||
</>
|
||||
<DialogContent>
|
||||
<Box sx={{ marginTop: 2 }} display="flex" flexDirection="column" gap={2}>
|
||||
{error && <Alert severity="error">{error}</Alert>}
|
||||
{success && <Alert severity="success">با موفقیت ثبت شد</Alert>}
|
||||
|
||||
<TextField
|
||||
label="توضیحات"
|
||||
multiline
|
||||
rows={3}
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
fullWidth
|
||||
/>
|
||||
|
||||
<Button variant="contained" onClick={handleSubmit} disabled={loading}>
|
||||
{loading ? <CircularProgress size={22} /> : "ثبت"}
|
||||
</Button>
|
||||
</Box>
|
||||
</DialogContent>
|
||||
);
|
||||
};
|
||||
export default ConfirmRoadSafetyFormContext;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import DialogLoading from "@/core/components/DialogLoading";
|
||||
import { GET_REQUEST_INQUIRY_PRIVACY } from "@/core/utils/routes";
|
||||
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 ConfirmRoadSafetyFormContext from "./ConfirmRoadSafetyFormContext";
|
||||
|
||||
@@ -27,13 +27,12 @@ const ConfirmRoadSafetyDialog = ({ row, handleClose, rowId, mutate }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogTitle>تاییدیه دسترسی راه</DialogTitle>
|
||||
{loading ? (
|
||||
<DialogLoading loadingOpen={loading} />
|
||||
) : data ? (
|
||||
<ConfirmRoadSafetyFormContext
|
||||
row={row}
|
||||
rowId={rowId}
|
||||
data={data}
|
||||
mutate={mutate}
|
||||
handleClose={handleClose}
|
||||
/>
|
||||
|
||||
@@ -1,85 +1,63 @@
|
||||
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 useRequest from "@/lib/hooks/useRequest";
|
||||
import { useState } from "react";
|
||||
import PrevCartableOpinion from "./PrevCartableOpinion";
|
||||
import Questions from "./Questions";
|
||||
import { CONFIRM_VERIFY_ROAD_SAFETY_FORM } from "@/core/utils/routes";
|
||||
import { Alert, Box, Button, CircularProgress, DialogContent, TextField } from "@mui/material";
|
||||
|
||||
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
||||
const [tabState, setTabState] = useState(0);
|
||||
const ConfirmRoadSafetyFormContext = ({ rowId, mutate, handleClose }) => {
|
||||
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) => {
|
||||
setTabState(newValue);
|
||||
};
|
||||
const handleSubmit = async () => {
|
||||
if (!description.trim()) {
|
||||
setError("لطفاً توضیحات را وارد کنید");
|
||||
return;
|
||||
}
|
||||
|
||||
const handlePrev = () => {
|
||||
if (tabState === 0) {
|
||||
handleClose();
|
||||
} else {
|
||||
setTabState((t) => t - 1);
|
||||
setLoading(true);
|
||||
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()
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
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>
|
||||
</>
|
||||
<DialogContent>
|
||||
<Box sx={{ marginTop: 2 }} display="flex" flexDirection="column" gap={2}>
|
||||
{error && <Alert severity="error">{error}</Alert>}
|
||||
{success && <Alert severity="success">با موفقیت ثبت شد</Alert>}
|
||||
|
||||
<TextField
|
||||
label="توضیحات"
|
||||
multiline
|
||||
rows={3}
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
fullWidth
|
||||
/>
|
||||
|
||||
<Button variant="contained" onClick={handleSubmit} disabled={loading}>
|
||||
{loading ? <CircularProgress size={22} /> : "ثبت"}
|
||||
</Button>
|
||||
</Box>
|
||||
</DialogContent>
|
||||
);
|
||||
};
|
||||
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,12 @@ 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_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
|
||||
export const GET_HISTORY_LIST = api + "/api/v3/harim/detail/histories";
|
||||
export const GET_REQUEST_INQUIRY_PRIVACY = api + "/api/v3/harim/technical_deputy";
|
||||
|
||||
Reference in New Issue
Block a user