Merge branch 'release/v1.18.2'

This commit is contained in:
AmirHossein Mahmoodi
2023-11-15 10:38:25 +03:30
69 changed files with 1371 additions and 314 deletions

View File

@@ -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"

View File

@@ -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');
}

Binary file not shown.

BIN
public/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="611.781" height="634.738" viewBox="0 0 611.781 634.738">
<g id="Group_67" data-name="Group 67" transform="translate(17717.998 5548)">
<g id="Group_35" data-name="Group 35" transform="translate(-18337.291 -5635.72)">
<path id="Path_5" data-name="Path 5"
d="M126.892,461.042c-1.676-6.24-3.057-12-4.776-17.668-6.5-21.426-17.146-40.936-27.846-60.456-10.362-18.9-20.22-38.081-30.31-57.132-.389-.734-.9-1.406-1.791-2.8C36.884,364.062,18.983,407.918,1.474,451.962l-1.21-.256a8.878,8.878,0,0,1-.214-2.524c2.581-12.372,4.479-24.951,8.05-37.034a334.761,334.761,0,0,1,13.91-37.364Q35.923,342.5,51.02,310.733c3.525-7.389,1.922-13.976.051-20.991a185.716,185.716,0,0,1-6.18-54.9,183.572,183.572,0,0,1,21.089-78.7A248.249,248.249,0,0,1,132.8,75.26a320,320,0,0,1,59.11-36.67c23.209-11.317,47.033-21.1,72.336-26.513A487.808,487.808,0,0,1,314.282,3.7C333.731,1.624,353.352,1.16,372.9.018a22,22,0,0,1,3.3.145c.4.037.775.291,1.236,1.13L360.926,4.642c-26.4,5.318-52.988,9.831-79.147,16.136a295.335,295.335,0,0,0-105.32,48.21c-24.648,17.9-45.935,39.123-61.823,65.3-11.419,18.813-17.813,39.38-20.064,61.275-1.445,14.062-1.024,28.1.166,42.133a44.216,44.216,0,0,0,1,4.8c1.418-1.165,2.427-1.875,3.3-2.728,10.2-10.038,20.041-20.48,30.661-30.055,14.1-12.713,29.419-23.882,46.9-31.678,21.42-9.55,43.69-13.568,66.553-6.9,10.553,3.079,20.531,8.393,30.44,13.353,20.075,10.051,39.841,20.721,59.892,30.821a182.512,182.512,0,0,0,68.478,19.421c33.07,2.549,64.407-3.894,93.662-19.748,25.04-13.571,46.544-31.674,66.252-52.041,15.44-15.956,28.916-33.487,41.494-51.746,2.217-3.219,4.962-6.073,7.463-9.1l.983.382a15.039,15.039,0,0,1-.828,3.67c-3.9,7.643-7.67,15.361-11.911,22.812-17.8,31.272-39.019,60-64.85,85.13-26.732,26.009-56.556,47.619-90.953,62.526a162.5,162.5,0,0,1-74.241,14.106c-24.876-.775-48.015,5.5-69.742,17.063-14.861,7.91-29.333,16.559-43.879,25.049-13.773,8.039-28.189,13.431-44.484,11.949-2.667-.242-2.49,1.854-2.988,3.479-2.151,7.019-3.92,14.193-6.627,20.993-3.8,9.547-10.327,17.4-17.557,24.572-15.526,15.4-28.738,32.778-42.59,49.608-4.68,5.687-9.284,11.436-14.28,17.6M284.4,266.987c-.334-.819-.375-1.206-.591-1.393a13.8,13.8,0,0,0-1.854-1.356c-22.793-13.885-46.277-26.286-71.807-34.532-20.915-6.755-41.455-6.841-61.848,1.941-15.741,6.779-28.925,17.112-41,29.01-5.591,5.508-5.981,8.93-2.421,15.921q12.355,24.272,24.657,48.572c10.087,19.93,20.125,39.886,30.279,59.783.543,1.062,1.967,1.674,2.98,2.5a12.859,12.859,0,0,0,1.933-3.081,49.022,49.022,0,0,0-2.4-33.292c-6.476-14.911-14.075-29.337-21.275-43.93-4.967-10.065-10.144-20.026-15.07-30.112-1.63-3.338-2.558-6.917.574-10.1,10.226-10.371,22.1-18.1,36.115-22.335,3.993-1.206,5.77-.416,7.975,3.16,3.927,6.365,7.687,12.846,11.888,19.028,9.727,14.31,23.437,21.051,40.7,20.974,16.93-.075,32.491-5.033,47.273-12.854,4.715-2.495,9.282-5.27,13.894-7.9"
transform="translate(619.257 87.713)" fill="#231955"/>
<path id="Path_6" data-name="Path 6"
d="M104.479,767.41c2.322-11.049,4.27-22.193,7.046-33.127,5.72-22.532,15.277-43.572,26.263-63.957,16.423-30.474,34.631-59.844,55.63-87.405,20.939-27.481,43.511-53.464,70.53-75.261,24.13-19.467,50.887-33.842,81.027-41.582,4.676-1.2,9.437-2.118,14.2-2.939a15,15,0,0,0,11.744-9.6c4.286-10.252,11.9-14.085,22.732-13.761a202.3,202.3,0,0,0,89.232-17.644A257.328,257.328,0,0,0,528.458,395.6c1.4-1.009,2.885-1.912,5.222-3.451-.953,3.026-1.265,5.258-2.293,7.089-14.936,26.6-31.633,51.891-54.057,72.956-18.879,17.734-40.265,31.046-65.744,36.862-15.1,3.446-30.348,6.253-45.529,9.349-18.622,3.8-37.406,6.945-55.825,11.553-27.566,6.9-51.782,20.673-73.654,38.685-23.608,19.441-42.473,43.054-59.8,68-24.96,35.939-44.814,74.717-63.24,114.278q-3.9,8.368-7.793,16.738l-1.263-.245"
transform="translate(583.845 -45.198)" fill="#231955"/>
<path id="Path_7" data-name="Path 7"
d="M405.392,690.855l-53.546,54.494-55.389-51.215,55.1-53.062L405.4,690.854"
transform="translate(518.777 -129.57)" fill="#ff9100"/>
</g>
<text id="MARHABA" transform="translate(-17322 -4931)" fill="#bcbcbc" font-size="50"
font-family="Montserrat-ExtraBold, Montserrat" font-weight="800">
<tspan x="-281.35" y="0">MARHABA</tspan>
</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -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": " نیاز به ویرایش",

9
public/print.scss Normal file
View File

@@ -0,0 +1,9 @@
@media print {
body {
margin: 0;
padding: 0;
}
@page {
size: A4;
}
}

View File

@@ -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 = () => {
<Typography margin={2} variant="h4" textAlign="center">
{t("UpdateProfile.typography_edit_profile")}
</Typography>
<Box
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
}}
>
<AvatarUpload
user={user}
setFieldValue={props.setFieldValue}
valueAvatar="expert_avatar"
changeFlag="change_avatar"
/>
</Box>
<Grid container spacing={2} sx={{pb: 2}}>
<Grid item xs={12} sm={6}>
<Field

View File

@@ -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_MACHINARY_OFFICE} from "@/core/data/apiRoutes";
import usePrint from "@/lib/app/hooks/usePrint";
const PrintReport = () => {
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 (
<Button
color="primary"
variant="contained"
size="small"
disabled={loading}
sx={{textTransform: "unset", alignSelf: "center"}}
startIcon={loading ? <CircularProgress size={18} color="inherit"/> : <PrintIcon/>}
onClick={clickHandler}
>
{t("MachinaryOffice.print_report")}
</Button>
)
}
export default PrintReport

View File

@@ -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}) => {
/>
</Stack>
<Stack>
<Typography>{t("UploadSystem.upload_file")}{t("UploadSystem.optional")}</Typography>
<Typography>{t("MachinaryOffice.upload_file")}</Typography>
<UploadSystem
selectedImage={selectedImage}
handleUploadChange={handleUploadChange} // Pass the updated function directly
@@ -140,9 +147,19 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
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}
/>
<FormHelperText
error={Boolean(formik.errors.confirm_img)}
>
{formik.touched.confirm_img && formik.errors.confirm_img}
</FormHelperText>
</Stack>
</Stack>
</DialogContent>

View File

@@ -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)
}}
>
<ThumbUpAltIcon/>
<CallMadeIcon/>
</IconButton>
</Tooltip>
<Dialog fullWidth open={openConfirmDialog}
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
<DialogTitle>{t("MachinaryOffice.confirm")}</DialogTitle>
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}
vehicle_type={vehicle_type}/>
</Dialog>
</>
)

View File

@@ -0,0 +1,96 @@
import PrintablePage from "@/core/components/PrintablePage";
import {Box, Stack, Typography} from "@mui/material";
const Content = ({data}) => {
return (
<>
<PrintablePage key={data.id} header={true} footer={true}>
<Box sx={{mt: 6}}>
<Typography
sx={{
fontFamily: 'Bnazanin',
fontWeight: 'bold',
fontSize: '1.2rem',
textAlign: 'center'
}}> {'گزارش کارشناسی ماشین آلات'} </Typography>
</Box>
<Box textAlign={'justify'} sx={{lineHeight: '1.8', mt: 2}}>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', pl: 4}}> {'با توجه به نامه شماره'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>35482</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'مورخ'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>1402/08/20</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'معاون محترم برنامه ریزی سازمان راهداری و حمل و نقل جاده ای در خصوص تسهیلات بند (الف) تبصره (18) قانون بودجه سال'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>1402</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'موضوع بازسازی ناوگان اتوبوس و مینی بوس و نیز تصویب آن درشورای برنامه ریزی و توسعه استان'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>تهران</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'و نامه شماره'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>35482</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'مورخ'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>1402/08/20</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'اداره کل راهداری و حمل و نقل جاده ای'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>تهران</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'در خصوص استفاده از ظرفیت انجمن های صنفی رانندگان در تاریخ'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>1402/08/20</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'از ناوگان اتوبوس/مینی بوس به شماره پلاک انتظامی'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>25پ4582</Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin'}}> {'و شماره هوشمند ناوگان'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>5875698725</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'به مالکیت آقای'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>امیرحسین محمودی</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'با کد ملی'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>0311318897</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'و شماره تماس'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>09120630655</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'ساکن شهرستان'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>تهران</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'در جلسه مطرح شد که نتیجه آن به شرح ذیل مورد تایید می باشد.'} </Typography>
</Box>
<Box sx={{border: 1, borderRadius: 1, mt: 3, p: 2}}>
<Typography
sx={{fontFamily: 'Bnazanin'}}> {'مبلغ پیشنهادی به عدد .............................................. ریال و به حروف ...................................................................... ریال می باشد.'} </Typography>
<Typography
sx={{
lineBreak: 'anywhere',
fontFamily: 'Bnazanin',
}}> {'توضیحات : ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................'} </Typography>
<Stack direction={'row'} justifyContent={'space-between'}>
<Typography
sx={{fontFamily: 'Bnazanin'}}> {'نام و نام خانوادگی کارشناس:'} </Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}> {'تاریخ و امضاء'} </Typography>
</Stack>
</Box>
</PrintablePage>
</>
)
}
export default Content

View File

@@ -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 (
<Stack sx={{bgcolor: '#efefef', width: isNotData ? '100%' : 'auto', height: isNotData ? '100%' : 'auto'}}>
{loading ? (
<CenterLayout>
<Stack>
<Typography variant={'h5'}>
{t('print_loading')}
</Typography>
</Stack>
</CenterLayout>
) : !data ? (
<CenterLayout>
<Typography variant={'h5'}>
{t('data_not_found')}
</Typography>
</CenterLayout>
) : !data.length ? (
<CenterLayout>
<Typography variant={'h5'}>
{t('data_not_found')}
</Typography>
</CenterLayout>
) : data.map(item => <Content key={item.id} data={item}/>)}
</Stack>
)
}
export default ReportComponent

View File

@@ -3,11 +3,11 @@ import Confirm from "./Form/ConfirmForm";
import Reject from "./Form/RejectForm";
const TableRow = ({row, mutate}) => {
return (
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
<Confirm
rowId={row.getValue("id")}
vehicle_type={row.original.vehicle_type}
mutate={mutate}
/>
<Reject

View File

@@ -1,13 +0,0 @@
import {Stack, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
function TableToolbar() {
const t = useTranslations();
return (
<Stack direction={"row"} spacing={2}>
<Tooltip title={t("add")} arrow placement="right"></Tooltip>
</Stack>
);
}
export default TableToolbar;

View File

@@ -0,0 +1,12 @@
import {Stack} from "@mui/material";
import PrintReport from "@/components/dashboard/machinary-office/Buttons/printReport";
const TableToolbar = () => {
return (
<Stack direction={"row"} spacing={2}>
<PrintReport/>
</Stack>
)
}
export default TableToolbar

View File

@@ -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

View File

@@ -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 (
<>
<DialogContent>
@@ -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)
}
/>
<FormHelperText
error={Boolean(formik.errors.confirm_img)}
>
{formik.touched.confirm_img && formik.errors.confirm_img}
</FormHelperText>
</Stack>
</Stack>
</DialogContent>
@@ -106,7 +123,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
{t("ConfirmDialog.button-cancel")}
</Button>
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
disabled={formik.isSubmitting}>
disabled={formik.isSubmitting || !formik.isValid}>
{t("ConfirmDialog.button-confirm")}
</Button>
</DialogActions>

View File

@@ -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)
}}
>
<ThumbUpAltIcon/>
<CallMadeIcon/>
</IconButton>
</Tooltip>
<Dialog fullWidth open={openConfirmDialog}
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
<DialogTitle>{t("NavganProvinceManager.confirm")}</DialogTitle>
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
</Dialog>
</>

View File

@@ -1,13 +0,0 @@
import {Stack, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
function TableToolbar() {
const t = useTranslations();
return (
<Stack direction={"row"} spacing={2}>
<Tooltip title={t("add")} arrow placement="right"></Tooltip>
</Stack>
);
}
export default TableToolbar;

View File

@@ -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 (
<Button
color="primary"
variant="contained"
size="small"
disabled={loading}
sx={{textTransform: "unset", alignSelf: "center"}}
startIcon={loading ? <CircularProgress size={18} color="inherit"/> : <PrintIcon/>}
onClick={clickHandler}
>
{t("PassengerBoss.print_final_credit_amount")}
</Button>
)
}
export default PrintFinalCreditAmount

View File

@@ -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 (
<>
<DialogContent>
@@ -129,7 +137,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
/>
</Stack>
<Stack>
<Typography>{t("UploadSystem.upload_file")}{t("UploadSystem.optional")}</Typography>
<Typography>{t("PassengerBoss.upload_file")}</Typography>
<UploadSystem
selectedImage={selectedImage}
handleUploadChange={handleUploadChange} // Pass the updated function directly
@@ -142,7 +150,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)
}
/>
<FormHelperText
error={Boolean(formik.errors.confirm_img)}
>
{formik.touched.confirm_img && formik.errors.confirm_img}
</FormHelperText>
</Stack>
</Stack>
</DialogContent>

View File

@@ -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)
}}
>
<ThumbUpAltIcon/>
<CallMadeIcon/>
</IconButton>
</Tooltip>
<Dialog fullWidth open={openConfirmDialog}
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
<DialogTitle>{t("PassengerBoss.confirm")}</DialogTitle>
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}
vehicle_type={vehicle_type}/>
</Dialog>
</>
)

View File

@@ -0,0 +1,123 @@
import PrintablePage from "@/core/components/PrintablePage";
import {Box, Grid, Stack, Typography} from "@mui/material";
const Content = ({data}) => {
return (
<>
<PrintablePage key={data.id} header={true} footer={true}>
<Box sx={{mt: 6}}>
<Typography
sx={{
fontFamily: 'Bnazanin',
fontWeight: 'bold',
fontSize: '1.2rem',
textAlign: 'center'
}}> {'فرم صورتجلسه تعیین مبلغ نهایی اعتبار'} </Typography>
</Box>
<Box textAlign={'justify'} sx={{lineHeight: '1.8', mt: 2}}>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', pl: 4}}> {'با توجه به نامه شماره'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>35482</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'مورخ'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>1402/08/20</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'معاون محترم برنامه ریزی سازمان راهداری و حمل و نقل جاده ای در خصوص تسهیلات بند (الف) تبصره (18) قانون بودجه سال'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>1402</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'موضوع بازسازی ناوگان اتوبوس و مینی بوس و نیز تصویب آن درشورای برنامه ریزی و توسعه استان'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>تهران</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'و نامه شماره'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>35482</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'مورخ'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>1402/08/20</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'اداره کل راهداری و حمل و نقل جاده ای'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>تهران</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'در خصوص استفاده از ظرفیت انجمن های صنفی رانندگان در تاریخ'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>1402/08/20</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'از ناوگان اتوبوس/مینی بوس به شماره پلاک انتظامی'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>25پ4582</Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin'}}> {'و شماره هوشمند ناوگان'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>5875698725</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'به مالکیت آقای'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>امیرحسین محمودی</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'با کد ملی'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>0311318897</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'و شماره تماس'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>09120630655</Typography>
<Typography component={'span'} sx={{fontFamily: 'Bnazanin'}}> {'ساکن شهرستان'} </Typography>
<Typography component={'span'}
sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>تهران</Typography>
<Typography
sx={{fontFamily: 'Bnazanin'}}
component={'span'}> {'در جلسه مطرح شد که نتیجه آن به شرح ذیل مورد تایید می باشد.'} </Typography>
</Box>
<Box sx={{border: 1, borderRadius: 1, mt: 3, p: 2}}>
<Typography textAlign={'justify'}
sx={{fontFamily: 'Bnazanin'}}> {'با توجه به گزارش واصله از اداره ماشین آلات (نامه در پیوست موجود می باشد) جهت بازسازی ناوگان مذکور مبلغ .............................................. ریال معادل .............................................. تومان مورد تایید می باشد.'} </Typography>
</Box>
<Grid container columns={4} sx={{border: 1, borderRadius: 1, mt: 3}}>
<Grid item xs={1} sx={{borderRight: 1, aspectRatio: '3 / 1'}}>
<Stack alignItems={'center'}>
<Typography variant={'caption'} sx={{fontFamily: 'Bnazanin'}}>رئیس انجمن</Typography>
</Stack>
</Grid>
<Grid item xs={1} sx={{borderRight: 1, aspectRatio: '3 / 1'}}>
<Stack alignItems={'center'}>
<Typography variant={'caption'} sx={{fontFamily: 'Bnazanin'}}>رئیس اداره مسافر</Typography>
</Stack>
</Grid>
<Grid item xs={1} sx={{borderRight: 1, aspectRatio: '3 / 1'}}>
</Grid>
<Grid item xs={1} sx={{aspectRatio: '3 / 1'}}>
</Grid>
<Grid item xs={1} sx={{borderRight: 1, borderTop: 1, aspectRatio: '2 / 1'}}>
<Stack alignItems={'center'} justifyContent={'center'} sx={{height: '100%'}}>
<Typography variant={'caption'} sx={{fontFamily: 'Bnazanin'}}>امضاء</Typography>
</Stack>
</Grid>
<Grid item xs={1} sx={{borderRight: 1, borderTop: 1, aspectRatio: '2 / 1'}}>
<Stack alignItems={'center'} justifyContent={'center'} sx={{height: '100%'}}>
<Typography variant={'caption'} sx={{fontFamily: 'Bnazanin'}}>امضاء</Typography>
</Stack>
</Grid>
<Grid item xs={1} sx={{borderRight: 1, borderTop: 1, aspectRatio: '2 / 1'}}>
<Stack alignItems={'center'} justifyContent={'center'} sx={{height: '100%'}}>
<Typography variant={'caption'} sx={{fontFamily: 'Bnazanin'}}>امضاء</Typography>
</Stack>
</Grid>
<Grid item xs={1} sx={{borderTop: 1, aspectRatio: '2 / 1'}}>
<Stack alignItems={'center'} justifyContent={'center'} sx={{height: '100%'}}>
<Typography variant={'caption'} sx={{fontFamily: 'Bnazanin'}}>امضاء</Typography>
</Stack>
</Grid>
</Grid>
</PrintablePage>
</>
)
}
export default Content

View File

@@ -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 (
<Stack sx={{bgcolor: '#efefef', width: isNotData ? '100%' : 'auto', height: isNotData ? '100%' : 'auto'}}>
{loading ? (
<CenterLayout>
<Stack>
<Typography variant={'h5'}>
{t('print_loading')}
</Typography>
</Stack>
</CenterLayout>
) : !data ? (
<CenterLayout>
<Typography variant={'h5'}>
{t('data_not_found')}
</Typography>
</CenterLayout>
) : !data.length ? (
<CenterLayout>
<Typography variant={'h5'}>
{t('data_not_found')}
</Typography>
</CenterLayout>
) : data.map(item => <Content key={item.id} data={item}/>)}
</Stack>
)
}
export default FinalCreditAmountComponent

View File

@@ -8,6 +8,7 @@ const TableRow = ({row, mutate}) => {
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
<Confirm
rowId={row.getValue("id")}
vehicle_type={row.original.vehicle_type}
mutate={mutate}
/>
<Reject

View File

@@ -1,13 +0,0 @@
import {Stack, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
function TableToolbar() {
const t = useTranslations();
return (
<Stack direction={"row"} spacing={2}>
<Tooltip title={t("add")} arrow placement="right"></Tooltip>
</Stack>
);
}
export default TableToolbar;

View File

@@ -0,0 +1,12 @@
import {Stack} from "@mui/material";
import PrintFinalCreditAmount from "@/components/dashboard/passenger-boss/Buttons/printFinalCreditAmount";
const TableToolbar = () => {
return (
<Stack direction={"row"} spacing={2}>
<PrintFinalCreditAmount/>
</Stack>
)
}
export default TableToolbar

View File

@@ -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

View File

@@ -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)
}
/>
<FormHelperText
error={Boolean(formik.errors.confirm_img)}
>
{formik.touched.confirm_img && formik.errors.confirm_img}
</FormHelperText>
</Stack>
</Stack>
</DialogContent>
@@ -106,7 +124,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
{t("ConfirmDialog.button-cancel")}
</Button>
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
disabled={formik.isSubmitting}>
disabled={formik.isSubmitting || !formik.isValid}>
{t("ConfirmDialog.button-confirm")}
</Button>
</DialogActions>

View File

@@ -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)
}}
>
<ThumbUpAltIcon/>
<CallMadeIcon/>
</IconButton>
</Tooltip>
<Dialog fullWidth open={openConfirmDialog}
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
<DialogTitle>{t("PassengerOffice.confirm")}</DialogTitle>
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
</Dialog>
</>

View File

@@ -1,13 +0,0 @@
import {Stack, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
function TableToolbar() {
const t = useTranslations();
return (
<Stack direction={"row"} spacing={2}>
<Tooltip title={t("add")} arrow placement="right"></Tooltip>
</Stack>
);
}
export default TableToolbar;

View File

@@ -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(() => {

View File

@@ -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)
}
/>
<FormHelperText
error={Boolean(formik.errors.confirm_img)}
>
{formik.touched.confirm_img && formik.errors.confirm_img}
</FormHelperText>
</Stack>
</Stack>
</DialogContent>
@@ -106,7 +124,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog}) => {
{t("ConfirmDialog.button-cancel")}
</Button>
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
disabled={formik.isSubmitting}>
disabled={formik.isSubmitting || !formik.isValid}>
{t("ConfirmDialog.button-confirm")}
</Button>
</DialogActions>

View File

@@ -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)
}}
>
<ThumbUpAltIcon/>
<CallMadeIcon/>
</IconButton>
</Tooltip>
<Dialog fullWidth open={openConfirmDialog}
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
<DialogTitle>{t("TransportationAssistance.confirm")}</DialogTitle>
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}/>
</Dialog>
</>

View File

@@ -1,13 +0,0 @@
import {Stack, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
function TableToolbar() {
const t = useTranslations();
return (
<Stack direction={"row"} spacing={2}>
<Tooltip title={t("add")} arrow placement="right"></Tooltip>
</Stack>
);
}
export default TableToolbar;

View File

@@ -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 (
<FullPageLayout sx={{mt: 3, position: 'relative'}}>
<LoadingHardPage icon={routingItem?.icon}
label={routingItem?.key ? `${t('routing_to')} ${t(routingItem?.key)}` : ''}
loading={routing} width={100} height={100}
sx={{position: "absolute", bgcolor: "#fffc"}}>
<RolePermissionMiddleware requiredPermissions={props.permissions}>
<BreadCrumbs isVisible={true}/>
{props.children}
</RolePermissionMiddleware>
</LoadingHardPage>
</FullPageLayout>
)
}
export default Content

View File

@@ -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 (
<>
<CssBaseline/>
<AppBar
position="fixed"
sx={{

View File

@@ -1,5 +1,5 @@
import {Divider, List} from "@mui/material";
import {Fragment, useEffect, useReducer, useRef, useState} from "react";
import {Fragment, useEffect, useReducer, useState} from "react";
import SidebarListItem from "./SidebarListItem";
import sidebarMenu from "@/core/data/sidebarMenu";
import {useRouter} from "next/router";
@@ -10,20 +10,41 @@ function reducer(state, action) {
case "COLLAPSE_MENU":
return state.map((itemsArr) =>
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 (
<List sx={{ overflow: "scroll"}}>
<List dense={true} sx={{overflow: "scroll"}}>
{itemMenu.map((itemArr, index) => (
<Fragment key={index}>
{itemArr.map((item) =>

View File

@@ -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 ?
<CircularProgress size={24} color="inherit"/> : item.icon}
</ListItemIcon>
<ListItemText
primary={t(item.key)}
@@ -69,7 +81,7 @@ const SidebarListItem = ({item, dispatch, handleDrawerToggle}) => {
}
/>
{hasSubItems && (item.showSubItem ? <ExpandLess /> : <ExpandMore />)}
{hasSubItems && (item.showSubItem ? <ExpandLess/> : <ExpandMore/>)}
</ListItemButton>
</ListItem>
{item.subItem && (

View File

@@ -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 ?
<CircularProgress size={24} color="inherit"/> : subitem.icon}
</ListItemIcon>
<ListItemText primary={t(subitem.key)} secondary={
subitem.secondary !== undefined ? (

View File

@@ -1,13 +1,31 @@
import {Box, Drawer} from "@mui/material";
import {Box, Drawer, useMediaQuery} from "@mui/material";
import SidebarDrawer from "./SidebarDrawer";
import {useTheme} from "@mui/material/styles";
const Sidebar = (props) => {
const theme = useTheme();
const isUpSm = useMediaQuery((theme.breakpoints.up('sm')))
return (
<Box
component="nav"
sx={{width: {md: props.drawerWidth}, flexShrink: {sm: 0}}}
aria-label="mailbox folders"
>
> {isUpSm ? (
<Drawer
variant="permanent"
sx={{
display: {xs: "none", md: "block"},
"& .MuiDrawer-paper": {
boxSizing: "border-box",
width: props.drawerWidth,
overflow: "hidden",
},
}}
open
>
<SidebarDrawer handleDrawerToggle={props.handleDrawerToggle}/>
</Drawer>
) : (
<Drawer
container={props.container}
variant="temporary"
@@ -27,20 +45,7 @@ const Sidebar = (props) => {
>
<SidebarDrawer handleDrawerToggle={props.handleDrawerToggle}/>
</Drawer>
<Drawer
variant="permanent"
sx={{
display: {xs: "none", md: "block"},
"& .MuiDrawer-paper": {
boxSizing: "border-box",
width: props.drawerWidth,
overflow: "hidden",
},
}}
open
>
<SidebarDrawer handleDrawerToggle={props.handleDrawerToggle}/>
</Drawer>
)}
</Box>
);
};

View File

@@ -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 (
<FullPageLayout direction="row">
<Header
@@ -34,12 +34,7 @@ const DashboardLayouts = (props) => {
sx={{flexGrow: 1, width: {sm: `calc(100% - ${drawerWidth}px)`}}}
>
<Toolbar/>
<FullPageLayout sx={{mt: 3}}>
<RolePermissionMiddleware requiredPermissions={props.permissions}>
<BreadCrumbs isVisible={true}/>
{props.children}
</RolePermissionMiddleware>
</FullPageLayout>
<Content {...props}/>
</FullPageLayout>
</FullPageLayout>
);

View File

@@ -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 (
<Stack alignItems="center" spacing={2} sx={{p: 3}}>
<Avatar
sx={{width: "80px", height: "80px"}}
alt="User Image"
src={user.avatar}
/>
<Typography sx={{fontSize: 15, fontWeight: 600}} textAlign="center">
{user.username}
</Typography>
</Stack>
);
}

View File

@@ -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 (
<>
<Tooltip title={t("header.open_profile")} arrow>
<IconButton onClick={handleOpenUserMenu} sx={{p: 0}}>
<Avatar
sx={{
width: 24,
height: 24,
backgroundColor: "#fff",
color: "primary.main",
}}
alt="User Image"
src={user.avatar}
/>
</IconButton>
</Tooltip>
<Menu
MenuListProps={{sx: {py: 0}}}
sx={{
mt: 6,
}}
id="menu-appbar"
anchorEl={anchorElUser}
anchorOrigin={{
vertical: "top",
horizontal: "right",
}}
keepMounted
transformOrigin={{
vertical: "top",
horizontal: "right",
}}
open={Boolean(anchorElUser)}
onClose={handleCloseUserMenu}
>
<ProfileData/>
<ProfileOptions handleCloseUserMenu={handleCloseUserMenu}/>
</Menu>
</>
);
}
export default ProfileMenu;

View File

@@ -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 (
<>
<MenuItem
component={Button}
to={{
pathname: "/dashboard/logout",
}}
sx={{
display: "flex",
justifyContent: "center",
borderTop: 1,
px: 3,
py: 1.5,
borderColor: "#e1e1e1",
textTransform: "unset",
}}
onClick={handleClickLogOut}
>
<Box sx={{display: "flex", alignItems: "center", flex: 1}}>
<Box
sx={{
display: "flex",
alignItems: "center",
color: "primary.main",
pr: 2,
}}
>
<MeetingRoomIcon/>
</Box>
<Typography sx={{flex: 1}} textAlign="start">
{t("header.logout")}
</Typography>
</Box>
</MenuItem>
</>
);
}

View File

@@ -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) => (
<MenuItem
component={NextLinkComposed}
to={{
pathname: profile_item.route,
}}
sx={{
display: "flex",
justifyContent: "center",
borderTop: 1,
px: 3,
py: 1.5,
borderColor: "#e1e1e1",
}}
key={profile_item.key}
onClick={handleCloseUserMenu}
>
<Box sx={{display: "flex", alignItems: "center", flex: 1}}>
<Box
sx={{
display: "flex",
alignItems: "center",
color: "primary.main",
pr: 2,
}}
>
{profile_item.icon}
</Box>
<Typography sx={{flex: 1}} textAlign="start">
{t(profile_item.name)}
</Typography>
</Box>
</MenuItem>
))}
<ProfileOptionLogOut handleCloseUserMenu={handleCloseUserMenu}/>
</>
);
}

View File

@@ -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 (
<AppBar
position="fixed"
sx={{
width: '100%',
displayPrint: 'none'
}}
>
<Container maxWidth="xxl">
<Toolbar
disableGutters
sx={{
display: "flex",
}}
>
<Stack
direction="row"
sx={{
flex: 1,
position: "relative",
...theme.mixins.toolbar,
}}
>
<Button onClick={() => {
setDisabled(true);
if (disabled) return
router.back()
}}
size={'large'} sx={{
color: "inherit",
}}>{t('button_back_to_previous')}</Button>
</Stack>
<Stack
alignItems={'center'}
justifyContent={'center'}
sx={{
flex: 1,
position: "relative",
...theme.mixins.toolbar,
}}
spacing={1}
>
<Typography>{printDetails.title}</Typography>
<Typography variant={'body2'}>{'تعداد صفحه:'} {printDetails.count}</Typography>
</Stack>
<Stack direction="row" spacing={4} justifyContent="flex-end" sx={{flex: 1}}>
<Button onClick={() => {
if (disabled) return;
print()
}} size={'large'} variant={'contained'}
color={'secondary'}>{t('btn_print')}</Button>
</Stack>
</Toolbar>
</Container>
</AppBar>
);
}
export default Header;

View File

@@ -0,0 +1,14 @@
import Header from "@/components/layouts/Print/Header";
import {Toolbar} from "@mui/material";
const Print = (props) => {
return (
<>
<Header/>
<Toolbar sx={{displayPrint: 'none'}}/>
{props.children}
</>
)
}
export default Print

View File

@@ -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 (
<>
<Backdrop
sx={{bgcolor: "#fff", zIndex: (theme) => theme.zIndex.drawer + 1}}
sx={{bgcolor: "#fff", zIndex: (theme) => theme.zIndex.drawer + 1, ...sx}}
open={loading}
>
<LoadingImage
width={100}
height={100}
>
<SvgLoading width={100}
height={100}/>
</LoadingImage>
<Stack alignItems={'center'} spacing={2}>
<LoadingImage
width={width}
height={height}
>
{icon ? (
<Box sx={{color: "primary.main", width: width, height: height}}>
{icon}
</Box>
) : (
<SvgLoading width={width}
height={height}/>
)}
</LoadingImage>
<Typography variant={'body2'} sx={{color: "primary.main"}}>{label}</Typography>
</Stack>
</Backdrop>
{children}
</>

View File

@@ -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

View File

@@ -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: <WifiOffIcon/>
})
}, [network.online]);

View File

@@ -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 (
<Stack spacing={1}>
<Stack>
<TextField
<LtrTextField
{...props}
/>
</Stack>

View File

@@ -0,0 +1,82 @@
import {Box, Container, Divider, Grid, Paper, Stack, Typography} from '@mui/material';
const PrintablePage = ({children, header, footer}) => (
<>
<Box sx={{width: "100%", height: 8, displayPrint: 'none'}}/>
<Container
sx={{
width: '21cm',
minHeight: '29.7cm',
margin: '0 auto',
backgroundColor: 'white',
p: '16px !important',
pb: footer ? '84px!important' : '',
position: 'relative'
}}
component="article" maxWidth="false">
<Grid container columns={5} sx={{pt: 2, px: 4, display: header ? '' : 'none'}}>
<Grid item xs={1}>
<Box sx={{width: 70}}>
<Box component={'img'} sx={{width: '100%', height: '100%', objectFit: 'contain'}}
src={'/images/logo.png'}/>
</Box>
</Grid>
<Grid item xs={3} sx={{textAlign: 'center'}}>
<Typography sx={{fontFamily: 'Bnazanin'}}>باسمه تعالی</Typography>
<Typography sx={{fontFamily: 'Bnazanin'}}>جمهوری اسلامی ایران</Typography>
<Typography sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>وزارت راه و
شهرسازی</Typography>
<Typography sx={{fontFamily: 'Bnazanin', fontWeight: 'bold'}}>سازمان
راهداری و حمل و نقل جاده
ای</Typography>
</Grid>
<Grid item xs={1}>
<Stack>
<Typography sx={{fontFamily: 'Bnazanin'}}>شماره:</Typography>
<Typography sx={{fontFamily: 'Bnazanin'}}>تاریخ:</Typography>
<Typography sx={{fontFamily: 'Bnazanin'}}>پیوست:</Typography>
</Stack>
</Grid>
</Grid>
<Paper elevation={0} sx={{px: 8}}>
{children}
</Paper>
<Box sx={{
position: 'absolute',
bottom: 0,
left: 0,
width: '100%',
px: 4,
pb: 2,
display: footer ? '' : 'none'
}}>
<Divider sx={{borderStyle: 'double', borderBottomWidth: 3, borderColor: '#000'}}/>
<Stack sx={{my: .5}}>
<Box sx={{textAlign: 'center'}}>
<Typography variant={'caption'} fontWeight={'bold'} component={'span'}
sx={{fontFamily: 'Bnazanin', px: 1}}> آدرس: تهران-بلوار
کشاورز-خیابان فلسطین جنوبی-خیابان
دمشق-پلاک17 </Typography>
<Typography variant={'caption'} fontWeight={'bold'} component={'span'}
sx={{fontFamily: 'Bnazanin', px: 1}}> تلفن: 88-88804379 </Typography>
<Typography variant={'caption'} fontWeight={'bold'} component={'span'}
sx={{fontFamily: 'Bnazanin', px: 1}}> تلفن گویا: 88804400 </Typography>
<Typography variant={'caption'} fontWeight={'bold'} component={'span'}
sx={{fontFamily: 'Bnazanin', px: 1}}> کدپستی: 1416753941 </Typography>
</Box>
<Box sx={{textAlign: 'center'}}>
<Typography variant={'caption'} fontWeight={'bold'} component={'span'}
sx={{fontFamily: 'Bnazanin', px: 2}}>صندوق پستی: 3773-14155</Typography>
<Typography variant={'caption'} fontWeight={'bold'} component={'span'}
sx={{fontFamily: 'Bnazanin', px: 2}}>پست الکترونیک: info@rmto.ir</Typography>
<Typography variant={'caption'} fontWeight={'bold'} component={'span'}
sx={{fontFamily: 'Bnazanin', px: 2}}>سایت الکترونیک: www.rmto.ir</Typography>
</Box>
</Stack>
</Box>
</Container>
<Box sx={{width: "100%", height: 8, displayPrint: 'none'}}/>
</>
);
export default PrintablePage;

View File

@@ -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")}<br/>
{t("UploadSystem.upload_file_unit")}
</Typography>
</Box>
</>

View File

@@ -20,7 +20,7 @@ const sidebarMenu = [
key: "sidebar.dashboard",
type: "page",
route: "/dashboard",
icon: <SpaceDashboardIcon/>,
icon: <SpaceDashboardIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "all",
},
@@ -30,7 +30,7 @@ const sidebarMenu = [
name: "passenger_office_chief",
type: "page",
route: "/dashboard/passenger-office-chief",
icon: <AirlineSeatReclineNormalIcon/>,
icon: <AirlineSeatReclineNormalIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_passenger_office_navgan",
},
@@ -39,7 +39,7 @@ const sidebarMenu = [
name: "machinery_expert",
type: "page",
route: "/dashboard/machinery-expert",
icon: <DirectionsCarFilledIcon/>,
icon: <DirectionsCarFilledIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_machinery_navgan",
},
@@ -49,7 +49,7 @@ const sidebarMenu = [
name: "province_working_group",
type: "page",
route: "/dashboard/passenger-boss",
icon: <AssignmentIndIcon/>,
icon: <AssignmentIndIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_province_working_group_navgan",
},
@@ -59,7 +59,7 @@ const sidebarMenu = [
name: "transportation_assistant",
type: "page",
route: "/dashboard/transportation-assistant",
icon: <DirectionsRailwayIcon/>,
icon: <DirectionsRailwayIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_transportation_navgan",
},
@@ -69,7 +69,7 @@ const sidebarMenu = [
name: "province_manager_navgan",
type: "page",
route: "/dashboard/navgan-province-manager",
icon: <DesktopWindowsIcon/>,
icon: <DesktopWindowsIcon sx={{width: 'inherit', height: 'inherit'}}/>,
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: <GavelIcon/>,
icon: <GavelIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_province_headquarter_refahi",
},
@@ -87,7 +87,7 @@ const sidebarMenu = [
name: "inspector_expert",
type: "page",
route: "/dashboard/inspector-expert",
icon: <GradingIcon/>,
icon: <GradingIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_inspector_refahi",
},
@@ -96,7 +96,7 @@ const sidebarMenu = [
name: "commercial_chief",
type: "page",
route: "/dashboard/commercial-chief",
icon: <BusinessCenterIcon/>,
icon: <BusinessCenterIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_commercial_refahi",
},
@@ -105,7 +105,7 @@ const sidebarMenu = [
name: "development_assistant",
type: "page",
route: "/dashboard/development-assistant",
icon: <Diversity3Icon/>,
icon: <Diversity3Icon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_development_refahi",
},
@@ -115,7 +115,7 @@ const sidebarMenu = [
name: "province_manager_refahi",
type: "page",
route: "/dashboard/refahi-province-manager",
icon: <SupervisedUserCircleIcon/>,
icon: <SupervisedUserCircleIcon sx={{width: 'inherit', height: 'inherit'}}/>,
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: <PaidIcon/>,
icon: <PaidIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_refahi_loan",
},
@@ -135,7 +135,7 @@ const sidebarMenu = [
name: "navgan_loan_management",
type: "page",
route: "/dashboard/navgan-loan-management",
icon: <PaidIcon/>,
icon: <PaidIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_navgan_loan",
},
@@ -144,7 +144,7 @@ const sidebarMenu = [
name: "expert_management",
type: "page",
route: "/dashboard/expert-management",
icon: <ManageAccountsIcon/>,
icon: <ManageAccountsIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_navgan_loan",
},
@@ -153,7 +153,7 @@ const sidebarMenu = [
name: "user_management",
type: "page",
route: "/dashboard/user-management",
icon: <PersonIcon/>,
icon: <PersonIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_users",
},
@@ -162,7 +162,7 @@ const sidebarMenu = [
name: "role_management",
type: "page",
route: "/dashboard/role-management",
icon: <AccessibilityIcon/>,
icon: <AccessibilityIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_roles",
},

View File

@@ -47,7 +47,16 @@ function AppLayout({children, isBot}) {
color={theme.palette.secondary.dark}
options={{showSpinner: false}}
/>
<ToastContainer position={directionApp === "ltr" ? "top-left" : "top-right"} rtl={directionApp === 'rtl'}/>
<ToastContainer
enableMultiContainer
containerId="validation"
position={directionApp === "ltr" ? "top-left" : "top-right"}
rtl={directionApp === 'rtl'}/>
<ToastContainer
enableMultiContainer
containerId={'connection'}
position={directionApp === "ltr" ? "top-right" : "top-left"}
rtl={directionApp === 'rtl'}/>
<NetworkComponent/>
{children}
</>);

View File

@@ -0,0 +1,12 @@
import WithAuthMiddleware from "@/middlewares/WithAuth";
import Print from "@/components/layouts/Print";
const PrintLayout = (props) => {
return (
<WithAuthMiddleware>
<Print {...props}/>
</WithAuthMiddleware>
)
}
export default PrintLayout

View File

@@ -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}) => {

View File

@@ -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 (
<PrintContext.Provider value={{printDetails, printDispatch}}>
{children}
</PrintContext.Provider>
);
};

View File

@@ -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;

View File

@@ -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}) => {
<LoadingProvider>
<ToastProvider>
<AppLayout isBot={pageProps.isBot}>
<Layout layout={pageProps.layout}>
<Component {...pageProps} />
</Layout>
<PrintProvider>
<Layout layout={pageProps.layout}>
<Component {...pageProps} />
</Layout>
</PrintProvider>
</AppLayout>
</ToastProvider>
</LoadingProvider>

View File

@@ -0,0 +1,21 @@
import {parse} from "next-useragent";
import ReportComponent from "@/components/dashboard/machinary-office/Prints/report";
export default function Report() {
return (
<ReportComponent/>
)
}
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'}
},
};
}

View File

@@ -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 (
<FinalCreditAmountComponent/>
)
}
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'}
},
};
}