diff --git a/package-lock.json b/package-lock.json
index 1815fa2..3dfb5da 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
- "name": "dashboard",
- "version": "0.1.0",
+ "name": "LoanFacilitiesDashboard",
+ "version": "1.7.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
- "name": "dashboard",
- "version": "0.1.0",
+ "name": "LoanFacilitiesDashboard",
+ "version": "1.7.5",
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/server": "^11.10.0",
diff --git a/src/components/dashboard/change-password/change-password-form/index.jsx b/src/components/dashboard/change-password/change-password-form/index.jsx
index e94801d..838b16d 100644
--- a/src/components/dashboard/change-password/change-password-form/index.jsx
+++ b/src/components/dashboard/change-password/change-password-form/index.jsx
@@ -123,7 +123,7 @@ const ChangePasswordForm = ({onSubmit}) => {
variant="contained"
color="primary"
size="large"
- disabled={props.isSubmitting || !(props.values.current_password && props.values.new_password && props.values.new_password_confirmation)}
+ disabled={props.isSubmitting || !props.dirty || !props.isValid}
>
{props.isSubmitting
? t("SubmitButton.button_while_submit")
diff --git a/src/components/dashboard/commercial-chief/Form/ConfirmForm.jsx b/src/components/dashboard/commercial-chief/Form/ConfirmForm.jsx
deleted file mode 100644
index c2025ab..0000000
--- a/src/components/dashboard/commercial-chief/Form/ConfirmForm.jsx
+++ /dev/null
@@ -1,142 +0,0 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography
-} from "@mui/material";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
-import UploadSystem from "@/core/components/UploadSystem";
-import {useFormik} from "formik";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import {CONFIRM_COMMERCIAL_CHIEF} from "@/core/data/apiRoutes";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Confirm = ({rowId, fetchUrl, mutate}) => {
- const t = useTranslations();
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const formik = useFormik({
- initialValues: {
- description: "",
- confirm_img: null
- },
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
- requestServer(`${CONFIRM_COMMERCIAL_CHIEF}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
-
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
- const fileType = event.target?.files?.[0].type;
- const fileName = event.target?.files?.[0].name;
- setSelectedImage(URL.createObjectURL(uploadedFile));
- setfileType(fileType);
- setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/commercial-chief/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/commercial-chief/Form/ConfirmForm/ConfirmContent.jsx
new file mode 100644
index 0000000..f68dd36
--- /dev/null
+++ b/src/components/dashboard/commercial-chief/Form/ConfirmForm/ConfirmContent.jsx
@@ -0,0 +1,116 @@
+import UploadSystem from "@/core/components/UploadSystem";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_COMMERCIAL_CHIEF} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
+
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ confirm_img: null
+ },
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ if (values.description != "") formData.append("description", values.description);
+ if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+
+ requestServer(`${CONFIRM_COMMERCIAL_CHIEF}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("confirm_img", uploadedFile);
+ setShowAddIcon(false);
+ }
+ };
+
+ return(
+ <>
+
+
+
+
+ {t("ConfirmDialog.description")}{t("ConfirmDialog.optional")}>}
+ value={formik.values.description}
+ onChange={handleDescriptionChange}
+ fullWidth
+ variant="outlined"
+ sx={{mt: 1}}
+ />
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/commercial-chief/Form/ConfirmForm/index.jsx b/src/components/dashboard/commercial-chief/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/commercial-chief/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/commercial-chief/Form/RejectForm.jsx b/src/components/dashboard/commercial-chief/Form/RejectForm.jsx
deleted file mode 100644
index fd8becb..0000000
--- a/src/components/dashboard/commercial-chief/Form/RejectForm.jsx
+++ /dev/null
@@ -1,146 +0,0 @@
-import {REJECT_COMMERCIAL_CHIEF} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- reject_img: null
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- formData.append("description", values.description);
- if (values.reject_img != null) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_COMMERCIAL_CHIEF}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/commercial-chief/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/commercial-chief/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..98f3528
--- /dev/null
+++ b/src/components/dashboard/commercial-chief/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_COMMERCIAL_CHIEF} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_COMMERCIAL_CHIEF}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/commercial-chief/Form/RejectForm/index.jsx b/src/components/dashboard/commercial-chief/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/commercial-chief/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/commercial-chief/TableRowActions.jsx b/src/components/dashboard/commercial-chief/TableRowActions.jsx
index 601240f..498f1e4 100644
--- a/src/components/dashboard/commercial-chief/TableRowActions.jsx
+++ b/src/components/dashboard/commercial-chief/TableRowActions.jsx
@@ -1,17 +1,16 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate, fetchUrl}) => {
-
return (
-
-
diff --git a/src/components/dashboard/development-assistant/Form/ConfirmForm.jsx b/src/components/dashboard/development-assistant/Form/ConfirmForm.jsx
deleted file mode 100644
index 07b3253..0000000
--- a/src/components/dashboard/development-assistant/Form/ConfirmForm.jsx
+++ /dev/null
@@ -1,141 +0,0 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography
-} from "@mui/material";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
-import UploadSystem from "@/core/components/UploadSystem";
-import {useFormik} from "formik";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import {CONFIRM_DEVELOPMENT_ASSISTANT} from "@/core/data/apiRoutes";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Confirm = ({rowId, fetchUrl, mutate}) => {
- const t = useTranslations();
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const formik = useFormik({
- initialValues: {
- description: "",
- confirm_img: null
- },
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
- requestServer(`${CONFIRM_DEVELOPMENT_ASSISTANT}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
- const fileType = event.target?.files?.[0].type;
- const fileName = event.target?.files?.[0].name;
- setSelectedImage(URL.createObjectURL(uploadedFile));
- setfileType(fileType);
- setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/development-assistant/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/development-assistant/Form/ConfirmForm/ConfirmContent.jsx
new file mode 100644
index 0000000..b548620
--- /dev/null
+++ b/src/components/dashboard/development-assistant/Form/ConfirmForm/ConfirmContent.jsx
@@ -0,0 +1,116 @@
+import UploadSystem from "@/core/components/UploadSystem";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_DEVELOPMENT_ASSISTANT} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
+
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ confirm_img: null
+ },
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ if (values.description != "") formData.append("description", values.description);
+ if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+
+ requestServer(`${CONFIRM_DEVELOPMENT_ASSISTANT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("confirm_img", uploadedFile);
+ setShowAddIcon(false);
+ }
+ };
+
+ return(
+ <>
+
+
+
+
+ {t("ConfirmDialog.description")}{t("ConfirmDialog.optional")}>}
+ value={formik.values.description}
+ onChange={handleDescriptionChange}
+ fullWidth
+ variant="outlined"
+ sx={{mt: 1}}
+ />
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/development-assistant/Form/ConfirmForm/index.jsx b/src/components/dashboard/development-assistant/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/development-assistant/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/development-assistant/Form/RejectForm.jsx b/src/components/dashboard/development-assistant/Form/RejectForm.jsx
deleted file mode 100644
index eb4e4a1..0000000
--- a/src/components/dashboard/development-assistant/Form/RejectForm.jsx
+++ /dev/null
@@ -1,146 +0,0 @@
-import {REJECT_DEVELOPMENT_ASSISTANT} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- reject_img: null
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- formData.append("description", values.description);
- if (values.reject_img != null) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_DEVELOPMENT_ASSISTANT}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/development-assistant/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/development-assistant/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..2b33cb2
--- /dev/null
+++ b/src/components/dashboard/development-assistant/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_DEVELOPMENT_ASSISTANT} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_DEVELOPMENT_ASSISTANT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/development-assistant/Form/RejectForm/index.jsx b/src/components/dashboard/development-assistant/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/development-assistant/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/development-assistant/TableRowActions.jsx b/src/components/dashboard/development-assistant/TableRowActions.jsx
index 601240f..121d4e0 100644
--- a/src/components/dashboard/development-assistant/TableRowActions.jsx
+++ b/src/components/dashboard/development-assistant/TableRowActions.jsx
@@ -1,17 +1,17 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate, fetchUrl}) => {
return (
-
-
diff --git a/src/components/dashboard/expert-management/Form/ChangePassword/ChangePasswordContent.jsx b/src/components/dashboard/expert-management/Form/ChangePassword/ChangePasswordContent.jsx
index b1c708c..b0a9157 100644
--- a/src/components/dashboard/expert-management/Form/ChangePassword/ChangePasswordContent.jsx
+++ b/src/components/dashboard/expert-management/Form/ChangePassword/ChangePasswordContent.jsx
@@ -81,7 +81,7 @@ const ChnagePasswordContent = ({rowId, fetchUrl, mutate, setOpenChangePasswordDi
{t("ExpertMangement.button-cancel")}
diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent.jsx b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent.jsx
index dc9e62f..3757087 100644
--- a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent.jsx
+++ b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent.jsx
@@ -374,7 +374,7 @@ const CreateContent = ({setOpenCreateDialog, mutate, fetchUrl}) => {
{t("ExpertMangement.button-cancel")}
diff --git a/src/components/dashboard/expert-management/Form/UpdateForm/UpdateContent.jsx b/src/components/dashboard/expert-management/Form/UpdateForm/UpdateContent.jsx
index dc6864c..a53a7c6 100644
--- a/src/components/dashboard/expert-management/Form/UpdateForm/UpdateContent.jsx
+++ b/src/components/dashboard/expert-management/Form/UpdateForm/UpdateContent.jsx
@@ -332,7 +332,7 @@ const UpdateContent = ({row, fetchUrl, mutate, setOpenUpdateDialog}) => {
{t("ExpertMangement.button-cancel")}
diff --git a/src/components/dashboard/expert-management/index.jsx b/src/components/dashboard/expert-management/index.jsx
index 2c711c5..a69a550 100644
--- a/src/components/dashboard/expert-management/index.jsx
+++ b/src/components/dashboard/expert-management/index.jsx
@@ -138,6 +138,7 @@ function DashboardExpertManagementComponent() {
],
[]
);
+
return (
diff --git a/src/components/dashboard/inspector-expert/Form/ConfirmForm.jsx b/src/components/dashboard/inspector-expert/Form/ConfirmForm.jsx
deleted file mode 100644
index 409ba94..0000000
--- a/src/components/dashboard/inspector-expert/Form/ConfirmForm.jsx
+++ /dev/null
@@ -1,141 +0,0 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography
-} from "@mui/material";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
-import UploadSystem from "@/core/components/UploadSystem";
-import {useFormik} from "formik";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import {CONFIRM_INSPECTOR_EXPERT} from "@/core/data/apiRoutes";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Confirm = ({rowId, fetchUrl, mutate}) => {
- const t = useTranslations();
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const formik = useFormik({
- initialValues: {
- description: "",
- confirm_img: null
- },
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
- requestServer(`${CONFIRM_INSPECTOR_EXPERT}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
- const fileType = event.target?.files?.[0].type;
- const fileName = event.target?.files?.[0].name;
- setSelectedImage(URL.createObjectURL(uploadedFile));
- setfileType(fileType);
- setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/inspector-expert/Form/ConfirmForm/ConfirmContent.jsx
new file mode 100644
index 0000000..195bdda
--- /dev/null
+++ b/src/components/dashboard/inspector-expert/Form/ConfirmForm/ConfirmContent.jsx
@@ -0,0 +1,116 @@
+import UploadSystem from "@/core/components/UploadSystem";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_INSPECTOR_EXPERT} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
+
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ confirm_img: null
+ },
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ if (values.description != "") formData.append("description", values.description);
+ if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+
+ requestServer(`${CONFIRM_INSPECTOR_EXPERT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("confirm_img", uploadedFile);
+ setShowAddIcon(false);
+ }
+ };
+
+ return(
+ <>
+
+
+
+
+ {t("ConfirmDialog.description")}{t("ConfirmDialog.optional")}>}
+ value={formik.values.description}
+ onChange={handleDescriptionChange}
+ fullWidth
+ variant="outlined"
+ sx={{mt: 1}}
+ />
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/Form/ConfirmForm/index.jsx b/src/components/dashboard/inspector-expert/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/inspector-expert/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/Form/RejectForm.jsx b/src/components/dashboard/inspector-expert/Form/RejectForm.jsx
deleted file mode 100644
index f59758d..0000000
--- a/src/components/dashboard/inspector-expert/Form/RejectForm.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import {REJECT_INSPECTOR_EXPERT} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useDirection from "@/lib/app/hooks/useDirection";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- reject_img: null
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- formData.append("description", values.description);
- if (values.reject_img != null) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_INSPECTOR_EXPERT}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/inspector-expert/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..1055bab
--- /dev/null
+++ b/src/components/dashboard/inspector-expert/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_INSPECTOR_EXPERT} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_INSPECTOR_EXPERT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/Form/RejectForm/index.jsx b/src/components/dashboard/inspector-expert/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/inspector-expert/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/Form/ReviseForm.jsx b/src/components/dashboard/inspector-expert/Form/ReviseForm.jsx
deleted file mode 100644
index 92e1a1e..0000000
--- a/src/components/dashboard/inspector-expert/Form/ReviseForm.jsx
+++ /dev/null
@@ -1,104 +0,0 @@
-import {REVISE_INSPECTOR_EXPERT} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import useRequest from "@/lib/app/hooks/useRequest";
-import ReplyIcon from '@mui/icons-material/Reply';
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Revise = ({rowId, fetchUrl, mutate}) => {
- const t = useTranslations();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("ReviseDialog.description_error")),
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- formData.append("description", values.description);
-
- requestServer(`${REVISE_INSPECTOR_EXPERT}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
-
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Revise;
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/Form/ReviseForm/ReviseContent.jsx b/src/components/dashboard/inspector-expert/Form/ReviseForm/ReviseContent.jsx
new file mode 100644
index 0000000..0322572
--- /dev/null
+++ b/src/components/dashboard/inspector-expert/Form/ReviseForm/ReviseContent.jsx
@@ -0,0 +1,80 @@
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import * as Yup from "yup";
+import {REVISE_INSPECTOR_EXPERT} from "@/core/data/apiRoutes";
+
+const ReviseContent = ({rowId, fetchUrl, mutate, setOpenReviseDialog}) => {
+ const t = useTranslations();
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const validationSchema = Yup.object().shape({
+ description: Yup.string().required(t("ReviseDialog.description_error")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+
+ requestServer(`${REVISE_INSPECTOR_EXPERT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ return(
+ <>
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default ReviseContent
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/Form/ReviseForm/index.jsx b/src/components/dashboard/inspector-expert/Form/ReviseForm/index.jsx
new file mode 100644
index 0000000..32ed64a
--- /dev/null
+++ b/src/components/dashboard/inspector-expert/Form/ReviseForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ReplyIcon from '@mui/icons-material/Reply';
+import { useState } from "react";
+import ReviseContent from "./ReviseContent";
+
+const Revise = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openReviseDialog, setOpenReviseDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenReviseDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Revise;
\ No newline at end of file
diff --git a/src/components/dashboard/inspector-expert/TableRowActions.jsx b/src/components/dashboard/inspector-expert/TableRowActions.jsx
index f76c2d2..577ad28 100644
--- a/src/components/dashboard/inspector-expert/TableRowActions.jsx
+++ b/src/components/dashboard/inspector-expert/TableRowActions.jsx
@@ -1,23 +1,23 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
-import ReviseForm from "./Form/ReviseForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
+import Revise from "./Form/ReviseForm";
const TableRow = ({row, mutate, fetchUrl}) => {
return (
-
-
-
diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx
similarity index 53%
rename from src/components/dashboard/machinary-office/Form/ConfirmForm.jsx
rename to src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx
index 555c580..00d8c2f 100644
--- a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx
+++ b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx
@@ -1,57 +1,43 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography
-} from "@mui/material";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
import UploadSystem from "@/core/components/UploadSystem";
-import {useFormik} from "formik";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import {CONFIRM_MACHINARY_OFFICE} from "@/core/data/apiRoutes";
-import * as Yup from "yup";
-import useRequest from "@/lib/app/hooks/useRequest";
import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_MACHINARY_OFFICE} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
import PriceField from "@/core/components/PriceField";
+import * as Yup from "yup";
-
-const Confirm = ({rowId, fetchUrl, mutate}) => {
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
const t = useTranslations();
const [selectedImage, setSelectedImage] = useState("");
const [fileType, setfileType] = useState(null);
const [fileName, setfileName] = useState(null);
const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
const requestServer = useRequest({auth: true})
const {update_notification} = useNotification()
const validationSchema = Yup.object().shape({
proposed_amount: Yup.mixed().test(
"is-number",
- `${t("ConfirmDialog.approved_amount_number")}`,
+ `${t("ConfirmDialog.proposed_amount_number")}`,
(value) => !isNaN(value)
).test("positive", `${t("ConfirmDialog.proposed_amount_positive")}`, (value) => value >= 0)
.required(t("ConfirmDialog.proposed_amount_error"))
- })
+ });
+
const formik = useFormik({
initialValues: {
description: "",
proposed_amount: "",
confirm_img: null
- },
- validationSchema,
+ },validationSchema,
onSubmit: (values, {setSubmitting}) => {
const formData = new FormData();
formData.append("proposed_amount", values.proposed_amount);
- if (values.description != "") formData.append("expert_description", values.description);
+ if (values.description != "") formData.append("description", values.description);
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
requestServer(`${CONFIRM_MACHINARY_OFFICE}/${rowId}`, 'post', {
@@ -69,13 +55,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
const handleDescriptionChange = (event) => {
formik.setFieldValue("description", event.target.value)
};
- const handleAmountChange = (event) => {
- if (!isNaN(event.target.value)) {
- formik.setFieldValue("proposed_amount", event.target.value)
- } else {
- formik.setFieldValue("proposed_amount", formik.values.proposed_amount)
- }
- };
+
const handleUploadChange = (event) => {
const uploadedFile = event.target?.files?.[0];
if (uploadedFile) {
@@ -95,38 +75,33 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
setShowAddIcon(false);
}
};
- return (
+ const handleAmountChange = (event) => {
+ if (!isNaN(event.target.value)) {
+ formik.setFieldValue("proposed_amount", event.target.value)
+ } else {
+ formik.setFieldValue("proposed_amount", formik.values.proposed_amount)
+ }
+ };
+
+ return(
<>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
+
+
+
+
+
+
>
- );
-};
-export default Confirm;
\ No newline at end of file
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/Form/RejectForm.jsx b/src/components/dashboard/machinary-office/Form/RejectForm.jsx
deleted file mode 100644
index 61cec90..0000000
--- a/src/components/dashboard/machinary-office/Form/RejectForm.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import {REJECT_MACHINARY_OFFICE} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useDirection from "@/lib/app/hooks/useDirection";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- 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) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_MACHINARY_OFFICE}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/machinary-office/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..1055bab
--- /dev/null
+++ b/src/components/dashboard/machinary-office/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_INSPECTOR_EXPERT} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_INSPECTOR_EXPERT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/Form/RejectForm/index.jsx b/src/components/dashboard/machinary-office/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/machinary-office/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/TableRowActions.jsx b/src/components/dashboard/machinary-office/TableRowActions.jsx
index 601240f..121d4e0 100644
--- a/src/components/dashboard/machinary-office/TableRowActions.jsx
+++ b/src/components/dashboard/machinary-office/TableRowActions.jsx
@@ -1,17 +1,17 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate, fetchUrl}) => {
return (
-
- {
- const t = useTranslations();
- const {loan_state_navgan} = useLoanStateNavgan()
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("UpdateDialog.description_error")),
- next_state_id: Yup.number().required(t("UpdateDialog.next-state-id-error"))
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- next_state_id: ""
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- formData.append("expert_description", values.description);
- formData.append("next_state_id", values.next_state_id);
-
- requestServer(`${UPDATE_LOAN_MANAGEMENT_NAVGAN}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleNextStateIDChange = (event) => {
- formik.setFieldValue("next_state_id", event.target.value)
- };
-
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Update;
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-loan-management/Form/UpdateForm/UpdateContent.jsx b/src/components/dashboard/navgan-loan-management/Form/UpdateForm/UpdateContent.jsx
new file mode 100644
index 0000000..f3ee9c5
--- /dev/null
+++ b/src/components/dashboard/navgan-loan-management/Form/UpdateForm/UpdateContent.jsx
@@ -0,0 +1,113 @@
+import { UPDATE_LOAN_MANAGEMENT_NAVGAN } from "@/core/data/apiRoutes";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import useLoanStateNavgan from "@/lib/prefetchDataTable/hooks/useLoanStateNavgan";
+import { Button, DialogActions, DialogContent, FormControl, FormHelperText, InputLabel, MenuItem, Select, Stack, TextField } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import * as Yup from "yup";
+
+const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const {loan_state_navgan} = useLoanStateNavgan()
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const validationSchema = Yup.object().shape({
+ description: Yup.string().required(t("UpdateDialog.description_error")),
+ next_state_id: Yup.number().required(t("UpdateDialog.next-state-id-error"))
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ next_state_id: ""
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("expert_description", values.description);
+ formData.append("next_state_id", values.next_state_id);
+
+ requestServer(`${UPDATE_LOAN_MANAGEMENT_NAVGAN}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+ const handleNextStateIDChange = (event) => {
+ formik.setFieldValue("next_state_id", event.target.value)
+ };
+ return(
+ <>
+
+
+
+
+
+
+
+ {t("UpdateDialog.next-state-id")}
+
+
+ {formik.touched.next_state_id && formik.errors.next_state_id}
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default UpdateContent
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-loan-management/Form/UpdateForm/index.jsx b/src/components/dashboard/navgan-loan-management/Form/UpdateForm/index.jsx
new file mode 100644
index 0000000..66e7521
--- /dev/null
+++ b/src/components/dashboard/navgan-loan-management/Form/UpdateForm/index.jsx
@@ -0,0 +1,30 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ChangeCircleIcon from '@mui/icons-material/ChangeCircle';
+import { useState } from "react";
+import UpdateContent from "./UpdateContent";
+
+const Update = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return (
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+}
+export default Update
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-loan-management/index.jsx b/src/components/dashboard/navgan-loan-management/index.jsx
index 27cf5c0..3664ccb 100644
--- a/src/components/dashboard/navgan-loan-management/index.jsx
+++ b/src/components/dashboard/navgan-loan-management/index.jsx
@@ -134,6 +134,7 @@ function DashboardNavganLoanManagementComponent() {
],
[]
);
+
return (
diff --git a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm.jsx b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm.jsx
deleted file mode 100644
index a4d0c1a..0000000
--- a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm.jsx
+++ /dev/null
@@ -1,143 +0,0 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography
-} from "@mui/material";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
-import UploadSystem from "@/core/components/UploadSystem";
-import useDirection from "@/lib/app/hooks/useDirection";
-import {useFormik} from "formik";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import {CONFIRM_NAVGAN_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Confirm = ({rowId, fetchUrl, mutate}) => {
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const formik = useFormik({
- initialValues: {
- description: "",
- confirm_img: null
- },
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("expert_description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
- requestServer(`${CONFIRM_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
- const fileType = event.target?.files?.[0].type;
- const fileName = event.target?.files?.[0].name;
- setSelectedImage(URL.createObjectURL(uploadedFile));
- setfileType(fileType);
- setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx
new file mode 100644
index 0000000..cb67d3f
--- /dev/null
+++ b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx
@@ -0,0 +1,116 @@
+import UploadSystem from "@/core/components/UploadSystem";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_NAVGAN_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
+
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ confirm_img: null
+ },
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ if (values.description != "") formData.append("description", values.description);
+ if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+
+ requestServer(`${CONFIRM_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("confirm_img", uploadedFile);
+ setShowAddIcon(false);
+ }
+ };
+
+ return(
+ <>
+
+
+
+
+ {t("ConfirmDialog.description")}{t("ConfirmDialog.optional")}>}
+ value={formik.values.description}
+ onChange={handleDescriptionChange}
+ fullWidth
+ variant="outlined"
+ sx={{mt: 1}}
+ />
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/index.jsx b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-province-manager/Form/RejectForm.jsx b/src/components/dashboard/navgan-province-manager/Form/RejectForm.jsx
deleted file mode 100644
index 6f81b4a..0000000
--- a/src/components/dashboard/navgan-province-manager/Form/RejectForm.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import {REJECT_NAVGAN_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useDirection from "@/lib/app/hooks/useDirection";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- 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) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-province-manager/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/navgan-province-manager/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..dd420b2
--- /dev/null
+++ b/src/components/dashboard/navgan-province-manager/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_NAVGAN_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-province-manager/Form/RejectForm/index.jsx b/src/components/dashboard/navgan-province-manager/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/navgan-province-manager/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/navgan-province-manager/TableRowActions.jsx b/src/components/dashboard/navgan-province-manager/TableRowActions.jsx
index 601240f..121d4e0 100644
--- a/src/components/dashboard/navgan-province-manager/TableRowActions.jsx
+++ b/src/components/dashboard/navgan-province-manager/TableRowActions.jsx
@@ -1,17 +1,17 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate, fetchUrl}) => {
return (
-
-
diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx
similarity index 53%
rename from src/components/dashboard/passenger-boss/Form/ConfirmForm.jsx
rename to src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx
index 135b921..6c229e0 100644
--- a/src/components/dashboard/passenger-boss/Form/ConfirmForm.jsx
+++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx
@@ -1,37 +1,21 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography
-} from "@mui/material";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
import UploadSystem from "@/core/components/UploadSystem";
-import useDirection from "@/lib/app/hooks/useDirection";
-import {useFormik} from "formik";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import * as Yup from "yup";
-import useRequest from "@/lib/app/hooks/useRequest";
-import {CONFIRM_PASSENGER_BOSS} from "@/core/data/apiRoutes";
import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_PASSENGER_BOSS} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
import PriceField from "@/core/components/PriceField";
+import * as Yup from "yup";
-
-const Confirm = ({rowId, fetchUrl, mutate}) => {
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
const t = useTranslations();
- const {directionApp} = useDirection();
const [selectedImage, setSelectedImage] = useState("");
const [fileType, setfileType] = useState(null);
const [fileName, setfileName] = useState(null);
const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
const requestServer = useRequest({auth: true})
const {update_notification} = useNotification()
@@ -43,17 +27,17 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
).test("positive", `${t("ConfirmDialog.approved_amount_positive")}`, (value) => value >= 0)
.required(t("ConfirmDialog.approved_amount_error"))
});
+
const formik = useFormik({
initialValues: {
description: "",
approved_amount: "",
confirm_img: null
- },
- validationSchema,
+ },validationSchema,
onSubmit: (values, {setSubmitting}) => {
const formData = new FormData();
formData.append("approved_amount", values.approved_amount);
- if (values.description != "") formData.append("expert_description", values.description);
+ if (values.description != "") formData.append("description", values.description);
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post', {
@@ -71,13 +55,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
const handleDescriptionChange = (event) => {
formik.setFieldValue("description", event.target.value)
};
- const handleAmountChange = (event) => {
- if (!isNaN(event.target.value)) {
- formik.setFieldValue("approved_amount", event.target.value)
- } else {
- formik.setFieldValue("approved_amount", formik.values.approved_amount)
- }
- };
+
const handleUploadChange = (event) => {
const uploadedFile = event.target?.files?.[0];
if (uploadedFile) {
@@ -97,38 +75,33 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
setShowAddIcon(false);
}
};
- return (
+ const handleAmountChange = (event) => {
+ if (!isNaN(event.target.value)) {
+ formik.setFieldValue("approved_amount", event.target.value)
+ } else {
+ formik.setFieldValue("approved_amount", formik.values.approved_amount)
+ }
+ };
+
+ return(
<>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
+
+
+
+
+
+
>
- );
-};
-export default Confirm;
\ No newline at end of file
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/Form/RejectForm.jsx b/src/components/dashboard/passenger-boss/Form/RejectForm.jsx
deleted file mode 100644
index 3688ae7..0000000
--- a/src/components/dashboard/passenger-boss/Form/RejectForm.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import {REJECT_PASSENGER_BOSS} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useDirection from "@/lib/app/hooks/useDirection";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- 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) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_PASSENGER_BOSS}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/passenger-boss/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..3583903
--- /dev/null
+++ b/src/components/dashboard/passenger-boss/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_PASSENGER_BOSS} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_PASSENGER_BOSS}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/Form/RejectForm/index.jsx b/src/components/dashboard/passenger-boss/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/passenger-boss/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/TableRowActions.jsx b/src/components/dashboard/passenger-boss/TableRowActions.jsx
index 601240f..c22cf80 100644
--- a/src/components/dashboard/passenger-boss/TableRowActions.jsx
+++ b/src/components/dashboard/passenger-boss/TableRowActions.jsx
@@ -1,17 +1,18 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
import RejectForm from "./Form/RejectForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate, fetchUrl}) => {
return (
-
- {
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const formik = useFormik({
- initialValues: {
- description: "",
- confirm_img: null
- },
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("expert_description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
- requestServer(`${CONFIRM_PASSENGER_OFFICE}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
- const fileType = event.target?.files?.[0].type;
- const fileName = event.target?.files?.[0].name;
- setSelectedImage(URL.createObjectURL(uploadedFile));
- setfileType(fileType);
- setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-office/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/passenger-office/Form/ConfirmForm/ConfirmContent.jsx
new file mode 100644
index 0000000..09c5d4e
--- /dev/null
+++ b/src/components/dashboard/passenger-office/Form/ConfirmForm/ConfirmContent.jsx
@@ -0,0 +1,116 @@
+import UploadSystem from "@/core/components/UploadSystem";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_PASSENGER_OFFICE} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
+
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ confirm_img: null
+ },
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ if (values.description != "") formData.append("description", values.description);
+ if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+
+ requestServer(`${CONFIRM_PASSENGER_OFFICE}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("confirm_img", uploadedFile);
+ setShowAddIcon(false);
+ }
+ };
+
+ return(
+ <>
+
+
+
+
+ {t("ConfirmDialog.description")}{t("ConfirmDialog.optional")}>}
+ value={formik.values.description}
+ onChange={handleDescriptionChange}
+ fullWidth
+ variant="outlined"
+ sx={{mt: 1}}
+ />
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-office/Form/ConfirmForm/index.jsx b/src/components/dashboard/passenger-office/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/passenger-office/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-office/Form/RejectForm.jsx b/src/components/dashboard/passenger-office/Form/RejectForm.jsx
deleted file mode 100644
index b187a2b..0000000
--- a/src/components/dashboard/passenger-office/Form/RejectForm.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import {REJECT_PASSENGER_OFFICE} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useDirection from "@/lib/app/hooks/useDirection";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- 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) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_PASSENGER_OFFICE}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-office/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/passenger-office/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..cf4879e
--- /dev/null
+++ b/src/components/dashboard/passenger-office/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_PASSENGER_OFFICE} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_PASSENGER_OFFICE}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-office/Form/RejectForm/index.jsx b/src/components/dashboard/passenger-office/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/passenger-office/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-office/TableRowActions.jsx b/src/components/dashboard/passenger-office/TableRowActions.jsx
index 601240f..121d4e0 100644
--- a/src/components/dashboard/passenger-office/TableRowActions.jsx
+++ b/src/components/dashboard/passenger-office/TableRowActions.jsx
@@ -1,17 +1,17 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate, fetchUrl}) => {
return (
-
- {
- const t = useTranslations();
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const formik = useFormik({
- initialValues: {
- description: "",
- confirm_img: null
- },
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
- requestServer(`${CONFIRM_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
- const fileType = event.target?.files?.[0].type;
- const fileName = event.target?.files?.[0].name;
- setSelectedImage(URL.createObjectURL(uploadedFile));
- setfileType(fileType);
- setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/province-head-expert/Form/ConfirmForm/ConfirmContent.jsx
new file mode 100644
index 0000000..a095a89
--- /dev/null
+++ b/src/components/dashboard/province-head-expert/Form/ConfirmForm/ConfirmContent.jsx
@@ -0,0 +1,116 @@
+import UploadSystem from "@/core/components/UploadSystem";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_PROVINCE_HEAD_EXPERT} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
+
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ confirm_img: null
+ },
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ if (values.description != "") formData.append("description", values.description);
+ if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+
+ requestServer(`${CONFIRM_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("confirm_img", uploadedFile);
+ setShowAddIcon(false);
+ }
+ };
+
+ return(
+ <>
+
+
+
+
+ {t("ConfirmDialog.description")}{t("ConfirmDialog.optional")}>}
+ value={formik.values.description}
+ onChange={handleDescriptionChange}
+ fullWidth
+ variant="outlined"
+ sx={{mt: 1}}
+ />
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/Form/ConfirmForm/index.jsx b/src/components/dashboard/province-head-expert/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/province-head-expert/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/Form/RejectForm.jsx b/src/components/dashboard/province-head-expert/Form/RejectForm.jsx
deleted file mode 100644
index e41f95a..0000000
--- a/src/components/dashboard/province-head-expert/Form/RejectForm.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import {REJECT_PROVINCE_HEAD_EXPERT} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useDirection from "@/lib/app/hooks/useDirection";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- reject_img: null
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- formData.append("description", values.description);
- if (values.reject_img != null) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/province-head-expert/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..6bf7ed0
--- /dev/null
+++ b/src/components/dashboard/province-head-expert/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_PROVINCE_HEAD_EXPERT} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/Form/RejectForm/index.jsx b/src/components/dashboard/province-head-expert/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/province-head-expert/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/Form/ReviceForm.jsx b/src/components/dashboard/province-head-expert/Form/ReviceForm.jsx
deleted file mode 100644
index 864d607..0000000
--- a/src/components/dashboard/province-head-expert/Form/ReviceForm.jsx
+++ /dev/null
@@ -1,108 +0,0 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
-} from "@mui/material";
-import {useFormik} from "formik";
-import ReplyIcon from '@mui/icons-material/Reply';
-import {REVISE_PROVINCE_HEAD_EXPERT} from "@/core/data/apiRoutes";
-import useRequest from "@/lib/app/hooks/useRequest";
-import * as Yup from "yup";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Revise = ({rowId, fetchUrl, mutate}) => {
- const t = useTranslations();
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("description", values.description);
-
- requestServer(`${REVISE_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
-
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Revise;
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/Form/ReviseForm/ReviseContent.jsx b/src/components/dashboard/province-head-expert/Form/ReviseForm/ReviseContent.jsx
new file mode 100644
index 0000000..9775d24
--- /dev/null
+++ b/src/components/dashboard/province-head-expert/Form/ReviseForm/ReviseContent.jsx
@@ -0,0 +1,80 @@
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import * as Yup from "yup";
+import {REVISE_PROVINCE_HEAD_EXPERT} from "@/core/data/apiRoutes";
+
+const ReviseContent = ({rowId, fetchUrl, mutate, setOpenReviseDialog}) => {
+ const t = useTranslations();
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const validationSchema = Yup.object().shape({
+ description: Yup.string().required(t("ReviseDialog.description_error")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+
+ requestServer(`${REVISE_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ return(
+ <>
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default ReviseContent
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/Form/ReviseForm/index.jsx b/src/components/dashboard/province-head-expert/Form/ReviseForm/index.jsx
new file mode 100644
index 0000000..32ed64a
--- /dev/null
+++ b/src/components/dashboard/province-head-expert/Form/ReviseForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ReplyIcon from '@mui/icons-material/Reply';
+import { useState } from "react";
+import ReviseContent from "./ReviseContent";
+
+const Revise = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openReviseDialog, setOpenReviseDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenReviseDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Revise;
\ No newline at end of file
diff --git a/src/components/dashboard/province-head-expert/TableRowActions.jsx b/src/components/dashboard/province-head-expert/TableRowActions.jsx
index b92f311..2ae3d42 100644
--- a/src/components/dashboard/province-head-expert/TableRowActions.jsx
+++ b/src/components/dashboard/province-head-expert/TableRowActions.jsx
@@ -1,23 +1,23 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
-import ReviseForm from "@/components/dashboard/province-head-expert/Form/ReviceForm";
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
+import Revise from "./Form/ReviseForm";
const TableRowActions = ({row, mutate, fetchUrl}) => {
return (
-
-
- {
- const t = useTranslations();
- const {loan_state_refahi} = useLoanStateRefahi()
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("UpdateDialog.description_error")),
- next_state_id: Yup.number().required(t("UpdateDialog.next-state-id-error"))
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- next_state_id: ""
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- formData.append("description", values.description);
- formData.append("next_state_id", values.next_state_id);
-
- requestServer(`${UPDATE_LOAN_MANAGEMENT_REFAHI}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleNextStateIDChange = (event) => {
- formik.setFieldValue("next_state_id", event.target.value)
- };
-
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Update;
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-loan-management/Form/UpdateForm/UpdateContent.jsx b/src/components/dashboard/refahi-loan-management/Form/UpdateForm/UpdateContent.jsx
new file mode 100644
index 0000000..7dc79bf
--- /dev/null
+++ b/src/components/dashboard/refahi-loan-management/Form/UpdateForm/UpdateContent.jsx
@@ -0,0 +1,113 @@
+import {UPDATE_LOAN_MANAGEMENT_REFAHI} from "@/core/data/apiRoutes";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import useLoanStateRefahi from "@/lib/prefetchDataTable/hooks/useLoanStateRefahi";
+import { Button, DialogActions, DialogContent, FormControl, FormHelperText, InputLabel, MenuItem, Select, Stack, TextField } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import * as Yup from "yup";
+
+const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const {loan_state_refahi} = useLoanStateRefahi()
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const validationSchema = Yup.object().shape({
+ description: Yup.string().required(t("UpdateDialog.description_error")),
+ next_state_id: Yup.number().required(t("UpdateDialog.next-state-id-error"))
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ next_state_id: ""
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("expert_description", values.description);
+ formData.append("next_state_id", values.next_state_id);
+
+ requestServer(`${UPDATE_LOAN_MANAGEMENT_REFAHI}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+ const handleNextStateIDChange = (event) => {
+ formik.setFieldValue("next_state_id", event.target.value)
+ };
+ return(
+ <>
+
+
+
+
+
+
+
+ {t("UpdateDialog.next-state-id")}
+
+
+ {formik.touched.next_state_id && formik.errors.next_state_id}
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default UpdateContent
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-loan-management/Form/UpdateForm/index.jsx b/src/components/dashboard/refahi-loan-management/Form/UpdateForm/index.jsx
new file mode 100644
index 0000000..66e7521
--- /dev/null
+++ b/src/components/dashboard/refahi-loan-management/Form/UpdateForm/index.jsx
@@ -0,0 +1,30 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ChangeCircleIcon from '@mui/icons-material/ChangeCircle';
+import { useState } from "react";
+import UpdateContent from "./UpdateContent";
+
+const Update = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return (
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+}
+export default Update
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-loan-management/TableRowActions.jsx b/src/components/dashboard/refahi-loan-management/TableRowActions.jsx
index fd599f9..0604922 100644
--- a/src/components/dashboard/refahi-loan-management/TableRowActions.jsx
+++ b/src/components/dashboard/refahi-loan-management/TableRowActions.jsx
@@ -1,5 +1,5 @@
import {Box} from "@mui/material";
-import Update from "./Form/UpdateForm"
+import Update from "./Form/UpdateForm";
const TableRowActions = ({row, mutate, fetchUrl}) => {
diff --git a/src/components/dashboard/refahi-loan-management/index.jsx b/src/components/dashboard/refahi-loan-management/index.jsx
index 4ae7238..3125654 100644
--- a/src/components/dashboard/refahi-loan-management/index.jsx
+++ b/src/components/dashboard/refahi-loan-management/index.jsx
@@ -134,6 +134,7 @@ function DashboardRefahiLoanManagementComponent() {
],
[]
);
+
return (
diff --git a/src/components/dashboard/refahi-province-manager/Form/ConfirmForm.jsx b/src/components/dashboard/refahi-province-manager/Form/ConfirmForm.jsx
deleted file mode 100644
index f14421c..0000000
--- a/src/components/dashboard/refahi-province-manager/Form/ConfirmForm.jsx
+++ /dev/null
@@ -1,143 +0,0 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography
-} from "@mui/material";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
-import UploadSystem from "@/core/components/UploadSystem";
-import useDirection from "@/lib/app/hooks/useDirection";
-import {useFormik} from "formik";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useRequest from "@/lib/app/hooks/useRequest";
-import {CONFIRM_REFAHI_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Confirm = ({rowId, fetchUrl, mutate}) => {
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const formik = useFormik({
- initialValues: {
- description: "",
- confirm_img: null
- },
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
- requestServer(`${CONFIRM_REFAHI_PROVINCE_MANAGER}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
- const fileType = event.target?.files?.[0].type;
- const fileName = event.target?.files?.[0].name;
- setSelectedImage(URL.createObjectURL(uploadedFile));
- setfileType(fileType);
- setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-province-manager/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/refahi-province-manager/Form/ConfirmForm/ConfirmContent.jsx
new file mode 100644
index 0000000..78c8953
--- /dev/null
+++ b/src/components/dashboard/refahi-province-manager/Form/ConfirmForm/ConfirmContent.jsx
@@ -0,0 +1,116 @@
+import UploadSystem from "@/core/components/UploadSystem";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_REFAHI_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
+
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ confirm_img: null
+ },
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ if (values.description != "") formData.append("description", values.description);
+ if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+
+ requestServer(`${CONFIRM_REFAHI_PROVINCE_MANAGER}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("confirm_img", uploadedFile);
+ setShowAddIcon(false);
+ }
+ };
+
+ return(
+ <>
+
+
+
+
+ {t("ConfirmDialog.description")}{t("ConfirmDialog.optional")}>}
+ value={formik.values.description}
+ onChange={handleDescriptionChange}
+ fullWidth
+ variant="outlined"
+ sx={{mt: 1}}
+ />
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-province-manager/Form/ConfirmForm/index.jsx b/src/components/dashboard/refahi-province-manager/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/refahi-province-manager/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-province-manager/Form/RejectForm.jsx b/src/components/dashboard/refahi-province-manager/Form/RejectForm.jsx
deleted file mode 100644
index f253844..0000000
--- a/src/components/dashboard/refahi-province-manager/Form/RejectForm.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import {REJECT_REFAHI_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useDirection from "@/lib/app/hooks/useDirection";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- const formik = useFormik({
- initialValues: {
- description: "",
- reject_img: null
- },
- validationSchema,
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- formData.append("description", values.description);
- if (values.reject_img != null) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_REFAHI_PROVINCE_MANAGER}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-province-manager/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/refahi-province-manager/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..5eaf16e
--- /dev/null
+++ b/src/components/dashboard/refahi-province-manager/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_REFAHI_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_REFAHI_PROVINCE_MANAGER}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-province-manager/Form/RejectForm/index.jsx b/src/components/dashboard/refahi-province-manager/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/refahi-province-manager/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/refahi-province-manager/TableRowActions.jsx b/src/components/dashboard/refahi-province-manager/TableRowActions.jsx
index 601240f..121d4e0 100644
--- a/src/components/dashboard/refahi-province-manager/TableRowActions.jsx
+++ b/src/components/dashboard/refahi-province-manager/TableRowActions.jsx
@@ -1,17 +1,17 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate, fetchUrl}) => {
return (
-
-
diff --git a/src/components/dashboard/role-management/Form/CreateForm/CreateContent.jsx b/src/components/dashboard/role-management/Form/CreateForm/CreateContent.jsx
index a7f5f37..b223bdc 100644
--- a/src/components/dashboard/role-management/Form/CreateForm/CreateContent.jsx
+++ b/src/components/dashboard/role-management/Form/CreateForm/CreateContent.jsx
@@ -57,7 +57,7 @@ const CreateContent = ({mutate, fetchUrl, setOpenConfirmDialog}) => {
<>
-
+
{
{t("AddDialog.button-cancel")}
diff --git a/src/components/dashboard/role-management/Form/UpdateForm.jsx b/src/components/dashboard/role-management/Form/UpdateForm/UpdateContent.jsx
similarity index 81%
rename from src/components/dashboard/role-management/Form/UpdateForm.jsx
rename to src/components/dashboard/role-management/Form/UpdateForm/UpdateContent.jsx
index 7fd4459..a52f6b8 100644
--- a/src/components/dashboard/role-management/Form/UpdateForm.jsx
+++ b/src/components/dashboard/role-management/Form/UpdateForm/UpdateContent.jsx
@@ -1,33 +1,14 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Checkbox,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- FormControl,
- FormControlLabel,
- FormHelperText,
- FormLabel,
- Grid,
- IconButton,
- Stack,
- TextField,
- Tooltip
-} from "@mui/material";
-import {useFormik} from "formik";
-import EditIcon from '@mui/icons-material/Edit';
-import {UPDATE_ROLE_MANAGEMENT} from "@/core/data/apiRoutes";
-import useRequest from "@/lib/app/hooks/useRequest";
+import { UPDATE_ROLE_MANAGEMENT } from "@/core/data/apiRoutes";
import useNotification from "@/lib/app/hooks/useNotification";
-import * as Yup from "yup";
import usePermissions from "@/lib/app/hooks/usePermissions";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, Checkbox, DialogActions, DialogContent, FormControl, FormControlLabel, FormHelperText, FormLabel, Grid, Stack, TextField } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import * as Yup from "yup";
-const UpdateForm = ({row, fetchUrl, mutate}) => {
+const UpdateContent = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
const t = useTranslations();
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
const requestServer = useRequest({auth: true})
const {update_notification} = useNotification()
const {permissions_list} = usePermissions()
@@ -62,24 +43,11 @@ const UpdateForm = ({row, fetchUrl, mutate}) => {
});
},
});
-
- return (<>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >);
-};
-export default UpdateForm;
\ No newline at end of file
+ >
+ )
+}
+export default UpdateContent
\ No newline at end of file
diff --git a/src/components/dashboard/role-management/Form/UpdateForm/index.jsx b/src/components/dashboard/role-management/Form/UpdateForm/index.jsx
new file mode 100644
index 0000000..2654f0e
--- /dev/null
+++ b/src/components/dashboard/role-management/Form/UpdateForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import EditIcon from '@mui/icons-material/Edit';
+import UpdateContent from "./UpdateContent";
+
+const Update = ({row, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+
+ return (
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+}
+export default Update
\ No newline at end of file
diff --git a/src/components/dashboard/role-management/TableRowActions.jsx b/src/components/dashboard/role-management/TableRowActions.jsx
index 5b0f031..8eb5a35 100644
--- a/src/components/dashboard/role-management/TableRowActions.jsx
+++ b/src/components/dashboard/role-management/TableRowActions.jsx
@@ -1,12 +1,12 @@
import {Box} from "@mui/material";
import DeleteForm from "./Form/DeleteForm"
-import UpdateForm from "./Form/UpdateForm"
+import Update from "./Form/UpdateForm";
const TableRowActions = ({row, mutate, fetchUrl}) => {
return (
- {
- const t = useTranslations();
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const formik = useFormik({
- initialValues: {
- description: "",
- confirm_img: null
- },
- onSubmit: (values, {setSubmitting}) => {
- const formData = new FormData();
- if (values.description != "") formData.append("expert_description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
- requestServer(`${CONFIRM_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value)
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
- const fileType = event.target?.files?.[0].type;
- const fileName = event.target?.files?.[0].name;
- setSelectedImage(URL.createObjectURL(uploadedFile));
- setfileType(fileType);
- setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >
- );
-};
-export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
new file mode 100644
index 0000000..c5533ee
--- /dev/null
+++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
@@ -0,0 +1,116 @@
+import UploadSystem from "@/core/components/UploadSystem";
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
+import {CONFIRM_TRANSPORTATION_ASSISTANCE} from "@/core/data/apiRoutes";
+import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
+import { useState } from "react";
+
+const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
+ const t = useTranslations();
+ const [selectedImage, setSelectedImage] = useState("");
+ const [fileType, setfileType] = useState(null);
+ const [fileName, setfileName] = useState(null);
+ const [showAddIcon, setShowAddIcon] = useState(true);
+ const requestServer = useRequest({auth: true})
+ const {update_notification} = useNotification()
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ confirm_img: null
+ },
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ if (values.description != "") formData.append("description", values.description);
+ if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+
+ requestServer(`${CONFIRM_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value)
+ };
+
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+
+ const fileType = event.target?.files?.[0].type;
+ const fileName = event.target?.files?.[0].name;
+ setSelectedImage(URL.createObjectURL(uploadedFile));
+ setfileType(fileType);
+ setfileName(fileName);
+ formik.setFieldValue("confirm_img", uploadedFile);
+ setShowAddIcon(false);
+ }
+ };
+
+ return(
+ <>
+
+
+
+
+ {t("ConfirmDialog.description")}{t("ConfirmDialog.optional")}>}
+ value={formik.values.description}
+ onChange={handleDescriptionChange}
+ fullWidth
+ variant="outlined"
+ sx={{mt: 1}}
+ />
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+
+}
+export default ConfirmContent
\ No newline at end of file
diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/index.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/index.jsx
new file mode 100644
index 0000000..3683d82
--- /dev/null
+++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/index.jsx
@@ -0,0 +1,31 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { useTranslations } from "next-intl";
+import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
+import { useState } from "react";
+import ConfirmContent from "./ConfirmContent";
+
+const Confirm = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return(
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+
+}
+export default Confirm;
\ No newline at end of file
diff --git a/src/components/dashboard/transportation-assistance/Form/RejectForm.jsx b/src/components/dashboard/transportation-assistance/Form/RejectForm.jsx
deleted file mode 100644
index d7a41df..0000000
--- a/src/components/dashboard/transportation-assistance/Form/RejectForm.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import {REJECT_TRANSPORTATION_ASSISTANCE} from "@/core/data/apiRoutes";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- IconButton,
- Stack,
- TextField,
- Tooltip,
- Typography,
-} from "@mui/material";
-import {useTranslations} from "next-intl";
-import {useFormik} from "formik";
-import * as Yup from "yup";
-import {useState} from "react";
-import UploadSystem from "@/core/components/UploadSystem";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
-import useDirection from "@/lib/app/hooks/useDirection";
-import ThumbDownIcon from "@mui/icons-material/ThumbDown";
-import useRequest from "@/lib/app/hooks/useRequest";
-import useNotification from "@/lib/app/hooks/useNotification";
-
-
-const Reject = ({rowId, fetchUrl, mutate}) => {
- const [selectedImage, setSelectedImage] = useState("");
- const [fileType, setfileType] = useState(null);
- const [fileName, setfileName] = useState(null);
- const [showAddIcon, setShowAddIcon] = useState(true);
- const t = useTranslations();
- const {directionApp} = useDirection();
- const [openRejectDialog, setOpenRejectDialog] = useState(false);
- const requestServer = useRequest({auth: true})
- const {update_notification} = useNotification()
-
- const validationSchema = Yup.object().shape({
- description: Yup.string().required(t("RejectDialog.description_error")),
- });
-
- 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) formData.append("attachment", values.reject_img);
-
- requestServer(`${REJECT_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
- data: formData,
- }).then((response) => {
- mutate(fetchUrl)
- update_notification()
- }).catch(() => {
- }).finally(() => {
- setSubmitting(false);
- });
- },
- });
-
- const handleDescriptionChange = (event) => {
- formik.setFieldValue("description", event.target.value);
- formik.handleChange(event);
- };
- const handleUploadChange = (event) => {
- const uploadedFile = event.target?.files?.[0];
- if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
- 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);
- setShowAddIcon(false);
- }
- };
- return (
- <>
-
- setOpenRejectDialog(true)}>
-
-
-
-
- >
- );
-};
-export default Reject;
\ No newline at end of file
diff --git a/src/components/dashboard/transportation-assistance/Form/RejectForm/RejectContent.jsx b/src/components/dashboard/transportation-assistance/Form/RejectForm/RejectContent.jsx
new file mode 100644
index 0000000..3ce51e9
--- /dev/null
+++ b/src/components/dashboard/transportation-assistance/Form/RejectForm/RejectContent.jsx
@@ -0,0 +1,122 @@
+import UploadSystem from "@/core/components/UploadSystem"
+import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, 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_TRANSPORTATION_ASSISTANCE} from "@/core/data/apiRoutes";
+
+const RejectContent = ({rowId, fetchUrl, 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")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ reject_img: null
+ },
+ validationSchema,
+ onSubmit: (values, {setSubmitting}) => {
+ const formData = new FormData();
+ formData.append("description", values.description);
+ if (values.reject_img != null) formData.append("attachment", values.reject_img);
+
+ requestServer(`${REJECT_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
+ data: formData,
+ }).then((response) => {
+ mutate(fetchUrl)
+ update_notification()
+ }).catch(() => {
+ }).finally(() => {
+ setSubmitting(false);
+ });
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ formik.setFieldValue("description", event.target.value);
+ formik.handleChange(event);
+ };
+ const handleUploadChange = (event) => {
+ const uploadedFile = event.target?.files?.[0];
+ if (uploadedFile) {
+ const maxFileSize = 2 * 1024 * 1024;
+ if (uploadedFile.size > maxFileSize) {
+ UploadFileNotification(t);
+ event.target.value = "";
+ return;
+ }
+ 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);
+ setShowAddIcon(false);
+ }
+ };
+ return(
+ <>
+
+
+
+
+
+
+ {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default RejectContent
\ No newline at end of file
diff --git a/src/components/dashboard/transportation-assistance/Form/RejectForm/index.jsx b/src/components/dashboard/transportation-assistance/Form/RejectForm/index.jsx
new file mode 100644
index 0000000..678a842
--- /dev/null
+++ b/src/components/dashboard/transportation-assistance/Form/RejectForm/index.jsx
@@ -0,0 +1,25 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import RejectContent from "./RejectContent";
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+
+const Reject = ({rowId, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+
+ >
+ )
+}
+export default Reject
\ No newline at end of file
diff --git a/src/components/dashboard/transportation-assistance/TableRowActions.jsx b/src/components/dashboard/transportation-assistance/TableRowActions.jsx
index 601240f..121d4e0 100644
--- a/src/components/dashboard/transportation-assistance/TableRowActions.jsx
+++ b/src/components/dashboard/transportation-assistance/TableRowActions.jsx
@@ -1,17 +1,17 @@
import {Box} from "@mui/material";
-import ConfirmForm from "./Form/ConfirmForm"
-import RejectForm from "./Form/RejectForm"
+import Confirm from "./Form/ConfirmForm";
+import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate, fetchUrl}) => {
return (
-
- {
{t("AddDialog.button-cancel")}
diff --git a/src/components/dashboard/user-management/Form/UpdateForm.jsx b/src/components/dashboard/user-management/Form/UpdateForm/UpdateContent.jsx
similarity index 83%
rename from src/components/dashboard/user-management/Form/UpdateForm.jsx
rename to src/components/dashboard/user-management/Form/UpdateForm/UpdateContent.jsx
index 77e495f..01db763 100644
--- a/src/components/dashboard/user-management/Form/UpdateForm.jsx
+++ b/src/components/dashboard/user-management/Form/UpdateForm/UpdateContent.jsx
@@ -1,37 +1,19 @@
-import {useTranslations} from "next-intl";
-import {useState} from "react";
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogTitle,
- FormControl,
- FormHelperText,
- IconButton,
- InputLabel,
- MenuItem,
- Select,
- Stack,
- TextField,
- Tooltip
-} from "@mui/material";
-import {useFormik} from "formik";
-import EditIcon from '@mui/icons-material/Edit';
-import {UPDATE_USER_MANAGEMENT} from "@/core/data/apiRoutes";
-import useRequest from "@/lib/app/hooks/useRequest";
+import { UPDATE_USER_MANAGEMENT } from "@/core/data/apiRoutes";
import useNotification from "@/lib/app/hooks/useNotification";
+import useRequest from "@/lib/app/hooks/useRequest";
+import { Button, DialogActions, DialogContent, FormControl, FormHelperText, InputLabel, MenuItem, Select, Stack, TextField } from "@mui/material"
+import { useFormik } from "formik";
+import { useTranslations } from "next-intl";
import * as Yup from "yup";
-const UpdateForm = ({row, fetchUrl, mutate}) => {
+const UpdateContent = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
const t = useTranslations();
- const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
const requestServer = useRequest({auth: true})
const {update_notification} = useNotification()
const validationSchema = Yup.object().shape({
phone_number: Yup.mixed().test("is-number", `${t("AddDialog.phone_number_number")}`, (value) => !isNaN(value)).test("positive", `${t("AddDialog.phone_number_positive")}`, (value) => value >= 0)
- .test("max", `${t("AddDialog.phone_number_max")}`, (value) => value.length <= 11)
+ .test("max", `${t("AddDialog.phone_number_max")}`, (value) => value.length == 11)
.required(t("AddDialog.phone_number_error")),
national_id: Yup.mixed().test("is-number", `${t("AddDialog.national_id_number")}`, (value) => !isNaN(value)).test("positive", `${t("AddDialog.national_id_positive")}`, (value) => value >= 0)
.test("max", `${t("AddDialog.national_id_max")}`, (value) => value.length <= 10)
@@ -49,7 +31,7 @@ const UpdateForm = ({row, fetchUrl, mutate}) => {
phone_number: row.getValue("phone_number"),
national_id: row.getValue("national_id"),
type_id: row.original.type_id,
- navgan_id: row.getValue("navgan_id"),
+ navgan_id:row.original.type_id === 1 ? row.getValue("navgan_id") : '',
}, validationSchema, onSubmit: (values, {setSubmitting}) => {
const formData = new FormData();
formData.append("phone_number", values.phone_number);
@@ -67,21 +49,8 @@ const UpdateForm = ({row, fetchUrl, mutate}) => {
});
},
});
-
- return (<>
-
- {
- setOpenConfirmDialog(true)
- }}
- >
-
-
-
-
- >);
-};
-export default UpdateForm;
\ No newline at end of file
+ >
+ )
+}
+export default UpdateContent
\ No newline at end of file
diff --git a/src/components/dashboard/user-management/Form/UpdateForm/index.jsx b/src/components/dashboard/user-management/Form/UpdateForm/index.jsx
new file mode 100644
index 0000000..93f89f8
--- /dev/null
+++ b/src/components/dashboard/user-management/Form/UpdateForm/index.jsx
@@ -0,0 +1,30 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
+import EditIcon from '@mui/icons-material/Edit';
+import { useTranslations } from "next-intl";
+import { useState } from "react";
+import UpdateContent from "./UpdateContent";
+
+const Update = ({row, fetchUrl, mutate}) => {
+ const t = useTranslations();
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return (
+ <>
+
+ {
+ setOpenConfirmDialog(true)
+ }}
+ >
+
+
+
+
+ >
+ )
+}
+export default Update
\ No newline at end of file
diff --git a/src/components/dashboard/user-management/TableRowActions.jsx b/src/components/dashboard/user-management/TableRowActions.jsx
index 5b0f031..8eb5a35 100644
--- a/src/components/dashboard/user-management/TableRowActions.jsx
+++ b/src/components/dashboard/user-management/TableRowActions.jsx
@@ -1,12 +1,12 @@
import {Box} from "@mui/material";
import DeleteForm from "./Form/DeleteForm"
-import UpdateForm from "./Form/UpdateForm"
+import Update from "./Form/UpdateForm";
const TableRowActions = ({row, mutate, fetchUrl}) => {
return (
- {
fullWidth
size="medium"
endIcon={}
- disabled={props.isSubmitting}
+ disabled={props.isSubmitting || !props.dirty || !props.isValid}
>
{t("LoginPage.button_submit")}