chore: update API URL in development and localhost environment files; enhance SurveySaleDownloadPdf component to handle null values gracefully

This commit is contained in:
Dayoung 2025-05-28 15:38:18 +09:00
parent 0d8dc7dc02
commit 56f8ad9aaf
3 changed files with 50 additions and 40 deletions

View File

@ -2,7 +2,7 @@ NEXT_PUBLIC_RUN_MODE=development
# 모바일 디바이스로 로컬 서버 확인하려면 자신 IP 주소로 변경 # 모바일 디바이스로 로컬 서버 확인하려면 자신 IP 주소로 변경
# 다시 로컬에서 개발할때는 localhost로 변경 # 다시 로컬에서 개발할때는 localhost로 변경
#route handler #route handler
NEXT_PUBLIC_API_URL=http://172.30.1.65:3000 NEXT_PUBLIC_API_URL=http://172.30.1.23:3000
#qsp 로그인 api #qsp 로그인 api
NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120 NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120

View File

@ -2,7 +2,7 @@ NEXT_PUBLIC_RUN_MODE=local
# 모바일 디바이스로 로컬 서버 확인하려면 자신 IP 주소로 변경 # 모바일 디바이스로 로컬 서버 확인하려면 자신 IP 주소로 변경
# 다시 로컬에서 개발할때는 localhost로 변경 # 다시 로컬에서 개발할때는 localhost로 변경
#route handler #route handler
NEXT_PUBLIC_API_URL=http://172.30.1.65:3000 NEXT_PUBLIC_API_URL=http://172.30.1.23:3000
#qsp 로그인 api #qsp 로그인 api
NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120 NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120

View File

@ -50,9 +50,13 @@ export default function SurveySaleDownloadPdf() {
router.push(`/survey-sale/${id}`) router.push(`/survey-sale/${id}`)
}) })
} }
const supplementList = supplementaryFacilities
.filter((facility) => surveyDetail?.detailInfo?.supplementaryFacilities?.includes(facility.id.toString()))
.map((facility) => facility.name)
return ( return (
<> <>
<button onClick={handleDownPdf}>down</button> {/* <button onClick={handleDownPdf}>down</button> */}
<div <div
ref={targetRef} ref={targetRef}
style={{ style={{
@ -80,13 +84,13 @@ 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} {surveyDetail?.store ?? '-'}
</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' }}>
{surveyDetail?.investigationDate} {surveyDetail?.investigationDate ?? '-'}
</p> </p>
</div> </div>
</div> </div>
@ -122,7 +126,7 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{surveyDetail?.customerName} {surveyDetail?.customerName ?? '-'}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -189,7 +193,7 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{surveyDetail?.detailInfo?.contractCapacity} {surveyDetail?.detailInfo?.contractCapacity ?? '-'}
</td> </td>
<th <th
style={{ style={{
@ -216,7 +220,7 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{surveyDetail?.detailInfo?.retailCompany} {surveyDetail?.detailInfo?.retailCompany ?? '-'}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -246,13 +250,11 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{supplementaryFacilities {supplementList === null && surveyDetail?.detailInfo?.supplementaryFacilitiesEtc === null
.filter((facility) => surveyDetail?.detailInfo?.supplementaryFacilities?.includes(facility.id.toString())) ? '-'
.map((facility) => facility.name) : surveyDetail?.detailInfo?.supplementaryFacilitiesEtc
.join(', ')} ? `${supplementList.join(', ')}, ${surveyDetail?.detailInfo?.supplementaryFacilitiesEtc}`
{surveyDetail?.detailInfo?.supplementaryFacilitiesEtc : supplementList.join(', ')}
? `, (その他) ${surveyDetail?.detailInfo?.supplementaryFacilitiesEtc}`
: '-'}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -282,11 +284,16 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{ {/* {selectBoxOptions.installationSystem.find ((system) => system.id.toString() === surveyDetail?.detailInfo?.installationSystem)
selectBoxOptions.installationSystem.find((system) => system.id.toString() === surveyDetail?.detailInfo?.installationSystem) ?.name ?? surveyDetail?.detailInfo?.installationSystemEtc !== null
?.name ? `${surveyDetail?.detailInfo?.installationSystemEtc}`
} : '-'} */}
{surveyDetail?.detailInfo?.installationSystemEtc ? `, (その他) ${surveyDetail?.detailInfo?.installationSystemEtc}` : '-'} {surveyDetail?.detailInfo?.installationSystem === null && surveyDetail?.detailInfo?.installationSystemEtc === null
? '-'
: surveyDetail?.detailInfo?.installationSystemEtc
? `${surveyDetail?.detailInfo?.installationSystemEtc}`
: selectBoxOptions.installationSystem.find((system) => system.id.toString() === surveyDetail?.detailInfo?.installationSystem)
?.name}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -351,11 +358,13 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{roofMaterial {surveyDetail?.detailInfo?.roofMaterial === null && surveyDetail?.detailInfo?.roofMaterialEtc === null
.filter((material) => surveyDetail?.detailInfo?.roofMaterial?.includes(material.id.toString())) ? '-'
.map((material) => material.name) : roofMaterial
.join(', ')} .filter((material) => surveyDetail?.detailInfo?.roofMaterial?.includes(material.id.toString()))
{surveyDetail?.detailInfo?.roofMaterialEtc ? `, (その他) ${surveyDetail?.detailInfo?.roofMaterialEtc}` : '-'} .map((material) => material.name)
.join(', ')}
{surveyDetail?.detailInfo?.roofMaterialEtc ? `, ${surveyDetail?.detailInfo?.roofMaterialEtc}` : ''}
</td> </td>
<th <th
style={{ style={{
@ -382,7 +391,8 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{selectBoxOptions.roofShape.find((shape) => shape.id.toString() === surveyDetail?.detailInfo?.roofShape)?.name} {selectBoxOptions.roofShape.find((shape) => shape.id.toString() === surveyDetail?.detailInfo?.roofShape)?.name ??
(surveyDetail?.detailInfo?.roofShapeEtc ? ` ${surveyDetail?.detailInfo?.roofShapeEtc}` : '-')}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -411,7 +421,7 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{`${surveyDetail?.detailInfo?.roofSlope}`} {surveyDetail?.detailInfo?.roofSlope ? `${surveyDetail?.detailInfo?.roofSlope}` : '-'}
</td> </td>
<th <th
style={{ style={{
@ -439,7 +449,8 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{`${surveyDetail?.detailInfo?.houseStructure ? '木製' : '(その他)'} ${surveyDetail?.detailInfo?.houseStructureEtc}`} {surveyDetail?.detailInfo?.houseStructure ? '木製' : ''}
{surveyDetail?.detailInfo?.houseStructureEtc ? ` ${surveyDetail?.detailInfo?.houseStructureEtc}` : '-'}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -468,8 +479,10 @@ export default function SurveySaleDownloadPdf() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
{radioEtcData.rafterMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.rafterMaterial)?.label ?? {surveyDetail?.detailInfo?.rafterMaterial === null && surveyDetail?.detailInfo?.rafterMaterialEtc === null
(surveyDetail?.detailInfo?.rafterMaterialEtc ? `(その他) ${surveyDetail?.detailInfo?.rafterMaterialEtc}` : '-')} ? '-'
: radioEtcData.rafterMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.rafterMaterial)?.label ??
surveyDetail?.detailInfo?.rafterMaterialEtc}
</td> </td>
<th <th
style={{ style={{
@ -498,7 +511,7 @@ export default function SurveySaleDownloadPdf() {
}} }}
> >
{selectBoxOptions.rafterSize.find((size) => size.id.toString() === surveyDetail?.detailInfo?.rafterSize)?.name ?? {selectBoxOptions.rafterSize.find((size) => size.id.toString() === surveyDetail?.detailInfo?.rafterSize)?.name ??
(surveyDetail?.detailInfo?.rafterSizeEtc ? `(その他) ${surveyDetail?.detailInfo?.rafterSizeEtc}` : '-')} (surveyDetail?.detailInfo?.rafterSizeEtc ? ` ${surveyDetail?.detailInfo?.rafterSizeEtc}` : '-')}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -528,7 +541,7 @@ export default function SurveySaleDownloadPdf() {
}} }}
> >
{selectBoxOptions.rafterPitch.find((pitch) => pitch.id.toString() === surveyDetail?.detailInfo?.rafterPitch)?.name ?? {selectBoxOptions.rafterPitch.find((pitch) => pitch.id.toString() === surveyDetail?.detailInfo?.rafterPitch)?.name ??
(surveyDetail?.detailInfo?.rafterPitchEtc ? `(その他) ${surveyDetail?.detailInfo?.rafterPitchEtc}` : '-')} (surveyDetail?.detailInfo?.rafterPitchEtc ? ` ${surveyDetail?.detailInfo?.rafterPitchEtc}` : '-')}
</td> </td>
<th <th
style={{ style={{
@ -587,7 +600,7 @@ export default function SurveySaleDownloadPdf() {
}} }}
> >
{selectBoxOptions.openFieldPlateKind.find((kind) => kind.id.toString() === surveyDetail?.detailInfo?.openFieldPlateKind)?.name ?? {selectBoxOptions.openFieldPlateKind.find((kind) => kind.id.toString() === surveyDetail?.detailInfo?.openFieldPlateKind)?.name ??
(surveyDetail?.detailInfo?.openFieldPlateKindEtc ? `(その他) ${surveyDetail?.detailInfo?.openFieldPlateKindEtc}` : '-')} (surveyDetail?.detailInfo?.openFieldPlateKindEtc ? `${surveyDetail?.detailInfo?.openFieldPlateKindEtc}` : '-')}
</td> </td>
<th <th
style={{ style={{
@ -676,8 +689,7 @@ export default function SurveySaleDownloadPdf() {
}} }}
> >
{radioEtcData.waterproofMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.waterproofMaterial) {radioEtcData.waterproofMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.waterproofMaterial)
?.label ?? ?.label ?? (surveyDetail?.detailInfo?.waterproofMaterialEtc ? ` ${surveyDetail?.detailInfo?.waterproofMaterialEtc}` : '-')}
(surveyDetail?.detailInfo?.waterproofMaterialEtc ? `(その他) ${surveyDetail?.detailInfo?.waterproofMaterialEtc}` : '-')}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -711,7 +723,7 @@ export default function SurveySaleDownloadPdf() {
radioEtcData.insulationPresence.find((presence) => presence.id.toString() === surveyDetail?.detailInfo?.insulationPresence) radioEtcData.insulationPresence.find((presence) => presence.id.toString() === surveyDetail?.detailInfo?.insulationPresence)
?.label ?.label
} }
{surveyDetail?.detailInfo?.insulationPresenceEtc ? `(その他) ${surveyDetail?.detailInfo?.insulationPresenceEtc}` : '-'} {surveyDetail?.detailInfo?.insulationPresenceEtc ? ` ${surveyDetail?.detailInfo?.insulationPresenceEtc}` : '-'}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -742,7 +754,7 @@ export default function SurveySaleDownloadPdf() {
}} }}
> >
{selectBoxOptions.structureOrder.find((order) => order.id.toString() === surveyDetail?.detailInfo?.structureOrder)?.name ?? {selectBoxOptions.structureOrder.find((order) => order.id.toString() === surveyDetail?.detailInfo?.structureOrder)?.name ??
(surveyDetail?.detailInfo?.structureOrderEtc ? `(その他) ${surveyDetail?.detailInfo?.structureOrderEtc}` : '-')} (surveyDetail?.detailInfo?.structureOrderEtc ? ` ${surveyDetail?.detailInfo?.structureOrderEtc}` : '-')}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -785,9 +797,7 @@ export default function SurveySaleDownloadPdf() {
(availability) => availability.id.toString() === surveyDetail?.detailInfo?.installationAvailability, (availability) => availability.id.toString() === surveyDetail?.detailInfo?.installationAvailability,
)?.name )?.name
} }
{surveyDetail?.detailInfo?.installationAvailabilityEtc {surveyDetail?.detailInfo?.installationAvailabilityEtc ? ` ${surveyDetail?.detailInfo?.installationAvailabilityEtc}` : '-'}
? `(その他) ${surveyDetail?.detailInfo?.installationAvailabilityEtc}`
: '-'}
</td> </td>
</tr> </tr>
</tbody> </tbody>