diff --git a/src/app/pdf/suitable/page.tsx b/src/app/pdf/suitable/page.tsx deleted file mode 100644 index cdc520a..0000000 --- a/src/app/pdf/suitable/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import SuitableDownloadPdf from '@/components/pdf/SuitableDownloadPdf' - -export default function page() { - return ( - <> - - - ) -} diff --git a/src/components/pdf/SuitableDownloadPdf.tsx b/src/components/pdf/SuitableDownloadPdf.tsx deleted file mode 100644 index c034fe9..0000000 --- a/src/components/pdf/SuitableDownloadPdf.tsx +++ /dev/null @@ -1,132 +0,0 @@ -'use client' - -import { useEffect, useRef, useState } from 'react' -import generatePDF, { Margin, Options, Resolution, usePDF } from 'react-to-pdf' -import { useSuitable } from '@/hooks/useSuitable' -import { useSuitableStore } from '@/store/useSuitableStore' -import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable' - -export default function SuitableDownloadPdf() { - const [fileName, setFileName] = useState([]) - const [createTime, setCreateTime] = useState('') - const targetRef = useRef(null) - const { toCodeName, toSuitableDetail, selectedSuitables, isSelectedSuitablesLoading } = useSuitable() - const { selectedCategory, suitableCommCode, selectedItemsSearching, setSelectedItemsSearching } = useSuitableStore() - - const handleDownPdf = () => { - const options: Options = { - filename: `${fileName.join('_')}.pdf`, - method: 'open' as const, - resolution: Resolution.HIGH, - page: { - margin: Margin.SMALL, - format: 'A4', - orientation: 'landscape' as const, - }, - canvas: { - mimeType: 'image/png' as const, - qualityRatio: 1, - }, - overrides: { - pdf: { - compress: true, - }, - canvas: { - useCORS: true, - }, - }, - } - - generatePDF(targetRef, options) - // generatePDF(targetRef, { filename: 'page.pdf' }) - } - - const formatDateString = () => { - const now = new Date() - const year = now.getFullYear() - const month = now.getMonth() + 1 - const day = now.getDate() - const hours = now.getHours() - const minutes = now.getMinutes() - - return `${year}年${month}月${day}日 ${hours}:${minutes.toString().padStart(2, '0')}` - } - - useEffect(() => { - setCreateTime(formatDateString()) - setFileName([ - `(${suitableCommCode.get(SUITABLE_HEAD_CODE.ROOF_MATL_GRP_CD)?.find((category) => category.code === selectedCategory)?.codeJp})`, - '屋根材適合表', - ]) - if (!selectedItemsSearching) { - setSelectedItemsSearching(true) - } - }, []) - - if (!selectedCategory) return
잘못된 접근입니다.
- if (isSelectedSuitablesLoading) return
Loading...
- - return ( - <> - {/* */} -
-
-
-
ハンファジャパン株式会社
-
{fileName.join(' ')}
-
{createTime}
-
-
-

本適合表は参考資料としてご使用下さい。

-

屋根材製品の形状・仕様はメーカーより変更される場合が御座います。

-

又、現場環境(働き、勾配、瓦桟木条件等)により本適合表と異なる適合結果となる場合が御座います。予めご了承下さい。

-

屋根材以外の設置条件(垂木、野地板等の設置基準)も必ずご確認下さい。

-
-
{createTime}
-
-
-
- {selectedSuitables?.map((item: Suitable) => ( -
-
- {item.productName} - {toCodeName(SUITABLE_HEAD_CODE.MANU_FT_CD, item.manuFtCd)} - {toCodeName(SUITABLE_HEAD_CODE.ROOF_MT_CD, item.roofMtCd)} -
-
- - - - - - - - - - - - - - - - - {toSuitableDetail(item.detail).map((subItem: SuitableDetail) => ( - - - - - - - ))} - -
金具タイプ金具名設置可否備考
{toCodeName(SUITABLE_HEAD_CODE.ROOF_SH_CD, item.roofShCd)}{toCodeName(SUITABLE_HEAD_CODE.TRESTLE_MFPC_CD, subItem.trestleMfpcCd)}{subItem.trestleManufacturerProductName}{subItem.memo}
-
-
- ))} -
-
{createTime}
-
-
- - ) -}