Merge branch 'develop' into 'main'

Develop

See merge request witel-front-end/loan-facilities/expert!131
This commit is contained in:
AmirHossein Mahmoodi
2023-12-31 10:02:39 +00:00
9 changed files with 407 additions and 40 deletions

View File

@@ -221,6 +221,7 @@
"upload_file_second_required": "وارد کردن فرم ب الزامیست",
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
"print_form_a": "چاپ فرم الف",
"print_form_b": "چاپ فرم ب",
"max_amount": "حداکثر مبلغ تصویب شده {value} میلیون ریال می باشد",
"excel_report": "گزارش اکسل",

View File

@@ -0,0 +1,51 @@
import {useTranslations} from "next-intl";
import {useRouter} from "next/router";
import {useState} from "react";
import useRequest from "@/lib/app/hooks/useRequest";
import usePrint from "@/lib/app/hooks/usePrint";
import {GET_PASSENGER_BOSS} from "@/core/data/apiRoutes";
import {Button, CircularProgress} from "@mui/material";
import PrintIcon from "@mui/icons-material/Print";
const PrintFormA = () => {
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 _chunkSize = 10
const _data = response.data.data
const chunk = Array.from({length: Math.ceil(_data.length / _chunkSize)}, (v, i) =>
_data.slice(i * _chunkSize, i * _chunkSize + _chunkSize)
);
setPrintPage(chunk.length)
setPrintTitle(t('PassengerBoss.print_form_a'))
sessionStorage.setItem('form-a-print', JSON.stringify(chunk))
router.push('/dashboard/passenger-boss/prints/form-a')
}).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_form_a")}
</Button>
)
}
export default PrintFormA

View File

@@ -0,0 +1,185 @@
import PrintablePage from "@/core/components/PrintablePage";
import {Box, Stack, Typography} from "@mui/material";
import Items from "@/components/dashboard/passenger-boss/Prints/form-a/items";
const Content = ({data}) => {
return (<>
<PrintablePage header={false} footer={false} paperSx={{px: 1}} landscape={true}>
<Box sx={{border: 1, borderBottom: 0}}>
<Stack direction={'row'} alignItems={'flex-end'} sx={{borderBottom: 1, px: 1, bgcolor: '#f0f0f0'}}>
<Stack sx={{flexGrow: 1}} alignItems={"center"}>
<Typography fontSize={14} sx={{fontFamily: 'Bnazanin'}}>بسمه
تعالی</Typography>
<Typography fontSize={14} fontWeight={'bold'}
sx={{fontFamily: 'Bnazanin'}}>{`فرم صورتجلسه بررسی درخواست تسهیلات موضوع جزء 1 تا 9 بند (الف) تبصره (18) قانون بودجه سال 1401 کل کشور`}</Typography>
</Stack>
<Typography fontSize={14} fontWeight={'bold'}
sx={{fontFamily: 'Bnazanin'}}>فرم الف</Typography>
</Stack>
<Box sx={{px: 1}}>
<Typography fontSize={14} sx={{fontFamily: 'Bnazanin'}}>با سلام و احترام</Typography>
<Typography fontSize={14} sx={{fontFamily: 'Bnazanin'}}>درخواست متقاضیان تسهیلات موضوع جزء 1 تا 9
بند (الف) تبصره (18) قانون بودجه سال 1401 کل کشور با خلاصه اطلاعات به شرح ذیل مطابق با جزء 1 تا
9 بند (الف) تبصره (18) قانون بودجه سال 1401 کل کشور، دستورالعمل های ذیربط و برنامه ابلاغی وزارت
متبوع و سایر مقررات مرتبط مورد بررسی و ارزیابی قرار گرفته و تایید می گردد.</Typography>
</Box>
</Box>
<Stack>
<table style={{
fontSize: '14px',
textAlign: 'center',
flexGrow: '1',
fontFamily: 'Bnazanin',
borderCollapse: 'collapse',
border: '1px solid'
}}>
<thead style={{background: '#f0f0f0'}}>
<tr>
<th rowSpan={2} style={{border: '1px solid'}}>ردیف</th>
<th rowSpan={2} style={{border: '1px solid'}}>نام متقاضی</th>
<th rowSpan={2} style={{border: '1px solid'}}>عنوان طرح</th>
<th colSpan={2} style={{border: '1px solid'}}>رسته فعالیت</th>
<th colSpan={2} style={{border: '1px solid'}}>میزان تسهیلات مصوب<br/>(میلیارد ریال)</th>
<th colSpan={5} style={{border: '1px solid'}}>وضعیت طرح</th>
<th rowSpan={2} style={{
writingMode: 'vertical-rl',
textOrientation: 'sideways',
transform: 'rotate(180deg)',
border: '1px solid'
}}>درصد
پیشرفت<br/>فیزیکی
</th>
<th rowSpan={2} style={{
writingMode: 'vertical-rl',
textOrientation: 'sideways',
transform: 'rotate(180deg)',
border: '1px solid'
}}>شهرستان
محل<br/>اجرا
</th>
<th rowSpan={2}
style={{
writingMode: 'vertical-rl',
textOrientation: 'sideways',
transform: 'rotate(180deg)',
border: '1px solid'
}}>اشتغال<br/>تعهد شده
(نفر)
</th>
<th rowSpan={2} style={{
writingMode: 'vertical-rl',
textOrientation: 'sideways',
transform: 'rotate(180deg)',
border: '1px solid'
}}>پیش بینی
تاریخ<br/>بهره برداری پس<br/>از
اخذ تسهیلات
</th>
<th rowSpan={2} style={{
writingMode: 'vertical-rl',
textOrientation: 'sideways',
transform: 'rotate(180deg)',
border: '1px solid'
}}>بانک
عامل
</th>
<th rowSpan={2} style={{
writingMode: 'vertical-rl',
textOrientation: 'sideways',
transform: 'rotate(180deg)',
border: '1px solid'
}}>نرخ سود
(درصد)
</th>
<th rowSpan={2} style={{
writingMode: 'vertical-rl',
textOrientation: 'sideways',
transform: 'rotate(180deg)',
border: '1px solid'
}}>دوره تنفس
(ماه)
</th>
<th rowSpan={2} style={{
writingMode: 'vertical-rl',
textOrientation: 'sideways',
transform: 'rotate(180deg)',
border: '1px solid'
}}>طول
دوره<br/>بازپرداخت (ماه)
</th>
</tr>
<tr>
<th style={{border: '1px solid'}}>تولیدی</th>
<th style={{border: '1px solid'}}>خدماتی</th>
<th style={{border: '1px solid'}}>در گردش</th>
<th style={{border: '1px solid'}}>ثابت</th>
<th style={{border: '1px solid'}}>جدید</th>
<th style={{border: '1px solid'}}>توسعه</th>
<th style={{border: '1px solid'}}>فعال</th>
<th style={{border: '1px solid'}}>نیمه<br/>تمام</th>
<th style={{border: '1px solid'}}>راکد</th>
</tr>
</thead>
<tbody><Items data={data}/></tbody>
<tfoot>
<tr>
<th style={{border: '1px solid'}} colSpan={3}>مجموع</th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
<th style={{border: '1px solid'}}></th>
</tr>
<tr style={{height: 60}}>
<th style={{border: '1px solid', verticalAlign: 'top', textAlign: 'right', paddingRight: 8}}
colSpan={10}>ملاحظات
کمیته استانی:
</th>
<th style={{border: '1px solid'}} colSpan={10}>رئیس سازمان / مدیرکل
............................... استان
........................................
</th>
</tr>
</tfoot>
</table>
</Stack>
<Box sx={{border: 1, borderTop: 0, px: 1}}>
<Typography fontSize={14} fontWeight={'bold'} sx={{fontFamily: 'Bnazanin'}}>با سلام و
احترام</Typography>
<Typography fontSize={14} fontWeight={'bold'} sx={{fontFamily: 'Bnazanin'}}>کمیته استانی موضوع
دستورالعمل جزء 1 تا 9 بند (الف) تبصره (18) قانون بودجه 1401 کل کشور با استناد به بررسی و تایید
دستگاه اجرایی ذیربط و توضیحات ارائه شده در جلسه، طرحهای فوق الذکر را بررسی و جهت انجام مراحل بعدی
تایید نمود.</Typography>
</Box>
<Stack sx={{border: 1, borderTop: 0, px: 1, height: 120}} direction={'row'}>
<Typography sx={{flexGrow: 1, fontFamily: 'Bnazanin'}} textAlign={'center'} fontSize={14}
fontWeight={'bold'}>رئیس
دستگاه تخصصی ذیربط طرح</Typography>
<Typography sx={{flexGrow: 1, fontFamily: 'Bnazanin'}} textAlign={'center'} fontSize={14}
fontWeight={'bold'}>مدیر کل تعاون، کار و رفاه اجتماعی</Typography>
<Typography sx={{flexGrow: 1, fontFamily: 'Bnazanin'}} textAlign={'center'} fontSize={14}
fontWeight={'bold'}>رئیس سازمان مدیریت و برنامه ریزی</Typography>
<Typography sx={{flexGrow: 1, fontFamily: 'Bnazanin'}} textAlign={'center'} fontSize={14}
fontWeight={'bold'}>مدیر کل امور اقتصادی و دارایی<br/>و دبیر کمیته</Typography>
<Typography sx={{flexGrow: 1, fontFamily: 'Bnazanin'}} textAlign={'center'} fontSize={14}
fontWeight={'bold'}>معاون هماهنگی امور اقتصادی استانداری و<br/>رئیس کمیته</Typography>
</Stack>
</PrintablePage>
</>)
}
export default Content

View File

@@ -0,0 +1,60 @@
import {useTranslations} from "next-intl";
import {useEffect, useState} from "react";
import {Stack, Typography} from "@mui/material";
import CenterLayout from "@/layouts/CenterLayout";
import Content from "@/components/dashboard/passenger-boss/Prints/form-a/Content";
const FormAComponent = () => {
const t = useTranslations()
const [data, setData] = useState(null)
const [loading, setLoading] = useState(true)
const [isNotData, setIsNotData] = useState(true)
useEffect(() => {
if (sessionStorage.getItem('form-a-print') === null) {
setLoading(false)
setIsNotData(true)
sessionStorage.setItem('form-a-print', 'seen')
} else if (sessionStorage.getItem('form-a-print') === 'seen') {
setLoading(false)
setData(null)
setIsNotData(true)
} else if (data) {
setLoading(false)
sessionStorage.setItem('form-a-print', 'seen')
setIsNotData(false)
} else {
setLoading(true)
setData(JSON.parse(sessionStorage.getItem('form-a-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, index) => <Content key={index} data={item}/>)}
</Stack>
)
}
export default FormAComponent

View File

@@ -0,0 +1,65 @@
import {useEffect, useState} from "react";
import DoneIcon from '@mui/icons-material/Done';
const Items = ({data}) => {
const [result, setResult] = useState([])
useEffect(() => {
let arr = []
for (let i = 0; i < 10; i++) {
if (data[i]) {
let _item = {}
_item.name = data[i].name
_item.city_name = data[i].city_name
_item.tanafos_period = data[i].tanafos_period
switch (data[i].vehicle_type) {
case 'اتوبوس':
_item.vehicle_num = 4
break;
case 'مینی بوس':
_item.vehicle_num = 2
break;
default:
_item.vehicle_num = 0
break;
}
arr.push(_item)
} else {
arr.push(null)
}
}
setResult(arr)
}, []);
return (<>
{result.map((item, index) => (<tr key={index}>
<td style={{minHeight: 21, border: '1px solid'}}>{index + 1}</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item?.name || (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item ? (<>بازسازی ناوگان
مسافری</>) : (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item ? (
<DoneIcon fontSize={'inherit'}/>) : (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item ? (
<DoneIcon fontSize={'inherit'}/>) : (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item?.city_name || (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item?.vehicle_num || (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>&nbsp;</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item ? (<>کارآفرینی امید</>) : (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item ? (<>15/2</>) : (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item?.tanafos_period || (<>&nbsp;</>)}</td>
<td style={{minHeight: 21, border: '1px solid'}}>{item ? (<>60</>) : (<>&nbsp;</>)}</td>
</tr>))}
</>
)
}
export default Items

View File

@@ -2,7 +2,6 @@ import PrintablePage from "@/core/components/PrintablePage";
import {Box, Stack, Typography} from "@mui/material";
const Content = ({data}) => {
console.log(data)
const varables = {
name: data.name,
national_code: data.national_id,
@@ -14,18 +13,20 @@ const Content = ({data}) => {
mahalejra: '................',
daftar: '................',
post_code: data.postal_code,
telephone: data.phone_number,
mobile: '................',
tarh_name: '................',
telephone: data.telephone_number,
mobile: data.phone_number,
tarh_name: 'بازسازی ناوگان مسافری',
mojavez_type: '................',
mojavez_number: '................',
darkhasti_amount: data.proposed_amount,
dore_tanafos: '................',
darkhasti_amount: '........................',
darkhasti_amount_gardesh: '........................',
darkhasti_amount_sabet: '........................',
dore_tanafos: data.tanafos_period || '',
avarde_moteghazi: 0,
avarde_dastgah: 0,
avarde_bank: 0,
sarmaye_all: '................',
bahrebardari: '................',
sarmaye_all: '.......................',
bahrebardari: '.......................',
sarane: '................',
kol: '................',
tahod_shode: '................',
@@ -159,27 +160,18 @@ const Content = ({data}) => {
sx={{
fontFamily: 'Bnazanin'
}}>{`ثابت`}</Typography>
<Box
sx={{border: 2, width: 15, height: 15}}></Box>
<Box sx={{border: 2, bgcolor: '#000', width: 15, height: 15}}></Box>
</Stack>
</Stack>
</Box>
<Box sx={{p: 0.5, borderBottom: 1}}>
<Stack direction={'row'} spacing={2}>
<Typography sx={{fontFamily: 'Bnazanin'}}>9-</Typography>
<Stack sx={{flexGrow: 1, pr: 20}}>
<Typography
fontSize={18}
sx={{
fontFamily: 'Bnazanin'
}}>{`میزان تسهیلات درخواستی (میلیون ریال): ${varables.darkhasti_amount} در گردش`}</Typography>
<Typography
fontSize={18}
sx={{
fontFamily: 'Bnazanin'
}}>{`ثابت`}</Typography>
</Stack>
<Typography
fontSize={18}
sx={{
fontFamily: 'Bnazanin'
}}>{`میزان تسهیلات درخواستی (میلیون ریال): ${varables.darkhasti_amount} در گردش ${varables.darkhasti_amount_gardesh} ثابت ${varables.darkhasti_amount_sabet}`}</Typography>
</Stack>
</Box>
<Box sx={{p: 0.5, borderBottom: 1}}>
@@ -200,8 +192,7 @@ const Content = ({data}) => {
sx={{
fontFamily: 'Bnazanin'
}}>{`دارد`}</Typography>
<Box
sx={{border: 2, width: 15, height: 15}}></Box>
<Box sx={{border: 2, bgcolor: '#000', width: 15, height: 15}}></Box>
</Stack>
<Stack direction={'row'} alignItems={'center'} spacing={.5}>
<Typography
@@ -288,7 +279,7 @@ const Content = ({data}) => {
fontFamily: 'Bnazanin'
}}>{`نیمه تمام`}</Typography>
<Box
sx={{border: 2, bgcolor: '#000', width: 15, height: 15}}></Box>
sx={{border: 2, width: 15, height: 15}}></Box>
</Stack>
<Stack direction={'row'} alignItems={'center'} spacing={.5}>
<Typography

View File

@@ -1,11 +1,12 @@
import {Stack} from "@mui/material";
import PrintExcel from "@/components/dashboard/passenger-boss/Buttons/printExcel";
import PrintFormB from "@/components/dashboard/passenger-boss/Buttons/printFormB";
import PrintFormA from "@/components/dashboard/passenger-boss/Buttons/printFormA";
const TableToolbar = ({table}) => {
return (
<Stack direction={"row"} spacing={2}>
{/*<PrintFinalCreditAmount/>*/}
<PrintFormA/>
<PrintFormB/>
<PrintExcel table={table}/>
</Stack>

View File

@@ -1,12 +1,11 @@
import {Box, Container, Divider, Grid, Paper, Stack, Typography} from '@mui/material';
const PrintablePage = ({children, header, footer, paperSx = {}}) => (
<>
const PrintablePage = ({children, header, footer, paperSx = {}, landscape = false}) => (<>
<Box sx={{width: "100%", height: 8, displayPrint: 'none'}}/>
<Container
sx={{
width: '21cm',
minHeight: '29.7cm',
width: landscape ? '29.7cm' : '21cm',
minHeight: landscape ? '21cm' : '29.7cm',
margin: '0 auto',
backgroundColor: 'white',
p: '16px !important',
@@ -42,13 +41,7 @@ const PrintablePage = ({children, header, footer, paperSx = {}}) => (
{children}
</Paper>
<Box sx={{
position: 'absolute',
bottom: 0,
left: 0,
width: '100%',
px: 4,
pb: 2,
display: footer ? '' : 'none'
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}}>
@@ -76,7 +69,6 @@ const PrintablePage = ({children, header, footer, paperSx = {}}) => (
</Box>
</Container>
<Box sx={{width: "100%", height: 8, displayPrint: 'none'}}/>
</>
);
</>);
export default PrintablePage;

View File

@@ -0,0 +1,21 @@
import {parse} from "next-useragent";
import FormAComponent from "@/components/dashboard/passenger-boss/Prints/form-a";
export default function FormB() {
return (
<FormAComponent/>
)
}
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'}
},
};
}