build and format
This commit is contained in:
@@ -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;
|
|
||||||
Reference in New Issue
Block a user