LFFE-25 Merge branch 'feature/LFFE-25_print_passenger_boss' into 'develop'
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
BIN
public/fonts/ttf/BNazanin.ttf
Normal file
BIN
public/fonts/ttf/BNazanin.ttf
Normal file
Binary file not shown.
BIN
public/images/logo.png
Normal file
BIN
public/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -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 |
@@ -17,6 +17,10 @@
|
||||
"online_message": "شما به اینترنت وصل هستید",
|
||||
"offline_message": "اتصال شما به اینترنت قطع شده است",
|
||||
"routing_to": "در حال انتقال به صفحه",
|
||||
"data_not_found": "اطلاعاتی یافت نشد!",
|
||||
"btn_print": "چاپ",
|
||||
"print_loading": "درحال پردازش اطلاعات ...",
|
||||
"button_back_to_previous": "بازگشت به صفحه قبل",
|
||||
"header": {
|
||||
"open_profile": "پروفایل",
|
||||
"edit_profile": " پروفایل",
|
||||
@@ -206,6 +210,7 @@
|
||||
"upload_file_required": "وارد کردن صورت جلسه کارگروه استانی الزامیست",
|
||||
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
|
||||
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
|
||||
"print_final_credit_amount": "چاپ صورت جلسه تعیین مبلغ نهایی",
|
||||
"max_amount": "حداکثر مبلغ تصویب شده {value} میلیون ریال می باشد"
|
||||
},
|
||||
"RefahiProvinceManager": {
|
||||
@@ -305,6 +310,7 @@
|
||||
"upload_file_required": "وارد کردن گزارش کارشناسی الزامیست",
|
||||
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
|
||||
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
|
||||
"print_report": "چاپ گزارش کارشناسی ماشین آلات",
|
||||
"max_amount": "حداکثر مبلغ پیشنهادی {value} میلیون ریال می باشد"
|
||||
},
|
||||
"UserManagement": {
|
||||
|
||||
9
public/print.scss
Normal file
9
public/print.scss
Normal file
@@ -0,0 +1,9 @@
|
||||
@media print {
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
@page {
|
||||
size: A4;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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;
|
||||
12
src/components/dashboard/machinary-office/TableToolbar.jsx
Normal file
12
src/components/dashboard/machinary-office/TableToolbar.jsx
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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;
|
||||
12
src/components/dashboard/passenger-boss/TableToolbar.jsx
Normal file
12
src/components/dashboard/passenger-boss/TableToolbar.jsx
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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={{
|
||||
|
||||
18
src/components/layouts/Print/Header/ProfileData.jsx
Normal file
18
src/components/layouts/Print/Header/ProfileData.jsx
Normal 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>
|
||||
);
|
||||
}
|
||||
62
src/components/layouts/Print/Header/ProfileMenu.jsx
Normal file
62
src/components/layouts/Print/Header/ProfileMenu.jsx
Normal 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;
|
||||
49
src/components/layouts/Print/Header/ProfileOptionLogOut.jsx
Normal file
49
src/components/layouts/Print/Header/ProfileOptionLogOut.jsx
Normal 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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
49
src/components/layouts/Print/Header/ProfileOptions.jsx
Normal file
49
src/components/layouts/Print/Header/ProfileOptions.jsx
Normal 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}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
72
src/components/layouts/Print/Header/index.jsx
Normal file
72
src/components/layouts/Print/Header/index.jsx
Normal 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;
|
||||
14
src/components/layouts/Print/index.jsx
Normal file
14
src/components/layouts/Print/index.jsx
Normal 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
|
||||
82
src/core/components/PrintablePage.jsx
Normal file
82
src/core/components/PrintablePage.jsx
Normal 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;
|
||||
12
src/layouts/PrintLayout.jsx
Normal file
12
src/layouts/PrintLayout.jsx
Normal 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
|
||||
@@ -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}) => {
|
||||
|
||||
24
src/lib/app/contexts/print.jsx
Normal file
24
src/lib/app/contexts/print.jsx
Normal 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>
|
||||
);
|
||||
};
|
||||
18
src/lib/app/hooks/usePrint.jsx
Normal file
18
src/lib/app/hooks/usePrint.jsx
Normal 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;
|
||||
@@ -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>
|
||||
|
||||
21
src/pages/dashboard/machinery-expert/prints/report.jsx
Normal file
21
src/pages/dashboard/machinery-expert/prints/report.jsx
Normal 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'}
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -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'}
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user