remove: 구 지붕재 적합성 pdf 페이지 삭제

This commit is contained in:
Daseul Kim 2025-06-05 16:15:07 +09:00
parent 1db17d6558
commit 85344afd43
2 changed files with 0 additions and 141 deletions

View File

@ -1,9 +0,0 @@
import SuitableDownloadPdf from '@/components/pdf/SuitableDownloadPdf'
export default function page() {
return (
<>
<SuitableDownloadPdf />
</>
)
}

View File

@ -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<string[]>([])
const [createTime, setCreateTime] = useState('')
const targetRef = useRef<HTMLDivElement>(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 <div> .</div>
if (isSelectedSuitablesLoading) return <div>Loading...</div>
return (
<>
{/* <button onClick={() => handleDownPdf()}>PDFダウンロード</button> */}
<div className="pdf-table-wrap" ref={targetRef}>
<div className="pdf-intro-page">
<div className="pdf-intro-tit-wrap">
<div className="pdf-intro-tit mb20"></div>
<div className="pdf-intro-tit mb20">{fileName.join(' ')}</div>
<div className="pdf-intro-date">{createTime}</div>
</div>
<div className="pdf-intro-cont-wrap">
<p>使</p>
<p></p>
<p></p>
<p></p>
</div>
<div className="pdf-intro-foot-date">{createTime}</div>
</div>
<div className="pdf-table-content">
<div className="pdf-table-grid-wrap">
{selectedSuitables?.map((item: Suitable) => (
<div className="pdf-table-card" key={item.id}>
<div className="pdf-table-tit-wrap">
<span>{item.productName}</span>
<span>{toCodeName(SUITABLE_HEAD_CODE.MANU_FT_CD, item.manuFtCd)}</span>
<span>{toCodeName(SUITABLE_HEAD_CODE.ROOF_MT_CD, item.roofMtCd)}</span>
</div>
<div className="pdf-roof-table">
<table>
<colgroup>
<col width={'18%'} />
<col width={'23%'} />
<col width={'18%'} />
<col />
</colgroup>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{toSuitableDetail(item.detail).map((subItem: SuitableDetail) => (
<tr key={subItem.id}>
<td>{toCodeName(SUITABLE_HEAD_CODE.ROOF_SH_CD, item.roofShCd)}</td>
<td>{toCodeName(SUITABLE_HEAD_CODE.TRESTLE_MFPC_CD, subItem.trestleMfpcCd)}</td>
<td>{subItem.trestleManufacturerProductName}</td>
<td>{subItem.memo}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
))}
</div>
<div className="pdf-intro-foot-date">{createTime}</div>
</div>
</div>
</>
)
}