diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4993d5b..5c4c1d8 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -214,6 +214,6 @@ model MS_USR_TRK { OWNER String @db.VarChar(100) TYPE String @db.VarChar(50) URL String? @db.VarChar(200) - DATA String? @db.VarChar(200) REG_DT DateTime @default(now()) + DATA String? @db.VarChar(200) } diff --git a/src/app/api/survey-sales/route.ts b/src/app/api/survey-sales/route.ts index 23f3d18..a2df29d 100644 --- a/src/app/api/survey-sales/route.ts +++ b/src/app/api/survey-sales/route.ts @@ -173,23 +173,18 @@ export async function GET(request: Request) { where.AND.push(roleCondition) } - // 데이터 조회 또는 카운트 - if (params.offset) { - // 페이지네이션 데이터 조회 - //@ts-ignore - const surveys = await prisma.SD_SURVEY_SALES_BASIC_INFO.findMany({ - where, - orderBy: params.sort === 'created' ? { REG_DT: 'desc' } : { UPT_DT: 'desc' }, - skip: Number(params.offset), - take: ITEMS_PER_PAGE, - }) - return NextResponse.json(surveys) - } else { - // 전체 개수만 조회 - //@ts-ignore - const count = await prisma.SD_SURVEY_SALES_BASIC_INFO.count({ where }) - return NextResponse.json(count) - } + // 페이지네이션 데이터 조회 + //@ts-ignore + const surveys = await prisma.SD_SURVEY_SALES_BASIC_INFO.findMany({ + where, + orderBy: params.sort === 'created' ? { REG_DT: 'desc' } : { UPT_DT: 'desc' }, + skip: Number(params.offset), + take: ITEMS_PER_PAGE, + }) + // 전체 개수만 조회 + //@ts-ignore + const count = await prisma.SD_SURVEY_SALES_BASIC_INFO.count({ where }) + return NextResponse.json({ data: { data: surveys, count: count } }) } catch (error) { console.error(error) return NextResponse.json({ error: 'Fail Read Survey' }, { status: 500 }) diff --git a/src/app/survey-sale/[id]/page.tsx b/src/app/survey-sale/[id]/page.tsx index 482dab4..ac22151 100644 --- a/src/app/survey-sale/[id]/page.tsx +++ b/src/app/survey-sale/[id]/page.tsx @@ -1,25 +1,6 @@ import DataTable from '@/components/survey-sale/detail/DataTable' -import DetailForm from '@/components/survey-sale/detail/DetailForm' -import { SurveyBasicInfo } from '@/types/Survey' export default function page() { - const surveyInfo: SurveyBasicInfo = { - ID: 1, - REPRESENTATIVE: 'HG', - STORE: 'HWJ(T01)', - CONSTRUCTION_POINT: '施工点名表示', - INVESTIGATION_DATE: '2021-01-01', - BUILDING_NAME: 'ビル名表示', - CUSTOMER_NAME: '顧客名表示', - POST_CODE: '1234567890', - ADDRESS: '東京都千代田区永田町1-7-1', - ADDRESS_DETAIL: '永田町ビル101号室', - SUBMISSION_STATUS: true, - SUBMISSION_DATE: '2021-01-01', - DETAIL_INFO: null, - REG_DT: new Date(), - UPT_DT: new Date(), - } return ( <> diff --git a/src/app/survey-sale/basic-info/page.tsx b/src/app/survey-sale/basic-info/page.tsx deleted file mode 100644 index 7359926..0000000 --- a/src/app/survey-sale/basic-info/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import BasicForm from '@/components/survey-sale/detail/my/basicForm' - -export default function page() { - return ( - <> - - - ) -} diff --git a/src/app/survey-sale/regist/page.tsx b/src/app/survey-sale/regist/page.tsx index cf18ff2..0dec827 100644 --- a/src/app/survey-sale/regist/page.tsx +++ b/src/app/survey-sale/regist/page.tsx @@ -1,5 +1,4 @@ -// import RegistForm from '@/components/survey-sale/temp/registForm' -import RegistForm from '@/components/survey-sale/RegistForm' +import RegistForm from '@/components/survey-sale/detail/RegistForm' export default function RegistPage() { return ( diff --git a/src/app/survey-sale/roof-info/page.tsx b/src/app/survey-sale/roof-info/page.tsx deleted file mode 100644 index 51797e6..0000000 --- a/src/app/survey-sale/roof-info/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import RoofInfoForm from '@/components/survey-sale/detail/my/roofInfoForm' - -export default function page() { - return ( - <> - - - ) -} \ No newline at end of file diff --git a/src/components/survey-sale/detail/BasicForm.tsx b/src/components/survey-sale/detail/BasicForm.tsx index bee4623..716930e 100644 --- a/src/components/survey-sale/detail/BasicForm.tsx +++ b/src/components/survey-sale/detail/BasicForm.tsx @@ -32,8 +32,8 @@ export default function BasicForm(props: { basicInfo: SurveyBasicRequest; setBas type="text" className="input-frame" readOnly={mode === 'READ'} - value={basicInfo?.REPRESENTATIVE ?? ''} - onChange={(e) => setBasicInfo({ ...basicInfo, REPRESENTATIVE: e.target.value })} + value={basicInfo?.representative ?? ''} + onChange={(e) => setBasicInfo({ ...basicInfo, representative: e.target.value })} />
@@ -42,8 +42,8 @@ export default function BasicForm(props: { basicInfo: SurveyBasicRequest; setBas type="text" className="input-frame" readOnly={mode === 'READ'} - value={basicInfo?.STORE ?? ''} - onChange={(e) => setBasicInfo({ ...basicInfo, STORE: e.target.value })} + value={basicInfo?.store ?? ''} + onChange={(e) => setBasicInfo({ ...basicInfo, store: e.target.value })} />
@@ -52,8 +52,8 @@ export default function BasicForm(props: { basicInfo: SurveyBasicRequest; setBas type="text" className="input-frame" readOnly={mode === 'READ'} - value={basicInfo?.CONSTRUCTION_POINT ?? ''} - onChange={(e) => setBasicInfo({ ...basicInfo, CONSTRUCTION_POINT: e.target.value })} + value={basicInfo?.constructionPoint ?? ''} + onChange={(e) => setBasicInfo({ ...basicInfo, constructionPoint: e.target.value })} />
@@ -67,32 +67,32 @@ export default function BasicForm(props: { basicInfo: SurveyBasicRequest; setBas - + ) : ( - + )}
{/* 건물명 */}
建物名
- +
{/* 고객명 */}
建物名
- +
郵便番号/都道府県
{/* 우편번호 */}
- +
{/* 도도부현 */}
- +
{/* 주소 */} diff --git a/src/components/survey-sale/detail/DataTable.tsx b/src/components/survey-sale/detail/DataTable.tsx index be8da34..1d06e2e 100644 --- a/src/components/survey-sale/detail/DataTable.tsx +++ b/src/components/survey-sale/detail/DataTable.tsx @@ -11,7 +11,6 @@ export default function DataTable() { const id = params.id const searchParams = useSearchParams() - const tab = searchParams.get('tab') const isTemp = searchParams.get('isTemporary') const { surveyDetail, isLoadingSurveyDetail } = useServey(Number(id)) @@ -20,8 +19,8 @@ export default function DataTable() { const { validateSurveyDetail } = useServey(Number(id)) useEffect(() => { - if (surveyDetail?.DETAIL_INFO) { - const validate = validateSurveyDetail(surveyDetail.DETAIL_INFO) + if (surveyDetail?.detailInfo) { + const validate = validateSurveyDetail(surveyDetail.detailInfo) if (validate.trim() !== '') { setIsTemporary(false) } @@ -48,25 +47,25 @@ export default function DataTable() { 仮保存 ) : ( - {surveyDetail?.ID} + {surveyDetail?.id} )} 登録日 - {surveyDetail?.REG_DT ? new Date(surveyDetail?.REG_DT).toLocaleString() : ''} + {surveyDetail?.regDt ? new Date(surveyDetail.regDt).toLocaleString() : ''} 更新日時 - {surveyDetail?.UPT_DT ? new Date(surveyDetail?.UPT_DT).toLocaleString() : ''} + {surveyDetail?.uptDt ? new Date(surveyDetail.uptDt).toLocaleString() : ''} 提出可否 - {surveyDetail?.SUBMISSION_STATUS && surveyDetail?.SUBMISSION_DATE ? ( + {surveyDetail?.submissionStatus && surveyDetail?.submissionDate ? ( <> {/* TODO: 제출한 판매점 ID 추가 필요 */} -
{new Date(surveyDetail.SUBMISSION_DATE).toLocaleString()}
-
{surveyDetail.STORE}
+
{new Date(surveyDetail.submissionDate).toLocaleString()}
+
{surveyDetail.store}
) : ( '-' diff --git a/src/components/survey-sale/detail/DetailForm.tsx b/src/components/survey-sale/detail/DetailForm.tsx index 92dbce4..387bb4f 100644 --- a/src/components/survey-sale/detail/DetailForm.tsx +++ b/src/components/survey-sale/detail/DetailForm.tsx @@ -6,55 +6,55 @@ import ButtonForm from './ButtonForm' import BasicForm from './BasicForm' import RoofForm from './RoofForm' const roofInfoForm: SurveyDetailRequest = { - CONTRACT_CAPACITY: null, - RETAIL_COMPANY: null, - SUPPLEMENTARY_FACILITIES: null, - SUPPLEMENTARY_FACILITIES_ETC: null, - INSTALLATION_SYSTEM: null, - INSTALLATION_SYSTEM_ETC: null, - CONSTRUCTION_YEAR: null, - CONSTRUCTION_YEAR_ETC: null, - ROOF_MATERIAL: null, - ROOF_MATERIAL_ETC: null, - ROOF_SHAPE: null, - ROOF_SHAPE_ETC: null, - ROOF_SLOPE: null, - HOUSE_STRUCTURE: '1', - HOUSE_STRUCTURE_ETC: null, - RAFTER_MATERIAL: '1', - RAFTER_MATERIAL_ETC: null, - RAFTER_SIZE: null, - RAFTER_SIZE_ETC: null, - RAFTER_PITCH: null, - RAFTER_PITCH_ETC: null, - RAFTER_DIRECTION: '1', - OPEN_FIELD_PLATE_KIND: null, - OPEN_FIELD_PLATE_KIND_ETC: null, - OPEN_FIELD_PLATE_THICKNESS: null, - LEAK_TRACE: false, - WATERPROOF_MATERIAL: null, - WATERPROOF_MATERIAL_ETC: null, - INSULATION_PRESENCE: '1', - INSULATION_PRESENCE_ETC: null, - STRUCTURE_ORDER: null, - STRUCTURE_ORDER_ETC: null, - INSTALLATION_AVAILABILITY: null, - INSTALLATION_AVAILABILITY_ETC: null, - MEMO: null, + contractCapacity: null, + retailCompany: null, + supplementaryFacilities: null, + supplementaryFacilitiesEtc: null, + installationSystem: null, + installationSystemEtc: null, + constructionYear: null, + constructionYearEtc: null, + roofMaterial: null, + roofMaterialEtc: null, + roofShape: null, + roofShapeEtc: null, + roofSlope: null, + houseStructure: '1', + houseStructureEtc: null, + rafterMaterial: '1', + rafterMaterialEtc: null, + rafterSize: null, + rafterSizeEtc: null, + rafterPitch: null, + rafterPitchEtc: null, + rafterDirection: '1', + openFieldPlateKind: null, + openFieldPlateKindEtc: null, + openFieldPlateThickness: null, + leakTrace: false, + waterproofMaterial: null, + waterproofMaterialEtc: null, + insulationPresence: '1', + insulationPresenceEtc: null, + structureOrder: null, + structureOrderEtc: null, + installationAvailability: null, + installationAvailabilityEtc: null, + memo: null, } const basicInfoForm: SurveyBasicRequest = { - REPRESENTATIVE: '', - STORE: null, - CONSTRUCTION_POINT: null, - INVESTIGATION_DATE: new Date().toLocaleDateString('en-CA'), - BUILDING_NAME: null, - CUSTOMER_NAME: null, - POST_CODE: null, - ADDRESS: null, - ADDRESS_DETAIL: null, - SUBMISSION_STATUS: false, - SUBMISSION_DATE: null, + representative: '', + store: null, + constructionPoint: null, + investigationDate: new Date().toLocaleDateString('en-CA'), + buildingName: null, + customerName: null, + postCode: null, + address: null, + addressDetail: null, + submissionStatus: false, + submissionDate: null, } export default function DetailForm(props: { surveyInfo?: SurveyBasicInfo; mode?: Mode }) { @@ -62,20 +62,12 @@ export default function DetailForm(props: { surveyInfo?: SurveyBasicInfo; mode?: const [basicInfoData, setBasicInfoData] = useState(basicInfoForm) const [roofInfoData, setRoofInfoData] = useState(roofInfoForm) - // useEffect(() => { - // // setMode(props.surveyInfo ? 'EDIT' : 'CREATE') - // }, [props.surveyInfo]) - useEffect(() => { - console.log(props.surveyInfo) - }, [props.surveyInfo]) - - useEffect(() => { - if (props.surveyInfo && mode === 'EDIT') { - const { ID, UPT_DT, REG_DT, DETAIL_INFO, ...rest } = props.surveyInfo + if (props.surveyInfo && (mode === 'EDIT' || mode === 'READ')) { + const { id, uptDt, regDt, detailInfo, ...rest } = props.surveyInfo setBasicInfoData(rest) - if (DETAIL_INFO) { - const { ID, UPT_DT, REG_DT, BASIC_INFO_ID, ...rest } = DETAIL_INFO + if (detailInfo) { + const { id, uptDt, regDt, basicInfoId, ...rest } = detailInfo setRoofInfoData(rest) } } @@ -91,7 +83,6 @@ export default function DetailForm(props: { surveyInfo?: SurveyBasicInfo; mode?: return ( <>
- {/* {mode} */} {/* 기본정보 */} {/* 전기/지붕정보 */} diff --git a/src/components/survey-sale/RegistForm.tsx b/src/components/survey-sale/detail/RegistForm.tsx similarity index 94% rename from src/components/survey-sale/RegistForm.tsx rename to src/components/survey-sale/detail/RegistForm.tsx index b1cc240..4377713 100644 --- a/src/components/survey-sale/RegistForm.tsx +++ b/src/components/survey-sale/detail/RegistForm.tsx @@ -1,6 +1,6 @@ import { Mode } from '@/types/Survey' import { useSearchParams } from 'next/navigation' -import DetailForm from './detail/DetailForm' +import DetailForm from './DetailForm' import { useServey } from '@/hooks/useSurvey' import { useEffect, useState } from 'react' import { SurveyBasicInfo } from '@/types/Survey' diff --git a/src/components/survey-sale/detail/RoofForm.tsx b/src/components/survey-sale/detail/RoofForm.tsx index 1e92ae9..794bf21 100644 --- a/src/components/survey-sale/detail/RoofForm.tsx +++ b/src/components/survey-sale/detail/RoofForm.tsx @@ -1,8 +1,204 @@ import { useState } from 'react' -import { Mode, SurveyBasicInfo, SurveyDetailInfo, SurveyDetailRequest } from '@/types/Survey' -import { roof_material, supplementary_facilities } from './form/etcProcess/MultiCheckEtc' -import { selectBoxOptions } from './form/etcProcess/SelectBoxEtc' -import { radioEtcData } from './form/etcProcess/RadioEtc' +import { Mode, SurveyDetailInfo, SurveyDetailRequest } from '@/types/Survey' + +type RadioEtcKeys = 'houseStructure' | 'rafterMaterial' | 'waterproofMaterial' | 'insulationPresence' | 'rafterDirection' | 'leakTrace' +type SelectBoxKeys = + | 'installationSystem' + | 'constructionYear' + | 'roofShape' + | 'rafterPitch' + | 'rafterSize' + | 'openFieldPlateKind' + | 'structureOrder' + | 'installationAvailability' + +export const supplementary_facilities = [ + { id: 1, name: 'エコキュート' }, //에코큐트 + { id: 2, name: 'エネパーム' }, //에네팜 + { id: 3, name: '蓄電池システム' }, //축전지시스템 + { id: 4, name: '太陽光発電' }, //태양광발전 +] + +export const roof_material = [ + { id: 1, name: 'スレート' }, //슬레이트 + { id: 2, name: 'アスファルトシングル' }, //아스팔트 싱글 + { id: 3, name: '瓦' }, //기와 + { id: 4, name: '金属屋根' }, //금속지붕 +] + +export const selectBoxOptions: Record = { + installationSystem: [ + { + id: 1, + name: '太陽光発電', //태양광발전 + }, + { + id: 2, + name: 'ハイブリッド蓄電システム', //하이브리드축전지시스템 + }, + { + id: 3, + name: '蓄電池システム', //축전지시스템 + }, + ], + constructionYear: [ + { + id: 1, + name: '新築', //신축 + }, + { + id: 2, + name: '既築', //기존 + }, + ], + roofShape: [ + { + id: 1, + name: '切妻', //박공지붕 + }, + { + id: 2, + name: '寄棟', //기동 + }, + { + id: 3, + name: '片流れ', //한쪽흐름 + }, + ], + rafterSize: [ + { + id: 1, + name: '幅35mm以上×高さ48mm以上', + }, + { + id: 2, + name: '幅36mm以上×高さ46mm以上', + }, + { + id: 3, + name: '幅37mm以上×高さ43mm以上', + }, + { + id: 4, + name: '幅38mm以上×高さ40mm以上', + }, + ], + rafterPitch: [ + { + id: 1, + name: '455mm以下', + }, + { + id: 2, + name: '500mm以下', + }, + { + id: 3, + name: '606mm以下', + }, + ], + openFieldPlateKind: [ + { + id: 1, + name: '構造用合板', //구조용합판 + }, + { + id: 2, + name: 'OSB', //OSB + }, + { + id: 3, + name: 'パーティクルボード', //파티클보드 + }, + { + id: 4, + name: '小幅板', //소판 + }, + ], + structureOrder: [ + { + id: 1, + name: '屋根材', //지붕재 + }, + { + id: 2, + name: '防水材', //방수재 + }, + { + id: 3, + name: '屋根の基礎', //지붕의기초 + }, + { + id: 4, + name: '垂木', //서까래 + }, + ], + installationAvailability: [ + { + id: 1, + name: '確認済み', //확인완료 + }, + { + id: 2, + name: '未確認', //미확인 + }, + ], +} + +export const radioEtcData: Record = { + houseStructure: [ + { + id: 1, + label: '木製', + }, + ], + rafterMaterial: [ + { + id: 1, + label: '木製', + }, + { + id: 2, + label: '強制', + }, + ], + waterproofMaterial: [ + { + id: 1, + label: 'アスファルト屋根940(22kg以上)', + }, + ], + insulationPresence: [ + { + id: 1, + label: 'なし', + }, + { + id: 2, + label: 'あり', + }, + ], + rafterDirection: [ + { + id: 1, + label: '垂直垂木', + }, + { + id: 2, + label: '水平垂木', + }, + ], + leakTrace: [ + { + id: 1, + label: 'あり', + }, + { + id: 2, + label: 'なし', + }, + ], +} export default function RoofForm(props: { roofInfo: SurveyDetailRequest | SurveyDetailInfo @@ -34,7 +230,7 @@ export default function RoofForm(props: { {/* 전기 계약 용량 */}
電気契約容量
- +
{mode === 'READ' && } {mode !== 'READ' && ( @@ -52,7 +248,7 @@ export default function RoofForm(props: {
{/* 전기 소매 회사사 */}
電気小売会社
- +
{/* 전기 부대 설비 */} @@ -69,19 +265,19 @@ export default function RoofForm(props: {
))}
- - + +
- +
@@ -104,7 +300,7 @@ export default function RoofForm(props: {
)} */}
設置希望システム
- + @@ -126,7 +322,7 @@ export default function RoofForm(props: { )} */} - + {/*
@@ -141,17 +337,17 @@ export default function RoofForm(props: {
{roof_material.map((item) => (
- +
))}
- - + +
- +
@@ -168,7 +364,7 @@ export default function RoofForm(props: { )} */} - +
@@ -178,46 +374,46 @@ export default function RoofForm(props: { {/* 지붕 경사도도 */}
屋根の斜面
- +
{/* 주택구조조 */}
住宅構造
- +
{/* 서까래 재질 */}
垂木材質
- +
{/* 서까래 크기 */}
垂木サイズ
- +
{/* 서까래 피치 */}
垂木サイズ
- +
{/* 서까래 방향 */}
垂木の方向
- +
{/* 노지판 종류류 */}
路地板の種類
- +
@@ -226,7 +422,7 @@ export default function RoofForm(props: { 路地板厚※小幅板を選択した場合, 厚さ. 小幅板間の間隔寸法を記載
- + mm
@@ -234,28 +430,28 @@ export default function RoofForm(props: { {/* 누수 흔적 */}
水漏れの痕跡
- +
{/* 방수재 종류 */}
防水材の種類
- +
{/* 단열재 유무 */}
断熱材の有無
- +
{/* 지붕 구조의 순서 */}
屋根構造の順序
- +
{/* 지붕 제품명 설치 가능 여부 확인 */}
屋根製品名 設置可否確認
- +
{/* 메모 */} @@ -266,7 +462,7 @@ export default function RoofForm(props: { name="" id="" placeholder="TextArea Filed" - value={roofInfo?.MEMO ?? ''} + value={roofInfo?.memo ?? ''} readOnly={mode === 'READ'} >
@@ -280,7 +476,7 @@ export default function RoofForm(props: { const SelectedBox = ({ column, detailInfoData }: { column: string; detailInfoData: SurveyDetailInfo }) => { const selectedId = detailInfoData?.[column as keyof SurveyDetailInfo] - const etcValue = detailInfoData?.[`${column}_ETC` as keyof SurveyDetailInfo] + const etcValue = detailInfoData?.[`${column}Etc` as keyof SurveyDetailInfo] return ( <> @@ -296,18 +492,18 @@ const SelectedBox = ({ column, detailInfoData }: { column: string; detailInfoDat const RadioSelected = ({ column, detailInfoData }: { column: string; detailInfoData: SurveyDetailInfo | null }) => { let selectedId = detailInfoData?.[column as keyof SurveyDetailInfo] - if (column === 'LEAK_TRACE') { + if (column === 'leakTrace') { selectedId = Number(selectedId) if (!selectedId) selectedId = 2 } let etcValue = null - if (column !== 'RAFTER_DIRECTION') { - etcValue = detailInfoData?.[`${column}_ETC` as keyof SurveyDetailInfo] + if (column !== 'rafterDirection') { + etcValue = detailInfoData?.[`${column}Etc` as keyof SurveyDetailInfo] } const etcChecked = etcValue !== null && etcValue !== undefined && etcValue !== '' - console.log('column: selectedId', column, selectedId) + // console.log('column: selectedId', column, selectedId) return ( <> {radioEtcData[column as keyof typeof radioEtcData].map((item) => ( @@ -316,10 +512,10 @@ const RadioSelected = ({ column, detailInfoData }: { column: string; detailInfoD ))} - {column !== 'RAFTER_DIRECTION' && column !== 'LEAK_TRACE' && column !== 'INSULATION_PRESENCE' && ( + {column !== 'rafterDirection' && column !== 'leakTrace' && column !== 'insulationPresence' && (
- - + +
)} {etcChecked && ( diff --git a/src/components/survey-sale/detail/form/etcProcess/MultiCheckEtc.tsx b/src/components/survey-sale/detail/form/etcProcess/MultiCheckEtc.tsx deleted file mode 100644 index 30a1ca7..0000000 --- a/src/components/survey-sale/detail/form/etcProcess/MultiCheckEtc.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import { SurveyDetailRequest } from '@/types/Survey' -import { useEffect, useState } from 'react' - -export const supplementary_facilities = [ - { id: 1, name: 'エコキュート' }, //에코큐트 - { id: 2, name: 'エネパーム' }, //에네팜 - { id: 3, name: '蓄電池システム' }, //축전지시스템 - { id: 4, name: '太陽光発電' }, //태양광발전 -] - -export const roof_material = [ - { id: 1, name: 'スレート' }, //슬레이트 - { id: 2, name: 'アスファルトシングル' }, //아스팔트 싱글 - { id: 3, name: '瓦' }, //기와 - { id: 4, name: '金属屋根' }, //금속지붕 -] - -export default function MultiCheckbox({ - column, - setDetailInfoData, - detailInfoData, -}: { - column: string - setDetailInfoData: (data: any) => void - detailInfoData: SurveyDetailRequest -}) { - const selectList = column === 'SUPPLEMENTARY_FACILITIES' ? supplementary_facilities : roof_material - - const [isOtherChecked, setIsOtherChecked] = useState(false) - const [otherValue, setOtherValue] = useState('') - - const makeNumArr = (value: string) => { - return value - .split(',') - .map((v) => v.trim()) - .filter((v) => v.length > 0) - } - - useEffect(() => { - if (detailInfoData[`${column}_ETC` as keyof SurveyDetailRequest]) { - setIsOtherChecked(true) - setOtherValue(detailInfoData[`${column}_ETC` as keyof SurveyDetailRequest] as string) - } - }, [detailInfoData]) - - const handleCheckbox = (dataIndex: number) => { - const value = makeNumArr(String(detailInfoData[column as keyof SurveyDetailRequest] ?? '')) - - let newValue: string[] - if (value.includes(String(dataIndex))) { - // 체크 해제 - newValue = value.filter((v) => v !== String(dataIndex)) - } else { - // 체크 - if (column === 'ROOF_MATERIAL') { - // 기타가 체크되어 있는지 확인 - const isOtherSelected = isOtherChecked - // 현재 선택된 항목 수 + 기타 선택 여부 - const totalSelected = value.length + (isOtherSelected ? 1 : 0) - - if (totalSelected >= 2) { - alert('屋根材は最大2個まで選択可能です。') - return - } - } - newValue = [...value, String(dataIndex)] - } - - setDetailInfoData({ - ...detailInfoData, - [column]: newValue.join(', '), - }) - } - - const handleOtherCheckbox = () => { - if (column === 'ROOF_MATERIAL') { - const value = makeNumArr(String(detailInfoData[column as keyof SurveyDetailRequest] ?? '')) - const currentSelected = value.length - if (!isOtherChecked && currentSelected >= 2) { - alert('Up to two roofing materials can be selected.') - return - } - } - - const newIsOtherChecked = !isOtherChecked - setIsOtherChecked(newIsOtherChecked) - setOtherValue('') - - setDetailInfoData({ - ...detailInfoData, - [`${column}_ETC`]: newIsOtherChecked ? '' : null, - }) - } - - const handleOtherInputChange = (e: React.ChangeEvent) => { - const value = e.target.value - setOtherValue(value) - setDetailInfoData({ - ...detailInfoData, - [`${column}_ETC`]: value, - }) - } - - return ( - <> - {column === 'SUPPLEMENTARY_FACILITIES' ? ( - <> -
- 電気袋設備※複数選択可能 -
- - ) : ( - <> -
- 屋根材※最大2個まで選択可能 -
- - )} -
- {selectList.map((item) => ( -
- handleCheckbox(item.id)} - /> - -
- ))} -
- - -
-
-
- -
- - ) -} diff --git a/src/components/survey-sale/detail/form/etcProcess/RadioEtc.tsx b/src/components/survey-sale/detail/form/etcProcess/RadioEtc.tsx deleted file mode 100644 index 29f3325..0000000 --- a/src/components/survey-sale/detail/form/etcProcess/RadioEtc.tsx +++ /dev/null @@ -1,175 +0,0 @@ -'use client' -import { useEffect, useState } from 'react' -import { SurveyDetailRequest } from '@/types/Survey' - -type RadioEtcKeys = 'HOUSE_STRUCTURE' | 'RAFTER_MATERIAL' | 'WATERPROOF_MATERIAL' | 'INSULATION_PRESENCE' | 'RAFTER_DIRECTION' | 'LEAK_TRACE' - -const translateJapanese: Record = { - HOUSE_STRUCTURE: '住宅構造', - RAFTER_MATERIAL: '垂木材質', - WATERPROOF_MATERIAL: '防水材の種類', - INSULATION_PRESENCE: '断熱材の有無', - RAFTER_DIRECTION: '垂木の方向', - LEAK_TRACE: '水漏れの痕跡', -} - -export const radioEtcData: Record = { - HOUSE_STRUCTURE: [ - { - id: 1, - label: '木製', - }, - ], - RAFTER_MATERIAL: [ - { - id: 1, - label: '木製', - }, - { - id: 2, - label: '強制', - }, - ], - WATERPROOF_MATERIAL: [ - { - id: 1, - label: 'アスファルト屋根940(22kg以上)', - }, - ], - INSULATION_PRESENCE: [ - { - id: 1, - label: 'なし', - }, - { - id: 2, - label: 'あり', - }, - ], - RAFTER_DIRECTION: [ - { - id: 1, - label: '垂直垂木', - }, - { - id: 2, - label: '水平垂木', - }, - ], - LEAK_TRACE: [ - { - id: 1, - label: 'あり', - }, - { - id: 2, - label: 'なし', - }, - ], -} - -export default function RadioEtc({ - column, - setDetailInfoData, - detailInfoData, -}: { - column: RadioEtcKeys - setDetailInfoData: (data: any) => void - detailInfoData: SurveyDetailRequest -}) { - const [isEtcSelected, setIsEtcSelected] = useState(false) - const [etcValue, setEtcValue] = useState('') - - useEffect(() => { - if (detailInfoData[`${column}_ETC` as keyof SurveyDetailRequest]) { - setIsEtcSelected(true) - setEtcValue(detailInfoData[`${column}_ETC` as keyof SurveyDetailRequest] as string) - } - }, [detailInfoData]) - - const handleRadioChange = (e: React.ChangeEvent) => { - // const value = e.target.value - // if (column === 'INSULATION_PRESENCE') { - // setIsEtcSelected(value === '2') - // setDetailInfoData({ - // ...detailInfoData, - // [column]: value, - // }) - // } else if (value === 'etc') { - // setIsEtcSelected(true) - // setDetailInfoData({ - // ...detailInfoData, - // [column]: null, - // }) - // } else { - // setIsEtcSelected(false) - // setEtcValue('') - // setDetailInfoData({ - // ...detailInfoData, - // [column]: value, - // [`${column}_ETC`]: null, - // }) - // } - const value = e.target.value - const isSpecialCase = column === 'INSULATION_PRESENCE' - const isEtc = value === 'etc' - const isSpecialEtc = isSpecialCase && value === '2' - - const updatedData: typeof detailInfoData = { - ...detailInfoData, - [column]: isEtc ? null : value, - [`${column}_ETC`]: isEtc ? '' : null, - } - - if (isSpecialEtc) { - updatedData[column] = value - } - - setIsEtcSelected(isEtc || isSpecialEtc) - if (!isEtc) setEtcValue('') - setDetailInfoData(updatedData) - } - - const handleEtcInputChange = (e: React.ChangeEvent) => { - const value = e.target.value - setEtcValue(value) - setDetailInfoData({ - ...detailInfoData, - [`${column}_ETC`]: value, - }) - } - - return ( -
-
{translateJapanese[column]}
- {radioEtcData[column].map((item) => ( -
- - -
- ))} - {column !== 'INSULATION_PRESENCE' && ( -
- - -
- )} -
- -
-
- ) -} diff --git a/src/components/survey-sale/detail/form/etcProcess/SelectBoxEtc.tsx b/src/components/survey-sale/detail/form/etcProcess/SelectBoxEtc.tsx deleted file mode 100644 index f509972..0000000 --- a/src/components/survey-sale/detail/form/etcProcess/SelectBoxEtc.tsx +++ /dev/null @@ -1,246 +0,0 @@ -import type { SurveyDetailRequest } from '@/types/Survey' -import { useEffect, useState } from 'react' - -export type SelectBoxKeys = - | 'INSTALLATION_SYSTEM' - | 'CONSTRUCTION_YEAR' - | 'ROOF_SHAPE' - | 'RAFTER_PITCH' - | 'RAFTER_SIZE' - | 'OPEN_FIELD_PLATE_KIND' - | 'STRUCTURE_ORDER' - | 'INSTALLATION_AVAILABILITY' - -const font: Record = { - INSTALLATION_SYSTEM: 'data-input-form-tit red-f', - CONSTRUCTION_YEAR: 'data-input-form-tit red-f', - ROOF_SHAPE: 'data-input-form-tit', - RAFTER_PITCH: 'data-input-form-tit red-f', - RAFTER_SIZE: 'data-input-form-tit red-f', - OPEN_FIELD_PLATE_KIND: 'data-input-form-tit', - STRUCTURE_ORDER: 'data-input-form-tit red-f', - INSTALLATION_AVAILABILITY: 'data-input-form-tit', -} - -const translateJapanese: Record = { - INSTALLATION_SYSTEM: '設置希望システム', - CONSTRUCTION_YEAR: '建築年数', - ROOF_SHAPE: '屋根の形状', - RAFTER_PITCH: '垂木傾斜', - RAFTER_SIZE: '垂木サイズ', - OPEN_FIELD_PLATE_KIND: '路地板の種類', - STRUCTURE_ORDER: '屋根構造の順序', - INSTALLATION_AVAILABILITY: '屋根製品名 設置可否確認', -} - -export const selectBoxOptions: Record = { - INSTALLATION_SYSTEM: [ - { - id: 1, - name: '太陽光発電', //태양광발전 - }, - { - id: 2, - name: 'ハイブリッド蓄電システム', //하이브리드축전지시스템 - }, - { - id: 3, - name: '蓄電池システム', //축전지시스템 - }, - ], - CONSTRUCTION_YEAR: [ - { - id: 1, - name: '新築', //신축 - }, - { - id: 2, - name: '既築', //기존 - }, - ], - ROOF_SHAPE: [ - { - id: 1, - name: '切妻', //박공지붕 - }, - { - id: 2, - name: '寄棟', //기동 - }, - { - id: 3, - name: '片流れ', //한쪽흐름 - }, - ], - RAFTER_SIZE: [ - { - id: 1, - name: '幅35mm以上×高さ48mm以上', - }, - { - id: 2, - name: '幅36mm以上×高さ46mm以上', - }, - { - id: 3, - name: '幅37mm以上×高さ43mm以上', - }, - { - id: 4, - name: '幅38mm以上×高さ40mm以上', - }, - ], - RAFTER_PITCH: [ - { - id: 1, - name: '455mm以下', - }, - { - id: 2, - name: '500mm以下', - }, - { - id: 3, - name: '606mm以下', - }, - ], - OPEN_FIELD_PLATE_KIND: [ - { - id: 1, - name: '構造用合板', //구조용합판 - }, - { - id: 2, - name: 'OSB', //OSB - }, - { - id: 3, - name: 'パーティクルボード', //파티클보드 - }, - { - id: 4, - name: '小幅板', //소판 - }, - ], - STRUCTURE_ORDER: [ - { - id: 1, - name: '屋根材', //지붕재 - }, - { - id: 2, - name: '防水材', //방수재 - }, - { - id: 3, - name: '屋根の基礎', //지붕의기초 - }, - { - id: 4, - name: '垂木', //서까래 - }, - ], - INSTALLATION_AVAILABILITY: [ - { - id: 1, - name: '確認済み', //확인완료 - }, - { - id: 2, - name: '未確認', //미확인 - }, - ], -} - -export default function SelectBoxForm({ - column, - setDetailInfoData, - detailInfoData, -}: { - column: SelectBoxKeys - setDetailInfoData: (data: any) => void - detailInfoData: SurveyDetailRequest -}) { - const [isEtcSelected, setIsEtcSelected] = useState(false) - const [etcValue, setEtcValue] = useState('') - - useEffect(() => { - if (detailInfoData[`${column}_ETC` as keyof SurveyDetailRequest]) { - setIsEtcSelected(true) - setEtcValue(detailInfoData[`${column}_ETC` as keyof SurveyDetailRequest] as string) - } - }, [detailInfoData]) - - const handleSelectChange = (e: React.ChangeEvent) => { - const value = e.target.value - const isSpecialCase = column === 'CONSTRUCTION_YEAR' || column === 'INSTALLATION_AVAILABILITY' - const isEtc = value === 'etc' - const isSpecialEtc = isSpecialCase && value === '2' - - const updatedData: typeof detailInfoData = { - ...detailInfoData, - [column]: isEtc ? null : value, - [`${column}_ETC`]: isEtc ? '' : null, - } - - // 건축연수 + 설치가능여부는 2번 선택 시 input 활성화 - if (isSpecialEtc) { - updatedData[column] = value - } - - setIsEtcSelected(isEtc || isSpecialEtc) - if (!isEtc) setEtcValue('') - setDetailInfoData(updatedData) - } - - const handleEtcInputChange = (e: React.ChangeEvent) => { - const value = e.target.value - setEtcValue(value) - setDetailInfoData({ - ...detailInfoData, - [`${column}_ETC`]: value, - }) - } - - return ( - <> -
-
{translateJapanese[column as keyof typeof translateJapanese]}
-
- -
-
- -
-
- - ) -} diff --git a/src/components/survey-sale/detail/my/basicForm.tsx b/src/components/survey-sale/detail/my/basicForm.tsx deleted file mode 100644 index 1f55838..0000000 --- a/src/components/survey-sale/detail/my/basicForm.tsx +++ /dev/null @@ -1,244 +0,0 @@ -'use client' - -import { useServey } from '@/hooks/useSurvey' -import { SurveyBasicRequest } from '@/types/Survey' -import { useRouter, useSearchParams } from 'next/navigation' -import { useState, useEffect } from 'react' -import { useSurveySaleTabState } from '@/store/surveySaleTabState' -import { usePopupController } from '@/store/popupController' -import { useAddressStore } from '@/store/addressStore' -import { useSessionStore } from '@/store/session' -// import { useUserType } from '@/hooks/useUserType' - -const defaultBasicInfoForm: SurveyBasicRequest = { - REPRESENTATIVE: '', - STORE: null, - CONSTRUCTION_POINT: null, - INVESTIGATION_DATE: new Date().toLocaleDateString('en-CA'), - BUILDING_NAME: null, - CUSTOMER_NAME: null, - POST_CODE: null, - ADDRESS: null, - ADDRESS_DETAIL: null, - SUBMISSION_STATUS: false, - SUBMISSION_DATE: null, -} - -const REQUIRED_FIELDS: (keyof SurveyBasicRequest)[] = ['REPRESENTATIVE', 'BUILDING_NAME', 'CUSTOMER_NAME'] - -export default function BasicForm() { - const searchParams = useSearchParams() - const id = searchParams.get('id') - const router = useRouter() - - const { setBasicInfoSelected } = useSurveySaleTabState() - const { surveyDetail, createSurvey, isCreatingSurvey, updateSurvey, isUpdatingSurvey } = useServey(Number(id)) - - const [basicInfoData, setBasicInfoData] = useState(defaultBasicInfoForm) - - const { addressData } = useAddressStore() - const { session } = useSessionStore() - - const popupController = usePopupController() - - useEffect(() => { - if (surveyDetail) { - const { ID, UPT_DT, REG_DT, DETAIL_INFO, ...rest } = surveyDetail - setBasicInfoData(rest) - } - if (addressData) { - setBasicInfoData({ - ...basicInfoData, - POST_CODE: addressData.post_code, - ADDRESS: addressData.address, - ADDRESS_DETAIL: addressData.address_detail, - }) - } - if (session?.isLoggedIn) { - setBasicInfoData((prev) => ({ - ...prev, - REPRESENTATIVE: session?.userId ?? '', - STORE: session?.storeNm ?? '', - CONSTRUCTION_POINT: session?.builderNo ?? '', - })) - } - setBasicInfoSelected() - }, [surveyDetail, addressData, session?.isLoggedIn, session?.userId, session?.storeNm, session?.builderNo]) - - const focusInput = (input: keyof SurveyBasicRequest) => { - const inputElement = document.getElementById(input) - if (inputElement) { - inputElement.focus() - } - } - - const validateSurvey = (basicInfoData: SurveyBasicRequest) => { - const emptyField = REQUIRED_FIELDS.find((field) => !basicInfoData[field]) - if (emptyField) { - focusInput(emptyField) - return false - } - return true - } - - const handleChange = (key: keyof SurveyBasicRequest, value: string) => { - setBasicInfoData({ ...basicInfoData, [key]: value }) - } - - const handleSave = async (isTemporary: boolean) => { - if (id) { - // updateSurvey(basicInfoData) - alert('保存しました。') - // router.push(`/survey-sale/${id}?tab=basic-info`) - } - if (isTemporary) { - // const saveId = await createSurvey(basicInfoData) - alert('一時保存されました。') - // router.push(`/survey-sale/${saveId}?tab=basic-info`) - } else { - if (validateSurvey(basicInfoData)) { - // const saveId = await createSurvey(basicInfoData) - alert('保存しました。') - // router.push(`/survey-sale/${saveId}?tab=basic-info`) - } - } - } - - if (isCreatingSurvey || isUpdatingSurvey) { - return
Loading...
- } - - return ( - <> -
-
-
-
担当者名
- handleChange('REPRESENTATIVE', e.target.value)} - /> -
- {(session?.role === 'Builder' || session?.role?.includes('Admin')) && ( - <> -
-
販売店
- handleChange('STORE', e.target.value)} - /> -
- - )} - {(session?.role === 'Partner' || session?.role === 'Builder') && ( -
-
施工店
- handleChange('CONSTRUCTION_POINT', e.target.value)} - /> -
- )} -
-
- -
-
-
-
現地調査日
-
- - handleChange('INVESTIGATION_DATE', e.target.value)} - /> -
-
-
-
建物名
- handleChange('BUILDING_NAME', e.target.value)} - /> -
-
-
顧客名
- handleChange('CUSTOMER_NAME', e.target.value)} - /> -
-
-
建物の住所
-
-
- -
-
- -
-
-
- -
-
-
-
市区町村名, 以後の住所
- handleChange('ADDRESS_DETAIL', e.target.value)} - /> -
-
-
-
- -
-
- -
-
- -
-
-
- - ) -} diff --git a/src/components/survey-sale/detail/my/detailButton.tsx b/src/components/survey-sale/detail/my/detailButton.tsx deleted file mode 100644 index 3a871bf..0000000 --- a/src/components/survey-sale/detail/my/detailButton.tsx +++ /dev/null @@ -1,119 +0,0 @@ -'use client' -import { useRouter, useSearchParams } from 'next/navigation' -import { useServey } from '@/hooks/useSurvey' -import { useSessionStore } from '@/store/session' -import { SurveyBasicInfo } from '@/types/Survey' -import { useState } from 'react' - -export default function DetailButton({ surveyDetail }: { surveyDetail: SurveyBasicInfo | null }) { - const router = useRouter() - const { session } = useSessionStore() - const { submitSurvey, deleteSurvey } = useServey(surveyDetail?.ID ?? 0) - - const searchParams = useSearchParams() - const isTemp = searchParams.get('isTemporary') - const [isTemporary, setIsTemporary] = useState(isTemp === 'true') - - const checkRole = () => { - switch (session?.role) { - case 'T01': - return session?.userNm === surveyDetail?.REPRESENTATIVE ? true : false - case 'Admin': - return session?.storeNm === surveyDetail?.STORE ? true : false - case 'Admin_Sub': - return session?.storeNm === surveyDetail?.STORE ? true : false - case 'Builder': - return session?.builderNo === surveyDetail?.CONSTRUCTION_POINT ? true : false - case 'Partner': - return session?.builderNo === surveyDetail?.CONSTRUCTION_POINT ? true : false - default: - return '' - } - } - - const handleSubmit = async () => { - const result = checkRole() - if (result) { - if (isTemporary) { - alert('一時保存されたデータは提出できません。') - return - } - window.neoConfirm( - '提出しますか??', - async () => { - if (surveyDetail?.ID) { - // TODO: 제출 페이지 추가 - alert('SUBMIT POPUP!!!!!!!!!!!') - await submitSurvey() - } - }, - () => null, - ) - } - } - const handleUpdate = () => { - const result = checkRole() - if (result) { - // router.push(`/survey-sale/basic-info?id=${surveyDetail?.ID}&isTemp=${isTemporary}`) - router.push(`/survey-sale/regist?id=${surveyDetail?.ID}`) - } else { - alert('担当者のみ修正可能です。') - } - } - const handleDelete = async () => { - window.neoConfirm( - '削除しますか?', - async () => { - if (surveyDetail?.ID) { - if (session.userNm === surveyDetail?.REPRESENTATIVE) { - await deleteSurvey() - alert('削除されました。') - router.push('/survey-sale') - } else { - alert('担当者のみ削除可能です。') - } - } - }, - () => null, - ) - } - - const isSubmitter = session?.storeNm === surveyDetail?.STORE && session?.builderNo === surveyDetail?.CONSTRUCTION_POINT - - return ( -
-
- -
- {isSubmitter && surveyDetail?.SUBMISSION_STATUS ? ( - <> - ) : ( - <> - {isTemporary || surveyDetail?.SUBMISSION_STATUS ? ( - <> - ) : ( - <> -
- -
- - )} -
- -
-
- -
- - )} -
- ) -} diff --git a/src/components/survey-sale/detail/my/roofDetailForm.tsx b/src/components/survey-sale/detail/my/roofDetailForm.tsx deleted file mode 100644 index 6b8bbb5..0000000 --- a/src/components/survey-sale/detail/my/roofDetailForm.tsx +++ /dev/null @@ -1,256 +0,0 @@ -import { SurveyBasicInfo, SurveyDetailInfo } from '@/types/Survey' -import DetailButton from './detailButton' -import { roof_material, supplementary_facilities } from '../form/etcProcess/MultiCheckEtc' -import { selectBoxOptions } from '../form/etcProcess/SelectBoxEtc' -import { radioEtcData } from '../form/etcProcess/RadioEtc' - -export default function RoofDetailForm({ - surveyDetail, - isLoadingSurveyDetail, -}: { - surveyDetail: SurveyBasicInfo | null - isLoadingSurveyDetail: boolean -}) { - console.log(surveyDetail) - - const makeNumArr = (value: string) => { - return value - .split(',') - .map((v) => v.trim()) - .filter((v) => v.length > 0) - } - - if (isLoadingSurveyDetail) { - return
Loading...
- } - return ( - <> -
-
-
- {/* 전기 계약 용량 */} -
電気契約容量
- -
- {/* 전기 소매 회사 */} -
-
電気小売会社
- -
- {/* 전기 부대 설비 */} -
-
電気附属設備
-
- {supplementary_facilities.map((item) => ( -
- - -
- ))} -
- - -
-
-
- -
-
- {/* 설치 희망 시스템 */} -
-
設置希望システム
- -
- {/* 건축 연수 */} -
-
建築年数
- -
- {/* 지붕재 */} -
-
屋根材
-
- {roof_material.map((item) => ( -
- - -
- ))} -
- - -
-
-
- -
-
- {/* 지붕 모양 */} -
-
屋根の形状
- -
- {/* 지붕 경사도 */} -
-
屋根の斜面
-
- - -
-
- {/* 주택 구조 */} -
-
住宅構造
- -
- {/* 서까래 재질 */} -
-
垂木の材質
- -
- {/* 서까래 크기 */} -
-
垂木の大きさ
- -
- {/* 서까래 피치 */} -
-
垂木のピッチ
- -
- {/* 서까래 방향 */} -
-
垂木の方向
- -
- {/* 노지판 종류 */} -
-
路地板の種類
- -
- {/* 노지판 두께 */} -
-
路地板厚
-
- - mm -
-
- {/* 누수 흔적 */} -
-
水漏れの痕跡
- -
- {/* 방수재 종류 */} -
-
防水材の種類
- -
- {/* 단열재 유무 */} -
-
断熱材の有無
- -
- {/* 구조 순서 */} -
-
屋根構造の順序
- -
- {/* 설치 가능 여부 */} -
-
設置可能な場合
- -
- {/* 메모 */} -
-
メモ
-
- -
-
-
-
-
- -
-
- -
-
- -
-
-
- - ) -} diff --git a/src/components/survey-sale/list/ListTable.tsx b/src/components/survey-sale/list/ListTable.tsx index 468f01d..b1ac703 100644 --- a/src/components/survey-sale/list/ListTable.tsx +++ b/src/components/survey-sale/list/ListTable.tsx @@ -7,33 +7,32 @@ import { useRouter } from 'next/navigation' import SearchForm from './SearchForm' import { useSurveyFilterStore } from '@/store/surveyFilterStore' import { useSessionStore } from '@/store/session' +import { SurveyBasicInfo } from '@/types/Survey' export default function ListTable() { const router = useRouter() - const { surveyList, isLoadingSurveyList, surveyListCount } = useServey() + const { surveyList, isLoadingSurveyList } = useServey() const { offset, setOffset } = useSurveyFilterStore() - const [heldSurveyList, setHeldSurveyList] = useState([]) + const [heldSurveyList, setHeldSurveyList] = useState([]) const [hasMore, setHasMore] = useState(false) const { session } = useSessionStore() useEffect(() => { - if (surveyList) { - if (offset === 0) { - setHeldSurveyList(surveyList) + if (!session.isLoggedIn || !('data' in surveyList)) return + if ('count' in surveyList && surveyList.count > 0) { + if (offset > 0) { + setHeldSurveyList((prev) => [...prev, ...surveyList.data]) } else { - setHeldSurveyList(prev => [...prev, ...surveyList]) + setHeldSurveyList(surveyList.data) } - setHasMore(surveyListCount > offset + 10) + setHasMore(surveyList.count > offset + 10) } else { setHeldSurveyList([]) setHasMore(false) } - }, [surveyList, surveyListCount, offset]) - - console.log('surveyList:: ', surveyList) - console.log('heldSurveyList:: ', heldSurveyList) + }, [surveyList, offset, session]) const handleDetailClick = (id: number) => { router.push(`/survey-sale/${id}`) @@ -48,22 +47,22 @@ export default function ListTable() { return ( <> - + {heldSurveyList.length > 0 ? (
    {heldSurveyList.map((survey) => ( -
  • handleDetailClick(survey.ID)}> +
  • handleDetailClick(survey.id)}>
    -
    {survey.ID}
    -
    {survey.INVESTIGATION_DATE}
    +
    {survey.id}
    +
    {survey.investigationDate}
    -
    {survey.BUILDING_NAME}
    -
    {survey.CUSTOMER_NAME}
    +
    {survey.buildingName}
    +
    {survey.customerName}
    -
    {survey.REPRESENTATIVE}
    -
    {new Date(survey.UPT_DT).toLocaleString()}
    +
    {survey.representative}
    +
    {new Date(survey.uptDt).toLocaleString()}
  • diff --git a/src/components/survey-sale/list/SearchForm.tsx b/src/components/survey-sale/list/SearchForm.tsx index 16a259d..327a85c 100644 --- a/src/components/survey-sale/list/SearchForm.tsx +++ b/src/components/survey-sale/list/SearchForm.tsx @@ -4,7 +4,7 @@ import { SEARCH_OPTIONS, SEARCH_OPTIONS_ENUM, SEARCH_OPTIONS_PARTNERS, useSurvey import { useRouter } from 'next/navigation' import { useState } from 'react' -export default function SearchForm({ onItemsInit, memberRole, userId }: { onItemsInit: () => void; memberRole: string; userId: string }) { +export default function SearchForm({ memberRole, userId }: { memberRole: string; userId: string }) { const router = useRouter() const { setSearchOption, setSort, setIsMySurvey, setKeyword, isMySurvey, keyword, searchOption, sort } = useSurveyFilterStore() const [searchKeyword, setSearchKeyword] = useState(keyword) diff --git a/src/components/survey-sale/temp/basicRegist.tsx b/src/components/survey-sale/temp/basicRegist.tsx deleted file mode 100644 index c5ddaf1..0000000 --- a/src/components/survey-sale/temp/basicRegist.tsx +++ /dev/null @@ -1,153 +0,0 @@ -'use client' - -import { SurveyBasicRequest, SurveyRegistRequest } from '@/types/Survey' -import { useEffect } from 'react' -import { usePopupController } from '@/store/popupController' -import { useAddressStore } from '@/store/addressStore' -import { useSessionStore } from '@/store/session' - -export default function BasicRegist({ - basicInfoData, - setBasicInfoData, -}: { - basicInfoData: SurveyBasicRequest - setBasicInfoData: (data: SurveyBasicRequest) => void -}) { - const { addressData } = useAddressStore() - const { session } = useSessionStore() - - const popupController = usePopupController() - - useEffect(() => { - if (addressData) { - setBasicInfoData({ - ...basicInfoData, - POST_CODE: addressData.post_code, - ADDRESS: addressData.address, - ADDRESS_DETAIL: addressData.address_detail, - }) - } - }, [addressData]) - - const handleChange = (key: keyof SurveyRegistRequest, value: string) => { - setBasicInfoData({ ...basicInfoData, [key]: value }) - } - - return ( - <> -
    -
    -
    -
    担当者名
    - -
    - {(session?.role === 'Builder' || session?.role?.includes('Admin')) && ( - <> -
    -
    販売店
    - -
    - - )} - {(session?.role === 'Partner' || session?.role === 'Builder') && ( -
    -
    施工店
    - -
    - )} -
    -
    - -
    -
    -
    -
    現地調査日
    -
    - - handleChange('INVESTIGATION_DATE', e.target.value)} - /> -
    -
    -
    -
    建物名
    - handleChange('BUILDING_NAME', e.target.value)} - /> -
    -
    -
    顧客名
    - handleChange('CUSTOMER_NAME', e.target.value)} - /> -
    -
    -
    建物の住所
    -
    -
    - -
    -
    - handleChange('ADDRESS', e.target.value)} - /> -
    -
    -
    - -
    -
    -
    -
    市区町村名, 以後の住所
    - handleChange('ADDRESS_DETAIL', e.target.value)} - /> -
    -
    -
    - - ) -} diff --git a/src/components/survey-sale/temp/formButton.tsx b/src/components/survey-sale/temp/formButton.tsx deleted file mode 100644 index 7b41003..0000000 --- a/src/components/survey-sale/temp/formButton.tsx +++ /dev/null @@ -1,92 +0,0 @@ -'use client' - -import { SurveyBasicRequest, SurveyRegistRequest } from '@/types/Survey' -import { SurveyDetailRequest } from '@/types/Survey' -import { useRouter } from 'next/navigation' -import { useServey } from '@/hooks/useSurvey' - -export default function FormButton({ - surveyData, - idParam, -}: { - surveyData: { basic: SurveyBasicRequest; roof: SurveyDetailRequest } - idParam: string | null -}) { - const router = useRouter() - const { validateSurveyDetail, createSurvey, updateSurvey } = useServey(Number(idParam)) - - const saveData = { - ...surveyData.basic, - DETAIL_INFO: surveyData.roof, - } - - const focusInput = (input: keyof SurveyRegistRequest) => { - const inputElement = document.getElementById(input) - if (inputElement) { - inputElement.focus() - } - } - - const handleSave = (isTemporary: boolean) => { - const emptyField = validateSurveyDetail(saveData.DETAIL_INFO) - if (!isTemporary) { - saveProcess(emptyField) - } else { - temporarySaveProcess() - } - } - const saveProcess = async (emptyField: string) => { - if (emptyField.trim() === '') { - if (idParam) { - // 매물 수정 (저장) - updateSurvey(saveData) - router.push(`/survey-sale/${idParam}`) - } else { - // 매물 생성 (저장) - const id = await createSurvey(saveData) - router.push(`/survey-sale/${id}`) - } - alert('保存されました。') - } else { - alert(emptyField + ' 項目が空です。') - focusInput(emptyField as keyof SurveyRegistRequest) - } - } - - const temporarySaveProcess = async () => { - if (idParam) { - // 매물 수정 (임시저장) - updateSurvey(saveData) - router.push(`/survey-sale/${idParam}?isTemporary=true`) - } else { - // 매물 생성 (임시저장) - const id = await createSurvey(saveData) - router.push(`/survey-sale/${id}?isTemporary=true`) - } - alert('一時保存されました。') - } - - return ( - <> -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - - ) -} diff --git a/src/components/survey-sale/temp/registForm.tsx b/src/components/survey-sale/temp/registForm.tsx deleted file mode 100644 index 42e7267..0000000 --- a/src/components/survey-sale/temp/registForm.tsx +++ /dev/null @@ -1,105 +0,0 @@ -'use client' - -import { SurveyBasicRequest, SurveyDetailRequest, SurveyRegistRequest } from '@/types/Survey' -import FormButton from './formButton' -import { useEffect, useState } from 'react' -import BasicRegist from './basicRegist' -import RoofRegist from './roofRegist' -import { useSessionStore } from '@/store/session' -import { useSearchParams } from 'next/navigation' -import { useServey } from '@/hooks/useSurvey' - -const roofInfoForm: SurveyDetailRequest = { - CONTRACT_CAPACITY: null, - RETAIL_COMPANY: null, - SUPPLEMENTARY_FACILITIES: null, - SUPPLEMENTARY_FACILITIES_ETC: null, - INSTALLATION_SYSTEM: null, - INSTALLATION_SYSTEM_ETC: null, - CONSTRUCTION_YEAR: null, - CONSTRUCTION_YEAR_ETC: null, - ROOF_MATERIAL: null, - ROOF_MATERIAL_ETC: null, - ROOF_SHAPE: null, - ROOF_SHAPE_ETC: null, - ROOF_SLOPE: null, - HOUSE_STRUCTURE: '1', - HOUSE_STRUCTURE_ETC: null, - RAFTER_MATERIAL: '1', - RAFTER_MATERIAL_ETC: null, - RAFTER_SIZE: null, - RAFTER_SIZE_ETC: null, - RAFTER_PITCH: null, - RAFTER_PITCH_ETC: null, - RAFTER_DIRECTION: '1', - OPEN_FIELD_PLATE_KIND: null, - OPEN_FIELD_PLATE_KIND_ETC: null, - OPEN_FIELD_PLATE_THICKNESS: null, - LEAK_TRACE: false, - WATERPROOF_MATERIAL: null, - WATERPROOF_MATERIAL_ETC: null, - INSULATION_PRESENCE: '1', - INSULATION_PRESENCE_ETC: null, - STRUCTURE_ORDER: null, - STRUCTURE_ORDER_ETC: null, - INSTALLATION_AVAILABILITY: null, - INSTALLATION_AVAILABILITY_ETC: null, - MEMO: null, -} - -const basicInfoForm: SurveyBasicRequest = { - REPRESENTATIVE: '', - STORE: null, - CONSTRUCTION_POINT: null, - INVESTIGATION_DATE: new Date().toLocaleDateString('en-CA'), - BUILDING_NAME: null, - CUSTOMER_NAME: null, - POST_CODE: null, - ADDRESS: null, - ADDRESS_DETAIL: null, - SUBMISSION_STATUS: false, - SUBMISSION_DATE: null, -} - -export default function RegistForm() { - const searchParams = useSearchParams() - const id = searchParams.get('id') - - const { session } = useSessionStore() - const { surveyDetail } = useServey(Number(id)) - - const [basicInfoData, setBasicInfoData] = useState(basicInfoForm) - const [roofInfoData, setRoofInfoData] = useState(roofInfoForm) - - useEffect(() => { - if (session) { - setBasicInfoData({ - ...basicInfoForm, - REPRESENTATIVE: session.userNm ?? '', - STORE: session.role === 'T01' ? '' : session.storeNm ?? '', - CONSTRUCTION_POINT: session.builderNo ?? '', - }) - } - if (id && surveyDetail) { - const { ID, UPT_DT, REG_DT, DETAIL_INFO, ...rest } = surveyDetail - setBasicInfoData(rest) - if (surveyDetail?.DETAIL_INFO) { - const { ID, UPT_DT, REG_DT, BASIC_INFO_ID, ...rest } = surveyDetail.DETAIL_INFO - setRoofInfoData(rest) - } - } - }, [session, surveyDetail]) - - const surveyData = { - basic: basicInfoData, - roof: roofInfoData, - } - - return ( - <> - - - - - ) -} diff --git a/src/components/survey-sale/temp/roofRegist.tsx b/src/components/survey-sale/temp/roofRegist.tsx deleted file mode 100644 index 6c5492a..0000000 --- a/src/components/survey-sale/temp/roofRegist.tsx +++ /dev/null @@ -1,284 +0,0 @@ -'use client' - -import { useSurveySaleTabState } from '@/store/surveySaleTabState' - -import { SurveyBasicInfo, SurveyDetailRequest } from '@/types/Survey' -import { useEffect } from 'react' -import MultiCheckEtc from '../detail/form/etcProcess/MultiCheckEtc' -import SelectBoxEtc from '../detail/form/etcProcess/SelectBoxEtc' -import RadioEtc from '../detail/form/etcProcess/RadioEtc' - -export default function RoofRegist({ - roofInfoData, - setRoofInfoData, -}: { - roofInfoData: SurveyDetailRequest - setRoofInfoData: (data: SurveyDetailRequest) => void -}) { - const { setRoofInfoSelected } = useSurveySaleTabState() - - useEffect(() => { - setRoofInfoSelected() - }, []) - - const handleNumberInput = (key: keyof SurveyDetailRequest, value: number | string) => { - if (key === 'ROOF_SLOPE' || key === 'OPEN_FIELD_PLATE_THICKNESS') { - const stringValue = value.toString() - if (stringValue.length > 5) { - alert('保存できるサイズを超えました。') - return - } - if (stringValue.includes('.')) { - const decimalPlaces = stringValue.split('.')[1].length - if (decimalPlaces > 1) { - alert('小数点以下1桁までしか許されません。') - return - } - } - } - setRoofInfoData({ ...roofInfoData, [key]: value.toString() }) - } - - const handleTextInput = (key: keyof SurveyDetailRequest, value: string) => { - setRoofInfoData({ ...roofInfoData, [key]: value || null }) - } - - const handleBooleanInput = (key: keyof SurveyDetailRequest, value: boolean) => { - setRoofInfoData({ ...roofInfoData, [key]: value }) - } - - const handleUnitInput = (value: string) => { - const numericValue = roofInfoData.CONTRACT_CAPACITY?.replace(/[^0-9.]/g, '') || '' - setRoofInfoData({ - ...roofInfoData, - CONTRACT_CAPACITY: numericValue ? `${numericValue} ${value}` : value, - }) - } - - // const handleSave = async () => { - // if (id) { - // const emptyField = validateSurveyDetail(roofInfoData) - // if (emptyField.trim() === '') { - // const updatedBasicInfoData = { - // DETAIL_INFO: roofInfoData, - // } - // try { - // createSurveyDetail({ - // surveyId: Number(id), - // surveyDetail: updatedBasicInfoData, - // }) - // alert('調査物件を保存しました。') - // } catch (error) { - // alert(error) - // throw new Error('failed to create survey detail: ' + error) - // } - // router.push(`/survey-sale`) - // } else { - // alert(emptyField + ' は必須項目です。') - // focusOnInput(emptyField) - // } - // } else { - // alert('基本情報を作成した後、屋根情報を作成することができます。') - // } - // } - // const focusOnInput = (field: string) => { - // const input = document.getElementById(field) - // if (input) { - // input.focus() - // } - // } - return ( - <> -
    -
    電気関係
    -
    -
    - {/* 전기계약 용량 - contract_capacity */} -
    電気契約容量
    -
    - handleNumberInput('CONTRACT_CAPACITY', e.target.value)} - /> -
    -
    - -
    -
    - {/* 전기 소매 회사 - retail_company */} -
    -
    電気小売会社
    - handleTextInput('RETAIL_COMPANY', e.target.value)} - /> -
    - {/* 전기 부대 설비 - supplementary_facilities */} -
    - -
    - {/* 설치 희망 시스템 - installation_system */} - -
    -
    - -
    -
    屋根関係
    -
    - {/* 건축 연수 - construction_year */} - - {/* 지붕재 - roof_material */} -
    - -
    - {/* 지붕 모양 - roof_shape */} - - {/* 지붕 경사도 - roof_slope */} -
    -
    屋根の斜面
    -
    - handleNumberInput('ROOF_SLOPE', e.target.value)} - /> - -
    -
    - {/* 주택 구조 - house_structure */} - - {/* 서까래 재질 - rafter_material */} - - {/* 서까래 크기 - rafter_size */} - - {/* 서까래 피치 - rafter_pitch */} - - {/* 서까래 방향 - rafter_direction */} -
    -
    垂木の方向
    -
    -
    - handleNumberInput('RAFTER_DIRECTION', Number(e.target.value))} - checked={roofInfoData.RAFTER_DIRECTION === '1'} - /> - -
    -
    - handleNumberInput('RAFTER_DIRECTION', Number(e.target.value))} - checked={roofInfoData.RAFTER_DIRECTION === '2'} - /> - -
    -
    -
    - {/* 노지판 종류 - open_field_plate_kind */} - - {/* 노지판 두께 - open_field_plate_thickness */} -
    -
    - 路地板厚※小幅板を選択した場合, 厚さ. 小幅板間の間隔寸法を記載 -
    -
    - handleNumberInput('OPEN_FIELD_PLATE_THICKNESS', e.target.value)} - /> - mm -
    -
    - {/* 누수 흔적 - leak_trace */} -
    -
    水漏れの痕跡
    -
    -
    - handleBooleanInput('LEAK_TRACE', true)} - /> - -
    -
    - handleBooleanInput('LEAK_TRACE', false)} - /> - -
    -
    -
    - {/* 방수재 종류 - waterproof_material */} - - {/* 단열재 유무 - insulation_presence */} - - {/* 노지판 종류 - open_field_plate_kind */} - - {/* 설치 가능 여부 - installation_availability */} - - {/* 메모 - memo */} -
    -
    メモ
    -
    - -
    -
    - -
    -
    -
    -
    - - ) -} diff --git a/src/hooks/useSurvey.ts b/src/hooks/useSurvey.ts index a047706..d07cddf 100644 --- a/src/hooks/useSurvey.ts +++ b/src/hooks/useSurvey.ts @@ -1,43 +1,39 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' -import type { - SurveyBasicInfo, - SurveyDetailInfo, - SurveyDetailRequest, - SurveyDetailCoverRequest, - SurveyRegistRequest, -} from '@/types/Survey' +import type { SurveyBasicInfo, SurveyDetailInfo, SurveyDetailRequest, SurveyDetailCoverRequest, SurveyRegistRequest } from '@/types/Survey' import { axiosInstance } from '@/libs/axios' import { useSurveyFilterStore } from '@/store/surveyFilterStore' import { queryStringFormatter } from '@/utils/common-utils' import { useSessionStore } from '@/store/session' +import { useMemo } from 'react' +import { AxiosResponse } from 'axios' const requiredFields = [ { - field: 'INSTALLATION_SYSTEM', + field: 'installationSystem', name: '設置希望システム', }, { - field: 'CONSTRUCTION_YEAR', + field: 'constructionYear', name: '建築年数', }, { - field: 'RAFTER_SIZE', + field: 'rafterSize', name: '垂木サイズ', }, { - field: 'RAFTER_PITCH', + field: 'rafterPitch', name: '垂木傾斜', }, { - field: 'WATERPROOF_MATERIAL', + field: 'waterproofMaterial', name: '防水材', }, { - field: 'INSULATION_PRESENCE', + field: 'insulationPresence', name: '断熱材有無', }, { - field: 'STRUCTURE_ORDER', + field: 'structureOrder', name: '屋根構造の順序', }, ] @@ -60,9 +56,8 @@ type ZipCode = { } export function useServey(id?: number): { - surveyList: SurveyBasicInfo[] | [] + surveyList: { data: SurveyBasicInfo[]; count: number } | {} surveyDetail: SurveyBasicInfo | null - surveyListCount: number isLoadingSurveyList: boolean isLoadingSurveyDetail: boolean isCreatingSurvey: boolean @@ -75,15 +70,20 @@ export function useServey(id?: number): { submitSurvey: () => void validateSurveyDetail: (surveyDetail: SurveyDetailRequest) => string getZipCode: (zipCode: string) => Promise + refetchSurveyList: () => void } { const queryClient = useQueryClient() const { keyword, searchOption, isMySurvey, sort, offset } = useSurveyFilterStore() const { session } = useSessionStore() - const { data: surveyList, isLoading: isLoadingSurveyList } = useQuery({ + const { + data, + isLoading: isLoadingSurveyList, + refetch: refetchSurveyList, + } = useQuery({ queryKey: ['survey', 'list', keyword, searchOption, isMySurvey, sort, offset, session?.storeNm, session?.builderNo, session?.role], queryFn: async () => { - const resp = await axiosInstance(null).get('/api/survey-sales', { + const resp = await axiosInstance(null).get<{ data: SurveyBasicInfo[]; count: number }>('/api/survey-sales', { params: { keyword, searchOption, @@ -97,7 +97,15 @@ export function useServey(id?: number): { }) return resp.data }, + enabled: session?.isLoggedIn, }) + const surveyData = useMemo(() => { + if (!data) return {} + return { + data: data.data, + count: data.count, + } + }, [data]) const { data: surveyDetail, isLoading: isLoadingSurveyDetail } = useQuery({ queryKey: ['survey', id], @@ -110,28 +118,10 @@ export function useServey(id?: number): { enabled: id !== undefined, }) - const { data: surveyListCount } = useQuery({ - queryKey: ['survey', 'list', keyword, searchOption, isMySurvey, sort, session?.builderNo, session?.storeNm, session?.role], - queryFn: async () => { - const resp = await axiosInstance(null).get('/api/survey-sales', { - params: { - keyword, - searchOption, - isMySurvey, - sort, - builderNo: session?.builderNo, - store: session?.storeNm, - role: session?.role, - }, - }) - return resp.data - }, - }) - const { mutateAsync: createSurvey, isPending: isCreatingSurvey } = useMutation({ mutationFn: async (survey: SurveyRegistRequest) => { const resp = await axiosInstance(null).post('/api/survey-sales', survey) - return resp.data.ID ?? 0 + return resp.data.id ?? 0 }, onSuccess: (data) => { queryClient.invalidateQueries({ queryKey: ['survey', 'list'] }) @@ -190,7 +180,7 @@ export function useServey(id?: number): { }) const validateSurveyDetail = (surveyDetail: SurveyDetailRequest) => { - const etcFields = ['INSTALLATION_SYSTEM', 'CONSTRUCTION_YEAR', 'RAFTER_SIZE', 'RAFTER_PITCH', 'WATERPROOF_MATERIAL', 'STRUCTURE_ORDER'] as const + const etcFields = ['installationSystem', 'constructionYear', 'rafterSize', 'rafterPitch', 'waterproofMaterial', 'structureOrder'] as const const emptyField = requiredFields.find((field) => { if (etcFields.includes(field.field as (typeof etcFields)[number])) { @@ -202,9 +192,9 @@ export function useServey(id?: number): { } }) - const contractCapacity = surveyDetail.CONTRACT_CAPACITY + const contractCapacity = surveyDetail.contractCapacity if (contractCapacity && contractCapacity.trim() !== '' && contractCapacity.split(' ')?.length === 1) { - return 'CONTRACT_CAPACITY_UNIT' + return 'contractCapacityUnit' } return emptyField?.name || '' @@ -223,9 +213,8 @@ export function useServey(id?: number): { } return { - surveyList: surveyList || [], - surveyDetail: surveyDetail || null, - surveyListCount: surveyListCount || 0, + surveyList: surveyData, + surveyDetail: surveyDetail as SurveyBasicInfo | null, isLoadingSurveyList, isLoadingSurveyDetail, isCreatingSurvey, @@ -238,5 +227,6 @@ export function useServey(id?: number): { submitSurvey, validateSurveyDetail, getZipCode, + refetchSurveyList, } } diff --git a/src/libs/axios.ts b/src/libs/axios.ts index 8718318..d973f9d 100644 --- a/src/libs/axios.ts +++ b/src/libs/axios.ts @@ -21,7 +21,10 @@ export const axiosInstance = (url: string | null | undefined) => { ) instance.interceptors.response.use( - (response) => transferResponse(response), + (response) => { + response.data = transferResponse(response) + return response + }, (error) => { // 에러 처리 로직 return Promise.reject(error) @@ -52,7 +55,7 @@ export const axiosInstance = (url: string | null | undefined) => { // ) // response데이터가 array, object에 따라 분기하여 키 변환 -const transferResponse = (response: any) => { +export const transferResponse = (response: any) => { if (!response.data) return response.data // 배열인 경우 각 객체의 키를 변환 @@ -80,7 +83,11 @@ const transformObjectKeys = (obj: any): any => { return obj } -// snake case to camel case -const snakeToCamel = (str: string): string => { - return str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', '').replace('_', '')) + +export const camelToSnake = (str: string): string => { + return str.replace(/([A-Z])/g, (group) => `_${group.toLowerCase()}`) +} + +const snakeToCamel = (str: string): string => { + return str.toLowerCase().replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', '').replace('_', '')) } diff --git a/src/types/Survey.ts b/src/types/Survey.ts index 9030f21..36e7aa5 100644 --- a/src/types/Survey.ts +++ b/src/types/Survey.ts @@ -1,132 +1,132 @@ export type SurveyBasicInfo = { - ID: number - REPRESENTATIVE: string - STORE: string | null - CONSTRUCTION_POINT: string | null - INVESTIGATION_DATE: string | null - BUILDING_NAME: string | null - CUSTOMER_NAME: string | null - POST_CODE: string | null - ADDRESS: string | null - ADDRESS_DETAIL: string | null - SUBMISSION_STATUS: boolean - SUBMISSION_DATE: string | null - DETAIL_INFO: SurveyDetailInfo | null - REG_DT: Date - UPT_DT: Date + id: number + representative: string + store: string | null + constructionPoint: string | null + investigationDate: string | null + buildingName: string | null + customerName: string | null + postCode: string | null + address: string | null + addressDetail: string | null + submissionStatus: boolean + submissionDate: string | null + detailInfo: SurveyDetailInfo | null + regDt: Date + uptDt: Date } export type SurveyDetailInfo = { - ID: number - BASIC_INFO_ID: number - CONTRACT_CAPACITY: string | null - RETAIL_COMPANY: string | null - SUPPLEMENTARY_FACILITIES: string | null // number 배열 - SUPPLEMENTARY_FACILITIES_ETC: string | null - INSTALLATION_SYSTEM: string | null - INSTALLATION_SYSTEM_ETC: string | null - CONSTRUCTION_YEAR: string | null - CONSTRUCTION_YEAR_ETC: string | null - ROOF_MATERIAL: string | null // number 배열 - ROOF_MATERIAL_ETC: string | null - ROOF_SHAPE: string | null - ROOF_SHAPE_ETC: string | null - ROOF_SLOPE: string | null - HOUSE_STRUCTURE: string | null - HOUSE_STRUCTURE_ETC: string | null - RAFTER_MATERIAL: string | null - RAFTER_MATERIAL_ETC: string | null - RAFTER_SIZE: string | null - RAFTER_SIZE_ETC: string | null - RAFTER_PITCH: string | null - RAFTER_PITCH_ETC: string | null - RAFTER_DIRECTION: string | null - OPEN_FIELD_PLATE_KIND: string | null - OPEN_FIELD_PLATE_KIND_ETC: string | null - OPEN_FIELD_PLATE_THICKNESS: string | null - LEAK_TRACE: boolean | null - WATERPROOF_MATERIAL: string | null - WATERPROOF_MATERIAL_ETC: string | null - INSULATION_PRESENCE: string | null - INSULATION_PRESENCE_ETC: string | null - STRUCTURE_ORDER: string | null - STRUCTURE_ORDER_ETC: string | null - INSTALLATION_AVAILABILITY: string | null - INSTALLATION_AVAILABILITY_ETC: string | null - MEMO: string | null - REG_DT: Date - UPT_DT: Date + id: number + basicInfoId: number + contractCapacity: string | null + retailCompany: string | null + supplementaryFacilities: string | null // number 배열 + supplementaryFacilitiesEtc: string | null + installationSystem: string | null + installationSystemEtc: string | null + constructionYear: string | null + constructionYearEtc: string | null + roofMaterial: string | null // number 배열 + roofMaterialEtc: string | null + roofShape: string | null + roofShapeEtc: string | null + roofSlope: string | null + houseStructure: string | null + houseStructureEtc: string | null + rafterMaterial: string | null + rafterMaterialEtc: string | null + rafterSize: string | null + rafterSizeEtc: string | null + rafterPitch: string | null + rafterPitchEtc: string | null + rafterDirection: string | null + openFieldPlateKind: string | null + openFieldPlateKindEtc: string | null + openFieldPlateThickness: string | null + leakTrace: boolean | null + waterproofMaterial: string | null + waterproofMaterialEtc: string | null + insulationPresence: string | null + insulationPresenceEtc: string | null + structureOrder: string | null + structureOrderEtc: string | null + installationAvailability: string | null + installationAvailabilityEtc: string | null + memo: string | null + regDt: Date + uptDt: Date } export type SurveyBasicRequest = { - REPRESENTATIVE: string - STORE: string | null - CONSTRUCTION_POINT: string | null - INVESTIGATION_DATE: string | null - BUILDING_NAME: string | null - CUSTOMER_NAME: string | null - POST_CODE: string | null - ADDRESS: string | null - ADDRESS_DETAIL: string | null - SUBMISSION_STATUS: boolean - SUBMISSION_DATE: string | null + representative: string + store: string | null + constructionPoint: string | null + investigationDate: string | null + buildingName: string | null + customerName: string | null + postCode: string | null + address: string | null + addressDetail: string | null + submissionStatus: boolean + submissionDate: string | null } export type SurveyDetailRequest = { - CONTRACT_CAPACITY: string | null - RETAIL_COMPANY: string | null - SUPPLEMENTARY_FACILITIES: string | null // number 배열 - SUPPLEMENTARY_FACILITIES_ETC: string | null - INSTALLATION_SYSTEM: string | null - INSTALLATION_SYSTEM_ETC: string | null - CONSTRUCTION_YEAR: string | null - CONSTRUCTION_YEAR_ETC: string | null - ROOF_MATERIAL: string | null // number 배열 - ROOF_MATERIAL_ETC: string | null - ROOF_SHAPE: string | null - ROOF_SHAPE_ETC: string | null - ROOF_SLOPE: string | null - HOUSE_STRUCTURE: string | null - HOUSE_STRUCTURE_ETC: string | null - RAFTER_MATERIAL: string | null - RAFTER_MATERIAL_ETC: string | null - RAFTER_SIZE: string | null - RAFTER_SIZE_ETC: string | null - RAFTER_PITCH: string | null - RAFTER_PITCH_ETC: string | null - RAFTER_DIRECTION: string | null - OPEN_FIELD_PLATE_KIND: string | null - OPEN_FIELD_PLATE_KIND_ETC: string | null - OPEN_FIELD_PLATE_THICKNESS: string | null - LEAK_TRACE: boolean | null - WATERPROOF_MATERIAL: string | null - WATERPROOF_MATERIAL_ETC: string | null - INSULATION_PRESENCE: string | null - INSULATION_PRESENCE_ETC: string | null - STRUCTURE_ORDER: string | null - STRUCTURE_ORDER_ETC: string | null - INSTALLATION_AVAILABILITY: string | null - INSTALLATION_AVAILABILITY_ETC: string | null - MEMO: string | null + contractCapacity: string | null + retailCompany: string | null + supplementaryFacilities: string | null // number 배열 + supplementaryFacilitiesEtc: string | null + installationSystem: string | null + installationSystemEtc: string | null + constructionYear: string | null + constructionYearEtc: string | null + roofMaterial: string | null // number 배열 + roofMaterialEtc: string | null + roofShape: string | null + roofShapeEtc: string | null + roofSlope: string | null + houseStructure: string | null + houseStructureEtc: string | null + rafterMaterial: string | null + rafterMaterialEtc: string | null + rafterSize: string | null + rafterSizeEtc: string | null + rafterPitch: string | null + rafterPitchEtc: string | null + rafterDirection: string | null + openFieldPlateKind: string | null + openFieldPlateKindEtc: string | null + openFieldPlateThickness: string | null + leakTrace: boolean | null + waterproofMaterial: string | null + waterproofMaterialEtc: string | null + insulationPresence: string | null + insulationPresenceEtc: string | null + structureOrder: string | null + structureOrderEtc: string | null + installationAvailability: string | null + installationAvailabilityEtc: string | null + memo: string | null } export type SurveyDetailCoverRequest = { - DETAIL_INFO: SurveyDetailRequest + detailInfo: SurveyDetailRequest } export type SurveyRegistRequest = { - REPRESENTATIVE: string - STORE: string | null - CONSTRUCTION_POINT: string | null - INVESTIGATION_DATE: string | null - BUILDING_NAME: string | null - CUSTOMER_NAME: string | null - POST_CODE: string | null - ADDRESS: string | null - ADDRESS_DETAIL: string | null - SUBMISSION_STATUS: boolean - SUBMISSION_DATE: string | null - DETAIL_INFO: SurveyDetailRequest | null + representative: string + store: string | null + constructionPoint: string | null + investigationDate: string | null + buildingName: string | null + customerName: string | null + postCode: string | null + address: string | null + addressDetail: string | null + submissionStatus: boolean + submissionDate: string | null + detailInfo: SurveyDetailRequest | null } export type Mode = 'CREATE' | 'EDIT' | 'READ' | 'TEMP' // 등록 | 수정 | 상세 | 임시저장