From 06aff1699e3cc38c2a4a285f1a1c83340afbb83f Mon Sep 17 00:00:00 2001 From: AminGhasempoor Date: Sat, 30 Dec 2023 08:22:32 +0330 Subject: [PATCH] add print form b --- public/locales/fa/app.json | 2 +- .../machinary-office/TableToolbar.jsx | 3 +- .../passenger-boss/Buttons/printFormB.jsx | 47 ++ .../passenger-boss/Prints/form-b/Content.jsx | 464 ++++++++++++++++++ .../passenger-boss/Prints/form-b/index.jsx | 60 +++ .../dashboard/passenger-boss/TableToolbar.jsx | 5 +- src/core/components/PrintablePage.jsx | 4 +- .../passenger-boss/prints/form-b.jsx | 21 + 8 files changed, 599 insertions(+), 7 deletions(-) create mode 100644 src/components/dashboard/passenger-boss/Buttons/printFormB.jsx create mode 100644 src/components/dashboard/passenger-boss/Prints/form-b/Content.jsx create mode 100644 src/components/dashboard/passenger-boss/Prints/form-b/index.jsx create mode 100644 src/pages/dashboard/passenger-boss/prints/form-b.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 36abf09..19cdf8e 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -221,7 +221,7 @@ "upload_file_second_required": "وارد کردن فرم ب الزامیست", "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد", "upload_file_format": "فرمت قابل قبول : png,jpg,pdf", - "print_final_credit_amount": "چاپ صورت جلسه تعیین مبلغ نهایی", + "print_form_b": "چاپ فرم ب", "max_amount": "حداکثر مبلغ تصویب شده {value} میلیون ریال می باشد", "excel_report": "گزارش اکسل", "first_form": "فرم الف را بارگذاری کنید", diff --git a/src/components/dashboard/machinary-office/TableToolbar.jsx b/src/components/dashboard/machinary-office/TableToolbar.jsx index cdf1562..c1e6672 100644 --- a/src/components/dashboard/machinary-office/TableToolbar.jsx +++ b/src/components/dashboard/machinary-office/TableToolbar.jsx @@ -1,11 +1,10 @@ import {Stack} from "@mui/material"; -import PrintReport from "@/components/dashboard/machinary-office/Buttons/printReport"; import PrintExcel from "@/components/dashboard/machinary-office/Buttons/printExcel"; const TableToolbar = ({table}) => { return ( - + {/**/} ) diff --git a/src/components/dashboard/passenger-boss/Buttons/printFormB.jsx b/src/components/dashboard/passenger-boss/Buttons/printFormB.jsx new file mode 100644 index 0000000..8380b07 --- /dev/null +++ b/src/components/dashboard/passenger-boss/Buttons/printFormB.jsx @@ -0,0 +1,47 @@ +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 PrintFormB = () => { + 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_form_b')) + sessionStorage.setItem('form-b-print', JSON.stringify(_data)) + router.push('/dashboard/passenger-boss/prints/form-b') + }).catch(() => { + setLoading(false) + }) + } + return ( + + ) +} + +export default PrintFormB \ 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 new file mode 100644 index 0000000..6daa682 --- /dev/null +++ b/src/components/dashboard/passenger-boss/Prints/form-b/Content.jsx @@ -0,0 +1,464 @@ +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, + co: '................', + shenase_eqh: '................', + modiramel: '................', + province: data.province_name, + city: data.city_name, + mahalejra: '................', + daftar: '................', + post_code: data.postal_code, + telephone: data.phone_number, + mobile: '................', + tarh_name: '................', + mojavez_type: '................', + mojavez_number: '................', + darkhasti_amount: data.proposed_amount, + dore_tanafos: '................', + avarde_moteghazi: 0, + avarde_dastgah: 0, + avarde_bank: 0, + sarmaye_all: '................', + bahrebardari: '................', + sarane: '................', + kol: '................', + tahod_shode: '................', + nafar: '................', + + } + return (<> + + + + {`فرم خلاصه اطلاعات تایید شده طرح متقاضی استفاده از تسهیلات موضوع جزء 1 تا 9 بند (الف) تبصره (18) قانون بودجه سال 1402 کل کشور (فرم ب)`} + + + + + 1- + + + {`نام متقاضی: ${varables.name}`} + {`کد ملی: ${varables.national_code}`} + + + {`نام شرکت: ${varables.co}`} + {`شناسه اقتصادی: ${varables.shenase_eqh}`} + + + {`نام مدیرعامل: ${varables.modiramel}`} + + + + + + + 2- + + {`آدرس: استان: ${varables.province} شهرستان: ${varables.city} محل اجرای طرح: ${varables.mahalejra}`} + + {`محل دفتر: ${varables.daftar}`} + {`کد پستی: ${varables.post_code}`} + + {`شماره تماس: ${varables.telephone} شماره همراه: ${varables.mobile}`} + + + + + + + 3- + {`عنوان طرح: ${varables.tarh_name}`} + + + + + 4- + + {`توضیح مطابقت طرح با برنامه ملی (شیوه نامه) ابلاغ شده دستگاه و سند آمایش استان: `} + {`مطابق با بند ................................ برنامه دستگاه اجرایی ذیربط می باشد.`} + + {`مطابق با سند آمایش سرزمین و اولویتهای مربوط استان می باشد.`} + + + + + + + + 5- + {`اولویت مورد نظر (بر اساس موارد 5 و 6 دستورالعمل):`} + + + + + 6- + {`زمینه فعالیت در بخش اقتصادی: حمل و نقل زیر بخش اقتصادی: ناوگان مسافری دستگاه اجرایی ذیربط: سازمان راهداری و حمل و نقل جاده ای`} + + + + + 7- + + + {`نوع مجوز: ${varables.mojavez_type}`} + {`شماره و تاریخ مجوز: ${varables.mojavez_number}`} + + + + + + + 8- + {`نوع تسهیلات:`} + + {`در گردش`} + + + + {`ثابت`} + + + + + + + 9- + + + {`میزان تسهیلات درخواستی (میلیون ریال): ${varables.darkhasti_amount} در گردش`} + {`ثابت`} + + + + + + 10- + + + {`نام بانک عامل: صندوق کارآفرینی امید`} + {`نرخ سود (درصد): 15/3%`} + + {`یارانه سود:`} + + {`دارد`} + + + + {`ندارد`} + + + + + + {`دوره تنفس (ماه): ${varables.dore_tanafos}`} + {`دوره مشارکت (ماه): ..........`} + {`دوره بازپرداخت (ماه): 60`} + + + + + + + 11- + آورده + + + + + + + + + + + + + + +
میزان آورده (میلیون ریال)متقاضیدستگاهبانک عامل
{varables.avarde_moteghazi}{varables.avarde_dastgah}{varables.avarde_bank}
+
+
+ + + 12- + وضعیت طرح + + + {`جدید`} + + + + {`توسعه ای`} + + + + {`فعال`} + + + + {`نیمه تمام`} + + + + {`راکد`} + + + + + + + + 13- + {`میزان پیشرفت فیزیکی طرح قبل از درخواست تسهیلات:`} + + + + + 14- + {`پیش بینی تاریخ بهره برداری:`} + + + + + 15- + {`میزان سرمایه گذاری (میلیون ریال): کل ${varables.sarmaye_all} برآورد منابع مالی مورد نیاز جهت بهره برداری پروژه: ${varables.bahrebardari}`} + + + + + 16- + {`سابقه استفاده از تسهیلات تکلیفی بر اساس خود اظهاری متقاضی:`} + + {`دارد`} + + + + {`ندارد`} + + + + + + + + + {`وضعیت بدهی ها بر اساس خود اظهاری متقاضی: مطالبات بانکی معقول:`} + + {`دارد`} + + + + {`ندارد`} + + + {`بدهی مالیاتی:`} + + {`دارد`} + + + + {`ندارد`} + + + + + {`چک برگشتی`} + + {`دارد`} + + + + {`ندارد`} + + + {`وثیقه (به جز طرح):`} + + {`دارد`} + + + + {`ندارد`} + + + نوع وثیقه: .............. + بانک عامل دارای حساب: + .................. + + + + + + + 17- + اشتغال (نفر): + {`موجود: ${varables.nafar} تعهد شده: ${varables.tahod_shode} کل: ${varables.kol} هزینه سرانه ایجاد اشتغال: ${varables.sarane}`} + + توجه: متغاضی استفاده از تسهیلات محقق اشتغال پیش بینی شده + را متعهد شده و پس از دریافت تسهیلات اشتغال (با تایید بیمه تامین اجتماعی) صورت می + پذیرد. + +
+
+ ) +} + +export default Content \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Prints/form-b/index.jsx b/src/components/dashboard/passenger-boss/Prints/form-b/index.jsx new file mode 100644 index 0000000..c3151b7 --- /dev/null +++ b/src/components/dashboard/passenger-boss/Prints/form-b/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-b/Content"; + +const FormBComponent = () => { + const t = useTranslations() + const [data, setData] = useState(null) + const [loading, setLoading] = useState(true) + const [isNotData, setIsNotData] = useState(true) + + useEffect(() => { + if (sessionStorage.getItem('form-b-print') === null) { + setLoading(false) + setIsNotData(true) + sessionStorage.setItem('form-b-print', 'seen') + } else if (sessionStorage.getItem('form-b-print') === 'seen') { + setLoading(false) + setData(null) + setIsNotData(true) + } else if (data) { + setLoading(false) + sessionStorage.setItem('form-b-print', 'seen') + setIsNotData(false) + } else { + setLoading(true) + setData(JSON.parse(sessionStorage.getItem('form-b-print'))) + setIsNotData(true) + } + }, [data]); + + return ( + + {loading ? ( + + + + {t('print_loading')} + + + + ) : !data ? ( + + + {t('data_not_found')} + + + ) : !data.length ? ( + + + {t('data_not_found')} + + + ) : data.map(item => )} + + ) +} + +export default FormBComponent \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/TableToolbar.jsx b/src/components/dashboard/passenger-boss/TableToolbar.jsx index 91db1f3..a0f71dc 100644 --- a/src/components/dashboard/passenger-boss/TableToolbar.jsx +++ b/src/components/dashboard/passenger-boss/TableToolbar.jsx @@ -1,11 +1,12 @@ import {Stack} from "@mui/material"; -import PrintFinalCreditAmount from "@/components/dashboard/passenger-boss/Buttons/printFinalCreditAmount"; import PrintExcel from "@/components/dashboard/passenger-boss/Buttons/printExcel"; +import PrintFormB from "@/components/dashboard/passenger-boss/Buttons/printFormB"; const TableToolbar = ({table}) => { return ( - + {/**/} + ) diff --git a/src/core/components/PrintablePage.jsx b/src/core/components/PrintablePage.jsx index 70a264b..8a92900 100644 --- a/src/core/components/PrintablePage.jsx +++ b/src/core/components/PrintablePage.jsx @@ -1,6 +1,6 @@ import {Box, Container, Divider, Grid, Paper, Stack, Typography} from '@mui/material'; -const PrintablePage = ({children, header, footer}) => ( +const PrintablePage = ({children, header, footer, paperSx = {}}) => ( <> ( - + {children} + ) +} + +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