diff --git a/src/app/survey-sale/[id]/page.tsx b/src/app/survey-sale/[id]/page.tsx index 52202ca..bc48257 100644 --- a/src/app/survey-sale/[id]/page.tsx +++ b/src/app/survey-sale/[id]/page.tsx @@ -1,11 +1,29 @@ 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/layout.tsx b/src/app/survey-sale/layout.tsx index f558ad6..83f37c0 100644 --- a/src/app/survey-sale/layout.tsx +++ b/src/app/survey-sale/layout.tsx @@ -9,10 +9,7 @@ export default function layout({ children, navTab }: SurveySaleLayoutProps) { return ( <>
-
- {navTab} - {children} -
+
{children}
) diff --git a/src/components/survey-sale/detail/BasicForm.tsx b/src/components/survey-sale/detail/BasicForm.tsx index f293495..5b7fb31 100644 --- a/src/components/survey-sale/detail/BasicForm.tsx +++ b/src/components/survey-sale/detail/BasicForm.tsx @@ -1,10 +1,18 @@ 'use client' -import { useEffect } from 'react' +import { useEffect, useState } from 'react' import { useSurveySaleTabState } from '@/store/surveySaleTabState' +import { SurveyBasicInfo } from '@/types/Survey' +import { Mode } from 'fs' -export default function BasicForm() { +export default function BasicForm(props: { + surveyInfo: Partial + setSurveyInfo: (surveyInfo: Partial) => void + mode: Mode +}) { + const { surveyInfo, setSurveyInfo, mode } = props const { setBasicInfoSelected } = useSurveySaleTabState() + const [isFlip, setIsFlip] = useState(true) useEffect(() => { setBasicInfoSelected() @@ -12,84 +20,101 @@ export default function BasicForm() { return ( <> -
-
-
-
担当者名
- -
-
-
販売店
- -
-
-
施工店
- +
+
setIsFlip(!isFlip)}> +
基本情報
+
+
-
+
+
+
+
+
担当者名
+ setSurveyInfo({ ...surveyInfo, REPRESENTATIVE: e.target.value })} + /> +
+
+
販売店
+ setSurveyInfo({ ...surveyInfo, BUILDING_NAME: e.target.value })} + /> +
+
+
施工店
+ setSurveyInfo({ ...surveyInfo, CONSTRUCTION_POINT: e.target.value })} + /> +
+
+
+
+
+
+
現地調査日
+ {['CREATE', 'EDIT'].includes(mode as 'CREATE' | 'EDIT') ? ( +
+ + +
+ ) : ( + + )} +
+
+ {/* 건물명 */} +
建物名
+ +
+
+ {/* 고객명 */} +
建物名
+ +
+
+
郵便番号/都道府県
+
+ {/* 우편번호 */} +
+ +
+ {/* 도도부현 */} +
+ +
+
+ {/* 주소 */} +
+ +
+
+ +
+
-
-
-
-
現地調査日
-
- - -
-
-
-
建物名
- -
-
-
建物名
- -
-
-
建物名
-
-
- -
-
- +
+
市区町村名, 以後の住所
+
-
- -
-
-
-
市区町村名, 以後の住所
- -
-
-
-
- -
-
- -
-
-
diff --git a/src/components/survey-sale/detail/ButtonForm.tsx b/src/components/survey-sale/detail/ButtonForm.tsx new file mode 100644 index 0000000..84b4b4c --- /dev/null +++ b/src/components/survey-sale/detail/ButtonForm.tsx @@ -0,0 +1,81 @@ +import { Mode } from '@/types/Survey' + +export default function ButtonForm(props: { mode: Mode; setMode: (mode: Mode) => void }) { + const { mode, setMode } = props + return ( + <> + {mode === 'CREATE' && ( +
+
+
+ {/* 임시저장 */} + +
+
+ {/* 저장 */} + +
+
+ {/* 목록 */} + +
+
+
+ )} + {mode === 'TEMP' && ( +
+
+
+ {/* 수정 */} + +
+
+ {/* 삭제 */} + +
+
+
+ )} + {mode === 'EDIT' && ( +
+
+
+ {/* 목록 */} + +
+
+ {/* 제출 */} + +
+
+ {/* 수정 */} + +
+
+ {/* 삭제 */} + +
+
+
+ )} + + ) +} diff --git a/src/components/survey-sale/detail/DataTable.tsx b/src/components/survey-sale/detail/DataTable.tsx index 414164c..b47c092 100644 --- a/src/components/survey-sale/detail/DataTable.tsx +++ b/src/components/survey-sale/detail/DataTable.tsx @@ -3,7 +3,7 @@ export default function DataTable() { return ( <> -
+
diff --git a/src/components/survey-sale/detail/DetailForm.tsx b/src/components/survey-sale/detail/DetailForm.tsx index 9462e95..6e5fc24 100644 --- a/src/components/survey-sale/detail/DetailForm.tsx +++ b/src/components/survey-sale/detail/DetailForm.tsx @@ -1,62 +1,53 @@ 'use client' -export default function DetailForm() { +import { Mode, SurveyBasicInfo } from '@/types/Survey' +import { useEffect, useState } from 'react' +import ButtonForm from './ButtonForm' +import BasicForm from './BasicForm' +import RoofForm from './RoofForm' + +export default function DetailForm(props: { surveyInfo?: SurveyBasicInfo; mode?: Mode }) { + const [surveyInfo, setSurveyInfo] = useState>( + props.surveyInfo ?? { + REPRESENTATIVE: '', + CONSTRUCTION_POINT: '', + STORE: '', + INVESTIGATION_DATE: '', + BUILDING_NAME: '', + CUSTOMER_NAME: '', + POST_CODE: '', + ADDRESS: '', + ADDRESS_DETAIL: '', + SUBMISSION_STATUS: true, + SUBMISSION_DATE: '2021-01-01', + DETAIL_INFO: null, + REG_DT: new Date(), + UPT_DT: new Date(), + }, + ) + const [roofValue, setRoofValue] = useState(false) + const [mode, setMode] = useState(props.mode ?? 'CREATE') + const basicInfoProps = { surveyInfo, setSurveyInfo, mode } + const roofInfoProps = { surveyInfo, mode } + const buttonFormProps = { mode, setMode } + + useEffect(() => { + // setMode(props.surveyInfo ? 'EDIT' : 'CREATE') + }, [props.surveyInfo]) + + useEffect(() => { + console.log(surveyInfo) + }, [surveyInfo]) + return ( <> -
-
-
-
担当者名
- -
-
-
販売店
- -
-
-
施工店
- -
-
-
- -
-
-
-
現地調査日
- -
-
-
建物名
- -
-
-
顧客名
- -
-
-
-
- -
-
- -
-
- -
-
- -
-
+
+ {mode} + {/* 기본정보 */} + + {/* 전기/지붕정보 */} + +
) diff --git a/src/components/survey-sale/detail/RoofForm.tsx b/src/components/survey-sale/detail/RoofForm.tsx new file mode 100644 index 0000000..878fbf2 --- /dev/null +++ b/src/components/survey-sale/detail/RoofForm.tsx @@ -0,0 +1,396 @@ +import { useState } from 'react' +import { Mode, SurveyBasicInfo } from '@/types/Survey' + +export default function RoofForm(props: { surveyInfo: Partial; mode: Mode }) { + const { surveyInfo, mode } = props + const [isFlip, setIsFlip] = useState(true) + return ( +
+
setIsFlip(!isFlip)}> +
電気 / 屋根情報
+
+ +
+
+
+
+ {/* 전기 관계 */} +
電気関係
+
+
+ {/* 전기 계약 용량 */} +
電気契約容量
+
+ +
+ {mode === 'READ' && } + {mode !== 'READ' && ( +
+ +
+ )} +
+
+ {/* 전기 소매 회사사 */} +
電気小売会社
+ +
+
+ {/* 전기 부대 설비 */} +
+ 電気袋設備※複数選択可能 +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+ {/* 설치 희망 시스템 */} +
設置希望システム
+ {mode === 'READ' && ( +
+ +
+ )} + {mode !== 'READ' && ( +
+ +
+ )} +
+
+
+
+ {/* 지붕 관계 */} +
屋根関係
+
+
+ {/* 건축 연수 */} +
建築研修
+
+ {mode === 'READ' && } + {mode !== 'READ' && ( + + )} +
+
+ + +
+
+
+ {/* 지붕재 */} +
+ 屋根材※最大2個まで選択可能 +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+ {/* 지붕 모양 */} +
建築研修
+
+ {mode === 'READ' && } + {mode !== 'READ' && ( + + )} +
+
+ +
+
+
+ {/* 지붕 경사도도 */} +
屋根の斜面
+
+ + +
+
+
+ {/* 주택구조조 */} +
住宅構造
+
+ + +
+
+ + +
+
+ +
+
+
+ {/* 서까래 재질 */} +
垂木材質
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+ {/* 서까래 크기 */} +
垂木サイズ
+
+ {mode === 'READ' && } + {mode !== 'READ' && ( + + )} +
+
+ +
+
+
+ {/* 서까래 피치 */} +
垂木サイズ
+
+ {mode === 'READ' && } + {mode !== 'READ' && ( + + )} +
+
+ +
+
+
+ {/* 서까래 방향 */} +
垂木の方向
+
+
+ + +
+
+ + +
+
+
+
+ {/* 노지판 종류류 */} +
路地板の種類
+
+ {mode === 'READ' && } + {mode !== 'READ' && ( + + )} +
+
+ +
+
+
+
+ 路地板厚※小幅板を選択した場合, 厚さ. 小幅板間の間隔寸法を記載 +
+
+ + mm +
+
+
+ {/* 서까래 방향 */} +
垂木の方向
+
+
+ + +
+
+ + +
+
+
+
+ {/* 주택 구조 */} +
住宅構造
+
+ + +
+
+ + +
+
+ +
+
+
+ {/* 단열재 유무 */} +
断熱材の有無
+
+ + +
+
+ +
+
+ + +
+
+
+ {/* 지붕 구조의 순서 */} +
路地板の種類
+
+ {mode === 'READ' && } + {mode !== 'READ' && ( + + )} +
+
+ +
+
+
+ {/* 지붕 제품명 설치 가능 여부 확인 */} +
屋根製品名 設置可否確認
+
+ {mode === 'READ' && } + {mode !== 'READ' && ( + + )} +
+
+ +
+
+
+ {/* 메모 */} +
メモ
+
+ +
+
+
+
+
+
+ ) +} diff --git a/src/types/Survey.ts b/src/types/Survey.ts index 1401c47..83d2ec1 100644 --- a/src/types/Survey.ts +++ b/src/types/Survey.ts @@ -1,5 +1,3 @@ -import { SEARCH_OPTIONS_ENUM, SEARCH_OPTIONS_PARTNERS_ENUM, SORT_OPTIONS_ENUM } from '@/store/surveyFilterStore' - export type SurveyBasicInfo = { ID: number REPRESENTATIVE: string @@ -130,3 +128,5 @@ export type SurveyRegistRequest = { SUBMISSION_DATE: string | null DETAIL_INFO: SurveyDetailRequest | null } + +export type Mode = 'CREATE' | 'EDIT' | 'READ' | 'TEMP' // 등록 | 수정 | 상세 | 임시저장