Compare commits
25 Commits
014f473d85
...
5be7237aa6
| Author | SHA1 | Date | |
|---|---|---|---|
| 5be7237aa6 | |||
| 4d16276221 | |||
| 0465f2306b | |||
| 495aeef2c2 | |||
| 8f365f998e | |||
| 03d91f3fa0 | |||
| 23164a3f8c | |||
| 56f8ad9aaf | |||
| dc0009ddd7 | |||
| 0d8dc7dc02 | |||
| 5014162f2f | |||
| 82cdb2a755 | |||
| 34883e166a | |||
| 479643216c | |||
| 76f85f65c9 | |||
| 3a8c431f41 | |||
| 221c66f293 | |||
| 67ba964eec | |||
| c027a3977b | |||
| 6d837d3e98 | |||
| d9824c6b9b | |||
| d599f28522 | |||
| 2a3a726b84 | |||
| 46fe524f79 | |||
| 5fd5e852c3 |
@ -2,10 +2,11 @@ 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
|
||||||
|
# NEXT_PUBLIC_QSP_API_URL=https://jp-dev.qsalesplatform.com
|
||||||
|
|
||||||
#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
|
||||||
@ -16,3 +17,10 @@ DB_USER=readonly
|
|||||||
DB_PASSWORD=aAjmFW12iHKW84l1
|
DB_PASSWORD=aAjmFW12iHKW84l1
|
||||||
DB_DATABASE=qpartners
|
DB_DATABASE=qpartners
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|
||||||
|
SMTP_HOST=autodiscover.qcells.com
|
||||||
|
SMTP_PORT=25
|
||||||
|
SMTP_SECURE=false
|
||||||
|
SMTP_USER=hss404.u021@cleverse.dev
|
||||||
|
SMTP_PASSWORD=0000
|
||||||
|
SMTP_FROM=qsalesplatform@qcells.com
|
||||||
@ -2,10 +2,11 @@ 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
|
||||||
|
# NEXT_PUBLIC_QSP_API_URL=https://jp-dev.qsalesplatform.com
|
||||||
|
|
||||||
#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
|
||||||
@ -16,3 +17,10 @@ DB_USER=readonly
|
|||||||
DB_PASSWORD=aAjmFW12iHKW84l1
|
DB_PASSWORD=aAjmFW12iHKW84l1
|
||||||
DB_DATABASE=qpartners
|
DB_DATABASE=qpartners
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|
||||||
|
SMTP_HOST=autodiscover.qcells.com
|
||||||
|
SMTP_PORT=25
|
||||||
|
SMTP_SECURE=false
|
||||||
|
SMTP_USER=hss404.u021@cleverse.dev
|
||||||
|
SMTP_PASSWORD=0000
|
||||||
|
SMTP_FROM=qsalesplatform@qcells.com
|
||||||
|
|||||||
@ -3,7 +3,8 @@ NEXT_PUBLIC_RUN_MODE=production
|
|||||||
NEXT_PUBLIC_API_URL=http://1.248.227.176:3000
|
NEXT_PUBLIC_API_URL=http://1.248.227.176: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
|
||||||
|
NEXT_PUBLIC_QSP_API_URL=https://jp.qsalesplatform.com
|
||||||
|
|
||||||
#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
|
||||||
@ -14,3 +15,10 @@ DB_USER=readonly
|
|||||||
DB_PASSWORD=aAjmFW12iHKW84l1
|
DB_PASSWORD=aAjmFW12iHKW84l1
|
||||||
DB_DATABASE=qpartners
|
DB_DATABASE=qpartners
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|
||||||
|
SMTP_HOST=autodiscover.qcells.com
|
||||||
|
SMTP_PORT=25
|
||||||
|
SMTP_SECURE=true
|
||||||
|
SMTP_USER=hss404.u021@cleverse.dev
|
||||||
|
SMTP_PASSWORD=0000
|
||||||
|
SMTP_FROM=qsalesplatform@qcells.com
|
||||||
24
README.md
24
README.md
@ -64,15 +64,21 @@ session에 있는 role 키로 구분한다
|
|||||||
# 지붕재 적합성 TODO
|
# 지붕재 적합성 TODO
|
||||||
|
|
||||||
```
|
```
|
||||||
const suitableCheck = (value: string) => {
|
const suitableCheckIcon = (value: string): string => {
|
||||||
if (value === '×') {
|
const iconMap: Record<string, string> = {
|
||||||
return <i className="compliance-icon x" />
|
'×': '/assets/images/sub/compliance_x_icon.svg',
|
||||||
} else if (value === 'ー') {
|
'ー': '/assets/images/sub/compliance_quest_icon.svg',
|
||||||
return <i className="compliance-icon quest" />
|
default: '/assets/images/sub/compliance_check_icon.svg',
|
||||||
} else {
|
|
||||||
return <i className="compliance-icon check" />
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return iconMap[value] || iconMap.default
|
||||||
|
}
|
||||||
|
const suitableCheckMemo = (value: string): string => {
|
||||||
|
if (value === '○') return '設置可'
|
||||||
|
if (value === '×') return '設置不可'
|
||||||
|
if (value === 'ー') return 'お問い合わせください'
|
||||||
|
return `${value}で設置可`
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- 추후 지붕재 적합성 데이터 CUD 구현 시 ×, ー 데이터 관리 필요
|
- src/hooks/useSuitable.ts > suitableCheckIcon(), suitableCheckMemo()
|
||||||
|
- 추후 지붕재 적합성 데이터 CUD 구현 시 ×, ー 데이터 관리 필요
|
||||||
|
|||||||
10
package-lock.json
generated
10
package-lock.json
generated
@ -18,6 +18,7 @@
|
|||||||
"mssql": "^11.0.1",
|
"mssql": "^11.0.1",
|
||||||
"mysql2": "^3.14.1",
|
"mysql2": "^3.14.1",
|
||||||
"next": "15.2.4",
|
"next": "15.2.4",
|
||||||
|
"nodemailer": "^7.0.3",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-to-pdf": "^2.0.0",
|
"react-to-pdf": "^2.0.0",
|
||||||
@ -3700,6 +3701,15 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"node_modules/nodemailer": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.3.tgz",
|
||||||
|
"integrity": "sha512-Ajq6Sz1x7cIK3pN6KesGTah+1gnwMnx5gKl3piQlQQE/PwyJ4Mbc8is2psWYxK3RJTVeqsDaCv8ZzXLCDHMTZw==",
|
||||||
|
"license": "MIT-0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/open": {
|
"node_modules/open": {
|
||||||
"version": "10.1.0",
|
"version": "10.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz",
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
"@prisma/client": "^6.7.0",
|
"@prisma/client": "^6.7.0",
|
||||||
"@tanstack/react-query": "^5.71.0",
|
"@tanstack/react-query": "^5.71.0",
|
||||||
"@tanstack/react-query-devtools": "^5.71.0",
|
"@tanstack/react-query-devtools": "^5.71.0",
|
||||||
|
"@types/nodemailer": "^6.4.17",
|
||||||
"axios": "^1.8.4",
|
"axios": "^1.8.4",
|
||||||
"env-cmd": "^10.1.0",
|
"env-cmd": "^10.1.0",
|
||||||
"iron-session": "^8.0.4",
|
"iron-session": "^8.0.4",
|
||||||
@ -25,6 +26,7 @@
|
|||||||
"mssql": "^11.0.1",
|
"mssql": "^11.0.1",
|
||||||
"mysql2": "^3.14.1",
|
"mysql2": "^3.14.1",
|
||||||
"next": "15.2.4",
|
"next": "15.2.4",
|
||||||
|
"nodemailer": "^7.0.3",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-to-pdf": "^2.0.0",
|
"react-to-pdf": "^2.0.0",
|
||||||
|
|||||||
@ -20,7 +20,6 @@ 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: {
|
||||||
@ -35,10 +34,29 @@ 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)
|
||||||
|
}
|
||||||
|
|||||||
@ -2,12 +2,15 @@ import { NextRequest, NextResponse } from 'next/server'
|
|||||||
import { prisma } from '@/libs/prisma'
|
import { prisma } from '@/libs/prisma'
|
||||||
import { Suitable } from '@/types/Suitable'
|
import { Suitable } from '@/types/Suitable'
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
export async function POST(request: NextRequest) {
|
||||||
try {
|
try {
|
||||||
const searchParams = request.nextUrl.searchParams
|
const body: Record<string, string> = await request.json()
|
||||||
|
const ids = body.ids
|
||||||
|
const detailIds = body.detailIds
|
||||||
|
|
||||||
const ids = searchParams.get('ids')
|
if (ids === '' || detailIds === '') {
|
||||||
const detailIds = searchParams.get('subIds')
|
return NextResponse.json({ error: '필수 파라미터가 누락되었습니다' }, { status: 400 })
|
||||||
|
}
|
||||||
|
|
||||||
let query = `
|
let query = `
|
||||||
SELECT
|
SELECT
|
||||||
@ -29,28 +32,22 @@ export async function GET(request: NextRequest) {
|
|||||||
, msd_json.memo
|
, msd_json.memo
|
||||||
FROM ms_suitable_detail msd_json
|
FROM ms_suitable_detail msd_json
|
||||||
WHERE msd.main_id = msd_json.main_id
|
WHERE msd.main_id = msd_json.main_id
|
||||||
|
AND msd_json.id IN (:detailIds)
|
||||||
FOR JSON PATH
|
FOR JSON PATH
|
||||||
) AS detail
|
) AS detail
|
||||||
FROM ms_suitable_detail msd
|
FROM ms_suitable_detail msd
|
||||||
GROUP BY msd.main_id
|
GROUP BY msd.main_id
|
||||||
) AS details
|
) AS details
|
||||||
ON msm.id = details.main_id
|
ON msm.id = details.main_id
|
||||||
--ids AND details.main_id IN (:mainIds)
|
AND details.main_id IN (:mainIds)
|
||||||
--detailIds AND details.id IN (:detailIds)
|
WHERE
|
||||||
WHERE 1=1
|
msm.id IN (:mainIds)
|
||||||
--ids AND msm.id IN (:mainIds)
|
|
||||||
ORDER BY msm.product_name;
|
ORDER BY msm.product_name;
|
||||||
`
|
`
|
||||||
|
|
||||||
// 검색 조건 설정
|
// 검색 조건 설정
|
||||||
if (ids) {
|
|
||||||
query = query.replaceAll('--ids ', '')
|
|
||||||
query = query.replaceAll(':mainIds', ids)
|
query = query.replaceAll(':mainIds', ids)
|
||||||
if (detailIds) {
|
|
||||||
query = query.replaceAll('--detailIds ', '')
|
|
||||||
query = query.replaceAll(':detailIds', detailIds)
|
query = query.replaceAll(':detailIds', detailIds)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const suitable: Suitable[] = await prisma.$queryRawUnsafe(query)
|
const suitable: Suitable[] = await prisma.$queryRawUnsafe(query)
|
||||||
|
|
||||||
@ -60,4 +57,3 @@ export async function GET(request: NextRequest) {
|
|||||||
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import DownloadPdf from '@/components/DownloadPDF'
|
|
||||||
|
|
||||||
export default function page() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<DownloadPdf />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
9
src/app/pdf/suitable/page.tsx
Normal file
9
src/app/pdf/suitable/page.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import SuitableDownloadPdf from '@/components/pdf/SuitableDownloadPdf'
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SuitableDownloadPdf />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
9
src/app/pdf/survey-sale/[id]/page.tsx
Normal file
9
src/app/pdf/survey-sale/[id]/page.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import SurveySaleDownloadPdf from '@/components/pdf/SurveySaleDownloadPdf'
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SurveySaleDownloadPdf />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -83,6 +83,10 @@ export default function Login() {
|
|||||||
loginId: account.loginId,
|
loginId: account.loginId,
|
||||||
pwd: account.pwd,
|
pwd: account.pwd,
|
||||||
})
|
})
|
||||||
|
// const { data } = await axiosInstance(`${process.env.NEXT_PUBLIC_QSP_API_URL}`).post(`/api/user/login`, {
|
||||||
|
// loginId: account.loginId,
|
||||||
|
// pwd: account.pwd,
|
||||||
|
// })
|
||||||
|
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
|
|||||||
1465
src/components/pdf/SuitableDownloadPdf.tsx
Normal file
1465
src/components/pdf/SuitableDownloadPdf.tsx
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,30 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useRef } from 'react'
|
import { useEffect, useRef } from 'react'
|
||||||
import generatePDF, { Margin, Resolution } from 'react-to-pdf'
|
import generatePDF, { Margin, Resolution } from 'react-to-pdf'
|
||||||
|
import { useParams, useRouter } from 'next/navigation'
|
||||||
|
import { useSurvey } from '@/hooks/useSurvey'
|
||||||
|
import { radioEtcData, roofMaterial, selectBoxOptions, supplementaryFacilities } from '../survey-sale/detail/RoofForm'
|
||||||
|
import { useSpinnerStore } from '@/store/spinnerStore'
|
||||||
|
|
||||||
|
export default function SurveySaleDownloadPdf() {
|
||||||
|
const params = useParams()
|
||||||
|
const id = params.id
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const { surveyDetail, isLoadingSurveyDetail } = useSurvey(Number(id))
|
||||||
|
const { setIsShow } = useSpinnerStore()
|
||||||
|
|
||||||
export default function DownloadPdf() {
|
|
||||||
const targetRef = useRef<HTMLDivElement>(null)
|
const targetRef = useRef<HTMLDivElement>(null)
|
||||||
|
const isGeneratedRef = useRef(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsShow(true)
|
||||||
|
if (isLoadingSurveyDetail || !surveyDetail || isGeneratedRef.current) return
|
||||||
|
isGeneratedRef.current = true
|
||||||
|
handleDownPdf()
|
||||||
|
}, [surveyDetail?.id, isLoadingSurveyDetail])
|
||||||
|
|
||||||
const handleDownPdf = () => {
|
const handleDownPdf = () => {
|
||||||
const options = {
|
const options = {
|
||||||
method: 'open' as const,
|
method: 'open' as const,
|
||||||
@ -28,14 +48,31 @@ export default function DownloadPdf() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
generatePDF(targetRef, options)
|
generatePDF(targetRef, options).then(() => {
|
||||||
// generatePDF(targetRef, { filename: 'page.pdf' })
|
setIsShow(false)
|
||||||
|
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>
|
<div
|
||||||
<div ref={targetRef} style={{ boxSizing: 'border-box' }}>
|
ref={targetRef}
|
||||||
<div style={{ margin: '0 auto', padding: 0, maxWidth: '800px', minWidth: '800px' }}>
|
style={{
|
||||||
|
width: '794px', // A4 너비
|
||||||
|
minHeight: '1123px', // A4 높이
|
||||||
|
transform: 'scale(1.0)',
|
||||||
|
transformOrigin: 'top left',
|
||||||
|
padding: '20px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
fontSize: '12px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
<div style={{ padding: '20px 20px 50px', borderBottom: '2px solid #2E3A59' }}>
|
<div style={{ padding: '20px 20px 50px', borderBottom: '2px solid #2E3A59' }}>
|
||||||
<div style={{ float: 'left', verticalAlign: 'middle', fontSize: '18px', color: '#101010', fontWeight: 600, fontFamily: 'M-Gothic' }}>
|
<div style={{ float: 'left', verticalAlign: 'middle', fontSize: '18px', color: '#101010', fontWeight: 600, fontFamily: 'M-Gothic' }}>
|
||||||
HWJ 現地調査シート1/2
|
HWJ 現地調査シート1/2
|
||||||
@ -46,12 +83,14 @@ export default function DownloadPdf() {
|
|||||||
現地明登施工店名
|
現地明登施工店名
|
||||||
</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' }}>
|
||||||
Sheet2 No.4Sheet2
|
{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' }}>2025.05.09</p>
|
<p style={{ margin: 0, padding: 0, fontSize: '13px', color: '#FF5656', fontWeight: 400, fontFamily: 'M-Gothic' }}>
|
||||||
|
{surveyDetail?.investigationDate ?? '-'}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -86,7 +125,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Sheet2No.1
|
{surveyDetail?.customerName ?? '-'}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -115,7 +154,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Sheet2No.2
|
{surveyDetail?.postCode ? `(${surveyDetail?.postCode}) ${surveyDetail?.address} ${surveyDetail?.addressDetail}` : '-'}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -153,7 +192,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Sheet2No.1
|
{surveyDetail?.detailInfo?.contractCapacity ?? '-'}
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -180,7 +219,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Sheet2No.1
|
{surveyDetail?.detailInfo?.retailCompany ?? '-'}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -210,7 +249,11 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Sheet2No.7 選式回答表示/自由入力回答表示
|
{supplementList === null && surveyDetail?.detailInfo?.supplementaryFacilitiesEtc === null
|
||||||
|
? '-'
|
||||||
|
: surveyDetail?.detailInfo?.supplementaryFacilitiesEtc
|
||||||
|
? `${supplementList.join(', ')}, ${surveyDetail?.detailInfo?.supplementaryFacilitiesEtc}`
|
||||||
|
: supplementList.join(', ')}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -240,7 +283,16 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Sheet2No.8 選択式回表示/自由入力回表
|
{/* {selectBoxOptions.installationSystem.find ((system) => system.id.toString() === surveyDetail?.detailInfo?.installationSystem)
|
||||||
|
?.name ?? surveyDetail?.detailInfo?.installationSystemEtc !== null
|
||||||
|
? `${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>
|
||||||
@ -278,7 +330,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.9
|
{surveyDetail?.detailInfo?.constructionYear === '1' ? '新築' : `既築 (${surveyDetail?.detailInfo?.constructionYear}年)`}
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -305,7 +357,13 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.10
|
{surveyDetail?.detailInfo?.roofMaterial === null && surveyDetail?.detailInfo?.roofMaterialEtc === null
|
||||||
|
? '-'
|
||||||
|
: roofMaterial
|
||||||
|
.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={{
|
||||||
@ -332,7 +390,8 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.11
|
{selectBoxOptions.roofShape.find((shape) => shape.id.toString() === surveyDetail?.detailInfo?.roofShape)?.name ??
|
||||||
|
(surveyDetail?.detailInfo?.roofShapeEtc ? ` ${surveyDetail?.detailInfo?.roofShapeEtc}` : '-')}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -361,7 +420,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.12
|
{surveyDetail?.detailInfo?.roofSlope ? `${surveyDetail?.detailInfo?.roofSlope} 寸` : '-'}
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -389,7 +448,8 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.13
|
{radioEtcData.houseStructure.find((structure) => structure.id.toString() === surveyDetail?.detailInfo?.houseStructure)?.label ??
|
||||||
|
(surveyDetail?.detailInfo?.houseStructureEtc ? ` ${surveyDetail?.detailInfo?.houseStructureEtc}` : '-')}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -418,7 +478,12 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.14
|
{/* {surveyDetail?.detailInfo?.rafterMaterial === null && surveyDetail?.detailInfo?.rafterMaterialEtc === null
|
||||||
|
? '-'
|
||||||
|
: radioEtcData.rafterMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.rafterMaterial)?.label ??
|
||||||
|
surveyDetail?.detailInfo?.rafterMaterialEtc} */}
|
||||||
|
{radioEtcData.rafterMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.rafterMaterial)?.label ??
|
||||||
|
(surveyDetail?.detailInfo?.rafterMaterialEtc ? ` ${surveyDetail?.detailInfo?.rafterMaterialEtc}` : '-')}
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -446,7 +511,8 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.15
|
{selectBoxOptions.rafterSize.find((size) => size.id.toString() === surveyDetail?.detailInfo?.rafterSize)?.name ??
|
||||||
|
(surveyDetail?.detailInfo?.rafterSizeEtc ? ` ${surveyDetail?.detailInfo?.rafterSizeEtc}` : '-')}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -463,7 +529,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
垂木ビッチ
|
垂木ピッチ
|
||||||
</th>
|
</th>
|
||||||
<td
|
<td
|
||||||
style={{
|
style={{
|
||||||
@ -475,7 +541,8 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.16
|
{selectBoxOptions.rafterPitch.find((pitch) => pitch.id.toString() === surveyDetail?.detailInfo?.rafterPitch)?.name ??
|
||||||
|
(surveyDetail?.detailInfo?.rafterPitchEtc ? ` ${surveyDetail?.detailInfo?.rafterPitchEtc}` : '-')}
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -503,7 +570,8 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.17
|
{radioEtcData.rafterDirection.find((direction) => direction.id.toString() === surveyDetail?.detailInfo?.rafterDirection)?.label ??
|
||||||
|
'-'}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -532,7 +600,8 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.18
|
{selectBoxOptions.openFieldPlateKind.find((kind) => kind.id.toString() === surveyDetail?.detailInfo?.openFieldPlateKind)?.name ??
|
||||||
|
(surveyDetail?.detailInfo?.openFieldPlateKindEtc ? `${surveyDetail?.detailInfo?.openFieldPlateKindEtc}` : '-')}
|
||||||
</td>
|
</td>
|
||||||
<th
|
<th
|
||||||
style={{
|
style={{
|
||||||
@ -560,7 +629,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.19
|
{surveyDetail?.detailInfo?.openFieldPlateThickness ? `${surveyDetail?.detailInfo?.openFieldPlateThickness}mm` : '-'}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -590,7 +659,7 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.20
|
{surveyDetail?.detailInfo?.leakTrace ? 'あり' : 'なし'}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -620,7 +689,8 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.21
|
{radioEtcData.waterproofMaterial.find((material) => material.id.toString() === surveyDetail?.detailInfo?.waterproofMaterial)
|
||||||
|
?.label ?? (surveyDetail?.detailInfo?.waterproofMaterialEtc ? ` ${surveyDetail?.detailInfo?.waterproofMaterialEtc}` : '-')}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -650,7 +720,11 @@ export default function DownloadPdf() {
|
|||||||
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>
|
||||||
@ -680,7 +754,8 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.23
|
{radioEtcData.structureOrder.find((order) => order.id.toString() === surveyDetail?.detailInfo?.structureOrder)?.label ??
|
||||||
|
(surveyDetail?.detailInfo?.structureOrderEtc ? `${surveyDetail?.detailInfo?.structureOrderEtc}` : '-')}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -718,7 +793,12 @@ export default function DownloadPdf() {
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.23
|
{surveyDetail?.detailInfo?.installationAvailability === null && surveyDetail.detailInfo?.installationAvailabilityEtc === null
|
||||||
|
? '-'
|
||||||
|
: selectBoxOptions.installationAvailability.find(
|
||||||
|
(availability) => availability.id.toString() === surveyDetail?.detailInfo?.installationAvailability,
|
||||||
|
)?.name}
|
||||||
|
{surveyDetail?.detailInfo?.installationAvailabilityEtc ? `, ${surveyDetail?.detailInfo?.installationAvailabilityEtc}` : ''}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -738,7 +818,7 @@ export default function DownloadPdf() {
|
|||||||
height: '150px',
|
height: '150px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No.25
|
{surveyDetail?.detailInfo?.memo ?? '-'}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -3,15 +3,13 @@
|
|||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
import { useSuitableStore } from '@/store/useSuitableStore'
|
|
||||||
import SuitableDetailPopupButton from './SuitableDetailPopupButton'
|
import SuitableDetailPopupButton from './SuitableDetailPopupButton'
|
||||||
import { useSuitable } from '@/hooks/useSuitable'
|
import { useSuitable } from '@/hooks/useSuitable'
|
||||||
import { Suitable } from '@/types/Suitable'
|
import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable'
|
||||||
|
|
||||||
export default function SuitableDetailPopup() {
|
export default function SuitableDetailPopup() {
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
const { getSuitableDetails, serializeSelectedItems } = useSuitable()
|
const { getSelectedItemsData, toCodeName, toSuitableDetail, suitableCheckIcon, suitableCheckMemo } = useSuitable()
|
||||||
const { selectedItems } = useSuitableStore()
|
|
||||||
|
|
||||||
const [openItems, setOpenItems] = useState<Set<number>>(new Set())
|
const [openItems, setOpenItems] = useState<Set<number>>(new Set())
|
||||||
const [suitableDetails, setSuitableDetails] = useState<Suitable[]>([])
|
const [suitableDetails, setSuitableDetails] = useState<Suitable[]>([])
|
||||||
@ -25,14 +23,9 @@ export default function SuitableDetailPopup() {
|
|||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// 선택된 아이템 상세 데이터 가져오기
|
|
||||||
const getSelectedItemsData = async () => {
|
|
||||||
const serialized: Map<string, string> = serializeSelectedItems()
|
|
||||||
setSuitableDetails(await getSuitableDetails(serialized.get('ids') ?? '', serialized.get('detailIds') ?? ''))
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getSelectedItemsData()
|
// TODO: 로딩 처리 필요
|
||||||
|
getSelectedItemsData().then((data) => setSuitableDetails(data))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -52,98 +45,56 @@ export default function SuitableDetailPopup() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="modal-body">
|
<div className="modal-body">
|
||||||
<div className="compliance-check-pop-wrap">
|
<div className="compliance-check-pop-wrap">
|
||||||
<div className={`compliance-check-bx ${openItems.has(1) ? 'act' : ''}`}>
|
{suitableDetails.map((item: Suitable) => (
|
||||||
|
<div className={`compliance-check-bx ${openItems.has(item.id) ? 'act' : ''}`} key={item.id}>
|
||||||
<div className="check-name-wrap">
|
<div className="check-name-wrap">
|
||||||
<div className="check-name">アースティ40</div>
|
<div className="check-name">{item.productName}</div>
|
||||||
<div className="check-name-btn">
|
<div className="check-name-btn">
|
||||||
<button className="bx-btn" onClick={() => toggleItemOpen(1)}></button>
|
<button className="bx-btn" onClick={() => toggleItemOpen(item.id)}></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="compliance-check-pop-contents">
|
<div className="compliance-check-pop-contents">
|
||||||
<div className="check-pop-data-wrap">
|
<div className="check-pop-data-wrap">
|
||||||
<div className="check-pop-data-tit">屋根技研 支持瓦</div>
|
<div className="check-pop-data-tit">屋根技研 支持瓦</div>
|
||||||
<div className="check-pop-data-txt">㈱ダイトー</div>
|
<div className="check-pop-data-txt">{toCodeName(SUITABLE_HEAD_CODE.MANU_FT_CD, item.manuFtCd)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="check-pop-data-wrap">
|
<div className="check-pop-data-wrap">
|
||||||
<div className="check-pop-data-tit">屋根材</div>
|
<div className="check-pop-data-tit">屋根材</div>
|
||||||
<div className="check-pop-data-txt">瓦</div>
|
<div className="check-pop-data-txt">{toCodeName(SUITABLE_HEAD_CODE.ROOF_MT_CD, item.roofMtCd)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="check-pop-data-wrap">
|
<div className="check-pop-data-wrap">
|
||||||
<div className="check-pop-data-tit">金具タイプ</div>
|
<div className="check-pop-data-tit">金具タイプ</div>
|
||||||
<div className="check-pop-data-txt">木ねじ打ち込み式</div>
|
<div className="check-pop-data-txt">{toCodeName(SUITABLE_HEAD_CODE.ROOF_SH_CD, item.roofShCd)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="check-pop-data-table-wrap">
|
<div className="check-pop-data-table-wrap">
|
||||||
<div className="check-pop-data-table">
|
{toSuitableDetail(item.detail).map((subItem: SuitableDetail) => (
|
||||||
|
<div className="check-pop-data-table" key={subItem.id}>
|
||||||
<div className="pop-data-table-head">
|
<div className="pop-data-table-head">
|
||||||
<div className="pop-data-table-head-name">屋根技研 支持瓦</div>
|
<div className="pop-data-table-head-name">{toCodeName(SUITABLE_HEAD_CODE.TRESTLE_MFPC_CD, subItem.trestleMfpcCd)}</div>
|
||||||
<div className="pop-data-table-head-icon">
|
<div className="pop-data-table-head-icon">
|
||||||
<div className="compliance-icon">
|
<div className="compliance-icon">
|
||||||
<Image src={'/assets/images/sub/compliance_check_icon.svg'} width={22} height={22} alt=""></Image>
|
<Image src={suitableCheckIcon(subItem.trestleManufacturerProductName)} width={22} height={22} alt="" />
|
||||||
</div>
|
</div>
|
||||||
|
{subItem.memo && (
|
||||||
<div className="compliance-icon">
|
<div className="compliance-icon">
|
||||||
<Image src={'/assets/images/sub/compliance_tip_icon.svg'} width={22} height={22} alt=""></Image>
|
<Image src={'/assets/images/sub/compliance_tip_icon.svg'} width={22} height={22} alt=""></Image>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="pop-data-table-body">Dで設置可</div>
|
<div className="pop-data-table-body">{suitableCheckMemo(subItem.trestleManufacturerProductName)}</div>
|
||||||
|
{subItem.memo && (
|
||||||
<div className="pop-data-table-footer">
|
<div className="pop-data-table-footer">
|
||||||
<div className="pop-data-table-footer-unit">備考</div>
|
<div className="pop-data-table-footer-unit">備考</div>
|
||||||
<div className="pop-data-table-footer-data">
|
<div className="pop-data-table-footer-data">{subItem.memo}</div>
|
||||||
桟木なしの場合は支持金具平ー1で設置可能。その場合水返しが高い為、レベルプレート使用。桟木ありの場合は支持金具平ー2で設置可能
|
</div>
|
||||||
</div>
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
))}
|
||||||
<div className="check-pop-data-table">
|
|
||||||
<div className="pop-data-table-head">
|
|
||||||
<div className="pop-data-table-head-name">屋根技研支持金具</div>
|
|
||||||
<div className="pop-data-table-head-icon">
|
|
||||||
<div className="compliance-icon">
|
|
||||||
<Image src={'/assets/images/sub/compliance_x_icon.svg'} width={22} height={22} alt=""></Image>
|
|
||||||
</div>
|
|
||||||
<div className="compliance-icon">
|
|
||||||
<Image src={'/assets/images/sub/compliance_tip_icon.svg'} width={22} height={22} alt=""></Image>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="pop-data-table-body">設置不可</div>
|
|
||||||
<div className="pop-data-table-footer">
|
|
||||||
<div className="pop-data-table-footer-unit">備考</div>
|
|
||||||
<div className="pop-data-table-footer-data">入手困難</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="check-pop-data-table">
|
|
||||||
<div className="pop-data-table-head">
|
|
||||||
<div className="pop-data-table-head-name">屋根技研YGアンカー</div>
|
|
||||||
<div className="pop-data-table-head-icon">
|
|
||||||
<div className="compliance-icon">
|
|
||||||
<Image src={'/assets/images/sub/compliance_quest_icon.svg'} width={22} height={22} alt=""></Image>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="pop-data-table-body">お問い合わせください</div>
|
|
||||||
<div className="pop-data-table-footer">
|
|
||||||
<div className="pop-data-table-footer-unit">備考</div>
|
|
||||||
<div className="pop-data-table-footer-data">入手困難</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="check-pop-data-table">
|
|
||||||
<div className="pop-data-table-head">
|
|
||||||
<div className="pop-data-table-head-name">ダイドーハント支持瓦Ⅱ</div>
|
|
||||||
<div className="pop-data-table-head-icon">
|
|
||||||
<div className="compliance-icon">
|
|
||||||
<Image src={'/assets/images/sub/compliance_check_icon.svg'} width={22} height={22} alt=""></Image>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="pop-data-table-body">Ⅳ (D) で設置可</div>
|
|
||||||
<div className="pop-data-table-footer">
|
|
||||||
<div className="pop-data-table-footer-unit">備考</div>
|
|
||||||
<div className="pop-data-table-footer-data">入手困難</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
<SuitableDetailPopupButton />
|
<SuitableDetailPopupButton />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import { useRouter } from 'next/navigation'
|
||||||
|
import { usePopupController } from '@/store/popupController'
|
||||||
|
|
||||||
export default function SuitableDetailPopupButton() {
|
export default function SuitableDetailPopupButton() {
|
||||||
|
const popupController = usePopupController()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="btn-flex-wrap com">
|
<div className="btn-flex-wrap com">
|
||||||
<div className="btn-bx">
|
<div className="btn-bx">
|
||||||
<button className="btn-frame n-blue icon">
|
<button className="btn-frame n-blue icon" onClick={() => popupController.setSuitableDetailPopup(false)}>
|
||||||
閉じる<i className="btn-arr"></i>
|
閉じる<i className="btn-arr"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -14,7 +20,13 @@ export default function SuitableDetailPopupButton() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="btn-bx">
|
<div className="btn-bx">
|
||||||
<button className="btn-frame n-blue icon">
|
<button
|
||||||
|
className="btn-frame n-blue icon"
|
||||||
|
onClick={async () => {
|
||||||
|
await popupController.setSuitableDetailPopup(false)
|
||||||
|
router.push('/inquiry/regist')
|
||||||
|
}}
|
||||||
|
>
|
||||||
1:1お問い合わせ<i className="btn-arr"></i>
|
1:1お問い合わせ<i className="btn-arr"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,15 +1,20 @@
|
|||||||
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 { useServey } from '@/hooks/useSurvey'
|
import { useSurvey } from '@/hooks/useSurvey'
|
||||||
import { useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
|
import { useCommCode } from '@/hooks/useCommCode'
|
||||||
|
import { CommCode } from '@/types/CommCode'
|
||||||
|
import { sendEmail } from '@/libs/mailer'
|
||||||
|
import { useSpinnerStore } from '@/store/spinnerStore'
|
||||||
|
|
||||||
interface SubmitFormData {
|
interface SubmitFormData {
|
||||||
|
saleBase: string | null
|
||||||
store: string
|
store: string
|
||||||
sender: string
|
sender: string
|
||||||
receiver: string
|
receiver: string[] | string
|
||||||
reference: string
|
reference: string | null
|
||||||
title: string
|
title: string
|
||||||
contents: string
|
contents: string
|
||||||
}
|
}
|
||||||
@ -20,31 +25,46 @@ 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 { setIsShow } = useSpinnerStore()
|
||||||
|
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: '',
|
reference: null,
|
||||||
title: '[HANASYS現地調査] 調査物件が提出.',
|
title: '[HANASYS現地調査] 調査物件が提出.',
|
||||||
contents: '',
|
contents: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const { submitSurvey, isSubmittingSurvey } = useServey(Number(routeId))
|
const { submitSurvey, isSubmittingSurvey } = useSurvey(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 }))
|
||||||
@ -54,27 +74,41 @@ 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].trim()) {
|
if (data[field.id]?.length === 0) {
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
if (validateData(submitData)) {
|
if (validateData(submitData)) {
|
||||||
window.neoConfirm('送信しますか? 送信後は変更・修正することはできません。', () => {
|
window.neoConfirm('送信しますか? 送信後は変更・修正することはできません。', () => {
|
||||||
|
setIsShow(true)
|
||||||
submitSurvey({ targetId: submitData.store })
|
submitSurvey({ targetId: submitData.store })
|
||||||
|
sendEmail({
|
||||||
|
to: submitData.receiver,
|
||||||
|
subject: submitData.title,
|
||||||
|
content: submitData.contents,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
if (!isSubmittingSurvey) {
|
if (!isSubmittingSurvey) {
|
||||||
popupController.setSurveySaleSubmitPopup(false)
|
popupController.setSurveySaleSubmitPopup(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error sending email:', error)
|
||||||
|
alert('メール送信に失敗しました。')
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setIsShow(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,9 +117,12 @@ 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">
|
||||||
@ -96,19 +133,44 @@ 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)}
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{field.id === 'saleBase' && session?.role === 'Admin' ? (
|
||||||
|
<select
|
||||||
|
className="select-form"
|
||||||
|
id={field.id}
|
||||||
|
value={submitData[field.id] ?? ''}
|
||||||
|
onChange={(e) => {
|
||||||
|
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
|
<input
|
||||||
className="input-frame"
|
className="input-frame"
|
||||||
type="text"
|
type="text"
|
||||||
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)}
|
||||||
readOnly={isReadOnly}
|
readOnly={isReadOnly}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useServey } from '@/hooks/useSurvey'
|
import { useSurvey } 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 } = useServey()
|
const { getZipCode } = useSurvey()
|
||||||
const [addressInfo, setAddressInfo] = useState<Address[] | null>([])
|
const [addressInfo, setAddressInfo] = useState<Address[] | null>([])
|
||||||
|
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
|
|||||||
@ -9,7 +9,17 @@ import { useSuitableStore } from '@/store/useSuitableStore'
|
|||||||
import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable'
|
import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable'
|
||||||
|
|
||||||
export default function SuitableList() {
|
export default function SuitableList() {
|
||||||
const { toCodeName, toSuitableDetail, toSuitableDetailIds, suitables, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = useSuitable()
|
const {
|
||||||
|
toCodeName,
|
||||||
|
toSuitableDetail,
|
||||||
|
toSuitableDetailIds,
|
||||||
|
suitables,
|
||||||
|
fetchNextPage,
|
||||||
|
hasNextPage,
|
||||||
|
isFetchingNextPage,
|
||||||
|
isLoading,
|
||||||
|
suitableCheckIcon,
|
||||||
|
} = useSuitable()
|
||||||
const { selectedItems, addSelectedItem, removeSelectedItem } = useSuitableStore()
|
const { selectedItems, addSelectedItem, removeSelectedItem } = useSuitableStore()
|
||||||
const [openItems, setOpenItems] = useState<Set<number>>(new Set())
|
const [openItems, setOpenItems] = useState<Set<number>>(new Set())
|
||||||
const observerTarget = useRef<HTMLDivElement>(null)
|
const observerTarget = useRef<HTMLDivElement>(null)
|
||||||
@ -52,20 +62,6 @@ export default function SuitableList() {
|
|||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// TODO: 추후 지붕재 적합성 데이터 CUD 구현 시 ×, ー 데이터 관리 필요
|
|
||||||
const suitableCheck = useCallback((value: string) => {
|
|
||||||
const iconMap: Record<string, string> = {
|
|
||||||
'×': '/assets/images/sub/compliance_x_icon.svg',
|
|
||||||
ー: '/assets/images/sub/compliance_quest_icon.svg',
|
|
||||||
default: '/assets/images/sub/compliance_check_icon.svg',
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div className="compliance-icon">
|
|
||||||
<Image src={iconMap[value] || iconMap.default} width={22} height={22} alt="" />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 아이템 렌더링
|
// 아이템 렌더링
|
||||||
const renderItem = useCallback(
|
const renderItem = useCallback(
|
||||||
(item: Suitable) => {
|
(item: Suitable) => {
|
||||||
@ -99,7 +95,9 @@ export default function SuitableList() {
|
|||||||
<label htmlFor={`ch${subItem.id}`}>{toCodeName(SUITABLE_HEAD_CODE.TRESTLE_MFPC_CD, subItem.trestleMfpcCd)}</label>
|
<label htmlFor={`ch${subItem.id}`}>{toCodeName(SUITABLE_HEAD_CODE.TRESTLE_MFPC_CD, subItem.trestleMfpcCd)}</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="compliance-icon-wrap">
|
<div className="compliance-icon-wrap">
|
||||||
{suitableCheck(subItem.trestleManufacturerProductName)}
|
<div className="compliance-icon">
|
||||||
|
<Image src={suitableCheckIcon(subItem.trestleManufacturerProductName)} width={22} height={22} alt="" />
|
||||||
|
</div>
|
||||||
{subItem.memo && (
|
{subItem.memo && (
|
||||||
<div className="compliance-icon">
|
<div className="compliance-icon">
|
||||||
<Image src={'/assets/images/sub/compliance_tip_icon.svg'} width={22} height={22} alt=""></Image>
|
<Image src={'/assets/images/sub/compliance_tip_icon.svg'} width={22} height={22} alt=""></Image>
|
||||||
@ -113,7 +111,7 @@ export default function SuitableList() {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[isItemSelected, openItems, handleItemClick, toggleItemOpen, suitableCheck, toCodeName, toSuitableDetail],
|
[isItemSelected, openItems, handleItemClick, toggleItemOpen, toCodeName, toSuitableDetail],
|
||||||
)
|
)
|
||||||
|
|
||||||
// 아이템 리스트
|
// 아이템 리스트
|
||||||
|
|||||||
@ -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, useServey } from '@/hooks/useSurvey'
|
import { requiredFields, useSurvey } 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 } = useServey(Number(id))
|
const { deleteSurvey, updateSurvey, isDeletingSurvey, isUpdatingSurvey } = useSurvey(Number(id))
|
||||||
const { validateSurveyDetail, createSurvey, isCreatingSurvey } = useServey()
|
const { validateSurveyDetail, createSurvey, isCreatingSurvey } = useSurvey()
|
||||||
|
|
||||||
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,13 +1,14 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useServey } from '@/hooks/useSurvey'
|
import { useSurvey } from '@/hooks/useSurvey'
|
||||||
import { useParams } from 'next/navigation'
|
import { useParams, useRouter } from 'next/navigation'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import DetailForm from './DetailForm'
|
import DetailForm from './DetailForm'
|
||||||
|
|
||||||
export default function DataTable() {
|
export default function DataTable() {
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
const id = params.id
|
const id = params.id
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (Number.isNaN(Number(id))) {
|
if (Number.isNaN(Number(id))) {
|
||||||
@ -16,7 +17,7 @@ export default function DataTable() {
|
|||||||
}
|
}
|
||||||
}, [id])
|
}, [id])
|
||||||
|
|
||||||
const { surveyDetail, isLoadingSurveyDetail } = useServey(Number(id))
|
const { surveyDetail, isLoadingSurveyDetail } = useSurvey(Number(id))
|
||||||
|
|
||||||
if (isLoadingSurveyDetail) {
|
if (isLoadingSurveyDetail) {
|
||||||
return <div>Loading...</div>
|
return <div>Loading...</div>
|
||||||
@ -67,7 +68,7 @@ export default function DataTable() {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>ダウンロード</th>
|
<th>ダウンロード</th>
|
||||||
<td>
|
<td>
|
||||||
<button className="data-down">
|
<button className="data-down" onClick={() => router.push(`/pdf/survey-sale/${id}`)}>
|
||||||
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 { useServey } from '@/hooks/useSurvey'
|
import { useSurvey } 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 } = useServey(Number(id))
|
const { surveyDetail, validateSurveyDetail } = useSurvey(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)
|
||||||
|
|||||||
@ -1,7 +1,14 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import type { Mode, SurveyDetailInfo, SurveyDetailRequest } from '@/types/Survey'
|
import type { Mode, SurveyDetailInfo, SurveyDetailRequest } from '@/types/Survey'
|
||||||
|
|
||||||
type RadioEtcKeys = 'houseStructure' | 'rafterMaterial' | 'waterproofMaterial' | 'insulationPresence' | 'rafterDirection' | 'leakTrace'
|
type RadioEtcKeys =
|
||||||
|
| 'structureOrder'
|
||||||
|
| 'houseStructure'
|
||||||
|
| 'rafterMaterial'
|
||||||
|
| 'waterproofMaterial'
|
||||||
|
| 'insulationPresence'
|
||||||
|
| 'rafterDirection'
|
||||||
|
| 'leakTrace'
|
||||||
type SelectBoxKeys =
|
type SelectBoxKeys =
|
||||||
| 'installationSystem'
|
| 'installationSystem'
|
||||||
| 'constructionYear'
|
| 'constructionYear'
|
||||||
@ -9,7 +16,6 @@ type SelectBoxKeys =
|
|||||||
| 'rafterPitch'
|
| 'rafterPitch'
|
||||||
| 'rafterSize'
|
| 'rafterSize'
|
||||||
| 'openFieldPlateKind'
|
| 'openFieldPlateKind'
|
||||||
| 'structureOrder'
|
|
||||||
| 'installationAvailability'
|
| 'installationAvailability'
|
||||||
|
|
||||||
export const supplementaryFacilities = [
|
export const supplementaryFacilities = [
|
||||||
@ -115,24 +121,6 @@ export const selectBoxOptions: Record<SelectBoxKeys, { id: number; name: string
|
|||||||
name: '小幅板', //소판
|
name: '小幅板', //소판
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
structureOrder: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '屋根材', //지붕재
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '防水材', //방수재
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '屋根の基礎', //지붕의기초
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
name: '垂木', //서까래
|
|
||||||
},
|
|
||||||
],
|
|
||||||
installationAvailability: [
|
installationAvailability: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -146,6 +134,12 @@ export const selectBoxOptions: Record<SelectBoxKeys, { id: number; name: string
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const radioEtcData: Record<RadioEtcKeys, { id: number; label: string }[]> = {
|
export const radioEtcData: Record<RadioEtcKeys, { id: number; label: string }[]> = {
|
||||||
|
structureOrder: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
label: '屋根材 - 防水材 - 屋根の基礎 - 垂木', //지붕재 방수재 지붕의기초 서까래
|
||||||
|
},
|
||||||
|
],
|
||||||
houseStructure: [
|
houseStructure: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -312,6 +306,7 @@ 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} />
|
||||||
@ -437,7 +432,7 @@ export default function RoofForm(props: {
|
|||||||
<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="structureOrder" detailInfoData={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
<RadioSelected mode={mode} column="structureOrder" detailInfoData={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
||||||
</div>
|
</div>
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
{/* 지붕 제품명 설치 가능 여부 확인 */}
|
{/* 지붕 제품명 설치 가능 여부 확인 */}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import LoadMoreButton from '@/components/LoadMoreButton'
|
import LoadMoreButton from '@/components/LoadMoreButton'
|
||||||
import { useServey } from '@/hooks/useSurvey'
|
import { useSurvey } 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 } = useServey()
|
const { surveyList, isLoadingSurveyList } = useSurvey()
|
||||||
const { offset, setOffset } = useSurveyFilterStore()
|
const { offset, setOffset } = useSurveyFilterStore()
|
||||||
|
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
@ -58,8 +58,8 @@ export default function ListTable() {
|
|||||||
<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}</div>
|
<div className="sale-item-tit">{survey.buildingName === null ? '-' : survey.buildingName}</div>
|
||||||
<div className="sale-item-customer">{survey.customerName}</div>
|
<div className="sale-item-customer">{survey.customerName === null ? '-' : 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">PDF</Link>
|
<Link href="/pdf/suitable">PDF</Link>
|
||||||
</span>
|
</span>
|
||||||
<span>{Config().mode}</span>
|
<span>{Config().mode}</span>
|
||||||
<span>{Config().baseUrl}</span>
|
<span>{Config().baseUrl}</span>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import getConfigs from '@/config/config.common'
|
import getConfigs from '@/config/config.common'
|
||||||
|
|
||||||
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 local 환경에 맞는 값을 지정합니다.)
|
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 local 환경에 맞는 값을 지정합니다.)
|
||||||
const baseUrl = 'http://localhost:3000'
|
const baseUrl = 'http://172.30.1.23:3000'
|
||||||
const mode = 'local'
|
const mode = 'local'
|
||||||
|
|
||||||
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
||||||
|
|||||||
@ -62,7 +62,7 @@ export function useSuitable() {
|
|||||||
try {
|
try {
|
||||||
const params: Record<string, string> = { ids: ids }
|
const params: Record<string, string> = { ids: ids }
|
||||||
if (detailIds) params.detailIds = detailIds
|
if (detailIds) params.detailIds = detailIds
|
||||||
const response = await axiosInstance(null).get<Suitable[]>('/api/suitable', { params })
|
const response = await axiosInstance(null).post<Suitable[]>('/api/suitable', params)
|
||||||
return response.data
|
return response.data
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('지붕재 상세 데이터 로드 실패:', error)
|
console.error('지붕재 상세 데이터 로드 실패:', error)
|
||||||
@ -134,17 +134,19 @@ export function useSuitable() {
|
|||||||
enabled: selectedCategory !== '' || searchKeyword !== '',
|
enabled: selectedCategory !== '' || searchKeyword !== '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const serializeSelectedItems = (): Map<string, string> => {
|
const serializeSelectedItems = (): { ids: string; detailIds: string } => {
|
||||||
const ids: string[] = []
|
const ids: string[] = []
|
||||||
const detailIds: string[] = []
|
const detailIds: string[] = []
|
||||||
for (const [key, value] of selectedItems) {
|
for (const [key, value] of selectedItems) {
|
||||||
ids.push(String(key))
|
ids.push(String(key))
|
||||||
for (const id of value) detailIds.push(String(id))
|
for (const id of value) detailIds.push(String(id))
|
||||||
}
|
}
|
||||||
return new Map<string, string>([
|
return { ids: ids.join(','), detailIds: detailIds.length > 0 ? detailIds.join(',') : '' }
|
||||||
['ids', ids.join(',')],
|
}
|
||||||
['detailIds', detailIds.join(',')],
|
|
||||||
])
|
const getSelectedItemsData = async (): Promise<Suitable[]> => {
|
||||||
|
const { ids, detailIds } = serializeSelectedItems()
|
||||||
|
return await getSuitableDetails(ids, detailIds)
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearSuitableSearch = ({ items = false, category = false, keyword = false }: { items?: boolean; category?: boolean; keyword?: boolean }) => {
|
const clearSuitableSearch = ({ items = false, category = false, keyword = false }: { items?: boolean; category?: boolean; keyword?: boolean }) => {
|
||||||
@ -153,6 +155,24 @@ export function useSuitable() {
|
|||||||
if (keyword) clearSearchKeyword()
|
if (keyword) clearSearchKeyword()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: 추후 지붕재 적합성 데이터 CUD 구현 시 ×, ー 데이터 관리 필요
|
||||||
|
const suitableCheckIcon = (value: string): string => {
|
||||||
|
const iconMap: Record<string, string> = {
|
||||||
|
'×': '/assets/images/sub/compliance_x_icon.svg',
|
||||||
|
'ー': '/assets/images/sub/compliance_quest_icon.svg',
|
||||||
|
default: '/assets/images/sub/compliance_check_icon.svg',
|
||||||
|
}
|
||||||
|
return iconMap[value] || iconMap.default
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: 추후 지붕재 적합성 데이터 CUD 구현 시 ○, ×, ー 데이터 관리 필요
|
||||||
|
const suitableCheckMemo = (value: string): string => {
|
||||||
|
if (value === '○') return '設置可'
|
||||||
|
if (value === '×') return '設置不可'
|
||||||
|
if (value === 'ー') return 'お問い合わせください'
|
||||||
|
return `${value}で設置可`
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getSuitables,
|
getSuitables,
|
||||||
getSuitableIds,
|
getSuitableIds,
|
||||||
@ -166,7 +186,9 @@ export function useSuitable() {
|
|||||||
hasNextPage,
|
hasNextPage,
|
||||||
isFetchingNextPage,
|
isFetchingNextPage,
|
||||||
isLoading,
|
isLoading,
|
||||||
serializeSelectedItems,
|
getSelectedItemsData,
|
||||||
clearSuitableSearch,
|
clearSuitableSearch,
|
||||||
|
suitableCheckIcon,
|
||||||
|
suitableCheckMemo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ type ZipCode = {
|
|||||||
kana3: string
|
kana3: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useServey(id?: number): {
|
export function useSurvey(id?: number): {
|
||||||
surveyList: { data: SurveyBasicInfo[]; count: number } | {}
|
surveyList: { data: SurveyBasicInfo[]; count: number } | {}
|
||||||
surveyDetail: SurveyBasicInfo | null
|
surveyDetail: SurveyBasicInfo | null
|
||||||
isLoadingSurveyList: boolean
|
isLoadingSurveyList: boolean
|
||||||
|
|||||||
50
src/libs/mailer.ts
Normal file
50
src/libs/mailer.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
'use server'
|
||||||
|
|
||||||
|
import nodemailer from 'nodemailer'
|
||||||
|
|
||||||
|
interface EmailParams {
|
||||||
|
to: string | string[]
|
||||||
|
cc?: string | string[]
|
||||||
|
subject: string
|
||||||
|
content: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function sendEmail({ to, cc, subject, content }: EmailParams): Promise<void> {
|
||||||
|
// Create a transporter using SMTP
|
||||||
|
const transporter = nodemailer.createTransport({
|
||||||
|
host: process.env.SMTP_HOST,
|
||||||
|
port: Number(process.env.SMTP_PORT),
|
||||||
|
secure: process.env.SMTP_SECURE === 'true',
|
||||||
|
requireTLS: true,
|
||||||
|
auth: {
|
||||||
|
user: process.env.SMTP_USER,
|
||||||
|
pass: process.env.SMTP_PASSWORD,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Email options
|
||||||
|
const mailOptions = {
|
||||||
|
from: process.env.SMTP_USER,
|
||||||
|
to: Array.isArray(to) ? to.join(', ') : to,
|
||||||
|
cc: cc ? (Array.isArray(cc) ? cc.join(', ') : cc) : undefined,
|
||||||
|
subject,
|
||||||
|
html: content,
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Send email
|
||||||
|
await transporter.sendMail(mailOptions)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error sending email:', error)
|
||||||
|
throw new Error('Failed to send email')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function sendEmailTest() {
|
||||||
|
await sendEmail({
|
||||||
|
to: 'test@test.com',
|
||||||
|
cc: 'test2@test.com',
|
||||||
|
subject: 'Test Email',
|
||||||
|
content: '<h1>Hello</h1><p>This is a test email.</p>',
|
||||||
|
})
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user