diff --git a/src/components/dashboard/bank-management/Form/Reject/RejectContent.jsx b/src/components/dashboard/bank-management/Form/Reject/RejectContent.jsx
index e69de29..7720503 100644
--- a/src/components/dashboard/bank-management/Form/Reject/RejectContent.jsx
+++ b/src/components/dashboard/bank-management/Form/Reject/RejectContent.jsx
@@ -0,0 +1,143 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import {Button, DialogActions, DialogContent, FormHelperText, Stack, TextField, Typography} from "@mui/material"
+import {useFormik} from "formik";
+import {useTranslations} from "next-intl";
+import {useState} from "react";
+import * as Yup from "yup";
+import {REJECT_BANK_MANAGEMENT} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const t = useTranslations();
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const validationSchema = Yup.object().shape({
+ description: Yup.string().required(t("RejectDialog.description_error")),
+ reject_img: Yup.mixed().notRequired(t("RejectDialog.choose_file"))
+ .test('fileSize', `${t("MachinaryOffice.upload_file_unit")}`, (value) => {
+ return !value || (value.size && value.size <= 5 * 1024 * 1024);
+ })
+ .test('fileType', `${t("MachinaryOffice.upload_file_format")}`, (value) => {
+ const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
+ return !value || (value.type && allowedTypes.includes(value.type));
+ }),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("expert_description", values.description);
+ if (values.reject_img != null) {
+ const attachments = [
+ {
+ title: "فایل ضمیمه کارتابل نظارت بانک",
+ file: values.reject_img
+ }
+ ];
+ attachments.forEach((attachment, index) => {
+ formData.append(`attachment[${index}][title]`, attachment.title);
+ formData.append(`attachment[${index}][file]`, attachment.file);
+ });
+ }
+ requestServer(`${REJECT_BANK_MANAGEMENT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ setOpenRejectDialog(false)
+ mutate()
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("reject_img", uploadedFile).then(() => {
+ formik.setFieldTouched("reject_img", true);
+ })
+ setShowAddIcon(false);
+ }
+ };
+ return (
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+ formik.handleBlur("reject_img")}
+ error={
+ formik.touched.reject_img &&
+ Boolean(formik.errors.reject_img)
+ }
+ />
+
+ {formik.touched.reject_img && formik.errors.reject_img}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/bank-management/Form/Reject/index.jsx b/src/components/dashboard/bank-management/Form/Reject/index.jsx
index 0536cbe..c5ea413 100644
--- a/src/components/dashboard/bank-management/Form/Reject/index.jsx
+++ b/src/components/dashboard/bank-management/Form/Reject/index.jsx
@@ -1,68 +1,25 @@
+import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material"
import {useTranslations} from "next-intl";
import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Tooltip,
- Typography
-} from "@mui/material";
-import ThumbDownIcon from '@mui/icons-material/ThumbDown';
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-import {RESEND_BANK_STATEMENT} from "@/core/data/apiRoutes";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
const RejectForm = ({rowId, mutate}) => {
const t = useTranslations();
const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const [isSubmitting, setIsSubmitting] = useState(false)
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
- const handleSubmit = () => {
- setIsSubmitting(true)
- requestServer(`${RESEND_BANK_STATEMENT}/${rowId}`, 'post').then((response) => {
- setOpenRejectDialog(false)
- mutate()
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setIsSubmitting(false)
- });
- }
-
return (
<>
- {
- setOpenRejectDialog(true)
- }}
- >
+ setOpenRejectDialog(true)}>
-
>
- );
-};
-export default RejectForm;
\ No newline at end of file
+ )
+}
+export default RejectForm
\ No newline at end of file
diff --git a/src/components/dashboard/bank-management/TableRowActions.jsx b/src/components/dashboard/bank-management/TableRowActions.jsx
index f2b7720..5fa249d 100644
--- a/src/components/dashboard/bank-management/TableRowActions.jsx
+++ b/src/components/dashboard/bank-management/TableRowActions.jsx
@@ -1,7 +1,7 @@
import {Box} from "@mui/material";
import UpdateForm from "@/components/dashboard/bank-management/Form/Update";
-import RejectForm from "@/components/dashboard/bank-management/Form/Reject";
import EditForm from "@/components/dashboard/bank-management/Form/Edit";
+import RejectForm from "@/components/dashboard/bank-management/Form/Reject";
const TableRow = ({row, mutate}) => {
return (
@@ -12,10 +12,14 @@ const TableRow = ({row, mutate}) => {
mutate={mutate}
/>
)}
-
+ {
+ row.original.bank_state == 8 && (
+
+ )
+ }