sideBar notification
This commit is contained in:
@@ -18,6 +18,8 @@ import {useFormik} from "formik";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import {CONFIRM_COMMERCIAL_CHIEF} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -27,6 +29,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
@@ -42,6 +45,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -19,6 +19,8 @@ import UploadSystem from "@/core/components/UploadSystem";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -28,6 +30,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -48,6 +51,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -18,6 +18,8 @@ import {useFormik} from "formik";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import {CONFIRM_DEVELOPMENT_ASSISTANT} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -27,6 +29,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
@@ -42,6 +45,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -19,6 +19,8 @@ import UploadSystem from "@/core/components/UploadSystem";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -28,6 +30,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -48,6 +51,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -18,6 +18,8 @@ import {useFormik} from "formik";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import {CONFIRM_INSPECTOR_EXPERT} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -27,6 +29,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
@@ -42,6 +45,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -30,6 +32,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -50,6 +53,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -16,11 +16,14 @@ import * as Yup from "yup";
|
||||
import {useState} from "react";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import EditIcon from "@mui/icons-material/Edit";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("ReviseDialog.description_error")),
|
||||
@@ -39,6 +42,7 @@ const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import {CONFIRM_MACHINARY_OFFICE} from "@/core/data/apiRoutes";
|
||||
import * as Yup from "yup";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -30,6 +32,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
proposed_amount: Yup.number().positive(t("ConfirmDialog.proposed_amount_positive")).required(t("ConfirmDialog.proposed_amount_error")),
|
||||
@@ -51,6 +54,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -30,6 +32,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -50,6 +53,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -19,6 +19,8 @@ import {useFormik} from "formik";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import {CONFIRM_NAVGAN_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -29,6 +31,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
@@ -44,6 +47,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -30,6 +32,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -50,6 +53,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import * as Yup from "yup";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {CONFIRM_PASSENGER_BOSS} from "@/core/data/apiRoutes";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -30,6 +32,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
approved_amount: Yup.number().positive(t("ConfirmDialog.approved_amount_positive")).required(t("ConfirmDialog.approved_amount_error"))
|
||||
@@ -51,6 +54,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -30,6 +32,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -50,6 +53,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -19,6 +19,7 @@ import {useFormik} from "formik";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {CONFIRM_PASSENGER_OFFICE} from "@/core/data/apiRoutes";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -29,6 +30,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
@@ -44,6 +46,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -30,6 +32,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -50,6 +53,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -18,6 +18,8 @@ import {useFormik} from "formik";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import {CONFIRM_PROVINCE_HEAD_EXPERT} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -27,6 +29,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
@@ -42,6 +45,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -30,6 +32,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -50,6 +53,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -16,11 +16,14 @@ import {useFormik} from "formik";
|
||||
import {REVISE_PROVINCE_HEAD_EXPERT} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import * as Yup from "yup";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -39,6 +42,7 @@ const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -19,6 +19,8 @@ import {useFormik} from "formik";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {CONFIRM_REFAHI_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -29,6 +31,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
@@ -44,6 +47,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -30,6 +32,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -50,6 +53,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -19,6 +19,8 @@ import {useFormik} from "formik";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import {CONFIRM_TRANSPORTATION_ASSISTANCE} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
@@ -29,6 +31,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
@@ -44,6 +47,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -20,6 +20,8 @@ import UploadFileNotification from "@/core/components/notifications/UploadFileNo
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
|
||||
|
||||
const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
@@ -30,6 +32,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const [openRejectDialog, setOpenRejectDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
@@ -50,6 +53,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -23,87 +23,97 @@ const sidebarMenu = [
|
||||
{
|
||||
key: "sidebar.passenger-office-chief",
|
||||
secondary: "secondary.passenger-office",
|
||||
name: "passenger_office_chief",
|
||||
type: "page",
|
||||
route: "/dashboard/passenger-office-chief",
|
||||
icon: <AirlineSeatReclineNormalIcon/>,
|
||||
selected: false,
|
||||
permission: "passenger_office_chief",
|
||||
permission: "manage_passenger_office_navgan",
|
||||
},
|
||||
{
|
||||
key: "sidebar.machinery-expert",
|
||||
name: "machinery_expert",
|
||||
type: "page",
|
||||
route: "/dashboard/machinery-expert",
|
||||
icon: <DirectionsCarFilledIcon/>,
|
||||
selected: false,
|
||||
permission: "machinery_expert",
|
||||
permission: "manage_machinery_navgan",
|
||||
},
|
||||
{
|
||||
key: "sidebar.passenger-boss",
|
||||
secondary: "secondary.passenger-boss",
|
||||
name: "province_manager_navgan",
|
||||
type: "page",
|
||||
route: "/dashboard/passenger-boss",
|
||||
icon: <AssignmentIndIcon/>,
|
||||
selected: false,
|
||||
permission: "passenger_office_chief",
|
||||
permission: "manage_province_working_group_navgan",
|
||||
},
|
||||
|
||||
{
|
||||
key: "sidebar.transportation-assistant",
|
||||
name: "transportation_assistant",
|
||||
type: "page",
|
||||
route: "/dashboard/transportation-assistant",
|
||||
icon: <DirectionsRailwayIcon/>,
|
||||
selected: false,
|
||||
permission: "transportation_assistant",
|
||||
permission: "manage_transportation_navgan",
|
||||
},
|
||||
{
|
||||
key: "sidebar.navgan-province-manager",
|
||||
secondary: "secondary.navgan-province-manager",
|
||||
name: "province_manager_navgan",
|
||||
type: "page",
|
||||
route: "/dashboard/navgan-province-manager",
|
||||
icon: <DesktopWindowsIcon/>,
|
||||
selected: false,
|
||||
permission: "province_manager",
|
||||
permission: "manage_province_affairs_navgan",
|
||||
},
|
||||
{
|
||||
key: "sidebar.province-head-expert",
|
||||
name: "province_head_expert",
|
||||
type: "page",
|
||||
route: "/dashboard/province-head-expert",
|
||||
icon: <GavelIcon/>,
|
||||
selected: false,
|
||||
permission: "province_head_expert",
|
||||
permission: "manage_province_headquarter_refahi",
|
||||
},
|
||||
{
|
||||
key: "sidebar.inspector-expert",
|
||||
name: "inspector_expert",
|
||||
type: "page",
|
||||
route: "/dashboard/inspector-expert",
|
||||
icon: <GradingIcon/>,
|
||||
selected: false,
|
||||
permission: "inspector_expert",
|
||||
permission: "manage_inspector_refahi",
|
||||
},
|
||||
{
|
||||
key: "sidebar.commercial-chief",
|
||||
name: "commercial_chief",
|
||||
type: "page",
|
||||
route: "/dashboard/commercial-chief",
|
||||
icon: <BusinessCenterIcon/>,
|
||||
selected: false,
|
||||
permission: "commercial_chief",
|
||||
permission: "manage_commercial_refahi",
|
||||
},
|
||||
{
|
||||
key: "sidebar.development-assistant",
|
||||
name: "development_assistant",
|
||||
type: "page",
|
||||
route: "/dashboard/development-assistant",
|
||||
icon: <Diversity3Icon/>,
|
||||
selected: false,
|
||||
permission: "development_assistant",
|
||||
permission: "manage_development_refahi",
|
||||
},
|
||||
{
|
||||
key: "sidebar.refahi-province-manager",
|
||||
secondary: "secondary.refahi-province-manager",
|
||||
name: "province_manager_refahi",
|
||||
type: "page",
|
||||
route: "/dashboard/refahi-province-manager",
|
||||
icon: <SupervisedUserCircleIcon/>,
|
||||
selected: false,
|
||||
permission: "province_manager",
|
||||
permission: "manage_province_affairs_refahi",
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function SidebarList({handleDrawerToggle}) {
|
||||
}, [router.pathname]);
|
||||
|
||||
const filteredItemMenu = itemMenu[0].filter(
|
||||
(item) => user.role.includes(item.permission) || item.permission === "all"
|
||||
(item) => user.permissions.includes(item.permission) || item.permission === "all"
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -17,7 +17,7 @@ const SidebarListItem = ({item, dispatch, handleDrawerToggle}) => {
|
||||
<ListItem disablePadding secondaryAction={
|
||||
<IconButton>
|
||||
<Badge
|
||||
badgeContent={item.permission}
|
||||
badgeContent={notification_count ? notification_count[item.name] : 0}
|
||||
color="error"
|
||||
variant="standard"
|
||||
anchorOrigin={{
|
||||
|
||||
@@ -16,11 +16,11 @@ const useNotification = () => {
|
||||
})
|
||||
};
|
||||
|
||||
const {data} = useSWR(GET_SIDEBAR_NOTIFICATION, fetcher)
|
||||
const {data, mutate} = useSWR(GET_SIDEBAR_NOTIFICATION, fetcher)
|
||||
const notification_count = data
|
||||
//swr config
|
||||
|
||||
|
||||
// render data
|
||||
return {notification_count}
|
||||
return {notification_count, update_notification: mutate}
|
||||
}
|
||||
export default useNotification
|
||||
@@ -9,7 +9,7 @@ const RolePermissionMiddleware = ({children, requiredPermissions}) => {
|
||||
const t = useTranslations();
|
||||
|
||||
const hasPermission = requiredPermissions.some((permission) =>
|
||||
user?.role?.includes(permission)
|
||||
user?.permissions?.includes(permission)
|
||||
);
|
||||
|
||||
if (!hasPermission) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
import DashboardCommercialChiefComponent from "@/components/dashboard/commercial-chief";
|
||||
|
||||
const requiredPermissions = ["commercial_chief"];
|
||||
const requiredPermissions = ["manage_commercial_refahi"];
|
||||
export default function CommercialChief() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
import DashboardDevelopmentAssistantComponent from "@/components/dashboard/development-assistant";
|
||||
|
||||
const requiredPermissions = ["development_assistant"];
|
||||
const requiredPermissions = ["manage_development_refahi"];
|
||||
export default function DevelopmentAssistant() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
import DashboardInspectorExpertComponent from "@/components/dashboard/inspector-expert";
|
||||
|
||||
const requiredPermissions = ["inspector_expert"];
|
||||
const requiredPermissions = ["manage_inspector_refahi"];
|
||||
export default function InspectorExpert() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import RolePermissionMiddleware from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["machinery_expert"];
|
||||
const requiredPermissions = ["manage_machinery_navgan"];
|
||||
export default function PassengerOffice() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import RolePermissionMiddleware from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["province_manager"];
|
||||
const requiredPermissions = ["manage_province_affairs_navgan"];
|
||||
export default function PassengerOffice() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import RolePermissionMiddleware from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["passenger_office_chief"];
|
||||
const requiredPermissions = ["manage_working_group_navgan"];
|
||||
export default function PassengerBoss() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import RolePermissionMiddleware from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["passenger_office_chief"];
|
||||
const requiredPermissions = ["manage_passenger_office_navgan"];
|
||||
export default function PassengerOffice() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
import DashboardProvinceHeadExpertComponent from "@/components/dashboard/province-head-expert";
|
||||
|
||||
const requiredPermissions = ["province_head_expert"];
|
||||
const requiredPermissions = ["manage_province_headquarter_refahi"];
|
||||
export default function ProvinceHeadExpertOffice() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
import DashboardRefahiProvinceManagerComponent from "@/components/dashboard/refahi-province-manager";
|
||||
|
||||
const requiredPermissions = ["province_manager"];
|
||||
const requiredPermissions = ["manage_province_affairs_refahi"];
|
||||
export default function RefahiProvinceManager() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
@@ -3,7 +3,7 @@ import RolePermissionMiddleware from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["transportation_assistant"];
|
||||
const requiredPermissions = ["manage_transportation_navgan"];
|
||||
export default function TransportationAssistance() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
|
||||
Reference in New Issue
Block a user