From ac9389274e8a667b30b25186ec623cca3b366b08 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sat, 22 Jul 2023 14:44:41 +0330 Subject: [PATCH 1/2] add minSize tooltip and delete handleClose --- public/locales/fa/app.json | 1 + .../machinary-office/Form/ConfirmForm.jsx | 8 ++-- .../machinary-office/Form/RejectForm.jsx | 8 ++-- .../machinary-office/TableRowActions.jsx | 30 +++++++------ .../dashboard/machinary-office/index.jsx | 1 + .../passenger-boss/Form/ConfirmForm.jsx | 8 ++-- .../passenger-boss/Form/RejectForm.jsx | 8 ++-- .../passenger-boss/TableRowActions.jsx | 30 +++++++------ .../dashboard/passenger-boss/index.jsx | 1 + .../passenger-office/Form/ConfirmForm.jsx | 8 ++-- .../passenger-office/Form/RejectForm.jsx | 8 ++-- .../passenger-office/TableRowActions.jsx | 30 +++++++------ .../dashboard/passenger-office/index.jsx | 1 + .../province-manager/Form/ConfirmForm.jsx | 8 ++-- .../province-manager/Form/RejectForm.jsx | 8 ++-- .../province-manager/TableRowActions.jsx | 30 +++++++------ .../dashboard/province-manager/index.jsx | 1 + .../Form/ConfirmForm.jsx | 42 +++++++++++++++---- .../Form/RejectForm.jsx | 8 ++-- .../TableRowActions.jsx | 31 ++++++++------ .../transportation-assistance/index.jsx | 1 + src/core/utils/theme.jsx | 9 ++++ .../transportation-assistance/index.jsx | 2 +- 23 files changed, 178 insertions(+), 104 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index bf81001..b0373e7 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -52,6 +52,7 @@ "Dashboard": { "dashboard_page": "داشبورد", "passenger_boss_page": "رئیس مسافر", + "transportation_assistance": "معاونت حمل و نقل", "change_password": "تغییر رمز عبور", "province_manager_page": "مدیر کل استانی", "passenger_office_page": "اداره مسافر", diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx index 55ae682..08e21b6 100644 --- a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx +++ b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx @@ -48,7 +48,7 @@ const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => { }; return ( - + {t("ConfirmDialog.confirm")} {t("ConfirmDialog.context")} @@ -88,12 +88,12 @@ const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => { /> - + ); diff --git a/src/components/dashboard/machinary-office/Form/RejectForm.jsx b/src/components/dashboard/machinary-office/Form/RejectForm.jsx index 723f9a6..8b6192f 100644 --- a/src/components/dashboard/machinary-office/Form/RejectForm.jsx +++ b/src/components/dashboard/machinary-office/Form/RejectForm.jsx @@ -40,7 +40,7 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { }; return ( - + {t("RejectDialog.reject")} {t("RejectDialog.context")} @@ -62,12 +62,12 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { /> - + ); diff --git a/src/components/dashboard/machinary-office/TableRowActions.jsx b/src/components/dashboard/machinary-office/TableRowActions.jsx index e9e815e..c7ee618 100644 --- a/src/components/dashboard/machinary-office/TableRowActions.jsx +++ b/src/components/dashboard/machinary-office/TableRowActions.jsx @@ -1,12 +1,14 @@ import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt"; import ThumbDownIcon from "@mui/icons-material/ThumbDown"; -import { Box, IconButton } from "@mui/material"; +import { Box, IconButton, Tooltip } from "@mui/material"; import { useContext } from "react"; import { DataTableContext } from "@/lib/app/contexts/DataTableContext"; import ConfirmForm from "./Form/ConfirmForm"; import RejectForm from "./Form/RejectForm"; +import { useTranslations } from "next-intl"; const TableRowActions = ({ row }) => { + const t = useTranslations(); const { openConfirmDialog, openRejectDialog, @@ -20,14 +22,16 @@ const TableRowActions = ({ row }) => { } = useContext(DataTableContext); return ( - { - handleOpenConfirmDialog(row); - }} - > - - + + { + handleOpenConfirmDialog(row); + }} + > + + + {openConfirmDialog && ( { confirmData={confirmData} /> )} - handleOpenRejectDialog(row)}> - - + + handleOpenRejectDialog(row)}> + + + {openRejectDialog && ( { }; return ( - + {t("ConfirmDialog.confirm")} {t("ConfirmDialog.context")} @@ -90,12 +90,12 @@ const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => { /> - + ); diff --git a/src/components/dashboard/passenger-boss/Form/RejectForm.jsx b/src/components/dashboard/passenger-boss/Form/RejectForm.jsx index 18a48a7..e163b5f 100644 --- a/src/components/dashboard/passenger-boss/Form/RejectForm.jsx +++ b/src/components/dashboard/passenger-boss/Form/RejectForm.jsx @@ -40,7 +40,7 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { }; return ( - + {t("RejectDialog.reject")} {t("RejectDialog.context")} @@ -62,12 +62,12 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { /> - + ); diff --git a/src/components/dashboard/passenger-boss/TableRowActions.jsx b/src/components/dashboard/passenger-boss/TableRowActions.jsx index e9e815e..c7ee618 100644 --- a/src/components/dashboard/passenger-boss/TableRowActions.jsx +++ b/src/components/dashboard/passenger-boss/TableRowActions.jsx @@ -1,12 +1,14 @@ import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt"; import ThumbDownIcon from "@mui/icons-material/ThumbDown"; -import { Box, IconButton } from "@mui/material"; +import { Box, IconButton, Tooltip } from "@mui/material"; import { useContext } from "react"; import { DataTableContext } from "@/lib/app/contexts/DataTableContext"; import ConfirmForm from "./Form/ConfirmForm"; import RejectForm from "./Form/RejectForm"; +import { useTranslations } from "next-intl"; const TableRowActions = ({ row }) => { + const t = useTranslations(); const { openConfirmDialog, openRejectDialog, @@ -20,14 +22,16 @@ const TableRowActions = ({ row }) => { } = useContext(DataTableContext); return ( - { - handleOpenConfirmDialog(row); - }} - > - - + + { + handleOpenConfirmDialog(row); + }} + > + + + {openConfirmDialog && ( { confirmData={confirmData} /> )} - handleOpenRejectDialog(row)}> - - + + handleOpenRejectDialog(row)}> + + + {openRejectDialog && ( { }; return ( - + {t("ConfirmDialog.confirm")} {t("ConfirmDialog.context")} @@ -115,12 +115,12 @@ const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => { - + ); diff --git a/src/components/dashboard/passenger-office/Form/RejectForm.jsx b/src/components/dashboard/passenger-office/Form/RejectForm.jsx index 149c480..6840f7c 100644 --- a/src/components/dashboard/passenger-office/Form/RejectForm.jsx +++ b/src/components/dashboard/passenger-office/Form/RejectForm.jsx @@ -40,7 +40,7 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { }; return ( - + {t("RejectDialog.reject")} {t("RejectDialog.context")} @@ -62,12 +62,12 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { /> - + ); diff --git a/src/components/dashboard/passenger-office/TableRowActions.jsx b/src/components/dashboard/passenger-office/TableRowActions.jsx index e9e815e..c7ee618 100644 --- a/src/components/dashboard/passenger-office/TableRowActions.jsx +++ b/src/components/dashboard/passenger-office/TableRowActions.jsx @@ -1,12 +1,14 @@ import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt"; import ThumbDownIcon from "@mui/icons-material/ThumbDown"; -import { Box, IconButton } from "@mui/material"; +import { Box, IconButton, Tooltip } from "@mui/material"; import { useContext } from "react"; import { DataTableContext } from "@/lib/app/contexts/DataTableContext"; import ConfirmForm from "./Form/ConfirmForm"; import RejectForm from "./Form/RejectForm"; +import { useTranslations } from "next-intl"; const TableRowActions = ({ row }) => { + const t = useTranslations(); const { openConfirmDialog, openRejectDialog, @@ -20,14 +22,16 @@ const TableRowActions = ({ row }) => { } = useContext(DataTableContext); return ( - { - handleOpenConfirmDialog(row); - }} - > - - + + { + handleOpenConfirmDialog(row); + }} + > + + + {openConfirmDialog && ( { confirmData={confirmData} /> )} - handleOpenRejectDialog(row)}> - - + + handleOpenRejectDialog(row)}> + + + {openRejectDialog && ( { }; return ( - + {t("ConfirmDialog.confirm")} {t("ConfirmDialog.context")} @@ -115,12 +115,12 @@ const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => { - + ); diff --git a/src/components/dashboard/province-manager/Form/RejectForm.jsx b/src/components/dashboard/province-manager/Form/RejectForm.jsx index 53f3c62..4cd56a5 100644 --- a/src/components/dashboard/province-manager/Form/RejectForm.jsx +++ b/src/components/dashboard/province-manager/Form/RejectForm.jsx @@ -40,7 +40,7 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { }; return ( - + {t("RejectDialog.reject")} {t("RejectDialog.context")} @@ -62,12 +62,12 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { /> - + ); diff --git a/src/components/dashboard/province-manager/TableRowActions.jsx b/src/components/dashboard/province-manager/TableRowActions.jsx index e9e815e..c7ee618 100644 --- a/src/components/dashboard/province-manager/TableRowActions.jsx +++ b/src/components/dashboard/province-manager/TableRowActions.jsx @@ -1,12 +1,14 @@ import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt"; import ThumbDownIcon from "@mui/icons-material/ThumbDown"; -import { Box, IconButton } from "@mui/material"; +import { Box, IconButton, Tooltip } from "@mui/material"; import { useContext } from "react"; import { DataTableContext } from "@/lib/app/contexts/DataTableContext"; import ConfirmForm from "./Form/ConfirmForm"; import RejectForm from "./Form/RejectForm"; +import { useTranslations } from "next-intl"; const TableRowActions = ({ row }) => { + const t = useTranslations(); const { openConfirmDialog, openRejectDialog, @@ -20,14 +22,16 @@ const TableRowActions = ({ row }) => { } = useContext(DataTableContext); return ( - { - handleOpenConfirmDialog(row); - }} - > - - + + { + handleOpenConfirmDialog(row); + }} + > + + + {openConfirmDialog && ( { confirmData={confirmData} /> )} - handleOpenRejectDialog(row)}> - - + + handleOpenRejectDialog(row)}> + + + {openRejectDialog && ( { const t = useTranslations(); - const handleConfirm = () => { - handleClose(); - confirmData(CONFIRM_TRANSPORTATION_ASSISTANCE, rowId); + const [description, setDescription] = useState(""); + + const formik = useFormik({ + initialValues: { + description: "", + }, + onSubmit: () => { + const formData = new FormData(); + if (description != "") formData.append("expert_description", description); + handleClose(); + confirmData(CONFIRM_TRANSPORTATION_ASSISTANCE, rowId, formData); + }, + }); + + const handleDescriptionChange = (event) => { + setDescription(event.target.value); }; + return ( - + {t("ConfirmDialog.confirm")} {t("ConfirmDialog.context")} + - + ); diff --git a/src/components/dashboard/transportation-assistance/Form/RejectForm.jsx b/src/components/dashboard/transportation-assistance/Form/RejectForm.jsx index 262f9db..1bd1464 100644 --- a/src/components/dashboard/transportation-assistance/Form/RejectForm.jsx +++ b/src/components/dashboard/transportation-assistance/Form/RejectForm.jsx @@ -40,7 +40,7 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { }; return ( - + {t("RejectDialog.reject")} {t("RejectDialog.context")} @@ -62,12 +62,12 @@ const RejectForm = ({ open, handleClose, rowId, rejectData }) => { /> - + ); diff --git a/src/components/dashboard/transportation-assistance/TableRowActions.jsx b/src/components/dashboard/transportation-assistance/TableRowActions.jsx index e9e815e..ccd5bde 100644 --- a/src/components/dashboard/transportation-assistance/TableRowActions.jsx +++ b/src/components/dashboard/transportation-assistance/TableRowActions.jsx @@ -1,12 +1,15 @@ import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt"; import ThumbDownIcon from "@mui/icons-material/ThumbDown"; -import { Box, IconButton } from "@mui/material"; +import { Box, IconButton, Tooltip } from "@mui/material"; import { useContext } from "react"; import { DataTableContext } from "@/lib/app/contexts/DataTableContext"; import ConfirmForm from "./Form/ConfirmForm"; import RejectForm from "./Form/RejectForm"; +import { useTranslations } from "next-intl"; const TableRowActions = ({ row }) => { + const t = useTranslations(); + const { openConfirmDialog, openRejectDialog, @@ -20,14 +23,16 @@ const TableRowActions = ({ row }) => { } = useContext(DataTableContext); return ( - { - handleOpenConfirmDialog(row); - }} - > - - + + { + handleOpenConfirmDialog(row); + }} + > + + + {openConfirmDialog && ( { confirmData={confirmData} /> )} - handleOpenRejectDialog(row)}> - - + + handleOpenRejectDialog(row)}> + + + {openRejectDialog && ( - + ); From 3f43bf9f4ac4186a1668b57811a0344315467cf1 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sat, 22 Jul 2023 15:26:57 +0330 Subject: [PATCH 2/2] warning notification --- .../notifications/WarningNotification.jsx | 41 +++++++++++++++++++ src/core/components/notifications/index.jsx | 1 + 2 files changed, 42 insertions(+) create mode 100644 src/core/components/notifications/WarningNotification.jsx diff --git a/src/core/components/notifications/WarningNotification.jsx b/src/core/components/notifications/WarningNotification.jsx new file mode 100644 index 0000000..1451031 --- /dev/null +++ b/src/core/components/notifications/WarningNotification.jsx @@ -0,0 +1,41 @@ +import ReportIcon from "@mui/icons-material/Report"; +import { Box, Divider, Typography } from "@mui/material"; +import { toast } from "react-toastify"; + +const WarningNotification = (directionApp, t, status) => { + toast( + ({ closeToast }) => ( + <> + + + + + + {t("warning")} ({t("code")}: {status}) + + + {t("warning_static_text")} + + + + + + + ), + { + position: directionApp === "ltr" ? "top-left" : "top-right", + autoClose: false, + closeOnClick: false, + draggable: false, + } + ); +}; + +export default WarningNotification; diff --git a/src/core/components/notifications/index.jsx b/src/core/components/notifications/index.jsx index f9eb82c..ddef384 100644 --- a/src/core/components/notifications/index.jsx +++ b/src/core/components/notifications/index.jsx @@ -1,4 +1,5 @@ import ErrorNotification from "./ErrorNotification"; +import WarningNotification from "./WarningNotification"; import SuccessNotification from "./successNotification"; const Notifications = async (directionApp, response, t) => {