LFFE-2 Merge branch 'feature/LFFE-2_update_table_component' into 'develop'
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
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 {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";
|
||||
import {useState} from "react";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -30,8 +30,9 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_COMMERCIAL_CHIEF}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
update_notification()
|
||||
mutate()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
@@ -63,7 +64,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_COMMERCIAL_CHIEF}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -2,17 +2,15 @@ import {Box} from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
const TableRow = ({row, mutate}) => {
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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";
|
||||
import {useState} from "react";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -30,7 +30,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_DEVELOPMENT_ASSISTANT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -63,7 +64,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_DEVELOPMENT_ASSISTANT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -2,18 +2,16 @@ import {Box} from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -8,7 +8,7 @@ import {useState} from "react";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
|
||||
|
||||
const ChnagePasswordContent = ({rowId, fetchUrl, mutate, setOpenChangePasswordDialog}) => {
|
||||
const ChnagePasswordContent = ({rowId, mutate, setOpenChangePasswordDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest();
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
@@ -40,7 +40,8 @@ const ChnagePasswordContent = ({rowId, fetchUrl, mutate, setOpenChangePasswordDi
|
||||
data: formData
|
||||
})
|
||||
.then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenChangePasswordDialog(false)
|
||||
mutate()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -5,7 +5,7 @@ import {useState} from "react";
|
||||
import ChangePasswordContent from "./ChangePasswordContent";
|
||||
|
||||
|
||||
const ChangePassword = ({rowId, fetchUrl, mutate}) => {
|
||||
const ChangePassword = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openChnagePasswordDialog, setOpenChangePasswordDialog] = useState(false);
|
||||
|
||||
@@ -24,7 +24,7 @@ const ChangePassword = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth maxWidth={'xs'} open={openChnagePasswordDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ExpertMangement.change_password")}</DialogTitle>
|
||||
<ChangePasswordContent rowId={rowId} mutate={mutate} fetchUrl={fetchUrl}
|
||||
<ChangePasswordContent rowId={rowId} mutate={mutate}
|
||||
setOpenChangePasswordDialog={setOpenChangePasswordDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
|
||||
@@ -25,7 +25,7 @@ import useProvince from "@/lib/app/hooks/useProvince";
|
||||
import useRole from "@/lib/app/hooks/useRole";
|
||||
import {Visibility, VisibilityOff} from "@mui/icons-material";
|
||||
|
||||
const CreateContent = ({setOpenCreateDialog, mutate, fetchUrl}) => {
|
||||
const CreateContent = ({setOpenCreateDialog, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest()
|
||||
const [cityList, setCityList] = useState([]);
|
||||
@@ -105,8 +105,8 @@ const CreateContent = ({setOpenCreateDialog, mutate, fetchUrl}) => {
|
||||
|
||||
requestServer(`${CREATE_EXPERT_MANAGEMENT}`, 'post', {auth: true, data: formData})
|
||||
.then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenCreateDialog(false)
|
||||
mutate()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -4,7 +4,7 @@ import DataSaverOnIcon from "@mui/icons-material/DataSaverOn";
|
||||
import {useState} from "react";
|
||||
import CreateContent from "./CreateContent";
|
||||
|
||||
const Create = ({mutate, fetchUrl}) => {
|
||||
const Create = ({mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openCreateDialog, setOpenCreateDialog] = useState(false);
|
||||
|
||||
@@ -30,7 +30,7 @@ const Create = ({mutate, fetchUrl}) => {
|
||||
TransitionProps={{unmountOnExit: true}}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ExpertMangement.create")}</DialogTitle>
|
||||
<CreateContent setOpenCreateDialog={setOpenCreateDialog} mutate={mutate} fetchUrl={fetchUrl}/>
|
||||
<CreateContent setOpenCreateDialog={setOpenCreateDialog} mutate={mutate}/>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@ import {DELETE_EXPERT_MANAGEMENT} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {useTranslations} from "next-intl";
|
||||
|
||||
const Delete = ({rowId, fetchUrl, mutate}) => {
|
||||
const Delete = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true});
|
||||
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
||||
@@ -24,7 +24,7 @@ const Delete = ({rowId, fetchUrl, mutate}) => {
|
||||
setIsSubmitting(true)
|
||||
requestServer(`${DELETE_EXPERT_MANAGEMENT}/${rowId}`, 'post')
|
||||
.then((response) => {
|
||||
mutate(fetchUrl)
|
||||
mutate()
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useProvince from "@/lib/app/hooks/useProvince";
|
||||
import useRole from "@/lib/app/hooks/useRole";
|
||||
|
||||
const UpdateContent = ({row, fetchUrl, mutate, setOpenUpdateDialog}) => {
|
||||
const UpdateContent = ({row, mutate, setOpenUpdateDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest();
|
||||
const [cityList, setCityList] = useState([]);
|
||||
@@ -89,7 +89,8 @@ const UpdateContent = ({row, fetchUrl, mutate, setOpenUpdateDialog}) => {
|
||||
|
||||
requestServer(`${UPDATE_EXPERT_MANAGEMENT}/${row.original.id}`, 'post', {auth: true, data: formData})
|
||||
.then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenUpdateDialog(false);
|
||||
mutate()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -5,7 +5,7 @@ import {useState} from "react";
|
||||
import UpdateContent from "./UpdateContent";
|
||||
|
||||
|
||||
const Update = ({row, fetchUrl, mutate}) => {
|
||||
const Update = ({row, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openUpdateDialog, setOpenUpdateDialog] = useState(false);
|
||||
|
||||
@@ -24,7 +24,7 @@ const Update = ({row, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth maxWidth={'lg'} open={openUpdateDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ExpertMangement.update")}</DialogTitle>
|
||||
<UpdateContent row={row} mutate={mutate} fetchUrl={fetchUrl} setOpenUpdateDialog={setOpenUpdateDialog}/>
|
||||
<UpdateContent row={row} mutate={mutate} setOpenUpdateDialog={setOpenUpdateDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -3,23 +3,20 @@ import Update from "./Form/UpdateForm"
|
||||
import Delete from "./Form/DeleteForm";
|
||||
import ChangePassword from "./Form/ChangePassword";
|
||||
|
||||
const TableRowActions = ({row, mutate, fetchUrl}) => {
|
||||
const TableRowActions = ({row, mutate}) => {
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Update
|
||||
row={row}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<ChangePassword
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Delete
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
|
||||
</Box>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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";
|
||||
import {useState} from "react";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -30,7 +30,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_INSPECTOR_EXPERT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -63,7 +64,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_INSPECTOR_EXPERT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
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 {Button, DialogActions, DialogContent, Stack, TextField} 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 ReviseContent = ({rowId, mutate, setOpenReviseDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
@@ -27,7 +27,8 @@ const ReviseContent = ({rowId, fetchUrl, mutate, setOpenReviseDialog}) => {
|
||||
requestServer(`${REVISE_INSPECTOR_EXPERT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenReviseDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -40,7 +41,7 @@ const ReviseContent = ({rowId, fetchUrl, mutate, setOpenReviseDialog}) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
formik.handleChange(event);
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ReviseContent from "./ReviseContent";
|
||||
|
||||
const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
const Revise = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openReviseDialog, setOpenReviseDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReviseDialog.revise")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openReviseDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ReviseDialog.revise")}</DialogTitle>
|
||||
<ReviseContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenReviseDialog={setOpenReviseDialog} />
|
||||
<ReviseContent mutate={mutate} rowId={rowId} setOpenReviseDialog={setOpenReviseDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -3,23 +3,20 @@ import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
import Revise from "./Form/ReviseForm";
|
||||
|
||||
const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
<Revise
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
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 {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 {useState} from "react";
|
||||
import PriceField from "@/core/components/PriceField";
|
||||
import * as Yup from "yup";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -33,7 +33,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
description: "",
|
||||
proposed_amount: "",
|
||||
confirm_img: null
|
||||
},validationSchema,
|
||||
}, validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("proposed_amount", values.proposed_amount);
|
||||
@@ -43,7 +43,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_MACHINARY_OFFICE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -83,7 +84,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
@@ -102,31 +103,31 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<PriceField
|
||||
name="proposed_amount"
|
||||
label={<>
|
||||
<span>{t("ConfirmDialog.proposed_amount")}</span><small>{t("ConfirmDialog.unit")}</small></>}
|
||||
type="text"
|
||||
inputProps={{
|
||||
inputMode: "number",
|
||||
min: 0,
|
||||
pattern: "[0-9]*",
|
||||
}}
|
||||
variant="outlined"
|
||||
value={formik.values.proposed_amount}
|
||||
onChange={handleAmountChange}
|
||||
onBlur={formik.handleBlur("proposed_amount")}
|
||||
error={
|
||||
formik.touched.proposed_amount &&
|
||||
Boolean(formik.errors.proposed_amount)
|
||||
}
|
||||
helperText={
|
||||
formik.touched.proposed_amount && formik.errors.proposed_amount
|
||||
}
|
||||
sx={{mt: 1}}
|
||||
fullWidth
|
||||
/>
|
||||
</Stack>
|
||||
<PriceField
|
||||
name="proposed_amount"
|
||||
label={<>
|
||||
<span>{t("ConfirmDialog.proposed_amount")}</span><small>{t("ConfirmDialog.unit")}</small></>}
|
||||
type="text"
|
||||
inputProps={{
|
||||
inputMode: "number",
|
||||
min: 0,
|
||||
pattern: "[0-9]*",
|
||||
}}
|
||||
variant="outlined"
|
||||
value={formik.values.proposed_amount}
|
||||
onChange={handleAmountChange}
|
||||
onBlur={formik.handleBlur("proposed_amount")}
|
||||
error={
|
||||
formik.touched.proposed_amount &&
|
||||
Boolean(formik.errors.proposed_amount)
|
||||
}
|
||||
helperText={
|
||||
formik.touched.proposed_amount && formik.errors.proposed_amount
|
||||
}
|
||||
sx={{mt: 1}}
|
||||
fullWidth
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>{t("UploadSystem.upload_file")}{t("UploadSystem.optional")}</Typography>
|
||||
<UploadSystem
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_INSPECTOR_EXPERT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -2,18 +2,16 @@ import {Box} from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
import { UPDATE_LOAN_MANAGEMENT_NAVGAN } from "@/core/data/apiRoutes";
|
||||
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 {
|
||||
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 UpdateContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const {loan_state_navgan} = useLoanStateNavgan()
|
||||
const requestServer = useRequest({auth: true})
|
||||
@@ -32,7 +43,8 @@ const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${UPDATE_LOAN_MANAGEMENT_NAVGAN}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -47,7 +59,7 @@ const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const handleNextStateIDChange = (event) => {
|
||||
formik.setFieldValue("next_state_id", event.target.value)
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import UpdateContent from "./UpdateContent";
|
||||
|
||||
const Update = ({rowId, fetchUrl, mutate}) => {
|
||||
const Update = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return (
|
||||
@@ -22,7 +22,7 @@ const Update = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("UpdateDialog.update")}</DialogTitle>
|
||||
<UpdateContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<UpdateContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import {Box} from "@mui/material";
|
||||
import Update from "./Form/UpdateForm"
|
||||
|
||||
const TableRowActions = ({row, mutate, fetchUrl}) => {
|
||||
const TableRowActions = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Update
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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";
|
||||
import {useState} from "react";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -30,7 +30,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -63,7 +64,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -2,18 +2,16 @@ import {Box} from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
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 {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 {useState} from "react";
|
||||
import PriceField from "@/core/components/PriceField";
|
||||
import * as Yup from "yup";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -33,7 +33,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
description: "",
|
||||
approved_amount: "",
|
||||
confirm_img: null
|
||||
},validationSchema,
|
||||
}, validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("approved_amount", values.approved_amount);
|
||||
@@ -43,7 +43,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -83,7 +84,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
@@ -102,31 +103,31 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<PriceField
|
||||
name="approved_amount"
|
||||
label={<>
|
||||
<span>{t("ConfirmDialog.approved_amount")}</span><small>{t("ConfirmDialog.unit")}</small></>}
|
||||
type="text"
|
||||
inputProps={{
|
||||
inputMode: "number",
|
||||
min: 0,
|
||||
pattern: "[0-9]*",
|
||||
}}
|
||||
variant="outlined"
|
||||
value={formik.values.approved_amount}
|
||||
onChange={handleAmountChange}
|
||||
onBlur={formik.handleBlur("approved_amount")}
|
||||
error={
|
||||
formik.touched.approved_amount &&
|
||||
Boolean(formik.errors.approved_amount)
|
||||
}
|
||||
helperText={
|
||||
formik.touched.approved_amount && formik.errors.approved_amount
|
||||
}
|
||||
sx={{mt: 1}}
|
||||
fullWidth
|
||||
/>
|
||||
</Stack>
|
||||
<PriceField
|
||||
name="approved_amount"
|
||||
label={<>
|
||||
<span>{t("ConfirmDialog.approved_amount")}</span><small>{t("ConfirmDialog.unit")}</small></>}
|
||||
type="text"
|
||||
inputProps={{
|
||||
inputMode: "number",
|
||||
min: 0,
|
||||
pattern: "[0-9]*",
|
||||
}}
|
||||
variant="outlined"
|
||||
value={formik.values.approved_amount}
|
||||
onChange={handleAmountChange}
|
||||
onBlur={formik.handleBlur("approved_amount")}
|
||||
error={
|
||||
formik.touched.approved_amount &&
|
||||
Boolean(formik.errors.approved_amount)
|
||||
}
|
||||
helperText={
|
||||
formik.touched.approved_amount && formik.errors.approved_amount
|
||||
}
|
||||
sx={{mt: 1}}
|
||||
fullWidth
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>{t("UploadSystem.upload_file")}{t("UploadSystem.optional")}</Typography>
|
||||
<UploadSystem
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_PASSENGER_BOSS}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
import {Box} from "@mui/material";
|
||||
import RejectForm from "./Form/RejectForm"
|
||||
import Reject from "./Form/RejectForm"
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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";
|
||||
import {useState} from "react";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -30,7 +30,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_PASSENGER_OFFICE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -63,7 +64,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_PASSENGER_OFFICE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -9,11 +9,9 @@ const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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";
|
||||
import {useState} from "react";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -30,7 +30,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -63,7 +64,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
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 {Button, DialogActions, DialogContent, Stack, TextField} 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 ReviseContent = ({rowId, mutate, setOpenReviseDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
@@ -27,7 +27,8 @@ const ReviseContent = ({rowId, fetchUrl, mutate, setOpenReviseDialog}) => {
|
||||
requestServer(`${REVISE_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenReviseDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -40,7 +41,7 @@ const ReviseContent = ({rowId, fetchUrl, mutate, setOpenReviseDialog}) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
formik.handleChange(event);
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ReviseContent from "./ReviseContent";
|
||||
|
||||
const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
const Revise = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openReviseDialog, setOpenReviseDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReviseDialog.revise")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openReviseDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ReviseDialog.revise")}</DialogTitle>
|
||||
<ReviseContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenReviseDialog={setOpenReviseDialog} />
|
||||
<ReviseContent mutate={mutate} rowId={rowId} setOpenReviseDialog={setOpenReviseDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -3,23 +3,20 @@ import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
import Revise from "./Form/ReviseForm";
|
||||
|
||||
const TableRowActions = ({row, mutate, fetchUrl}) => {
|
||||
const TableRowActions = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
<Revise
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -2,12 +2,23 @@ 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 {
|
||||
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 UpdateContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const {loan_state_refahi} = useLoanStateRefahi()
|
||||
const requestServer = useRequest({auth: true})
|
||||
@@ -32,7 +43,8 @@ const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${UPDATE_LOAN_MANAGEMENT_REFAHI}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -47,7 +59,7 @@ const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const handleNextStateIDChange = (event) => {
|
||||
formik.setFieldValue("next_state_id", event.target.value)
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
@@ -84,7 +96,7 @@ const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
onChange={handleNextStateIDChange}
|
||||
onBlur={formik.handleBlur("next_state_id")}
|
||||
>
|
||||
{loan_state_refahi ? (loan_state_refahi.map((item) => {
|
||||
{loan_state_refahi ? (loan_state_refahi.map((item) => {
|
||||
return (
|
||||
<MenuItem key={item.id} value={item.id}>{item.name}</MenuItem>
|
||||
)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import UpdateContent from "./UpdateContent";
|
||||
|
||||
const Update = ({rowId, fetchUrl, mutate}) => {
|
||||
const Update = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return (
|
||||
@@ -22,7 +22,7 @@ const Update = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("UpdateDialog.update")}</DialogTitle>
|
||||
<UpdateContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<UpdateContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import {Box} from "@mui/material";
|
||||
import Update from "./Form/UpdateForm";
|
||||
|
||||
const TableRowActions = ({row, mutate, fetchUrl}) => {
|
||||
const TableRowActions = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Update
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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";
|
||||
import {useState} from "react";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -30,7 +30,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_REFAHI_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -63,7 +64,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_REFAHI_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -2,18 +2,16 @@ import {Box} from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -18,7 +18,7 @@ import {useFormik} from "formik";
|
||||
import {ADD_ROLE_MANAGEMENT} from "@/core/data/apiRoutes";
|
||||
import usePermissions from "@/lib/app/hooks/usePermissions";
|
||||
|
||||
const CreateContent = ({mutate, fetchUrl, setOpenConfirmDialog}) => {
|
||||
const CreateContent = ({mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {permissions_list} = usePermissions()
|
||||
@@ -44,7 +44,7 @@ const CreateContent = ({mutate, fetchUrl, setOpenConfirmDialog}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate(fetchUrl)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -57,7 +57,7 @@ const CreateContent = ({mutate, fetchUrl, setOpenConfirmDialog}) => {
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack direction="row" spacing={2} sx={{mt : 1}}>
|
||||
<Stack direction="row" spacing={2} sx={{mt: 1}}>
|
||||
<TextField
|
||||
name="name"
|
||||
label={t("AddDialog.name")}
|
||||
|
||||
@@ -4,7 +4,7 @@ import {useTranslations} from "next-intl";
|
||||
import {useState} from "react";
|
||||
import CreateContent from "./CreateContent";
|
||||
|
||||
const CreateForm = ({mutate, fetchUrl}) => {
|
||||
const CreateForm = ({mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
|
||||
@@ -27,7 +27,7 @@ const CreateForm = ({mutate, fetchUrl}) => {
|
||||
<Dialog maxWidth={"md"} open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("AddDialog.add")}</DialogTitle>
|
||||
<CreateContent mutate={mutate} fetchUrl={fetchUrl} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
<CreateContent mutate={mutate} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</Stack>
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import {DELETE_ROLE_MANAGEMENT} from "@/core/data/apiRoutes";
|
||||
|
||||
const DeleteForm = ({rowId, fetchUrl, mutate}) => {
|
||||
const DeleteForm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
@@ -24,7 +24,7 @@ const DeleteForm = ({rowId, fetchUrl, mutate}) => {
|
||||
const handleSubmit = () => {
|
||||
setIsSubmitting(true)
|
||||
requestServer(`${DELETE_ROLE_MANAGEMENT}/${rowId}`, 'delete').then((response) => {
|
||||
mutate(fetchUrl)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
import { UPDATE_ROLE_MANAGEMENT } from "@/core/data/apiRoutes";
|
||||
import {UPDATE_ROLE_MANAGEMENT} from "@/core/data/apiRoutes";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
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 {
|
||||
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 UpdateContent = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const UpdateContent = ({row, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
@@ -35,7 +47,8 @@ const UpdateContent = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${UPDATE_ROLE_MANAGEMENT}/${row.getValue("id")}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -43,11 +56,11 @@ const UpdateContent = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
});
|
||||
},
|
||||
});
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack direction="row" spacing={2} sx={{mt : 1}}>
|
||||
<Stack direction="row" spacing={2} sx={{mt: 1}}>
|
||||
<TextField
|
||||
name="name"
|
||||
label={t("UpdateDialog.name")}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Update = ({row, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("UpdateDialog.update-tooltip")}>
|
||||
@@ -23,7 +23,7 @@ const Update = ({row, fetchUrl, mutate}) => {
|
||||
<Dialog maxWidth={"md"} open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("UpdateDialog.update")}</DialogTitle>
|
||||
<UpdateContent row={row} fetchUrl={fetchUrl} mutate={mutate} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<UpdateContent row={row} mutate={mutate} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -2,18 +2,16 @@ import {Box} from "@mui/material";
|
||||
import DeleteForm from "./Form/DeleteForm"
|
||||
import Update from "./Form/UpdateForm";
|
||||
|
||||
const TableRowActions = ({row, mutate, fetchUrl}) => {
|
||||
const TableRowActions = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Update
|
||||
row={row}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<DeleteForm
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {useTranslations} from "next-intl";
|
||||
import CreateForm from "./Form/CreateForm/index";
|
||||
|
||||
function TableToolbar({mutate, fetchUrl}) {
|
||||
function TableToolbar({mutate}) {
|
||||
const t = useTranslations();
|
||||
|
||||
return <CreateForm mutate={mutate} fetchUrl={fetchUrl}/>
|
||||
return <CreateForm mutate={mutate}/>
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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";
|
||||
import {useState} from "react";
|
||||
|
||||
const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
@@ -30,7 +30,8 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${CONFIRM_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -63,7 +64,7 @@ const ConfirmContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 {useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const Confirm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
@@ -22,7 +22,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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 {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 RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
@@ -35,7 +35,8 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
requestServer(`${REJECT_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenRejectDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -66,7 +67,7 @@ const RejectContent = ({rowId, fetchUrl, mutate, setOpenRejectDialog}) => {
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
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 Reject = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openRejectDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("RejectDialog.reject")}</DialogTitle>
|
||||
<RejectContent mutate={mutate} fetchUrl={fetchUrl} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog} />
|
||||
<RejectContent mutate={mutate} rowId={rowId} setOpenRejectDialog={setOpenRejectDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -2,18 +2,16 @@ import {Box} from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({row, mutate, fetchUrl}) => {
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<Reject
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -16,7 +16,7 @@ import * as Yup from "yup";
|
||||
import {useFormik} from "formik";
|
||||
import {ADD_USER_MANAGEMENT} from "@/core/data/apiRoutes";
|
||||
|
||||
const CreateContent = ({mutate, fetchUrl, setOpenConfirmDialog}) => {
|
||||
const CreateContent = ({mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const validationSchema = Yup.object().shape({
|
||||
@@ -51,7 +51,7 @@ const CreateContent = ({mutate, fetchUrl, setOpenConfirmDialog}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate(fetchUrl)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {useTranslations} from "next-intl";
|
||||
import {useState} from "react";
|
||||
import CreateContent from "@/components/dashboard/user-management/Form/CreateForm/CreateContent";
|
||||
|
||||
const CreateForm = ({mutate, fetchUrl}) => {
|
||||
const CreateForm = ({mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
|
||||
@@ -27,7 +27,7 @@ const CreateForm = ({mutate, fetchUrl}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("AddDialog.add")}</DialogTitle>
|
||||
<CreateContent mutate={mutate} fetchUrl={fetchUrl} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
<CreateContent mutate={mutate} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</Stack>
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ import {DELETE_USER_MANAGEMENT} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
const DeleteForm = ({rowId, fetchUrl, mutate}) => {
|
||||
const DeleteForm = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
@@ -24,7 +24,7 @@ const DeleteForm = ({rowId, fetchUrl, mutate}) => {
|
||||
const handleSubmit = () => {
|
||||
setIsSubmitting(true)
|
||||
requestServer(`${DELETE_USER_MANAGEMENT}/${rowId}`, 'delete').then((response) => {
|
||||
mutate(fetchUrl)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
import { UPDATE_USER_MANAGEMENT } from "@/core/data/apiRoutes";
|
||||
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 {
|
||||
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 = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const UpdateContent = ({row, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
@@ -31,7 +42,7 @@ const UpdateContent = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
phone_number: row.getValue("phone_number"),
|
||||
national_id: row.getValue("national_id"),
|
||||
type_id: row.original.type_id,
|
||||
navgan_id:row.original.type_id === 1 ? 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);
|
||||
@@ -41,7 +52,8 @@ const UpdateContent = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${UPDATE_USER_MANAGEMENT}/${row.getValue("id")}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -49,7 +61,7 @@ const UpdateContent = ({row, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
});
|
||||
},
|
||||
});
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material"
|
||||
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 {useTranslations} from "next-intl";
|
||||
import {useState} from "react";
|
||||
import UpdateContent from "./UpdateContent";
|
||||
|
||||
const Update = ({row, fetchUrl, mutate}) => {
|
||||
const Update = ({row, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return (
|
||||
@@ -22,9 +22,9 @@ const Update = ({row, fetchUrl, mutate}) => {
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("UpdateDialog.update")}</DialogTitle>
|
||||
<UpdateContent row={row} fetchUrl={fetchUrl} mutate={mutate} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
<UpdateContent row={row} mutate={mutate} setOpenConfirmDialog={setOpenConfirmDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
)
|
||||
}
|
||||
export default Update
|
||||
@@ -2,18 +2,16 @@ import {Box} from "@mui/material";
|
||||
import DeleteForm from "./Form/DeleteForm"
|
||||
import Update from "./Form/UpdateForm";
|
||||
|
||||
const TableRowActions = ({row, mutate, fetchUrl}) => {
|
||||
const TableRowActions = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<Update
|
||||
row={row}
|
||||
mutate={mutate}
|
||||
fetchUrl={fetchUrl}
|
||||
/>
|
||||
<DeleteForm
|
||||
rowId={row.getValue("id")}
|
||||
fetchUrl={fetchUrl}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {useTranslations} from "next-intl";
|
||||
import CreateForm from "@/components/dashboard/user-management/Form/CreateForm";
|
||||
|
||||
function TableToolbar({mutate, fetchUrl}) {
|
||||
function TableToolbar({mutate}) {
|
||||
const t = useTranslations();
|
||||
|
||||
return <CreateForm mutate={mutate} fetchUrl={fetchUrl}/>
|
||||
return <CreateForm mutate={mutate}/>
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,15 +9,6 @@ import useRequest from "@/lib/app/hooks/useRequest";
|
||||
|
||||
function DataTable(props) {
|
||||
const requestServer = useRequest({auth: true})
|
||||
const fetcher = (...args) => {
|
||||
return requestServer(args, 'get', {
|
||||
pending: false, success: {notification: {show: false}}
|
||||
}).then((response) => {
|
||||
setRowCount(response.data.meta.totalRowCount);
|
||||
return response.data.data;
|
||||
}).catch(() => {
|
||||
})
|
||||
};
|
||||
const t = useTranslations();
|
||||
const {languageApp, languageList} = useLanguage();
|
||||
const [columnFilters, setColumnFilters] = useState([]);
|
||||
@@ -36,7 +27,9 @@ function DataTable(props) {
|
||||
return output;
|
||||
});
|
||||
|
||||
const [updateTime, setupdateTime] = useState(moment().format("HH:mm | jYYYY/jM/jD"));
|
||||
const [updateTime, setUpdateTime] = useState(
|
||||
moment().format("HH:mm | jYYYY/jMM/jDD")
|
||||
);
|
||||
|
||||
const tableLocalization = useMemo(() => languageList.find((item) => item.key == languageApp).tableLocalization, [languageApp, languageList]);
|
||||
|
||||
@@ -60,17 +53,26 @@ function DataTable(props) {
|
||||
return url;
|
||||
}, [props.tableUrl, columnFilters, columnFilterFns, pagination, sorting, props.columns,]);
|
||||
|
||||
const {data, isValidating, mutate} = useSWR(fetchUrl, fetcher, {
|
||||
revalidateIfStale: false, revalidateOnFocus: false, revalidateOnReconnect: false
|
||||
});
|
||||
const {data, isValidating, mutate} = useSWR(fetchUrl, (...args) =>
|
||||
requestServer(args, 'get', {
|
||||
pending: false,
|
||||
success: {notification: {show: false}}
|
||||
}).then((response) => response.data).catch(() => {
|
||||
})
|
||||
, {
|
||||
revalidateIfStale: false,
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: true,
|
||||
keepPreviousData: true
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setupdateTime(moment().format("HH:mm | jYYYY/jM/jD"));
|
||||
setUpdateTime(moment().format("HH:mm | jYYYY/jMM/jDD"));
|
||||
}, [isValidating, languageApp]);
|
||||
|
||||
return (<MaterialReactTable
|
||||
localization={tableLocalization}
|
||||
data={data ?? []}
|
||||
data={data?.data ?? []}
|
||||
manualFiltering
|
||||
manualPagination
|
||||
manualSorting
|
||||
@@ -83,21 +85,25 @@ function DataTable(props) {
|
||||
enableColumnResizing={props.enableColumnResizing}
|
||||
muiTableHeadCellProps={{
|
||||
sx: {
|
||||
color: "primary.main", borderLeft: "1px solid #e1e1e1", "&:first-of-type": {
|
||||
color: "primary.main",
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset"
|
||||
}, "& .Mui-TableHeadCell-Content": {justifyContent: "space-between"},
|
||||
},
|
||||
"& .Mui-TableHeadCell-Content": {justifyContent: "space-between"},
|
||||
},
|
||||
}}
|
||||
muiTableBodyCellProps={{
|
||||
sx: {
|
||||
borderLeft: "1px solid #e1e1e1", "&:first-of-type": {
|
||||
borderLeft: "1px solid #e1e1e1",
|
||||
"&:first-of-type": {
|
||||
borderLeft: "unset"
|
||||
}
|
||||
},
|
||||
}}
|
||||
enableColumnFilterModes
|
||||
muiTablePaperProps={{elevation: 0}}
|
||||
rowCount={rowCount}
|
||||
rowCount={data?.meta?.totalRowCount ?? 0}
|
||||
onColumnFilterFnsChange={setColumnFilterFns}
|
||||
onColumnFiltersChange={setColumnFilters}
|
||||
onPaginationChange={setPagination}
|
||||
@@ -105,8 +111,8 @@ function DataTable(props) {
|
||||
positionToolbarAlertBanner="bottom"
|
||||
renderTopToolbarCustomActions={({table}) => (<>
|
||||
{props.enableCustomToolbar /* send condition */ ?
|
||||
<props.CustomToolbar fetchUrl={fetchUrl}
|
||||
mutate={mutate}/> /* send component */ : <span></span>}
|
||||
<props.CustomToolbar
|
||||
mutate={mutate}/> /* send component */ : <span></span>}
|
||||
</>)}
|
||||
renderBottomToolbarCustomActions={({table}) => (<>
|
||||
{props.enableLastUpdate /* send condition */ ? (<Typography
|
||||
@@ -123,11 +129,15 @@ function DataTable(props) {
|
||||
</Typography>) : ("")}
|
||||
</>)}
|
||||
state={{
|
||||
isLoading: isValidating, columnFilters, columnFilterFns, pagination, sorting,
|
||||
showProgressBars: isValidating,
|
||||
columnFilters,
|
||||
columnFilterFns,
|
||||
pagination,
|
||||
sorting,
|
||||
}}
|
||||
positionActionsColumn={"last"}
|
||||
enableRowActions={props.enableRowActions}
|
||||
renderRowActions={({row}) => <props.TableRowAction fetchUrl={fetchUrl} mutate={mutate} row={row}/>}
|
||||
renderRowActions={({row}) => <props.TableRowAction mutate={mutate} row={row}/>}
|
||||
{...props}
|
||||
/>);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user