diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 19cdf8e..1ec3d08 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -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": "گزارش اکسل", diff --git a/src/components/dashboard/passenger-boss/Buttons/printFormA.jsx b/src/components/dashboard/passenger-boss/Buttons/printFormA.jsx new file mode 100644 index 0000000..2396d5f --- /dev/null +++ b/src/components/dashboard/passenger-boss/Buttons/printFormA.jsx @@ -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 ( + + ) +} + +export default PrintFormA \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Prints/form-a/Content.jsx b/src/components/dashboard/passenger-boss/Prints/form-a/Content.jsx new file mode 100644 index 0000000..8525b97 --- /dev/null +++ b/src/components/dashboard/passenger-boss/Prints/form-a/Content.jsx @@ -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 (<> + + + + + بسمه + تعالی + {`فرم صورتجلسه بررسی درخواست تسهیلات موضوع جزء 1 تا 9 بند (الف) تبصره (18) قانون بودجه سال 1401 کل کشور`} + + فرم الف + + + با سلام و احترام + درخواست متقاضیان تسهیلات موضوع جزء 1 تا 9 + بند (الف) تبصره (18) قانون بودجه سال 1401 کل کشور با خلاصه اطلاعات به شرح ذیل مطابق با جزء 1 تا + 9 بند (الف) تبصره (18) قانون بودجه سال 1401 کل کشور، دستورالعمل های ذیربط و برنامه ابلاغی وزارت + متبوع و سایر مقررات مرتبط مورد بررسی و ارزیابی قرار گرفته و تایید می گردد. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ردیفنام متقاضیعنوان طرحرسته فعالیتمیزان تسهیلات مصوب
(میلیارد ریال)
وضعیت طرحدرصد + پیشرفت
فیزیکی +
شهرستان + محل
اجرا +
اشتغال
تعهد شده + (نفر) +
پیش بینی + تاریخ
بهره برداری پس
از + اخذ تسهیلات +
بانک + عامل + نرخ سود + (درصد) + دوره تنفس + (ماه) + طول + دوره
بازپرداخت (ماه) +
تولیدیخدماتیدر گردشثابتجدیدتوسعهفعالنیمه
تمام
راکد
مجموع
ملاحظات + کمیته استانی: + رئیس سازمان / مدیرکل + ............................... استان + ........................................ +
+
+ + با سلام و + احترام + کمیته استانی موضوع + دستورالعمل جزء 1 تا 9 بند (الف) تبصره (18) قانون بودجه 1401 کل کشور با استناد به بررسی و تایید + دستگاه اجرایی ذیربط و توضیحات ارائه شده در جلسه، طرحهای فوق الذکر را بررسی و جهت انجام مراحل بعدی + تایید نمود. + + + رئیس + دستگاه تخصصی ذیربط طرح + مدیر کل تعاون، کار و رفاه اجتماعی + رئیس سازمان مدیریت و برنامه ریزی + مدیر کل امور اقتصادی و دارایی
و دبیر کمیته
+ معاون هماهنگی امور اقتصادی استانداری و
رئیس کمیته
+
+ +
+ ) +} + +export default Content \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Prints/form-a/index.jsx b/src/components/dashboard/passenger-boss/Prints/form-a/index.jsx new file mode 100644 index 0000000..5368ed6 --- /dev/null +++ b/src/components/dashboard/passenger-boss/Prints/form-a/index.jsx @@ -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 ( + + {loading ? ( + + + + {t('print_loading')} + + + + ) : !data ? ( + + + {t('data_not_found')} + + + ) : !data.length ? ( + + + {t('data_not_found')} + + + ) : data.map((item, index) => )} + + ) +} + +export default FormAComponent \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Prints/form-a/items.jsx b/src/components/dashboard/passenger-boss/Prints/form-a/items.jsx new file mode 100644 index 0000000..6d92f8c --- /dev/null +++ b/src/components/dashboard/passenger-boss/Prints/form-a/items.jsx @@ -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) => ( + {index + 1} + {item?.name || (<> )} + {item ? (<>بازسازی ناوگان + مسافری) : (<> )} +   + {item ? ( + ) : (<> )} +   + {item ? ( + ) : (<> )} +   +   +   +   +   +   + {item?.city_name || (<> )} + {item?.vehicle_num || (<> )} +   + {item ? (<>کارآفرینی امید) : (<> )} + {item ? (<>15/2) : (<> )} + {item?.tanafos_period || (<> )} + {item ? (<>60) : (<> )} + ))} + + + ) +} +export default Items \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Prints/form-b/Content.jsx b/src/components/dashboard/passenger-boss/Prints/form-b/Content.jsx index 6daa682..842dbfe 100644 --- a/src/components/dashboard/passenger-boss/Prints/form-b/Content.jsx +++ b/src/components/dashboard/passenger-boss/Prints/form-b/Content.jsx @@ -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' }}>{`ثابت`} - + 9- - - - {`میزان تسهیلات درخواستی (میلیون ریال): ${varables.darkhasti_amount} در گردش`} - {`ثابت`} - + {`میزان تسهیلات درخواستی (میلیون ریال): ${varables.darkhasti_amount} در گردش ${varables.darkhasti_amount_gardesh} ثابت ${varables.darkhasti_amount_sabet}`} @@ -200,8 +192,7 @@ const Content = ({data}) => { sx={{ fontFamily: 'Bnazanin' }}>{`دارد`} - + { fontFamily: 'Bnazanin' }}>{`نیمه تمام`} + sx={{border: 2, width: 15, height: 15}}> { return ( - {/**/} + diff --git a/src/core/components/PrintablePage.jsx b/src/core/components/PrintablePage.jsx index 8a92900..362cc4e 100644 --- a/src/core/components/PrintablePage.jsx +++ b/src/core/components/PrintablePage.jsx @@ -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}) => (<> ( {children} @@ -76,7 +69,6 @@ const PrintablePage = ({children, header, footer, paperSx = {}}) => ( - -); + ); export default PrintablePage; \ No newline at end of file diff --git a/src/pages/dashboard/passenger-boss/prints/form-a.jsx b/src/pages/dashboard/passenger-boss/prints/form-a.jsx new file mode 100644 index 0000000..5521b69 --- /dev/null +++ b/src/pages/dashboard/passenger-boss/prints/form-a.jsx @@ -0,0 +1,21 @@ +import {parse} from "next-useragent"; +import FormAComponent from "@/components/dashboard/passenger-boss/Prints/form-a"; + +export default function FormB() { + return ( + + ) +} + +export async function getServerSideProps({req, locale}) { + const {isBot} = parse(req.headers["user-agent"]); + return { + props: { + messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.passenger_boss_page", + isBot, + locale, + layout: {name: 'PrintLayout'} + }, + }; +} \ No newline at end of file