diff --git a/example.env.local b/example.env.local
index a2d8ab0..f6cb8f0 100644
--- a/example.env.local
+++ b/example.env.local
@@ -1,5 +1,5 @@
NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard"
-NEXT_PUBLIC_API_VERSION = "1.10.2"
+NEXT_PUBLIC_API_VERSION = "1.18.2"
NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa"
NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"
diff --git a/public/fontiran.scss b/public/fontiran.scss
index 86d585d..5ee0036 100644
--- a/public/fontiran.scss
+++ b/public/fontiran.scss
@@ -167,3 +167,10 @@ This set of fonts are used in this project under the license: (.....)
url('./fonts/woff/Parastoo-Bold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('./fonts/ttf/Parastoo-Bold.ttf') format('truetype');
}
+
+@font-face {
+ font-family: Bnazanin;
+ font-style: normal;
+ font-weight: normal;
+ src: url('./fonts/ttf/BNazanin.ttf') format('truetype');
+}
diff --git a/public/fonts/ttf/BNazanin.ttf b/public/fonts/ttf/BNazanin.ttf
new file mode 100644
index 0000000..4e59251
Binary files /dev/null and b/public/fonts/ttf/BNazanin.ttf differ
diff --git a/public/images/logo.png b/public/images/logo.png
new file mode 100644
index 0000000..075e3fe
Binary files /dev/null and b/public/images/logo.png differ
diff --git a/public/images/logo.svg b/public/images/logo.svg
deleted file mode 100644
index eebb9fa..0000000
--- a/public/images/logo.svg
+++ /dev/null
@@ -1,19 +0,0 @@
-
diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json
index 9fd2984..fa27cd6 100644
--- a/public/locales/fa/app.json
+++ b/public/locales/fa/app.json
@@ -16,6 +16,11 @@
"between": "میان",
"online_message": "شما به اینترنت وصل هستید",
"offline_message": "اتصال شما به اینترنت قطع شده است",
+ "routing_to": "در حال انتقال به صفحه",
+ "data_not_found": "اطلاعاتی یافت نشد!",
+ "btn_print": "چاپ",
+ "print_loading": "درحال پردازش اطلاعات ...",
+ "button_back_to_previous": "بازگشت به صفحه قبل",
"header": {
"open_profile": "پروفایل",
"edit_profile": " پروفایل",
@@ -160,7 +165,10 @@
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
- "state_name": "وضعیت درخواست"
+ "state_name": "وضعیت درخواست",
+ "confirm": "ارجاع به کارشناس ماشین آلات",
+ "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
+ "upload_file_format": "فرمت قابل قبول : png,jpg,pdf"
},
"CommercialChief": {
"name": "نام",
@@ -182,7 +190,10 @@
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
- "state_name": "وضعیت درخواست"
+ "state_name": "وضعیت درخواست",
+ "confirm": "تایید نهایی و ارجاع به بانک",
+ "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
+ "upload_file_format": "فرمت قابل قبول : png,jpg,pdf"
},
"PassengerBoss": {
"name": "نام",
@@ -193,7 +204,14 @@
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
- "state_name": "وضعیت درخواست"
+ "state_name": "وضعیت درخواست",
+ "confirm": "ارجاع به معاون حمل و نقل",
+ "upload_file": "صورت جلسه کارگروه استانی را بارگذاری کنید",
+ "upload_file_required": "وارد کردن صورت جلسه کارگروه استانی الزامیست",
+ "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
+ "upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
+ "print_final_credit_amount": "چاپ صورت جلسه تعیین مبلغ نهایی",
+ "max_amount": "حداکثر مبلغ تصویب شده {value} میلیون ریال می باشد"
},
"RefahiProvinceManager": {
"name": "نام",
@@ -261,7 +279,10 @@
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
- "state_name": "وضعیت درخواست"
+ "state_name": "وضعیت درخواست",
+ "confirm": "ارجاع به مدیر کل استانی",
+ "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
+ "upload_file_format": "فرمت قابل قبول : png,jpg,pdf"
},
"InspectorExpert": {
"name": "نام",
@@ -283,7 +304,14 @@
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
- "state_name": "وضعیت درخواست"
+ "state_name": "وضعیت درخواست",
+ "confirm": "ارجاع به کارگروه استانی",
+ "upload_file": "گزارش کارشناسی را بارگذاری کنید",
+ "upload_file_required": "وارد کردن گزارش کارشناسی الزامیست",
+ "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
+ "upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
+ "print_report": "چاپ گزارش کارشناسی ماشین آلات",
+ "max_amount": "حداکثر مبلغ پیشنهادی {value} میلیون ریال می باشد"
},
"UserManagement": {
"name": "نام",
@@ -305,23 +333,24 @@
"updated_at": "تاریخ بروزرسانی"
},
"ConfirmDialog": {
- "confirm": "تایید",
+ "confirm": "ارجاع",
"context": "آیا از تایید این آیتم اطمینان دارید؟",
"button-cancel": "بستن",
- "button-confirm": "تایید",
+ "button-confirm": "ارجاع",
"description_error": "وارد کردن توضیحات الزامی است!",
"optional": " (اختیاری)",
- "unit": " (ریال)",
+ "unit": " (میلیون ریال)",
"description": "توضیحات خود را وارد نمائید",
"choose_file": "انتخاب فایل",
"approved_amount": "مبلغ تصویب شده",
"approved_amount_error": "وارد کردن مبلغ تصویب شده الزامیست",
"approved_amount_positive": "مبلغ تصویب شده باید مثبت باشد",
"approved_amount_number": "مبلغ تصویب شده باید عدد باشد",
- "toman": "تومان",
+ "toman": "میلیون تومان",
"proposed_amount_error": "وارد کردن مقدار پیشنهادی الزامیست",
"proposed_amount": "مقدار پیشنهادی",
- "proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد"
+ "proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد",
+ "proposed_amount_number": "مقدار پیشنهادی باید عدد باشد"
},
"ReviseDialog": {
"revise": " نیاز به ویرایش",
diff --git a/public/print.scss b/public/print.scss
new file mode 100644
index 0000000..990a647
--- /dev/null
+++ b/public/print.scss
@@ -0,0 +1,9 @@
+@media print {
+ body {
+ margin: 0;
+ padding: 0;
+ }
+ @page {
+ size: A4;
+ }
+}
\ No newline at end of file
diff --git a/src/components/dashboard/commercial-chief/TableTollbar.jsx b/src/components/dashboard/commercial-chief/TableTollbar.jsx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/components/dashboard/development-assistant/TableTollbar.jsx b/src/components/dashboard/development-assistant/TableTollbar.jsx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/components/dashboard/edit-profile/index.jsx b/src/components/dashboard/edit-profile/index.jsx
index 1187057..c97fc56 100644
--- a/src/components/dashboard/edit-profile/index.jsx
+++ b/src/components/dashboard/edit-profile/index.jsx
@@ -1,44 +1,16 @@
import StyledForm from "@/core/components/StyledForm";
import CenterLayout from "@/layouts/CenterLayout";
import useUser from "@/lib/app/hooks/useUser";
-import {Box, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
+import {Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
import * as Yup from "yup";
import {Field, Formik} from "formik";
import {useTranslations} from "next-intl";
-import AvatarUpload from "@/core/components/AvatarUpload";
-import axios from "axios";
-import {UPDATE_AVATAR} from "@/core/data/apiRoutes";
import useDirection from "@/lib/app/hooks/useDirection";
-import Notifications from "@/core/components/notifications";
-import ImageResizer from "@/core/components/ImageConvertor";
const DashboardEditProfile = () => {
const t = useTranslations();
const {user, token, getUser, changeUser} = useUser();
- const {directionApp} = useDirection();
-
- const editAvatar = async (avatar) => {
- Notifications(t);
- try {
- const formData = new FormData();
-
- if (avatar != null) {
- var resizedAvatar;
- resizedAvatar = await ImageResizer(avatar);
- formData.append("avatar", resizedAvatar);
- }
-
- await axios.post(UPDATE_AVATAR, formData, {
- headers: {
- authorization: `Bearer ${token}`,
- "Content-Type": "multipart/form-data",
- },
- });
- } catch (error) {
- Notifications(t, error.response);
- throw error;
- }
- };
+ const {directionApp} = useDirection()
const handleSubmit = (values, {setSubmitting}) => {
};
@@ -72,21 +44,6 @@ const DashboardEditProfile = () => {
{t("UpdateProfile.typography_edit_profile")}
-
-
-
{
+ const t = useTranslations();
+ const router = useRouter()
+ const [loading, setLoading] = useState(false)
+ const requestServer = useRequest({auth: true, pending: false, success: {notification: {show: false}}})
+ const {setPrintPage, setPrintTitle} = usePrint()
+ const clickHandler = () => {
+ setLoading(true)
+ const params = new URLSearchParams();
+ params.set("start", '0');
+ params.set("filters", '[]');
+ params.set("sorting", '[]');
+ requestServer(`${GET_MACHINARY_OFFICE}?${params}`, 'get').then((response) => {
+ const _data = response.data.data
+ setPrintPage(_data.length)
+ setPrintTitle(t('MachinaryOffice.print_report'))
+ sessionStorage.setItem('report-print', JSON.stringify(_data))
+ router.push('/dashboard/machinery-expert/prints/report')
+ }).catch(() => {
+ setLoading(false)
+ })
+ }
+
+ return (
+ : }
+ onClick={clickHandler}
+ >
+ {t("MachinaryOffice.print_report")}
+
+ )
+}
+
+export default PrintReport
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx
index da0acda..16b7ca3 100644
--- a/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx
+++ b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx
@@ -1,16 +1,19 @@
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 {Button, DialogActions, DialogContent, FormHelperText, Stack, TextField, Typography} from "@mui/material"
import {useFormik} from "formik";
import {useTranslations} from "next-intl";
import {CONFIRM_MACHINARY_OFFICE} from "@/core/data/apiRoutes";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
import {useState} from "react";
import PriceField from "@/core/components/PriceField";
import * as Yup from "yup";
-const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
+const vehicle_amount = {
+ "اتوبوس": 7000,
+ "مینی بوس": 2000,
+}
+const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type}) => {
const t = useTranslations();
const [selectedImage, setSelectedImage] = useState("");
const [fileType, setfileType] = useState(null);
@@ -18,14 +21,24 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const [showAddIcon, setShowAddIcon] = useState(true);
const requestServer = useRequest({auth: true})
const {update_notification} = useNotification()
-
const validationSchema = Yup.object().shape({
proposed_amount: Yup.mixed().test(
"is-number",
`${t("ConfirmDialog.proposed_amount_number")}`,
(value) => !isNaN(value)
- ).test("positive", `${t("ConfirmDialog.proposed_amount_positive")}`, (value) => value >= 0)
- .required(t("ConfirmDialog.proposed_amount_error"))
+ ).test("max-amount", `${t("MachinaryOffice.max_amount", {value: parseInt(vehicle_amount[vehicle_type]).toLocaleString('en')})}`,
+ (value) => value <= vehicle_amount[vehicle_type])
+ .test("positive", `${t("ConfirmDialog.proposed_amount_positive")}`, (value) => value >= 0)
+ .required(t("ConfirmDialog.proposed_amount_error")),
+ confirm_img: Yup.mixed()
+ .required(t("MachinaryOffice.upload_file_required"))
+ .test('fileSize', `${t("MachinaryOffice.upload_file_unit")}`, (value) => {
+ return value.size <= 2 * 1024 * 1024;
+ })
+ .test('fileType', `${t("MachinaryOffice.upload_file_format")}`, (value) => {
+ const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf'];
+ return allowedTypes.includes(value.type);
+ })
});
const formik = useFormik({
@@ -39,7 +52,6 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
formData.append("proposed_amount", values.proposed_amount);
if (values.description != "") formData.append("expert_description", values.description);
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
-
requestServer(`${CONFIRM_MACHINARY_OFFICE}/${rowId}`, 'post', {
data: formData,
}).then((response) => {
@@ -60,19 +72,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const handleUploadChange = (event) => {
const uploadedFile = event.target?.files?.[0];
if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
const fileType = event.target?.files?.[0].type;
const fileName = event.target?.files?.[0].name;
setSelectedImage(URL.createObjectURL(uploadedFile));
setfileType(fileType);
setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
+ formik.setFieldValue("confirm_img", uploadedFile).then(() => {
+ formik.setFieldTouched("confirm_img", true);
+ })
setShowAddIcon(false);
}
};
@@ -129,7 +136,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
/>
- {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+ {t("MachinaryOffice.upload_file")}
{
fileName={fileName}
imageAlt={t("app_name")}
imageSize={[250, 150]}
+ onBlur={formik.handleBlur("confirm_img")}
+ error={
+ formik.touched.confirm_img &&
+ Boolean(formik.errors.confirm_img)
+ }
setShowAddIcon={setShowAddIcon}
showAddIcon={showAddIcon}
/>
+
+ {formik.touched.confirm_img && formik.errors.confirm_img}
+
diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx
index 95a6367..3affc7b 100644
--- a/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx
+++ b/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx
@@ -1,10 +1,10 @@
import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
import {useState} from "react";
import ConfirmContent from "./ConfirmContent";
+import CallMadeIcon from '@mui/icons-material/CallMade';
-const Confirm = ({rowId, mutate}) => {
+const Confirm = ({rowId, mutate, vehicle_type}) => {
const t = useTranslations();
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
return (
@@ -16,13 +16,14 @@ const Confirm = ({rowId, mutate}) => {
setOpenConfirmDialog(true)
}}
>
-
+
>
)
diff --git a/src/components/dashboard/machinary-office/Prints/report/Content.jsx b/src/components/dashboard/machinary-office/Prints/report/Content.jsx
new file mode 100644
index 0000000..8098ecb
--- /dev/null
+++ b/src/components/dashboard/machinary-office/Prints/report/Content.jsx
@@ -0,0 +1,96 @@
+import PrintablePage from "@/core/components/PrintablePage";
+import {Box, Stack, Typography} from "@mui/material";
+
+const Content = ({data}) => {
+ return (
+ <>
+
+
+ {'گزارش کارشناسی ماشین آلات'}
+
+
+ {'با توجه به نامه شماره'}
+ 35482
+ {'مورخ'}
+ 1402/08/20
+ {'معاون محترم برنامه ریزی سازمان راهداری و حمل و نقل جاده ای در خصوص تسهیلات بند (الف) تبصره (18) قانون بودجه سال'}
+ 1402
+ {'موضوع بازسازی ناوگان اتوبوس و مینی بوس و نیز تصویب آن درشورای برنامه ریزی و توسعه استان'}
+ تهران
+ {'و نامه شماره'}
+ 35482
+ {'مورخ'}
+ 1402/08/20
+ {'اداره کل راهداری و حمل و نقل جاده ای'}
+ تهران
+ {'در خصوص استفاده از ظرفیت انجمن های صنفی رانندگان در تاریخ'}
+ 1402/08/20
+ {'از ناوگان اتوبوس/مینی بوس به شماره پلاک انتظامی'}
+ 25پ4582
+ {'و شماره هوشمند ناوگان'}
+ 5875698725
+ {'به مالکیت آقای'}
+ امیرحسین محمودی
+ {'با کد ملی'}
+ 0311318897
+ {'و شماره تماس'}
+ 09120630655
+ {'ساکن شهرستان'}
+ تهران
+ {'در جلسه مطرح شد که نتیجه آن به شرح ذیل مورد تایید می باشد.'}
+
+
+ {'مبلغ پیشنهادی به عدد .............................................. ریال و به حروف ...................................................................... ریال می باشد.'}
+ {'توضیحات : ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................'}
+
+ {'نام و نام خانوادگی کارشناس:'}
+ {'تاریخ و امضاء'}
+
+
+
+ >
+ )
+}
+
+export default Content
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/Prints/report/index.jsx b/src/components/dashboard/machinary-office/Prints/report/index.jsx
new file mode 100644
index 0000000..54dca24
--- /dev/null
+++ b/src/components/dashboard/machinary-office/Prints/report/index.jsx
@@ -0,0 +1,60 @@
+import {useEffect, useState} from "react";
+import CenterLayout from "@/layouts/CenterLayout";
+import {useTranslations} from "next-intl";
+import {Stack, Typography} from "@mui/material";
+import Content from "@/components/dashboard/machinary-office/Prints/report/Content";
+
+const ReportComponent = () => {
+ const t = useTranslations()
+ const [data, setData] = useState(null)
+ const [loading, setLoading] = useState(true)
+ const [isNotData, setIsNotData] = useState(true)
+
+ useEffect(() => {
+ if (sessionStorage.getItem('report-print') === null) {
+ setLoading(false)
+ setIsNotData(true)
+ sessionStorage.setItem('report-print', 'seen')
+ } else if (sessionStorage.getItem('report-print') === 'seen') {
+ setLoading(false)
+ setData(null)
+ setIsNotData(true)
+ } else if (data) {
+ setLoading(false)
+ sessionStorage.setItem('report-print', 'seen')
+ setIsNotData(false)
+ } else {
+ setLoading(true)
+ setData(JSON.parse(sessionStorage.getItem('report-print')))
+ setIsNotData(true)
+ }
+ }, [data]);
+
+ return (
+
+ {loading ? (
+
+
+
+ {t('print_loading')}
+
+
+
+ ) : !data ? (
+
+
+ {t('data_not_found')}
+
+
+ ) : !data.length ? (
+
+
+ {t('data_not_found')}
+
+
+ ) : data.map(item => )}
+
+ )
+}
+
+export default ReportComponent
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/TableRowActions.jsx b/src/components/dashboard/machinary-office/TableRowActions.jsx
index 69f9d6f..f50938e 100644
--- a/src/components/dashboard/machinary-office/TableRowActions.jsx
+++ b/src/components/dashboard/machinary-office/TableRowActions.jsx
@@ -3,11 +3,11 @@ import Confirm from "./Form/ConfirmForm";
import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate}) => {
-
return (
-
-
- );
-}
-
-export default TableToolbar;
diff --git a/src/components/dashboard/machinary-office/TableToolbar.jsx b/src/components/dashboard/machinary-office/TableToolbar.jsx
new file mode 100644
index 0000000..9704f95
--- /dev/null
+++ b/src/components/dashboard/machinary-office/TableToolbar.jsx
@@ -0,0 +1,12 @@
+import {Stack} from "@mui/material";
+import PrintReport from "@/components/dashboard/machinary-office/Buttons/printReport";
+
+const TableToolbar = () => {
+ return (
+
+
+
+ )
+}
+
+export default TableToolbar
\ No newline at end of file
diff --git a/src/components/dashboard/machinary-office/index.jsx b/src/components/dashboard/machinary-office/index.jsx
index 820519e..853c065 100644
--- a/src/components/dashboard/machinary-office/index.jsx
+++ b/src/components/dashboard/machinary-office/index.jsx
@@ -6,6 +6,7 @@ import TableRowActions from "./TableRowActions";
import moment from "jalali-moment";
import DataTable from "@/core/components/DataTable";
import MuiDatePicker from "@/core/components/MuiDatePicker";
+import TableToolbar from "@/components/dashboard/machinary-office/TableToolbar";
function DashboardMachinaryOfficeComponent() {
const t = useTranslations();
@@ -160,7 +161,8 @@ function DashboardMachinaryOfficeComponent() {
tableUrl={GET_MACHINARY_OFFICE}
columns={columns}
selectableRow={false}
- enableCustomToolbar={false}
+ enableCustomToolbar={true}
+ CustomToolbar={TableToolbar}
enableLastUpdate={true}
sorting={[{
id: 'id', desc: false
diff --git a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx
index af9e93a..daa4df9 100644
--- a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx
+++ b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx
@@ -1,12 +1,12 @@
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 {Button, DialogActions, DialogContent, FormHelperText, 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 * as Yup from "yup";
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const t = useTranslations();
@@ -17,11 +17,24 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const requestServer = useRequest({auth: true})
const {update_notification} = useNotification()
+ const validationSchema = Yup.object().shape({
+ confirm_img: Yup.mixed().notRequired(t("ConfirmDialog.approved_amount_error"))
+ .test('fileSize', `${t("NavganProvinceManager.upload_file_unit")}`, (value) => {
+ if (!value) return true
+ return value.size <= 2 * 1024 * 1024;
+ })
+ .test('fileType', `${t("NavganProvinceManager.upload_file_format")}`, (value) => {
+ if (!value) return true
+ const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
+ return allowedTypes.includes(value.type);
+ })
+ })
+
const formik = useFormik({
initialValues: {
description: "",
confirm_img: null
- },
+ }, validationSchema,
onSubmit: (values, {setSubmitting}) => {
const formData = new FormData();
if (values.description != "") formData.append("expert_description", values.description);
@@ -47,23 +60,17 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const handleUploadChange = (event) => {
const uploadedFile = event.target?.files?.[0];
if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
const fileType = event.target?.files?.[0].type;
const fileName = event.target?.files?.[0].name;
setSelectedImage(URL.createObjectURL(uploadedFile));
setfileType(fileType);
setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
+ formik.setFieldValue("confirm_img", uploadedFile).then(() => {
+ formik.setFieldTouched("confirm_img", true);
+ })
setShowAddIcon(false);
}
};
-
return (
<>
@@ -96,7 +103,17 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
imageSize={[250, 150]}
setShowAddIcon={setShowAddIcon}
showAddIcon={showAddIcon}
+ onBlur={() => formik.handleBlur("confirm_img")}
+ error={
+ formik.touched.confirm_img &&
+ Boolean(formik.errors.confirm_img)
+ }
/>
+
+ {formik.touched.confirm_img && formik.errors.confirm_img}
+
@@ -106,7 +123,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
{t("ConfirmDialog.button-cancel")}
diff --git a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/index.jsx b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/index.jsx
index 95a6367..2d983db 100644
--- a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/index.jsx
+++ b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/index.jsx
@@ -1,9 +1,8 @@
import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
import {useState} from "react";
import ConfirmContent from "./ConfirmContent";
-
+import CallMadeIcon from '@mui/icons-material/CallMade';
const Confirm = ({rowId, mutate}) => {
const t = useTranslations();
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
@@ -16,12 +15,12 @@ const Confirm = ({rowId, mutate}) => {
setOpenConfirmDialog(true)
}}
>
-
+
>
diff --git a/src/components/dashboard/navgan-province-manager/TableTollbar.jsx b/src/components/dashboard/navgan-province-manager/TableTollbar.jsx
deleted file mode 100644
index e267691..0000000
--- a/src/components/dashboard/navgan-province-manager/TableTollbar.jsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import {Stack, Tooltip} from "@mui/material";
-import {useTranslations} from "next-intl";
-
-function TableToolbar() {
- const t = useTranslations();
- return (
-
-
-
- );
-}
-
-export default TableToolbar;
diff --git a/src/components/dashboard/passenger-boss/Buttons/printFinalCreditAmount.jsx b/src/components/dashboard/passenger-boss/Buttons/printFinalCreditAmount.jsx
new file mode 100644
index 0000000..58a97af
--- /dev/null
+++ b/src/components/dashboard/passenger-boss/Buttons/printFinalCreditAmount.jsx
@@ -0,0 +1,48 @@
+import PrintIcon from "@mui/icons-material/Print";
+import {Button, CircularProgress} from "@mui/material";
+import {useTranslations} from "next-intl";
+import {useRouter} from "next/router";
+import {useState} from "react";
+import useRequest from "@/lib/app/hooks/useRequest";
+import {GET_PASSENGER_BOSS} from "@/core/data/apiRoutes";
+import usePrint from "@/lib/app/hooks/usePrint";
+
+const PrintFinalCreditAmount = () => {
+ const t = useTranslations();
+ const router = useRouter()
+ const [loading, setLoading] = useState(false)
+ const requestServer = useRequest({auth: true, pending: false, success: {notification: {show: false}}})
+ const {setPrintPage, setPrintTitle} = usePrint()
+ const clickHandler = () => {
+ setLoading(true)
+ const params = new URLSearchParams();
+ params.set("start", '0');
+ params.set("filters", '[]');
+ params.set("sorting", '[]');
+ requestServer(`${GET_PASSENGER_BOSS}?${params}`, 'get').then((response) => {
+ const _data = response.data.data
+ setPrintPage(_data.length)
+ setPrintTitle(t('PassengerBoss.print_final_credit_amount'))
+ sessionStorage.setItem('final-credit-amount-print', JSON.stringify(_data))
+ router.push('/dashboard/passenger-boss/prints/final-credit-amount')
+ }).catch(() => {
+ setLoading(false)
+ })
+ }
+
+ return (
+ : }
+ onClick={clickHandler}
+ >
+ {t("PassengerBoss.print_final_credit_amount")}
+
+ )
+}
+
+export default PrintFinalCreditAmount
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx
index d189a6b..f0a8c12 100644
--- a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx
+++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx
@@ -1,16 +1,19 @@
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 {Button, DialogActions, DialogContent, FormHelperText, Stack, TextField, Typography} from "@mui/material"
import {useFormik} from "formik";
import {useTranslations} from "next-intl";
import {CONFIRM_PASSENGER_BOSS} from "@/core/data/apiRoutes";
-import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
import {useState} from "react";
import PriceField from "@/core/components/PriceField";
import * as Yup from "yup";
-const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
+const vehicle_amount = {
+ "اتوبوس": 7000,
+ "مینی بوس": 2000,
+}
+const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) => {
const t = useTranslations();
const [selectedImage, setSelectedImage] = useState("");
const [fileType, setfileType] = useState(null);
@@ -24,8 +27,19 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
"is-number",
`${t("ConfirmDialog.approved_amount_number")}`,
(value) => !isNaN(value)
- ).test("positive", `${t("ConfirmDialog.approved_amount_positive")}`, (value) => value >= 0)
- .required(t("ConfirmDialog.approved_amount_error"))
+ ).test("max-amount", `${t("PassengerBoss.max_amount", {value: parseInt(vehicle_amount[vehicle_type]).toLocaleString('en')})}`,
+ (value) => value <= vehicle_amount[vehicle_type])
+ .test("positive", `${t("ConfirmDialog.approved_amount_positive")}`, (value) => value >= 0)
+ .required(t("ConfirmDialog.approved_amount_error")),
+ confirm_img: Yup.mixed()
+ .required(t("PassengerBoss.upload_file_required"))
+ .test('fileSize', `${t("PassengerBoss.upload_file_unit")}`, (value) => {
+ return value.size <= 2 * 1024 * 1024;
+ })
+ .test('fileType', `${t("PassengerBoss.upload_file_format")}`, (value) => {
+ const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
+ return allowedTypes.includes(value.type);
+ })
});
const formik = useFormik({
@@ -38,7 +52,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const formData = new FormData();
formData.append("approved_amount", values.approved_amount);
if (values.description != "") formData.append("expert_description", values.description);
- if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
+ formData.append("attachment", values.confirm_img);
requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post', {
data: formData,
@@ -60,19 +74,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const handleUploadChange = (event) => {
const uploadedFile = event.target?.files?.[0];
if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
const fileType = event.target?.files?.[0].type;
const fileName = event.target?.files?.[0].name;
setSelectedImage(URL.createObjectURL(uploadedFile));
setfileType(fileType);
setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
+ formik.setFieldValue("confirm_img", uploadedFile).then(() => {
+ formik.setFieldTouched("confirm_img", true);
+ })
setShowAddIcon(false);
}
};
@@ -83,7 +92,6 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
formik.setFieldValue("approved_amount", formik.values.approved_amount)
}
};
-
return (
<>
@@ -129,7 +137,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
/>
- {t("UploadSystem.upload_file")}{t("UploadSystem.optional")}
+ {t("PassengerBoss.upload_file")}
{
imageSize={[250, 150]}
setShowAddIcon={setShowAddIcon}
showAddIcon={showAddIcon}
+ onBlur={() => formik.handleBlur("confirm_img")}
+ error={
+ formik.touched.confirm_img &&
+ Boolean(formik.errors.confirm_img)
+ }
/>
+
+ {formik.touched.confirm_img && formik.errors.confirm_img}
+
diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx
index 95a6367..004d119 100644
--- a/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx
+++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx
@@ -1,10 +1,10 @@
import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
import {useState} from "react";
import ConfirmContent from "./ConfirmContent";
+import CallMadeIcon from '@mui/icons-material/CallMade';
-const Confirm = ({rowId, mutate}) => {
+const Confirm = ({rowId, mutate, vehicle_type}) => {
const t = useTranslations();
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
return (
@@ -16,13 +16,14 @@ const Confirm = ({rowId, mutate}) => {
setOpenConfirmDialog(true)
}}
>
-
+
>
)
diff --git a/src/components/dashboard/passenger-boss/Prints/final-credit-amount/Content.jsx b/src/components/dashboard/passenger-boss/Prints/final-credit-amount/Content.jsx
new file mode 100644
index 0000000..e9844ee
--- /dev/null
+++ b/src/components/dashboard/passenger-boss/Prints/final-credit-amount/Content.jsx
@@ -0,0 +1,123 @@
+import PrintablePage from "@/core/components/PrintablePage";
+import {Box, Grid, Stack, Typography} from "@mui/material";
+
+const Content = ({data}) => {
+ return (
+ <>
+
+
+ {'فرم صورتجلسه تعیین مبلغ نهایی اعتبار'}
+
+
+ {'با توجه به نامه شماره'}
+ 35482
+ {'مورخ'}
+ 1402/08/20
+ {'معاون محترم برنامه ریزی سازمان راهداری و حمل و نقل جاده ای در خصوص تسهیلات بند (الف) تبصره (18) قانون بودجه سال'}
+ 1402
+ {'موضوع بازسازی ناوگان اتوبوس و مینی بوس و نیز تصویب آن درشورای برنامه ریزی و توسعه استان'}
+ تهران
+ {'و نامه شماره'}
+ 35482
+ {'مورخ'}
+ 1402/08/20
+ {'اداره کل راهداری و حمل و نقل جاده ای'}
+ تهران
+ {'در خصوص استفاده از ظرفیت انجمن های صنفی رانندگان در تاریخ'}
+ 1402/08/20
+ {'از ناوگان اتوبوس/مینی بوس به شماره پلاک انتظامی'}
+ 25پ4582
+ {'و شماره هوشمند ناوگان'}
+ 5875698725
+ {'به مالکیت آقای'}
+ امیرحسین محمودی
+ {'با کد ملی'}
+ 0311318897
+ {'و شماره تماس'}
+ 09120630655
+ {'ساکن شهرستان'}
+ تهران
+ {'در جلسه مطرح شد که نتیجه آن به شرح ذیل مورد تایید می باشد.'}
+
+
+ {'با توجه به گزارش واصله از اداره ماشین آلات (نامه در پیوست موجود می باشد) جهت بازسازی ناوگان مذکور مبلغ .............................................. ریال معادل .............................................. تومان مورد تایید می باشد.'}
+
+
+
+
+ رئیس انجمن
+
+
+
+
+ رئیس اداره مسافر
+
+
+
+
+
+
+
+
+
+
+ امضاء
+
+
+
+
+ امضاء
+
+
+
+
+ امضاء
+
+
+
+
+ امضاء
+
+
+
+
+ >
+ )
+}
+
+export default Content
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/Prints/final-credit-amount/index.jsx b/src/components/dashboard/passenger-boss/Prints/final-credit-amount/index.jsx
new file mode 100644
index 0000000..9fd6a78
--- /dev/null
+++ b/src/components/dashboard/passenger-boss/Prints/final-credit-amount/index.jsx
@@ -0,0 +1,60 @@
+import {useEffect, useState} from "react";
+import CenterLayout from "@/layouts/CenterLayout";
+import {useTranslations} from "next-intl";
+import {Stack, Typography} from "@mui/material";
+import Content from "@/components/dashboard/passenger-boss/Prints/final-credit-amount/Content";
+
+const FinalCreditAmountComponent = () => {
+ const t = useTranslations()
+ const [data, setData] = useState(null)
+ const [loading, setLoading] = useState(true)
+ const [isNotData, setIsNotData] = useState(true)
+
+ useEffect(() => {
+ if (sessionStorage.getItem('final-credit-amount-print') === null) {
+ setLoading(false)
+ setIsNotData(true)
+ sessionStorage.setItem('final-credit-amount-print', 'seen')
+ } else if (sessionStorage.getItem('final-credit-amount-print') === 'seen') {
+ setLoading(false)
+ setData(null)
+ setIsNotData(true)
+ } else if (data) {
+ setLoading(false)
+ sessionStorage.setItem('final-credit-amount-print', 'seen')
+ setIsNotData(false)
+ } else {
+ setLoading(true)
+ setData(JSON.parse(sessionStorage.getItem('final-credit-amount-print')))
+ setIsNotData(true)
+ }
+ }, [data]);
+
+ return (
+
+ {loading ? (
+
+
+
+ {t('print_loading')}
+
+
+
+ ) : !data ? (
+
+
+ {t('data_not_found')}
+
+
+ ) : !data.length ? (
+
+
+ {t('data_not_found')}
+
+
+ ) : data.map(item => )}
+
+ )
+}
+
+export default FinalCreditAmountComponent
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/TableRowActions.jsx b/src/components/dashboard/passenger-boss/TableRowActions.jsx
index d10e248..cef474d 100644
--- a/src/components/dashboard/passenger-boss/TableRowActions.jsx
+++ b/src/components/dashboard/passenger-boss/TableRowActions.jsx
@@ -8,6 +8,7 @@ const TableRow = ({row, mutate}) => {
-
-
- );
-}
-
-export default TableToolbar;
diff --git a/src/components/dashboard/passenger-boss/TableToolbar.jsx b/src/components/dashboard/passenger-boss/TableToolbar.jsx
new file mode 100644
index 0000000..ed224f4
--- /dev/null
+++ b/src/components/dashboard/passenger-boss/TableToolbar.jsx
@@ -0,0 +1,12 @@
+import {Stack} from "@mui/material";
+import PrintFinalCreditAmount from "@/components/dashboard/passenger-boss/Buttons/printFinalCreditAmount";
+
+const TableToolbar = () => {
+ return (
+
+
+
+ )
+}
+
+export default TableToolbar
\ No newline at end of file
diff --git a/src/components/dashboard/passenger-boss/index.jsx b/src/components/dashboard/passenger-boss/index.jsx
index c338f6e..1a13b3b 100644
--- a/src/components/dashboard/passenger-boss/index.jsx
+++ b/src/components/dashboard/passenger-boss/index.jsx
@@ -6,6 +6,7 @@ import TableRowActions from "./TableRowActions";
import moment from "jalali-moment";
import DataTable from "@/core/components/DataTable";
import MuiDatePicker from "@/core/components/MuiDatePicker";
+import TableToolbar from "@/components/dashboard/passenger-boss/TableToolbar";
function DashboardPassengerOfficeComponent() {
const t = useTranslations();
@@ -161,7 +162,8 @@ function DashboardPassengerOfficeComponent() {
tableUrl={GET_PASSENGER_BOSS}
columns={columns}
selectableRow={false}
- enableCustomToolbar={false}
+ enableCustomToolbar={true}
+ CustomToolbar={TableToolbar}
enableLastUpdate={true}
sorting={[{
id: 'id', desc: false
diff --git a/src/components/dashboard/passenger-office/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/passenger-office/Form/ConfirmForm/ConfirmContent.jsx
index 46a735f..d86c4f2 100644
--- a/src/components/dashboard/passenger-office/Form/ConfirmForm/ConfirmContent.jsx
+++ b/src/components/dashboard/passenger-office/Form/ConfirmForm/ConfirmContent.jsx
@@ -1,12 +1,12 @@
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 {Button, DialogActions, DialogContent, FormHelperText, 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 * as Yup from "yup";
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const t = useTranslations();
@@ -17,11 +17,24 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const requestServer = useRequest({auth: true})
const {update_notification} = useNotification()
+ const validationSchema = Yup.object().shape({
+ confirm_img: Yup.mixed().notRequired(t("ConfirmDialog.approved_amount_error"))
+ .test('fileSize', `${t("PassengerOffice.upload_file_unit")}`, (value) => {
+ if (!value) return true
+ return value.size <= 2 * 1024 * 1024;
+ })
+ .test('fileType', `${t("PassengerOffice.upload_file_format")}`, (value) => {
+ if (!value) return true
+ const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
+ return allowedTypes.includes(value.type);
+ })
+ })
+
const formik = useFormik({
initialValues: {
description: "",
confirm_img: null
- },
+ }, validationSchema,
onSubmit: (values, {setSubmitting}) => {
const formData = new FormData();
if (values.description != "") formData.append("description", values.description);
@@ -47,19 +60,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const handleUploadChange = (event) => {
const uploadedFile = event.target?.files?.[0];
if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
const fileType = event.target?.files?.[0].type;
const fileName = event.target?.files?.[0].name;
setSelectedImage(URL.createObjectURL(uploadedFile));
setfileType(fileType);
setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
+ formik.setFieldValue("confirm_img", uploadedFile).then(() => {
+ formik.setFieldTouched("confirm_img", true);
+ })
setShowAddIcon(false);
}
};
@@ -96,7 +104,17 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
imageSize={[250, 150]}
setShowAddIcon={setShowAddIcon}
showAddIcon={showAddIcon}
+ onBlur={() => formik.handleBlur("confirm_img")}
+ error={
+ formik.touched.confirm_img &&
+ Boolean(formik.errors.confirm_img)
+ }
/>
+
+ {formik.touched.confirm_img && formik.errors.confirm_img}
+
@@ -106,7 +124,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
{t("ConfirmDialog.button-cancel")}
diff --git a/src/components/dashboard/passenger-office/Form/ConfirmForm/index.jsx b/src/components/dashboard/passenger-office/Form/ConfirmForm/index.jsx
index 95a6367..fa47fcf 100644
--- a/src/components/dashboard/passenger-office/Form/ConfirmForm/index.jsx
+++ b/src/components/dashboard/passenger-office/Form/ConfirmForm/index.jsx
@@ -1,9 +1,8 @@
import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
import {useState} from "react";
import ConfirmContent from "./ConfirmContent";
-
+import CallMadeIcon from '@mui/icons-material/CallMade';
const Confirm = ({rowId, mutate}) => {
const t = useTranslations();
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
@@ -16,12 +15,12 @@ const Confirm = ({rowId, mutate}) => {
setOpenConfirmDialog(true)
}}
>
-
+
>
diff --git a/src/components/dashboard/passenger-office/TableTollbar.jsx b/src/components/dashboard/passenger-office/TableTollbar.jsx
deleted file mode 100644
index e267691..0000000
--- a/src/components/dashboard/passenger-office/TableTollbar.jsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import {Stack, Tooltip} from "@mui/material";
-import {useTranslations} from "next-intl";
-
-function TableToolbar() {
- const t = useTranslations();
- return (
-
-
-
- );
-}
-
-export default TableToolbar;
diff --git a/src/components/dashboard/province-head-expert/TableTollbar.jsx b/src/components/dashboard/province-head-expert/TableTollbar.jsx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/components/dashboard/refahi-province-manager/TableTollbar.jsx b/src/components/dashboard/refahi-province-manager/TableTollbar.jsx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/components/dashboard/role-management/Form/DeleteForm.jsx b/src/components/dashboard/role-management/Form/DeleteForm.jsx
index 78319bd..5f2d169 100644
--- a/src/components/dashboard/role-management/Form/DeleteForm.jsx
+++ b/src/components/dashboard/role-management/Form/DeleteForm.jsx
@@ -24,6 +24,7 @@ const DeleteForm = ({rowId, mutate}) => {
const handleSubmit = () => {
setIsSubmitting(true)
requestServer(`${DELETE_ROLE_MANAGEMENT}/${rowId}`, 'delete').then((response) => {
+ setOpenConfirmDialog(false)
mutate()
update_notification()
}).catch(() => {
diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
index 52137c2..0dcec2a 100644
--- a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
+++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
@@ -1,12 +1,12 @@
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 {Button, DialogActions, DialogContent, FormHelperText, 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 * as Yup from "yup";
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const t = useTranslations();
@@ -17,11 +17,24 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const requestServer = useRequest({auth: true})
const {update_notification} = useNotification()
+ const validationSchema = Yup.object().shape({
+ confirm_img: Yup.mixed().notRequired(t("ConfirmDialog.approved_amount_error"))
+ .test('fileSize', `${t("TransportationAssistance.upload_file_unit")}`, (value) => {
+ if (!value) return true
+ return value.size <= 2 * 1024 * 1024;
+ })
+ .test('fileType', `${t("TransportationAssistance.upload_file_format")}`, (value) => {
+ if (!value) return true
+ const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
+ return allowedTypes.includes(value.type);
+ })
+ })
+
const formik = useFormik({
initialValues: {
description: "",
confirm_img: null
- },
+ }, validationSchema,
onSubmit: (values, {setSubmitting}) => {
const formData = new FormData();
if (values.description != "") formData.append("expert_description", values.description);
@@ -47,19 +60,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
const handleUploadChange = (event) => {
const uploadedFile = event.target?.files?.[0];
if (uploadedFile) {
- const maxFileSize = 2 * 1024 * 1024;
- if (uploadedFile.size > maxFileSize) {
- UploadFileNotification(t);
- event.target.value = "";
- return;
- }
-
const fileType = event.target?.files?.[0].type;
const fileName = event.target?.files?.[0].name;
setSelectedImage(URL.createObjectURL(uploadedFile));
setfileType(fileType);
setfileName(fileName);
- formik.setFieldValue("confirm_img", uploadedFile);
+ formik.setFieldValue("confirm_img", uploadedFile).then(() => {
+ formik.setFieldTouched("confirm_img", true);
+ })
setShowAddIcon(false);
}
};
@@ -96,7 +104,17 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
imageSize={[250, 150]}
setShowAddIcon={setShowAddIcon}
showAddIcon={showAddIcon}
+ onBlur={() => formik.handleBlur("confirm_img")}
+ error={
+ formik.touched.confirm_img &&
+ Boolean(formik.errors.confirm_img)
+ }
/>
+
+ {formik.touched.confirm_img && formik.errors.confirm_img}
+
@@ -106,7 +124,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
{t("ConfirmDialog.button-cancel")}
diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/index.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/index.jsx
index 95a6367..2ef7d25 100644
--- a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/index.jsx
+++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/index.jsx
@@ -1,9 +1,8 @@
import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
-import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
import {useState} from "react";
import ConfirmContent from "./ConfirmContent";
-
+import CallMadeIcon from '@mui/icons-material/CallMade';
const Confirm = ({rowId, mutate}) => {
const t = useTranslations();
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
@@ -16,12 +15,12 @@ const Confirm = ({rowId, mutate}) => {
setOpenConfirmDialog(true)
}}
>
-
+
>
diff --git a/src/components/dashboard/transportation-assistance/TableTollbar.jsx b/src/components/dashboard/transportation-assistance/TableTollbar.jsx
deleted file mode 100644
index e267691..0000000
--- a/src/components/dashboard/transportation-assistance/TableTollbar.jsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import {Stack, Tooltip} from "@mui/material";
-import {useTranslations} from "next-intl";
-
-function TableToolbar() {
- const t = useTranslations();
- return (
-
-
-
- );
-}
-
-export default TableToolbar;
diff --git a/src/components/layouts/Dashboard/Content/index.jsx b/src/components/layouts/Dashboard/Content/index.jsx
new file mode 100644
index 0000000..e3f39db
--- /dev/null
+++ b/src/components/layouts/Dashboard/Content/index.jsx
@@ -0,0 +1,65 @@
+import LoadingHardPage from "@/core/components/LoadingHardPage";
+import RolePermissionMiddleware from "@/middlewares/RolePermission";
+import BreadCrumbs from "@/components/layouts/Dashboard/Breadcrumbs";
+import FullPageLayout from "@/layouts/FullPageLayout";
+import {useEffect, useMemo, useState} from "react";
+import sidebarMenu from "@/core/data/sidebarMenu";
+import {useRouter} from "next/router";
+import {useTranslations} from "next-intl";
+
+const Content = (props) => {
+ const t = useTranslations()
+ const router = useRouter()
+ const [routing, setRouting] = useState(false)
+ const [routingItem, setRoutingItem] = useState({})
+ const pageList = useMemo(() => {
+ const list = []
+ for (const menu of sidebarMenu) {
+ for (const item of menu) {
+ if (item.type === 'menu') {
+ for (const subItem of item.subItem) {
+ list.push(subItem)
+ }
+ } else {
+ list.push(item)
+ }
+ }
+ }
+
+ return list
+ }, [])
+
+ useEffect(() => {
+ const handlerStartRoute = (url) => {
+ setRoutingItem(pageList.find(page => page.route === url))
+ setRouting(true)
+ }
+ const handlerCompleteRoute = () => {
+ setRouting(false)
+ }
+
+ router.events.on('routeChangeStart', handlerStartRoute)
+ router.events.on('routeChangeComplete', handlerCompleteRoute)
+
+ return () => {
+ router.events.off('routeChangeStart', handlerStartRoute)
+ router.events.off('routeChangeComplete', handlerCompleteRoute)
+ }
+ }, [router]);
+
+ return (
+
+
+
+
+ {props.children}
+
+
+
+ )
+}
+
+export default Content
\ No newline at end of file
diff --git a/src/components/layouts/Dashboard/Header/index.jsx b/src/components/layouts/Dashboard/Header/index.jsx
index 8760960..8050806 100644
--- a/src/components/layouts/Dashboard/Header/index.jsx
+++ b/src/components/layouts/Dashboard/Header/index.jsx
@@ -1,5 +1,5 @@
import MenuIcon from "@mui/icons-material/Menu";
-import {AppBar, Box, Container, CssBaseline, IconButton, Stack, Toolbar, useTheme} from "@mui/material";
+import {AppBar, Box, Container, IconButton, Stack, Toolbar, useTheme} from "@mui/material";
import ProfileMenu from "./ProfileMenu";
function Header({drawerWidth, handleDrawerToggle}) {
@@ -7,7 +7,6 @@ function Header({drawerWidth, handleDrawerToggle}) {
return (
<>
-
itemsArr.map((item) =>
- action.key === item.key ? { ...item, showSubItem: !item.showSubItem } : item
+ action.key === item.key ? {...item, showSubItem: !item.showSubItem} : item
)
);
case "SELECTED":
return state.map((itemsArr) =>
itemsArr.map((item) => {
return item.type === "page"
- ? { ...item, selected: action.route === item.route }
+ ? {...item, selected: action.route === item.route, routing: false}
: item.subItem && Array.isArray(item.subItem)
? {
...item,
subItem: item.subItem.map((subitem) => ({
...subitem,
selected: subitem.route === action.route,
+ routing: false
+ })),
+ showSubItem: item.subItem.some(
+ (subitem) => subitem.selected
+ ),
+ }
+ : item;
+ })
+ );
+ case "SELECTING":
+ return state.map((itemsArr) =>
+ itemsArr.map((item) => {
+ return item.type === "page"
+ ? {...item, selected: action.route === item.route, routing: action.route === item.route}
+ : item.subItem && Array.isArray(item.subItem)
+ ? {
+ ...item,
+ subItem: item.subItem.map((subitem) => ({
+ ...subitem,
+ selected: subitem.route === action.route,
+ routing: subitem.route === action.route
})),
showSubItem: item.subItem.some(
(subitem) => subitem.selected
@@ -46,7 +67,16 @@ export default function SidebarList({handleDrawerToggle}) {
useEffect(() => {
dispatch({type: "SELECTED", route: router.pathname});
setSelectedKey(router.pathname);
- }, [router.pathname]);
+ const handlerStartRoute = (url) => {
+ dispatch({type: "SELECTING", route: url});
+ }
+
+ router.events.on('routeChangeStart', handlerStartRoute)
+
+ return () => {
+ router.events.off('routeChangeStart', handlerStartRoute)
+ }
+ }, [router]);
useEffect(() => {
@@ -57,7 +87,7 @@ export default function SidebarList({handleDrawerToggle}) {
}, [selectedKey]);
return (
-
+
{itemMenu.map((itemArr, index) => (
{itemArr.map((item) =>
diff --git a/src/components/layouts/Dashboard/Sidebar/SidebarListItem.jsx b/src/components/layouts/Dashboard/Sidebar/SidebarListItem.jsx
index e9657a9..81fd444 100644
--- a/src/components/layouts/Dashboard/Sidebar/SidebarListItem.jsx
+++ b/src/components/layouts/Dashboard/Sidebar/SidebarListItem.jsx
@@ -1,7 +1,16 @@
import {NextLinkComposed} from "@/core/components/LinkRouting";
import ExpandLess from "@mui/icons-material/ExpandLess";
import ExpandMore from "@mui/icons-material/ExpandMore";
-import {Badge, IconButton, ListItem, ListItemButton, ListItemIcon, ListItemText, Typography,} from "@mui/material";
+import {
+ Badge,
+ CircularProgress,
+ IconButton,
+ ListItem,
+ ListItemButton,
+ ListItemIcon,
+ ListItemText,
+ Typography,
+} from "@mui/material";
import {useTranslations} from "next-intl";
import {Fragment} from "react";
import SidebarListSubItem from "./SidebarListSubItem";
@@ -9,7 +18,7 @@ import useNotification from "@/lib/app/hooks/useNotification";
const SidebarListItem = ({item, dispatch, handleDrawerToggle}) => {
const t = useTranslations();
- const { notification_count } = useNotification();
+ const {notification_count} = useNotification();
const hasSubItems = item.type === "menu" && item.subItem && item.subItem.length > 0;
const renderBadge = () => {
return !hasSubItems ? (
@@ -40,7 +49,7 @@ const SidebarListItem = ({item, dispatch, handleDrawerToggle}) => {
})}
onClick={() => {
if (hasSubItems) {
- dispatch({ type: "COLLAPSE_MENU", key: item.key });
+ dispatch({type: "COLLAPSE_MENU", key: item.key});
}
}}
sx={{
@@ -53,10 +62,13 @@ const SidebarListItem = ({item, dispatch, handleDrawerToggle}) => {
minWidth: 0,
justifyContent: "center",
color: "primary.main",
+ width: 40,
+ height: 24,
pr: 2,
}}
>
- {item.icon}
+ {item.routing ?
+ : item.icon}
{
}
/>
- {hasSubItems && (item.showSubItem ? : )}
+ {hasSubItems && (item.showSubItem ? : )}
{item.subItem && (
diff --git a/src/components/layouts/Dashboard/Sidebar/SidebarListSubItem.jsx b/src/components/layouts/Dashboard/Sidebar/SidebarListSubItem.jsx
index d663d2c..3ef8731 100644
--- a/src/components/layouts/Dashboard/Sidebar/SidebarListSubItem.jsx
+++ b/src/components/layouts/Dashboard/Sidebar/SidebarListSubItem.jsx
@@ -1,6 +1,7 @@
import {NextLinkComposed} from "@/core/components/LinkRouting";
import {
Badge,
+ CircularProgress,
Collapse,
IconButton,
List,
@@ -13,7 +14,7 @@ import {
import {useTranslations} from "next-intl";
import useNotification from "@/lib/app/hooks/useNotification";
-const SidebarListSubItem = ({item, handleDrawerToggle }) => {
+const SidebarListSubItem = ({item, handleDrawerToggle}) => {
const t = useTranslations();
const {notification_count} = useNotification();
const renderBadge = (subitem) => (
@@ -50,10 +51,13 @@ const SidebarListSubItem = ({item, handleDrawerToggle }) => {
sx={{
minWidth: 0,
justifyContent: "center",
+ width: 40,
+ height: 24,
pr: 2,
}}
>
- {subitem.icon}
+ {subitem.routing ?
+ : subitem.icon}
{
+ const theme = useTheme();
+ const isUpSm = useMediaQuery((theme.breakpoints.up('sm')))
return (
+ > {isUpSm ? (
+
+
+
+ ) : (
{
>
-
-
-
+ )}
);
};
diff --git a/src/components/layouts/Dashboard/index.jsx b/src/components/layouts/Dashboard/index.jsx
index 953dd3c..ef3f3bd 100644
--- a/src/components/layouts/Dashboard/index.jsx
+++ b/src/components/layouts/Dashboard/index.jsx
@@ -1,10 +1,9 @@
import {useState} from "react";
import {Toolbar} from "@mui/material";
import FullPageLayout from "@/layouts/FullPageLayout";
-import RolePermissionMiddleware from "@/middlewares/RolePermission";
import Header from "@/components/layouts/Dashboard/Header";
import Sidebar from "@/components/layouts/Dashboard/Sidebar";
-import BreadCrumbs from "@/components/layouts/Dashboard/Breadcrumbs";
+import Content from "@/components/layouts/Dashboard/Content";
const drawerWidth = 240;
@@ -17,6 +16,7 @@ const DashboardLayouts = (props) => {
const handleDrawerToggle = () => {
setMobileOpen(!mobileOpen);
};
+
return (
{
sx={{flexGrow: 1, width: {sm: `calc(100% - ${drawerWidth}px)`}}}
>
-
-
-
- {props.children}
-
-
+
);
diff --git a/src/components/layouts/Print/Header/ProfileData.jsx b/src/components/layouts/Print/Header/ProfileData.jsx
new file mode 100644
index 0000000..548378b
--- /dev/null
+++ b/src/components/layouts/Print/Header/ProfileData.jsx
@@ -0,0 +1,18 @@
+import {Avatar, Stack, Typography} from "@mui/material";
+import useUser from "@/lib/app/hooks/useUser";
+
+export default function ProfileData() {
+ const {user} = useUser();
+ return (
+
+
+
+ {user.username}
+
+
+ );
+}
diff --git a/src/components/layouts/Print/Header/ProfileMenu.jsx b/src/components/layouts/Print/Header/ProfileMenu.jsx
new file mode 100644
index 0000000..415d501
--- /dev/null
+++ b/src/components/layouts/Print/Header/ProfileMenu.jsx
@@ -0,0 +1,62 @@
+import {Avatar, IconButton, Menu, Tooltip} from "@mui/material";
+import {useState} from "react";
+import ProfileData from "./ProfileData";
+import ProfileOptions from "./ProfileOptions";
+import {useTranslations} from "next-intl";
+import useUser from "@/lib/app/hooks/useUser";
+
+function ProfileMenu() {
+ const t = useTranslations();
+ const [anchorElUser, setAnchorElUser] = useState(null);
+ const {user} = useUser();
+
+ const handleOpenUserMenu = (event) => {
+ setAnchorElUser(event.currentTarget);
+ };
+ const handleCloseUserMenu = () => {
+ setAnchorElUser(null);
+ };
+
+ return (
+ <>
+
+
+
+
+
+
+ >
+ );
+}
+
+export default ProfileMenu;
diff --git a/src/components/layouts/Print/Header/ProfileOptionLogOut.jsx b/src/components/layouts/Print/Header/ProfileOptionLogOut.jsx
new file mode 100644
index 0000000..2a6cf85
--- /dev/null
+++ b/src/components/layouts/Print/Header/ProfileOptionLogOut.jsx
@@ -0,0 +1,49 @@
+import {Box, Button, MenuItem, Typography} from "@mui/material";
+import MeetingRoomIcon from "@mui/icons-material/MeetingRoom";
+import useUser from "@/lib/app/hooks/useUser";
+import {useTranslations} from "next-intl";
+
+export default function ProfileOptionLogOut({handleCloseUserMenu}) {
+ const t = useTranslations();
+ const {clearToken} = useUser();
+ const handleClickLogOut = () => {
+ handleCloseUserMenu();
+ clearToken();
+ };
+ return (
+ <>
+
+ >
+ );
+}
diff --git a/src/components/layouts/Print/Header/ProfileOptions.jsx b/src/components/layouts/Print/Header/ProfileOptions.jsx
new file mode 100644
index 0000000..6e7bdba
--- /dev/null
+++ b/src/components/layouts/Print/Header/ProfileOptions.jsx
@@ -0,0 +1,49 @@
+import {Box, MenuItem, Typography} from "@mui/material";
+import {NextLinkComposed} from "@/core/components/LinkRouting";
+import {useTranslations} from "next-intl";
+import headerProfileItems from "@/core/data/headerProfileItems";
+import ProfileOptionLogOut from "./ProfileOptionLogOut";
+
+export default function ProfileOptions({handleCloseUserMenu}) {
+ const t = useTranslations();
+
+ return (
+ <>
+ {headerProfileItems.map((profile_item) => (
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/components/layouts/Print/Header/index.jsx b/src/components/layouts/Print/Header/index.jsx
new file mode 100644
index 0000000..7c0d990
--- /dev/null
+++ b/src/components/layouts/Print/Header/index.jsx
@@ -0,0 +1,72 @@
+import {AppBar, Button, Container, Stack, Toolbar, Typography, useTheme} from "@mui/material";
+import {useTranslations} from "next-intl";
+import {useRouter} from "next/router";
+import {useState} from "react";
+import usePrint from "@/lib/app/hooks/usePrint";
+
+function Header({drawerWidth, handleDrawerToggle}) {
+ const theme = useTheme();
+ const t = useTranslations()
+ const router = useRouter()
+ const {printDetails} = usePrint()
+ const [disabled, setDisabled] = useState(false)
+
+ return (
+
+
+
+
+
+
+
+ {printDetails.title}
+ {'تعداد صفحه:'} {printDetails.count}
+
+
+
+
+
+
+
+ );
+}
+
+export default Header;
\ No newline at end of file
diff --git a/src/components/layouts/Print/index.jsx b/src/components/layouts/Print/index.jsx
new file mode 100644
index 0000000..afa6585
--- /dev/null
+++ b/src/components/layouts/Print/index.jsx
@@ -0,0 +1,14 @@
+import Header from "@/components/layouts/Print/Header";
+import {Toolbar} from "@mui/material";
+
+const Print = (props) => {
+ return (
+ <>
+
+
+ {props.children}
+ >
+ )
+}
+
+export default Print
\ No newline at end of file
diff --git a/src/core/components/LoadingHardPage.jsx b/src/core/components/LoadingHardPage.jsx
index c3b24d6..59e4a02 100644
--- a/src/core/components/LoadingHardPage.jsx
+++ b/src/core/components/LoadingHardPage.jsx
@@ -1,4 +1,4 @@
-import {Backdrop, Box, styled} from "@mui/material";
+import {Backdrop, Box, Stack, styled, Typography} from "@mui/material";
import SvgLoading from "@/core/components/svgs/SvgLoading";
const LoadingImage = styled(Box)({
@@ -9,7 +9,7 @@ const LoadingImage = styled(Box)({
},
"50%": {
// opacity: 1,
- transform: "scale(2)",
+ transform: "scale(.5)",
},
"100%": {
// opacity: 0,
@@ -19,20 +19,29 @@ const LoadingImage = styled(Box)({
animation: "load 2s infinite",
});
-const LoadingHardPage = ({children, loading}) => {
+const LoadingHardPage = ({children, loading, sx = {}, icon = null, width = 200, height = 200, label = ''}) => {
return (
<>
theme.zIndex.drawer + 1}}
+ sx={{bgcolor: "#fff", zIndex: (theme) => theme.zIndex.drawer + 1, ...sx}}
open={loading}
>
-
-
-
+
+
+ {icon ? (
+
+ {icon}
+
+ ) : (
+
+ )}
+
+ {label}
+
{children}
>
diff --git a/src/core/components/LtrTextField.jsx b/src/core/components/LtrTextField.jsx
new file mode 100644
index 0000000..aa9efcb
--- /dev/null
+++ b/src/core/components/LtrTextField.jsx
@@ -0,0 +1,11 @@
+import {styled, TextField} from "@mui/material";
+
+const LtrTextField = styled(TextField)`
+ .MuiInputBase-input {
+ /* @noflip */
+ direction: ltr;
+ text-align: left;
+ }
+`;
+
+export default LtrTextField
\ No newline at end of file
diff --git a/src/core/components/NetworkComponent.jsx b/src/core/components/NetworkComponent.jsx
index 8ebbb68..9610b1c 100644
--- a/src/core/components/NetworkComponent.jsx
+++ b/src/core/components/NetworkComponent.jsx
@@ -6,13 +6,13 @@ import WifiOffIcon from '@mui/icons-material/WifiOff';
import {useTranslations} from "next-intl";
const NetworkComponent = () => {
- const toastId = useRef(null);
+ const networkToastId = useRef(null);
const network = useNetwork()
const t = useTranslations()
useEffect(() => {
if (network.online) {
- toast.update(toastId.current, {
+ toast.update(networkToastId.current, {
type: toast.TYPE.SUCCESS,
render: t('online_message'),
autoClose: 2000,
@@ -22,8 +22,9 @@ const NetworkComponent = () => {
});
return
}
- toast.dismiss()
- toastId.current = toast.warn(t('offline_message'), {
+ networkToastId.current = toast.warn(t('offline_message'), {
+ containerId: 'connection',
+ draggable: false,
autoClose: false, closeButton: false, closeOnClick: false, icon:
})
}, [network.online]);
diff --git a/src/core/components/PriceField.jsx b/src/core/components/PriceField.jsx
index e62e4e1..1df1ba2 100644
--- a/src/core/components/PriceField.jsx
+++ b/src/core/components/PriceField.jsx
@@ -1,12 +1,13 @@
-import {Stack, TextField, Typography} from "@mui/material";
+import {Stack, Typography} from "@mui/material";
import {useTranslations} from "next-intl";
+import LtrTextField from "@/core/components/LtrTextField";
const PriceField = (props) => {
const t = useTranslations();
return (
-
diff --git a/src/core/components/PrintablePage.jsx b/src/core/components/PrintablePage.jsx
new file mode 100644
index 0000000..70a264b
--- /dev/null
+++ b/src/core/components/PrintablePage.jsx
@@ -0,0 +1,82 @@
+import {Box, Container, Divider, Grid, Paper, Stack, Typography} from '@mui/material';
+
+const PrintablePage = ({children, header, footer}) => (
+ <>
+
+
+
+
+
+
+
+
+
+ باسمه تعالی
+ جمهوری اسلامی ایران
+ وزارت راه و
+ شهرسازی
+ سازمان
+ راهداری و حمل و نقل جاده
+ ای
+
+
+
+ شماره:
+ تاریخ:
+ پیوست:
+
+
+
+
+ {children}
+
+
+
+
+
+ آدرس: تهران-بلوار
+ کشاورز-خیابان فلسطین جنوبی-خیابان
+ دمشق-پلاک17
+ تلفن: 88-88804379
+ تلفن گویا: 88804400
+ کدپستی: 1416753941
+
+
+ صندوق پستی: 3773-14155
+ پست الکترونیک: info@rmto.ir
+ سایت الکترونیک: www.rmto.ir
+
+
+
+
+
+ >
+);
+
+export default PrintablePage;
\ No newline at end of file
diff --git a/src/core/components/UploadSystem.jsx b/src/core/components/UploadSystem.jsx
index b40fb46..ea573d7 100644
--- a/src/core/components/UploadSystem.jsx
+++ b/src/core/components/UploadSystem.jsx
@@ -10,7 +10,6 @@ const UploadSystem = ({
handleUploadChange,
fieldname,
setFieldValue,
- imageAlt,
imageSize,
fileType,
fileName,
@@ -19,7 +18,6 @@ const UploadSystem = ({
}) => {
const t = useTranslations();
const fileInputRef = useRef(null);
-
const handleClick = () => {
fileInputRef.current.click();
};
@@ -69,13 +67,14 @@ const UploadSystem = ({
variant="subtitle2"
sx={{
fontWeight: 600,
- fontSize: "1rem",
+ fontSize: "0.8rem",
color: "#a19d9d",
mt: 1,
}}
textAlign="center"
>
- {t("UploadSystem.upload_file")}
+ {t("UploadSystem.upload_file_format")}
+ {t("UploadSystem.upload_file_unit")}
>
diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx
index db8e0b8..c54bbca 100644
--- a/src/core/data/sidebarMenu.jsx
+++ b/src/core/data/sidebarMenu.jsx
@@ -20,7 +20,7 @@ const sidebarMenu = [
key: "sidebar.dashboard",
type: "page",
route: "/dashboard",
- icon: ,
+ icon: ,
selected: false,
permission: "all",
},
@@ -30,7 +30,7 @@ const sidebarMenu = [
name: "passenger_office_chief",
type: "page",
route: "/dashboard/passenger-office-chief",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_passenger_office_navgan",
},
@@ -39,7 +39,7 @@ const sidebarMenu = [
name: "machinery_expert",
type: "page",
route: "/dashboard/machinery-expert",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_machinery_navgan",
},
@@ -49,7 +49,7 @@ const sidebarMenu = [
name: "province_working_group",
type: "page",
route: "/dashboard/passenger-boss",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_province_working_group_navgan",
},
@@ -59,7 +59,7 @@ const sidebarMenu = [
name: "transportation_assistant",
type: "page",
route: "/dashboard/transportation-assistant",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_transportation_navgan",
},
@@ -69,7 +69,7 @@ const sidebarMenu = [
name: "province_manager_navgan",
type: "page",
route: "/dashboard/navgan-province-manager",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_province_affairs_navgan",
},
@@ -78,7 +78,7 @@ const sidebarMenu = [
name: "province_head_expert",
type: "page",
route: "/dashboard/province-head-expert",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_province_headquarter_refahi",
},
@@ -87,7 +87,7 @@ const sidebarMenu = [
name: "inspector_expert",
type: "page",
route: "/dashboard/inspector-expert",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_inspector_refahi",
},
@@ -96,7 +96,7 @@ const sidebarMenu = [
name: "commercial_chief",
type: "page",
route: "/dashboard/commercial-chief",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_commercial_refahi",
},
@@ -105,7 +105,7 @@ const sidebarMenu = [
name: "development_assistant",
type: "page",
route: "/dashboard/development-assistant",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_development_refahi",
},
@@ -115,7 +115,7 @@ const sidebarMenu = [
name: "province_manager_refahi",
type: "page",
route: "/dashboard/refahi-province-manager",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_province_affairs_refahi",
},
@@ -125,7 +125,7 @@ const sidebarMenu = [
name: "refahi_loan_management",
type: "page",
route: "/dashboard/refahi-loan-management",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_refahi_loan",
},
@@ -135,7 +135,7 @@ const sidebarMenu = [
name: "navgan_loan_management",
type: "page",
route: "/dashboard/navgan-loan-management",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_navgan_loan",
},
@@ -144,7 +144,7 @@ const sidebarMenu = [
name: "expert_management",
type: "page",
route: "/dashboard/expert-management",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_navgan_loan",
},
@@ -153,7 +153,7 @@ const sidebarMenu = [
name: "user_management",
type: "page",
route: "/dashboard/user-management",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_users",
},
@@ -162,7 +162,7 @@ const sidebarMenu = [
name: "role_management",
type: "page",
route: "/dashboard/role-management",
- icon: ,
+ icon: ,
selected: false,
permission: "manage_roles",
},
diff --git a/src/layouts/AppLayout.jsx b/src/layouts/AppLayout.jsx
index 4fc5e1d..5c01881 100644
--- a/src/layouts/AppLayout.jsx
+++ b/src/layouts/AppLayout.jsx
@@ -47,7 +47,16 @@ function AppLayout({children, isBot}) {
color={theme.palette.secondary.dark}
options={{showSpinner: false}}
/>
-
+
+
{children}
>);
diff --git a/src/layouts/PrintLayout.jsx b/src/layouts/PrintLayout.jsx
new file mode 100644
index 0000000..301a161
--- /dev/null
+++ b/src/layouts/PrintLayout.jsx
@@ -0,0 +1,12 @@
+import WithAuthMiddleware from "@/middlewares/WithAuth";
+import Print from "@/components/layouts/Print";
+
+const PrintLayout = (props) => {
+ return (
+
+
+
+ )
+}
+
+export default PrintLayout
\ No newline at end of file
diff --git a/src/layouts/index.jsx b/src/layouts/index.jsx
index 4d4ed7f..a69d886 100644
--- a/src/layouts/index.jsx
+++ b/src/layouts/index.jsx
@@ -1,8 +1,10 @@
import DashboardLayout from "@/layouts/DashboardLayout";
import {Fragment} from "react";
+import PrintLayout from "@/layouts/PrintLayout";
const layoutList = {
- DashboardLayout
+ DashboardLayout,
+ PrintLayout
}
const Layout = ({layout = {}, children}) => {
diff --git a/src/lib/app/contexts/print.jsx b/src/lib/app/contexts/print.jsx
new file mode 100644
index 0000000..20fd1dc
--- /dev/null
+++ b/src/lib/app/contexts/print.jsx
@@ -0,0 +1,24 @@
+import {createContext, useReducer} from "react";
+
+export const PrintContext = createContext();
+
+const reducer = (state, action) => {
+ switch (action.type) {
+ case "SET_PRINT_PAGE":
+ return {
+ ...state, count: action.count
+ };
+ case "SET_PRINT_TITLE":
+ return {
+ ...state, title: action.title
+ };
+ }
+};
+export const PrintProvider = ({children}) => {
+ const [printDetails, printDispatch] = useReducer(reducer, {title: '', count: 0});
+ return (
+
+ {children}
+
+ );
+};
\ No newline at end of file
diff --git a/src/lib/app/hooks/usePrint.jsx b/src/lib/app/hooks/usePrint.jsx
new file mode 100644
index 0000000..35a1017
--- /dev/null
+++ b/src/lib/app/hooks/usePrint.jsx
@@ -0,0 +1,18 @@
+import {useContext} from "react";
+import {PrintContext} from "@/lib/app/contexts/print";
+
+const usePrint = () => {
+ const {printDetails, printDispatch} = useContext(PrintContext);
+
+ const setPrintPage = (count) => {
+ printDispatch({type: 'SET_PRINT_PAGE', count})
+ }
+
+ const setPrintTitle = (title) => {
+ printDispatch({type: 'SET_PRINT_TITLE', title})
+ }
+
+ return {printDetails, setPrintPage, setPrintTitle}
+};
+
+export default usePrint;
\ No newline at end of file
diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx
index 8d2f3b0..9824687 100644
--- a/src/pages/_app.jsx
+++ b/src/pages/_app.jsx
@@ -9,6 +9,7 @@ import {NextIntlProvider} from "next-intl";
import TitlePage from "@/core/components/TitlePage";
import Layout from "@/layouts";
import {ToastProvider} from "@/lib/app/contexts/toast";
+import {PrintProvider} from "@/lib/app/contexts/print";
const App = ({Component, pageProps}) => {
@@ -22,9 +23,11 @@ const App = ({Component, pageProps}) => {
-
-
-
+
+
+
+
+
diff --git a/src/pages/dashboard/machinery-expert/prints/report.jsx b/src/pages/dashboard/machinery-expert/prints/report.jsx
new file mode 100644
index 0000000..526851b
--- /dev/null
+++ b/src/pages/dashboard/machinery-expert/prints/report.jsx
@@ -0,0 +1,21 @@
+import {parse} from "next-useragent";
+import ReportComponent from "@/components/dashboard/machinary-office/Prints/report";
+
+export default function Report() {
+ return (
+
+ )
+}
+
+export async function getServerSideProps({req, locale}) {
+ const {isBot} = parse(req.headers["user-agent"]);
+ return {
+ props: {
+ messages: (await import(`&/locales/${locale}/app.json`)).default,
+ title: "Dashboard.machinary_office_page",
+ isBot,
+ locale,
+ layout: {name: 'PrintLayout'}
+ },
+ };
+}
\ No newline at end of file
diff --git a/src/pages/dashboard/passenger-boss/prints/final-credit-amount.jsx b/src/pages/dashboard/passenger-boss/prints/final-credit-amount.jsx
new file mode 100644
index 0000000..0bd763b
--- /dev/null
+++ b/src/pages/dashboard/passenger-boss/prints/final-credit-amount.jsx
@@ -0,0 +1,21 @@
+import {parse} from "next-useragent";
+import FinalCreditAmountComponent from "@/components/dashboard/passenger-boss/Prints/final-credit-amount";
+
+export default function FinalCreditAmount() {
+ return (
+
+ )
+}
+
+export async function getServerSideProps({req, locale}) {
+ const {isBot} = parse(req.headers["user-agent"]);
+ return {
+ props: {
+ messages: (await import(`&/locales/${locale}/app.json`)).default,
+ title: "Dashboard.passenger_boss_page",
+ isBot,
+ locale,
+ layout: {name: 'PrintLayout'}
+ },
+ };
+}
\ No newline at end of file