Compare commits
No commits in common. "52a2032a8c5061c3a6590b9f1fcefd3779d1d571" and "1adbb24daa3b54c8b383a05dc6dd754ab4854ec9" have entirely different histories.
52a2032a8c
...
1adbb24daa
@ -9,8 +9,6 @@ NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120
|
|||||||
|
|
||||||
#1:1문의 api
|
#1:1문의 api
|
||||||
NEXT_PUBLIC_INQUIRY_API_URL=http://172.23.4.129:8110
|
NEXT_PUBLIC_INQUIRY_API_URL=http://172.23.4.129:8110
|
||||||
NEXT_PUBLIC_INQUIRY_FILE_DOWNLOAD_API_URL=https://jp-dev.qsalesplatform.com
|
|
||||||
|
|
||||||
|
|
||||||
#QPARTNER 로그인 api
|
#QPARTNER 로그인 api
|
||||||
DB_HOST=202.218.61.226
|
DB_HOST=202.218.61.226
|
||||||
|
|||||||
@ -9,7 +9,6 @@ NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120
|
|||||||
|
|
||||||
#1:1문의 api
|
#1:1문의 api
|
||||||
NEXT_PUBLIC_INQUIRY_API_URL=http://172.23.4.129:8110
|
NEXT_PUBLIC_INQUIRY_API_URL=http://172.23.4.129:8110
|
||||||
NEXT_PUBLIC_INQUIRY_FILE_DOWNLOAD_API_URL=https://jp-dev.qsalesplatform.com
|
|
||||||
|
|
||||||
#QPARTNER 로그인 api
|
#QPARTNER 로그인 api
|
||||||
DB_HOST=202.218.61.226
|
DB_HOST=202.218.61.226
|
||||||
|
|||||||
@ -20,6 +20,7 @@ export async function GET(request: NextRequest) {
|
|||||||
if (!headCd) {
|
if (!headCd) {
|
||||||
return NextResponse.json({ error: `${headCode}를 찾을 수 없습니다` }, { status: 404 })
|
return NextResponse.json({ error: `${headCode}를 찾을 수 없습니다` }, { status: 404 })
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const roofMaterials: CommCode[] = await prisma.BC_COMM_L.findMany({
|
const roofMaterials: CommCode[] = await prisma.BC_COMM_L.findMany({
|
||||||
where: {
|
where: {
|
||||||
@ -34,29 +35,10 @@ export async function GET(request: NextRequest) {
|
|||||||
CODE: 'asc',
|
CODE: 'asc',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (headCode === 'SALES_OFFICE_CD') {
|
|
||||||
return getSaleOffice(headCd.HEAD_CD)
|
|
||||||
}
|
|
||||||
return NextResponse.json(roofMaterials)
|
return NextResponse.json(roofMaterials)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ 데이터 조회 중 오류가 발생했습니다:', error)
|
console.error('❌ 데이터 조회 중 오류가 발생했습니다:', error)
|
||||||
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSaleOffice = async (headCode: string) => {
|
|
||||||
// @ts-ignore
|
|
||||||
const commCodeSaleOffice: CommCode[] = await prisma.BC_COMM_L.findMany({
|
|
||||||
where: {
|
|
||||||
HEAD_CD: headCode,
|
|
||||||
REF_NUM1: 1,
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
CODE: true,
|
|
||||||
CODE_JP: true,
|
|
||||||
REF_CHR1: true,
|
|
||||||
REF_NUM1: true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return NextResponse.json(commCodeSaleOffice)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -4,30 +4,19 @@ import { NextResponse } from 'next/server'
|
|||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
const { searchParams } = new URL(request.url)
|
const { searchParams } = new URL(request.url)
|
||||||
const encodeFileNo = searchParams.get('encodeFileNo')
|
const encodeFileNo = searchParams.get('encodeFileNo')
|
||||||
const srcFileNm = searchParams.get('srcFileNm')
|
|
||||||
|
|
||||||
if (!encodeFileNo) {
|
if (!encodeFileNo) {
|
||||||
return NextResponse.json({ error: 'encodeFileNo is required' }, { status: 400 })
|
return NextResponse.json({ error: 'encodeFileNo is required' }, { status: 400 })
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${process.env.NEXT_PUBLIC_INQUIRY_FILE_DOWNLOAD_API_URL}/api/file/downloadFile2`, {
|
const response = await axios.get(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/file/downloadFile`, {
|
||||||
responseType: 'arraybuffer',
|
|
||||||
params: {
|
params: {
|
||||||
encodeFileNo,
|
encodeFileNo,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (response.headers['content-type'] === 'application/octet-stream;charset=UTF-8') {
|
return NextResponse.json(response.data)
|
||||||
return new NextResponse(response.data, {
|
|
||||||
status: 200,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/octet-stream;charset=UTF-8',
|
|
||||||
'Content-Disposition': `attachment; filename="${srcFileNm}"`,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return NextResponse.json({ error: 'file not found' }, { status: 404 })
|
|
||||||
}
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error(error.response)
|
||||||
return NextResponse.json({ error: error.response.data }, { status: 500 })
|
return NextResponse.json({ error: error.response.data }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import { NextResponse } from 'next/server'
|
|||||||
|
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
const formData = await request.formData()
|
const formData = await request.formData()
|
||||||
console.log(formData)
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/qna/save`, formData, {
|
const response = await axios.post(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/qna/save`, formData, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
9
src/app/pdf/page.tsx
Normal file
9
src/app/pdf/page.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import DownloadPdf from '@/components/DownloadPDF'
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DownloadPdf />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import SuitableDownloadPdf from '@/components/pdf/SuitableDownloadPdf'
|
|
||||||
|
|
||||||
export default function page() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<SuitableDownloadPdf />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import SurveySaleDownloadPdf from '@/components/pdf/SurveySaleDownloadPdf'
|
|
||||||
|
|
||||||
export default function page() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<SurveySaleDownloadPdf />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,22 +1,9 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect, useRef } from 'react'
|
import { useRef } from 'react'
|
||||||
import generatePDF, { Margin, Resolution } from 'react-to-pdf'
|
import generatePDF, { Margin, Resolution } from 'react-to-pdf'
|
||||||
import { useParams } from 'next/navigation'
|
|
||||||
import { useSurvey } from '@/hooks/useSurvey'
|
|
||||||
import { radioEtcData, roofMaterial, selectBoxOptions, supplementaryFacilities } from '../survey-sale/detail/RoofForm'
|
|
||||||
|
|
||||||
export default function SurveySaleDownloadPdf() {
|
|
||||||
const params = useParams()
|
|
||||||
const id = params.id
|
|
||||||
|
|
||||||
const { surveyDetail, isLoadingSurveyDetail } = useSurvey(Number(id))
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isLoadingSurveyDetail) return
|
|
||||||
handleDownPdf()
|
|
||||||
}, [surveyDetail, isLoadingSurveyDetail])
|
|
||||||
|
|
||||||
|
export default function DownloadPdf() {
|
||||||
const targetRef = useRef<HTMLDivElement>(null)
|
const targetRef = useRef<HTMLDivElement>(null)
|
||||||
const handleDownPdf = () => {
|
const handleDownPdf = () => {
|
||||||
const options = {
|
const options = {
|
||||||
@ -46,7 +33,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <button onClick={handleDownPdf}>down</button> */}
|
<button onClick={handleDownPdf}>down</button>
|
||||||
<div ref={targetRef} style={{ boxSizing: 'border-box' }}>
|
<div ref={targetRef} style={{ boxSizing: 'border-box' }}>
|
||||||
<div style={{ margin: '0 auto', padding: 0, maxWidth: '800px', minWidth: '800px' }}>
|
<div style={{ margin: '0 auto', padding: 0, maxWidth: '800px', minWidth: '800px' }}>
|
||||||
<div style={{ padding: '20px 20px 50px', borderBottom: '2px solid #2E3A59' }}>
|
<div style={{ padding: '20px 20px 50px', borderBottom: '2px solid #2E3A59' }}>
|
||||||
@ -59,14 +46,12 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
現地明登施工店名
|
現地明登施工店名
|
||||||
</p>
|
</p>
|
||||||
<p style={{ margin: 0, padding: 0, fontSize: '13px', color: '#FF5656', fontWeight: 400, fontFamily: 'M-Gothic' }}>
|
<p style={{ margin: 0, padding: 0, fontSize: '13px', color: '#FF5656', fontWeight: 400, fontFamily: 'M-Gothic' }}>
|
||||||
{surveyDetail?.store}
|
Sheet2 No.4Sheet2
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ float: 'right' }}>
|
<div style={{ float: 'right' }}>
|
||||||
<p style={{ margin: 0, padding: 0, fontSize: '13px', color: '#101010', fontWeight: 500, fontFamily: 'M-Gothic' }}>現地阴買日</p>
|
<p style={{ margin: 0, padding: 0, fontSize: '13px', color: '#101010', fontWeight: 500, fontFamily: 'M-Gothic' }}>現地阴買日</p>
|
||||||
<p style={{ margin: 0, padding: 0, fontSize: '13px', color: '#FF5656', fontWeight: 400, fontFamily: 'M-Gothic' }}>
|
<p style={{ margin: 0, padding: 0, fontSize: '13px', color: '#FF5656', fontWeight: 400, fontFamily: 'M-Gothic' }}>2025.05.09</p>
|
||||||
{surveyDetail?.investigationDate}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -101,7 +86,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{surveyDetail?.customerName}
|
Sheet2No.1
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -130,7 +115,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{surveyDetail?.postCode ? `(${surveyDetail?.postCode}) ${surveyDetail?.address} ${surveyDetail?.addressDetail}` : '-'}
|
Sheet2No.2
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -168,7 +153,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{surveyDetail?.detailInfo?.contractCapacity}
|
Sheet2No.1
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -195,7 +180,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{surveyDetail?.detailInfo?.retailCompany}
|
Sheet2No.1
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -225,13 +210,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{supplementaryFacilities
|
Sheet2No.7 選式回答表示/自由入力回答表示
|
||||||
.filter((facility) => surveyDetail?.detailInfo?.supplementaryFacilities?.includes(facility.id.toString()))
|
|
||||||
.map((facility) => facility.name)
|
|
||||||
.join(', ')}
|
|
||||||
{surveyDetail?.detailInfo?.supplementaryFacilitiesEtc
|
|
||||||
? `, (その他) ${surveyDetail?.detailInfo?.supplementaryFacilitiesEtc}`
|
|
||||||
: '-'}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -261,11 +240,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{
|
Sheet2No.8 選択式回表示/自由入力回表
|
||||||
selectBoxOptions.installationSystem.find((system) => system.id.toString() === surveyDetail?.detailInfo?.installationSystem)
|
|
||||||
?.name
|
|
||||||
}
|
|
||||||
{surveyDetail?.detailInfo?.installationSystemEtc ? `, (その他) ${surveyDetail?.detailInfo?.installationSystemEtc}` : '-'}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -303,7 +278,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{surveyDetail?.detailInfo?.constructionYear === '1' ? '新築' : `既築 (${surveyDetail?.detailInfo?.constructionYear}年)`}
|
No.9
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -330,11 +305,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{roofMaterial
|
No.10
|
||||||
.filter((material) => surveyDetail?.detailInfo?.roofMaterial?.includes(material.id.toString()))
|
|
||||||
.map((material) => material.name)
|
|
||||||
.join(', ')}
|
|
||||||
{surveyDetail?.detailInfo?.roofMaterialEtc ? `, (その他) ${surveyDetail?.detailInfo?.roofMaterialEtc}` : '-'}
|
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -361,7 +332,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectBoxOptions.roofShape.find((shape) => shape.id.toString() === surveyDetail?.detailInfo?.roofShape)?.name}
|
No.11
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -390,7 +361,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{`${surveyDetail?.detailInfo?.roofSlope} 寸`}
|
No.12
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -418,7 +389,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{`${surveyDetail?.detailInfo?.houseStructure ? '木製' : '(その他)'} ${surveyDetail?.detailInfo?.houseStructureEtc}`}
|
No.13
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -447,8 +418,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{radioEtcData.rafterMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.rafterMaterial)?.label ??
|
No.14
|
||||||
(surveyDetail?.detailInfo?.rafterMaterialEtc ? `(その他) ${surveyDetail?.detailInfo?.rafterMaterialEtc}` : '-')}
|
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -476,8 +446,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectBoxOptions.rafterSize.find((size) => size.id.toString() === surveyDetail?.detailInfo?.rafterSize)?.name ??
|
No.15
|
||||||
(surveyDetail?.detailInfo?.rafterSizeEtc ? `(その他) ${surveyDetail?.detailInfo?.rafterSizeEtc}` : '-')}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -494,7 +463,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
垂木ピッチ
|
垂木ビッチ
|
||||||
</th>
|
</th>
|
||||||
<td
|
<td
|
||||||
style={{
|
style={{
|
||||||
@ -506,8 +475,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectBoxOptions.rafterPitch.find((pitch) => pitch.id.toString() === surveyDetail?.detailInfo?.rafterPitch)?.name ??
|
No.16
|
||||||
(surveyDetail?.detailInfo?.rafterPitchEtc ? `(その他) ${surveyDetail?.detailInfo?.rafterPitchEtc}` : '-')}
|
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -535,8 +503,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{radioEtcData.rafterDirection.find((direction) => direction.id.toString() === surveyDetail?.detailInfo?.rafterDirection)?.label ??
|
No.17
|
||||||
'-'}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -565,8 +532,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectBoxOptions.openFieldPlateKind.find((kind) => kind.id.toString() === surveyDetail?.detailInfo?.openFieldPlateKind)?.name ??
|
No.18
|
||||||
(surveyDetail?.detailInfo?.openFieldPlateKindEtc ? `(その他) ${surveyDetail?.detailInfo?.openFieldPlateKindEtc}` : '-')}
|
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -594,7 +560,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{surveyDetail?.detailInfo?.openFieldPlateThickness ? `${surveyDetail?.detailInfo?.openFieldPlateThickness}mm` : '-'}
|
No.19
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -624,7 +590,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{surveyDetail?.detailInfo?.leakTrace ? 'あり' : 'なし'}
|
No.20
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -654,9 +620,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{radioEtcData.waterproofMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.waterproofMaterial)
|
No.21
|
||||||
?.label ??
|
|
||||||
(surveyDetail?.detailInfo?.waterproofMaterialEtc ? `(その他) ${surveyDetail?.detailInfo?.waterproofMaterialEtc}` : '-')}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -686,11 +650,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{
|
No.22
|
||||||
radioEtcData.insulationPresence.find((presence) => presence.id.toString() === surveyDetail?.detailInfo?.insulationPresence)
|
|
||||||
?.label
|
|
||||||
}
|
|
||||||
{surveyDetail?.detailInfo?.insulationPresenceEtc ? `(その他) ${surveyDetail?.detailInfo?.insulationPresenceEtc}` : '-'}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -720,8 +680,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectBoxOptions.structureOrder.find((order) => order.id.toString() === surveyDetail?.detailInfo?.structureOrder)?.name ??
|
No.23
|
||||||
(surveyDetail?.detailInfo?.structureOrderEtc ? `(その他) ${surveyDetail?.detailInfo?.structureOrderEtc}` : '-')}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -759,14 +718,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{
|
No.23
|
||||||
selectBoxOptions.installationAvailability.find(
|
|
||||||
(availability) => availability.id.toString() === surveyDetail?.detailInfo?.installationAvailability,
|
|
||||||
)?.name
|
|
||||||
}
|
|
||||||
{surveyDetail?.detailInfo?.installationAvailabilityEtc
|
|
||||||
? `(その他) ${surveyDetail?.detailInfo?.installationAvailabilityEtc}`
|
|
||||||
: '-'}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -786,7 +738,7 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
height: '150px',
|
height: '150px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{surveyDetail?.detailInfo?.memo ?? '-'}
|
No.25
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -2,13 +2,7 @@
|
|||||||
|
|
||||||
import { Inquiry } from '@/types/Inquiry'
|
import { Inquiry } from '@/types/Inquiry'
|
||||||
|
|
||||||
export default function Answer({
|
export default function Answer({ inquiryDetail, downloadFile }: { inquiryDetail: Inquiry; downloadFile: (encodeFileNo: number) => Promise<File> }) {
|
||||||
inquiryDetail,
|
|
||||||
downloadFile,
|
|
||||||
}: {
|
|
||||||
inquiryDetail: Inquiry
|
|
||||||
downloadFile: (encodeFileNo: number, srcFileNm: string) => Promise<Blob | null>
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="inquiry-answer-wrap">
|
<div className="inquiry-answer-wrap">
|
||||||
@ -27,7 +21,7 @@ export default function Answer({
|
|||||||
<ul className="file-list">
|
<ul className="file-list">
|
||||||
{inquiryDetail?.ansListFile?.map((file) => (
|
{inquiryDetail?.ansListFile?.map((file) => (
|
||||||
<li className="file-item" key={file.fileNo}>
|
<li className="file-item" key={file.fileNo}>
|
||||||
<button className="file-item-bx" onClick={() => downloadFile(Number(file.encodeFileNo), file.srcFileNm)}>
|
<button className="file-item-bx" onClick={() => downloadFile(Number(file.encodeFileNo))}>
|
||||||
<div className="file-item-name">{file.srcFileNm} </div>
|
<div className="file-item-name">{file.srcFileNm} </div>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -65,12 +65,7 @@ export default function Detail() {
|
|||||||
<ul className="file-list">
|
<ul className="file-list">
|
||||||
{inquiryDetail?.listFile?.map((file) => (
|
{inquiryDetail?.listFile?.map((file) => (
|
||||||
<li className="file-item" key={file.fileNo}>
|
<li className="file-item" key={file.fileNo}>
|
||||||
<button
|
<button className="file-item-bx" onClick={() => downloadFile(Number(file.encodeFileNo))}>
|
||||||
className="file-item-bx"
|
|
||||||
onClick={() => {
|
|
||||||
downloadFile(Number(file.encodeFileNo), file.srcFileNm)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="file-item-name">{file.srcFileNm} </div>
|
<div className="file-item-name">{file.srcFileNm} </div>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -74,6 +74,7 @@ export default function RegistForm() {
|
|||||||
focusOnRequiredField('qstMail')
|
focusOnRequiredField('qstMail')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
attachedFiles.forEach((file) => {
|
attachedFiles.forEach((file) => {
|
||||||
formData.append('files', file)
|
formData.append('files', file)
|
||||||
@ -81,6 +82,12 @@ export default function RegistForm() {
|
|||||||
Object.entries(inquiryRequest).forEach(([key, value]) => {
|
Object.entries(inquiryRequest).forEach(([key, value]) => {
|
||||||
formData.append(key, value ?? '')
|
formData.append(key, value ?? '')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const formDataObj: Record<string, any> = {}
|
||||||
|
formData.forEach((value, key) => {
|
||||||
|
formDataObj[key] = value
|
||||||
|
})
|
||||||
|
|
||||||
window.neoConfirm(
|
window.neoConfirm(
|
||||||
'お問い合わせを登録しますか? Hanwha Japanの担当者にお問い合わせメールが送信されます。',
|
'お問い合わせを登録しますか? Hanwha Japanの担当者にお問い合わせメールが送信されます。',
|
||||||
async () => {
|
async () => {
|
||||||
@ -108,9 +115,7 @@ export default function RegistForm() {
|
|||||||
value={inquiryRequest.qnaClsLrgCd}
|
value={inquiryRequest.qnaClsLrgCd}
|
||||||
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsLrgCd: e.target.value })}
|
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsLrgCd: e.target.value })}
|
||||||
>
|
>
|
||||||
<option value="" hidden>
|
<option value="" hidden>選択してください</option>
|
||||||
選択してください
|
|
||||||
</option>
|
|
||||||
{commonCodeList
|
{commonCodeList
|
||||||
.filter((code) => code.headCd === '204200')
|
.filter((code) => code.headCd === '204200')
|
||||||
.map((code) => (
|
.map((code) => (
|
||||||
@ -128,9 +133,7 @@ export default function RegistForm() {
|
|||||||
value={inquiryRequest.qnaClsMidCd}
|
value={inquiryRequest.qnaClsMidCd}
|
||||||
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsMidCd: e.target.value })}
|
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsMidCd: e.target.value })}
|
||||||
>
|
>
|
||||||
<option value="" hidden>
|
<option value="" hidden>選択してください</option>
|
||||||
選択してください
|
|
||||||
</option>
|
|
||||||
{commonCodeList
|
{commonCodeList
|
||||||
.filter((code) => code.refChar1 === inquiryRequest.qnaClsLrgCd)
|
.filter((code) => code.refChar1 === inquiryRequest.qnaClsLrgCd)
|
||||||
.map((code) => (
|
.map((code) => (
|
||||||
@ -148,9 +151,7 @@ export default function RegistForm() {
|
|||||||
value={inquiryRequest.qnaClsSmlCd ?? ''}
|
value={inquiryRequest.qnaClsSmlCd ?? ''}
|
||||||
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsSmlCd: e.target.value })}
|
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsSmlCd: e.target.value })}
|
||||||
>
|
>
|
||||||
<option value="" hidden>
|
<option value="" hidden>選択してください</option>
|
||||||
選択してください
|
|
||||||
</option>
|
|
||||||
{commonCodeList
|
{commonCodeList
|
||||||
.filter((code) => code.refChar1 === inquiryRequest.qnaClsMidCd)
|
.filter((code) => code.refChar1 === inquiryRequest.qnaClsMidCd)
|
||||||
.map((code) => (
|
.map((code) => (
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,18 +1,15 @@
|
|||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
import { useParams } from 'next/navigation'
|
import { useParams } from 'next/navigation'
|
||||||
import { useSurvey } from '@/hooks/useSurvey'
|
import { useServey } from '@/hooks/useSurvey'
|
||||||
import { useEffect, useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import { useCommCode } from '@/hooks/useCommCode'
|
|
||||||
import { CommCode } from '@/types/CommCode'
|
|
||||||
|
|
||||||
interface SubmitFormData {
|
interface SubmitFormData {
|
||||||
saleBase: string | null
|
|
||||||
store: string
|
store: string
|
||||||
sender: string
|
sender: string
|
||||||
receiver: string[]
|
receiver: string
|
||||||
reference: string | null
|
reference: string
|
||||||
title: string
|
title: string
|
||||||
contents: string
|
contents: string
|
||||||
}
|
}
|
||||||
@ -23,45 +20,31 @@ interface FormField {
|
|||||||
required: boolean
|
required: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const FORM_FIELDS: FormField[] = [
|
||||||
|
{ id: 'store', name: '提出販売店', required: true },
|
||||||
|
{ id: 'sender', name: '発送者', required: true },
|
||||||
|
{ id: 'receiver', name: '受信者', required: true },
|
||||||
|
{ id: 'reference', name: '参考', required: false },
|
||||||
|
{ id: 'title', name: 'タイトル', required: true },
|
||||||
|
{ id: 'contents', name: '内容', required: true },
|
||||||
|
]
|
||||||
|
|
||||||
export default function SurveySaleSubmitPopup() {
|
export default function SurveySaleSubmitPopup() {
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
const routeId = params.id
|
const routeId = params.id
|
||||||
|
|
||||||
const [commCodeList, setCommCodeList] = useState<CommCode[]>([])
|
|
||||||
|
|
||||||
const { getCommCode } = useCommCode()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (session?.isLoggedIn && session?.role === 'Admin') {
|
|
||||||
getCommCode('SALES_OFFICE_CD').then((codes) => {
|
|
||||||
setCommCodeList(codes)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [session])
|
|
||||||
|
|
||||||
const FORM_FIELDS: FormField[] = [
|
|
||||||
{ id: 'saleBase', name: '提出地点選択', required: session?.role === 'Admin' },
|
|
||||||
{ id: 'store', name: '提出販売店', required: true },
|
|
||||||
{ id: 'sender', name: '発送者', required: true },
|
|
||||||
{ id: 'receiver', name: '受信者', required: true },
|
|
||||||
{ id: 'reference', name: '参考', required: false },
|
|
||||||
{ id: 'title', name: 'タイトル', required: true },
|
|
||||||
{ id: 'contents', name: '内容', required: true },
|
|
||||||
]
|
|
||||||
|
|
||||||
const [submitData, setSubmitData] = useState<SubmitFormData>({
|
const [submitData, setSubmitData] = useState<SubmitFormData>({
|
||||||
saleBase: null,
|
|
||||||
store: '',
|
store: '',
|
||||||
sender: session?.email ?? '',
|
sender: session?.email ?? '',
|
||||||
receiver: [],
|
receiver: '',
|
||||||
reference: null,
|
reference: '',
|
||||||
title: '[HANASYS現地調査] 調査物件が提出.',
|
title: '[HANASYS現地調査] 調査物件が提出.',
|
||||||
contents: '',
|
contents: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const { submitSurvey, isSubmittingSurvey } = useSurvey(Number(routeId))
|
const { submitSurvey, isSubmittingSurvey } = useServey(Number(routeId))
|
||||||
|
|
||||||
const handleInputChange = (field: keyof SubmitFormData, value: string) => {
|
const handleInputChange = (field: keyof SubmitFormData, value: string) => {
|
||||||
setSubmitData((prev) => ({ ...prev, [field]: value }))
|
setSubmitData((prev) => ({ ...prev, [field]: value }))
|
||||||
@ -71,15 +54,16 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
const requiredFields = FORM_FIELDS.filter((field) => field.required)
|
const requiredFields = FORM_FIELDS.filter((field) => field.required)
|
||||||
|
|
||||||
for (const field of requiredFields) {
|
for (const field of requiredFields) {
|
||||||
if (data[field.id]?.length === 0) {
|
if (!data[field.id].trim()) {
|
||||||
alert(`${field.name}は必須入力項目です。`)
|
|
||||||
const element = document.getElementById(field.id)
|
const element = document.getElementById(field.id)
|
||||||
if (element) {
|
if (element) {
|
||||||
element.focus()
|
element.focus()
|
||||||
}
|
}
|
||||||
|
alert(`${field.name}は必須入力項目です。`)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,12 +83,9 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const renderFormField = (field: FormField) => {
|
const renderFormField = (field: FormField) => {
|
||||||
|
// const isReadOnly = (field.id === 'store' && session?.role !== 'Partner') || (field.id === 'receiver' && session?.role !== 'Partner')
|
||||||
const isReadOnly = false
|
const isReadOnly = false
|
||||||
|
|
||||||
if (field.id === 'saleBase' && session?.role !== 'Admin') {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="data-input-form-bx" key={field.id}>
|
<div className="data-input-form-bx" key={field.id}>
|
||||||
<div className="data-input-form-tit">
|
<div className="data-input-form-tit">
|
||||||
@ -115,43 +96,18 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
<textarea
|
<textarea
|
||||||
className="textarea-form"
|
className="textarea-form"
|
||||||
id={field.id}
|
id={field.id}
|
||||||
value={submitData[field.id] ?? ''}
|
value={submitData[field.id]}
|
||||||
onChange={(e) => handleInputChange(field.id, e.target.value)}
|
onChange={(e) => handleInputChange(field.id, e.target.value)}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<input
|
||||||
{field.id === 'saleBase' && session?.role === 'Admin' ? (
|
className="input-frame"
|
||||||
<select
|
type="text"
|
||||||
className="select-form"
|
id={field.id}
|
||||||
id={field.id}
|
value={submitData[field.id]}
|
||||||
value={submitData[field.id] ?? ''}
|
onChange={(e) => handleInputChange(field.id, e.target.value)}
|
||||||
onChange={(e) => {
|
readOnly={isReadOnly}
|
||||||
const selectedOffice = commCodeList.find((item) => item.code === e.target.value)
|
/>
|
||||||
if (selectedOffice) {
|
|
||||||
//@ts-ignore
|
|
||||||
const receiver = selectedOffice.REF_CHR1.split(';')
|
|
||||||
setSubmitData((prev) => ({ ...prev, receiver: receiver, saleBase: e.target.value }))
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<option value="">選択してください</option>
|
|
||||||
{commCodeList.map((item) => (
|
|
||||||
<option key={item.code} value={item.code}>
|
|
||||||
{item.codeJp}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
) : (
|
|
||||||
<input
|
|
||||||
className="input-frame"
|
|
||||||
type="text"
|
|
||||||
id={field.id}
|
|
||||||
value={submitData[field.id] ?? ''}
|
|
||||||
onChange={(e) => handleInputChange(field.id, e.target.value)}
|
|
||||||
readOnly={isReadOnly}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useSurvey } from '@/hooks/useSurvey'
|
import { useServey } from '@/hooks/useSurvey'
|
||||||
import { useAddressStore } from '@/store/addressStore'
|
import { useAddressStore } from '@/store/addressStore'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
@ -19,7 +19,7 @@ type Address = {
|
|||||||
export default function ZipCodePopup() {
|
export default function ZipCodePopup() {
|
||||||
const [searchValue, setSearchValue] = useState('') //search 데이터 유무
|
const [searchValue, setSearchValue] = useState('') //search 데이터 유무
|
||||||
const { setAddressData } = useAddressStore()
|
const { setAddressData } = useAddressStore()
|
||||||
const { getZipCode } = useSurvey()
|
const { getZipCode } = useServey()
|
||||||
const [addressInfo, setAddressInfo] = useState<Address[] | null>([])
|
const [addressInfo, setAddressInfo] = useState<Address[] | null>([])
|
||||||
|
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import type { Mode, SurveyBasicRequest, SurveyDetailInfo, SurveyDetailRequest }
|
|||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useParams, useRouter, useSearchParams } from 'next/navigation'
|
import { useParams, useRouter, useSearchParams } from 'next/navigation'
|
||||||
import { requiredFields, useSurvey } from '@/hooks/useSurvey'
|
import { requiredFields, useServey } from '@/hooks/useSurvey'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
|
|
||||||
export default function ButtonForm(props: {
|
export default function ButtonForm(props: {
|
||||||
@ -72,8 +72,8 @@ export default function ButtonForm(props: {
|
|||||||
// 저장/임시저장/수정
|
// 저장/임시저장/수정
|
||||||
const id = Number(routeId) ? Number(routeId) : Number(idParam)
|
const id = Number(routeId) ? Number(routeId) : Number(idParam)
|
||||||
|
|
||||||
const { deleteSurvey, updateSurvey, isDeletingSurvey, isUpdatingSurvey } = useSurvey(Number(id))
|
const { deleteSurvey, updateSurvey, isDeletingSurvey, isUpdatingSurvey } = useServey(Number(id))
|
||||||
const { validateSurveyDetail, createSurvey, isCreatingSurvey } = useSurvey()
|
const { validateSurveyDetail, createSurvey, isCreatingSurvey } = useServey()
|
||||||
|
|
||||||
const handleSave = (isTemporary: boolean, isSubmitProcess = false) => {
|
const handleSave = (isTemporary: boolean, isSubmitProcess = false) => {
|
||||||
const emptyField = validateSurveyDetail(props.data.roof)
|
const emptyField = validateSurveyDetail(props.data.roof)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useSurvey } from '@/hooks/useSurvey'
|
import { useServey } from '@/hooks/useSurvey'
|
||||||
import { useParams } from 'next/navigation'
|
import { useParams } from 'next/navigation'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import DetailForm from './DetailForm'
|
import DetailForm from './DetailForm'
|
||||||
@ -16,7 +16,7 @@ export default function DataTable() {
|
|||||||
}
|
}
|
||||||
}, [id])
|
}, [id])
|
||||||
|
|
||||||
const { surveyDetail, isLoadingSurveyDetail } = useSurvey(Number(id))
|
const { surveyDetail, isLoadingSurveyDetail } = useServey(Number(id))
|
||||||
|
|
||||||
if (isLoadingSurveyDetail) {
|
if (isLoadingSurveyDetail) {
|
||||||
return <div>Loading...</div>
|
return <div>Loading...</div>
|
||||||
@ -67,7 +67,7 @@ export default function DataTable() {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>ダウンロード</th>
|
<th>ダウンロード</th>
|
||||||
<td>
|
<td>
|
||||||
<button className="data-down" onClick={() => window.open(`/pdf/survey-sale/${id}`, '_blank')}>
|
<button className="data-down">
|
||||||
HWJ現地調査票確認<i className="down-icon"></i>
|
HWJ現地調査票確認<i className="down-icon"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import ButtonForm from './ButtonForm'
|
|||||||
import BasicForm from './BasicForm'
|
import BasicForm from './BasicForm'
|
||||||
import RoofForm from './RoofForm'
|
import RoofForm from './RoofForm'
|
||||||
import { useParams, useSearchParams } from 'next/navigation'
|
import { useParams, useSearchParams } from 'next/navigation'
|
||||||
import { useSurvey } from '@/hooks/useSurvey'
|
import { useServey } from '@/hooks/useSurvey'
|
||||||
|
|
||||||
const roofInfoForm: SurveyDetailRequest = {
|
const roofInfoForm: SurveyDetailRequest = {
|
||||||
contractCapacity: null,
|
contractCapacity: null,
|
||||||
@ -71,7 +71,7 @@ export default function DetailForm() {
|
|||||||
const modeset = Number(routeId) ? 'READ' : idParam ? 'EDIT' : 'CREATE'
|
const modeset = Number(routeId) ? 'READ' : idParam ? 'EDIT' : 'CREATE'
|
||||||
const id = Number(routeId) ? Number(routeId) : Number(idParam)
|
const id = Number(routeId) ? Number(routeId) : Number(idParam)
|
||||||
|
|
||||||
const { surveyDetail, validateSurveyDetail } = useSurvey(Number(id))
|
const { surveyDetail, validateSurveyDetail } = useServey(Number(id))
|
||||||
|
|
||||||
const [mode, setMode] = useState<Mode>(modeset)
|
const [mode, setMode] = useState<Mode>(modeset)
|
||||||
const [basicInfoData, setBasicInfoData] = useState<SurveyBasicRequest>(basicInfoForm)
|
const [basicInfoData, setBasicInfoData] = useState<SurveyBasicRequest>(basicInfoForm)
|
||||||
|
|||||||
@ -312,7 +312,6 @@ export default function RoofForm(props: {
|
|||||||
</div>
|
</div>
|
||||||
<MultiCheck mode={mode} column="supplementaryFacilities" roofInfo={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
<MultiCheck mode={mode} column="supplementaryFacilities" roofInfo={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
||||||
</div>
|
</div>
|
||||||
{/* 설치 희망 시스템 */}
|
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
<div className="data-input-form-tit red-f">設置希望システム</div>
|
<div className="data-input-form-tit red-f">設置希望システム</div>
|
||||||
<SelectedBox mode={mode} column="installationSystem" detailInfoData={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
<SelectedBox mode={mode} column="installationSystem" detailInfoData={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import LoadMoreButton from '@/components/LoadMoreButton'
|
import LoadMoreButton from '@/components/LoadMoreButton'
|
||||||
import { useSurvey } from '@/hooks/useSurvey'
|
import { useServey } from '@/hooks/useSurvey'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useRouter, usePathname } from 'next/navigation'
|
import { useRouter, usePathname } from 'next/navigation'
|
||||||
import SearchForm from './SearchForm'
|
import SearchForm from './SearchForm'
|
||||||
@ -13,7 +13,7 @@ export default function ListTable() {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
|
|
||||||
const { surveyList, isLoadingSurveyList } = useSurvey()
|
const { surveyList, isLoadingSurveyList } = useServey()
|
||||||
const { offset, setOffset } = useSurveyFilterStore()
|
const { offset, setOffset } = useSurveyFilterStore()
|
||||||
|
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
@ -54,12 +54,12 @@ export default function ListTable() {
|
|||||||
{heldSurveyList.map((survey) => (
|
{heldSurveyList.map((survey) => (
|
||||||
<li className="sale-list-item cursor-pointer" key={survey.id} onClick={() => handleDetailClick(survey.id)}>
|
<li className="sale-list-item cursor-pointer" key={survey.id} onClick={() => handleDetailClick(survey.id)}>
|
||||||
<div className="sale-item-bx">
|
<div className="sale-item-bx">
|
||||||
<div className="sale-item-date-bx">
|
<div className="sale-item-date-bx">
|
||||||
<div className="sale-item-num">{survey.srlNo}</div>
|
<div className="sale-item-num">{survey.srlNo}</div>
|
||||||
<div className="sale-item-date">{survey.investigationDate}</div>
|
<div className="sale-item-date">{survey.investigationDate}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="sale-item-tit">{survey.buildingName === null ? '-' : survey.buildingName}</div>
|
<div className="sale-item-tit">{survey.buildingName}</div>
|
||||||
<div className="sale-item-customer">{survey.customerName === null ? '-' : survey.customerName}</div>
|
<div className="sale-item-customer">{survey.customerName}</div>
|
||||||
<div className="sale-item-update-bx">
|
<div className="sale-item-update-bx">
|
||||||
<div className="sale-item-name">{survey.representative}</div>
|
<div className="sale-item-name">{survey.representative}</div>
|
||||||
<div className="sale-item-update">{new Date(survey.uptDt).toLocaleString()}</div>
|
<div className="sale-item-update">{new Date(survey.uptDt).toLocaleString()}</div>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export default function Footer() {
|
|||||||
<div className="footer-inner">
|
<div className="footer-inner">
|
||||||
COPYRIGHT©2025 Hanwha Japan All Rights Reserved{' '}
|
COPYRIGHT©2025 Hanwha Japan All Rights Reserved{' '}
|
||||||
<span>
|
<span>
|
||||||
<Link href="/pdf/suitable">PDF</Link>
|
<Link href="/pdf">PDF</Link>
|
||||||
</span>
|
</span>
|
||||||
<span>{Config().mode}</span>
|
<span>{Config().mode}</span>
|
||||||
<span>{Config().baseUrl}</span>
|
<span>{Config().baseUrl}</span>
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export function useInquiry(
|
|||||||
isLoadingInquiryDetail: boolean
|
isLoadingInquiryDetail: boolean
|
||||||
isSavingInquiry: boolean
|
isSavingInquiry: boolean
|
||||||
saveInquiry: (formData: FormData) => Promise<InquirySaveResponse>
|
saveInquiry: (formData: FormData) => Promise<InquirySaveResponse>
|
||||||
downloadFile: (encodeFileNo: number, srcFileNm: string) => Promise<Blob | null>
|
downloadFile: (encodeFileNo: number) => Promise<File>
|
||||||
commonCodeList: CommonCode[]
|
commonCodeList: CommonCode[]
|
||||||
} {
|
} {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
@ -74,23 +74,9 @@ export function useInquiry(
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const downloadFile = async (encodeFileNo: number, srcFileNm: string) => {
|
const downloadFile = async (encodeFileNo: number) => {
|
||||||
try {
|
const resp = await axiosInstance(null).get<File>(`/api/qna/file`, { params: { encodeFileNo } })
|
||||||
const resp = await axiosInstance(null).get<Blob>(`/api/qna/file`, { params: { encodeFileNo, srcFileNm } })
|
return resp.data
|
||||||
const blob = new Blob([resp.data], { type: 'application/octet-stream;charset=UTF-8' })
|
|
||||||
const url = URL.createObjectURL(blob)
|
|
||||||
const a = document.createElement('a')
|
|
||||||
a.href = url
|
|
||||||
a.download = `${srcFileNm}`
|
|
||||||
a.click()
|
|
||||||
URL.revokeObjectURL(url)
|
|
||||||
return blob
|
|
||||||
} catch (error: any) {
|
|
||||||
if (error.response.status === 404) {
|
|
||||||
alert('ファイルが見つかりません')
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data: commonCodeList, isLoading: isLoadingCommonCodeList } = useQuery({
|
const { data: commonCodeList, isLoading: isLoadingCommonCodeList } = useQuery({
|
||||||
|
|||||||
@ -54,7 +54,7 @@ type ZipCode = {
|
|||||||
kana3: string
|
kana3: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useSurvey(id?: number): {
|
export function useServey(id?: number): {
|
||||||
surveyList: { data: SurveyBasicInfo[]; count: number } | {}
|
surveyList: { data: SurveyBasicInfo[]; count: number } | {}
|
||||||
surveyDetail: SurveyBasicInfo | null
|
surveyDetail: SurveyBasicInfo | null
|
||||||
isLoadingSurveyList: boolean
|
isLoadingSurveyList: boolean
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user