Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/translation

This commit is contained in:
Daseul Kim 2025-08-06 14:01:01 +09:00
commit ee44eaff2b
2 changed files with 39 additions and 44 deletions

View File

@ -137,7 +137,7 @@ export default function SurveySalePdf({ survey }: { survey: SurveyBasicInfo }) {
<Text style={styles.title}>HWJ 調</Text>
<View style={styles.headerRight}>
<View style={styles.headerLeft}>
<Text style={styles.headerLabel}>調</Text>
<Text style={styles.headerLabel}>調</Text>
<Text style={styles.headerValue}>{survey?.store ?? '-'}</Text>
</View>
{survey?.constructionPoint && (
@ -147,7 +147,7 @@ export default function SurveySalePdf({ survey }: { survey: SurveyBasicInfo }) {
</View>
)}
<View>
<Text style={styles.headerLabel}></Text>
<Text style={styles.headerLabel}>調</Text>
<Text style={styles.headerValue}>{survey?.investigationDate ?? '-'}</Text>
</View>
</View>
@ -171,16 +171,16 @@ export default function SurveySalePdf({ survey }: { survey: SurveyBasicInfo }) {
{/* Electric Info */}
<View style={styles.section}>
<Text style={styles.sectionTitle}></Text>
<Text style={styles.sectionTitle}></Text>
<View style={styles.table}>
<View style={styles.tableRow}>
<Text style={[styles.tableHeader, styles.tableHeaderMedium]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex1, styles.marginL]}>{survey?.detailInfo?.contractCapacity ?? '-'}</Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginL]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex1, styles.marginL]}>{survey?.detailInfo?.retailCompany ?? '-'}</Text>
</View>
<View style={styles.tableRow}>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginT]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginT]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex1, styles.marginL, styles.marginT]}>
{survey?.detailInfo?.supplementaryFacilities
? supplementaryFacilities
@ -207,7 +207,7 @@ export default function SurveySalePdf({ survey }: { survey: SurveyBasicInfo }) {
{/* Roof Info */}
<View style={styles.section}>
<Text style={styles.sectionTitle}></Text>
<Text style={styles.sectionTitle}></Text>
<View style={styles.table}>
<View style={styles.tableRow}>
<Text style={[styles.tableHeader, styles.tableHeaderMedium]}></Text>
@ -218,7 +218,7 @@ export default function SurveySalePdf({ survey }: { survey: SurveyBasicInfo }) {
? `既築 (${survey?.detailInfo?.constructionYear}年)`
: '-'}
</Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginL]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginL]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex07, styles.marginL, styles.marginL]}>
{survey?.detailInfo?.roofMaterial === null && survey?.detailInfo?.roofMaterialEtc === null
? '-'
@ -228,25 +228,25 @@ export default function SurveySalePdf({ survey }: { survey: SurveyBasicInfo }) {
.join(', ')}
{survey?.detailInfo?.roofMaterialEtc ? `, ${survey?.detailInfo?.roofMaterialEtc}` : ''}
</Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginL]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginL]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex07, styles.marginL]}>
{selectBoxOptions.roofShape.find((shape) => shape.id.toString() === survey?.detailInfo?.roofShape)?.name ??
(survey?.detailInfo?.roofShapeEtc ? ` ${survey?.detailInfo?.roofShapeEtc}` : '-')}
</Text>
</View>
<View style={styles.tableRow}>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginT]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginT]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex1, styles.marginL, styles.marginT, styles.marginL]}>
{survey?.detailInfo?.roofSlope ? `${survey?.detailInfo?.roofSlope}` : '-'}
</Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginL, styles.marginT]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginL, styles.marginT]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex2, styles.marginL, styles.marginL, styles.marginT]}>
{radioEtcData.houseStructure.find((structure) => structure.id.toString() === survey?.detailInfo?.houseStructure)?.label ??
(survey?.detailInfo?.houseStructureEtc ? ` ${survey?.detailInfo?.houseStructureEtc}` : '-')}
</Text>
</View>
<View style={styles.tableRow}>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginT]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginT]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex1, styles.marginL, styles.marginT]}>
{radioEtcData.rafterMaterial.find((material) => material.id.toString() === survey?.detailInfo?.rafterMaterial)?.label ??
(survey?.detailInfo?.rafterMaterialEtc ? ` ${survey?.detailInfo?.rafterMaterialEtc}` : '-')}
@ -280,7 +280,7 @@ export default function SurveySalePdf({ survey }: { survey: SurveyBasicInfo }) {
</Text>
</View>
<View style={styles.tableRow}>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginT]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderMedium, styles.marginT]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex1, styles.marginL, styles.marginT]}>
{survey?.detailInfo?.leakTrace ? 'あり' : 'なし'}
</Text>
@ -313,7 +313,7 @@ export default function SurveySalePdf({ survey }: { survey: SurveyBasicInfo }) {
<View style={styles.sectionNoPadding}>
<View style={styles.table}>
<View style={styles.tableRow}>
<Text style={[styles.tableHeader, styles.tableHeaderLarge]}></Text>
<Text style={[styles.tableHeader, styles.tableHeaderLarge]}></Text>
<Text style={[styles.tableCell, styles.tableCellFlex1, styles.marginL]}>
{survey?.detailInfo?.installationAvailability === null && survey.detailInfo?.installationAvailabilityEtc === null
? '-'

View File

@ -309,7 +309,6 @@ const SelectedBox = ({
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
const value = e.target.value
const isEtc = value === 'etc'
const isSpecialEtc = isSpecialCase && value === 'O'
const updatedData = {
...detailInfoData,
@ -317,11 +316,7 @@ const SelectedBox = ({
[`${column}Etc`]: isEtc ? '' : null,
}
if (isSpecialEtc) {
updatedData[column] = value
}
setIsEtcSelected(isEtc || isSpecialEtc)
setIsEtcSelected(isEtc)
setRoofInfo(updatedData)
}
@ -333,13 +328,13 @@ const SelectedBox = ({
/** Input box
* - 모드 : 비활성화
* - 여부 : 기타
* - 연수 : 신축(1)
* - 연수 : 新築 (N)
* */
const isInputDisabled = () => {
if (mode === 'READ') return true
if (column === 'installationAvailability') return false
if (column === 'constructionYear') {
return detailInfoData.constructionYear === 'N' || detailInfoData.constructionYear === null
return detailInfoData.constructionYear === selectBoxOptions.constructionYear[0].code || detailInfoData.constructionYear === null
}
return !isEtcSelected && !etcValue
}
@ -402,7 +397,9 @@ const RadioSelected = ({
const selectedId =
/** 누수 흔적 boolean 타입이므로 number 타입으로 변환 - 값이 없을 경우 2(없음) 으로 초기화*/
column === 'leakTrace' ? Number(detailInfoData?.[column as keyof SurveyDetailInfo]) || 2 : detailInfoData?.[column as keyof SurveyDetailInfo]
column === 'leakTrace'
? Number(detailInfoData?.[column as keyof SurveyDetailInfo]) || radioEtcData.leakTrace[1].id
: detailInfoData?.[column as keyof SurveyDetailInfo]
const isSpecialColumn = column === 'rafterDirection' || column === 'leakTrace' || column === 'insulationPresence'
const showEtcOption = !isSpecialColumn
@ -413,7 +410,7 @@ const RadioSelected = ({
/** 누수 흔적 처리 - boolean 타입이므로 별도 처리 */
if (column === 'leakTrace') {
setRoofInfo({ ...detailInfoData, leakTrace: value === '1' })
setRoofInfo({ ...detailInfoData, leakTrace: value === String(radioEtcData.leakTrace[0].id) })
return
}
@ -430,7 +427,7 @@ const RadioSelected = ({
const isInsulationPresence = column === 'insulationPresence'
const isRafterDirection = column === 'rafterDirection'
setEtcChecked(isInsulationPresence && value === '2')
setEtcChecked(isInsulationPresence && value === String(radioEtcData.insulationPresence[1].id))
setRoofInfo({
...detailInfoData,
@ -451,7 +448,7 @@ const RadioSelected = ({
const isInputDisabled = () => {
if (mode === 'READ') return true
if (column === 'insulationPresence') {
return detailInfoData.insulationPresence !== '2'
return detailInfoData.insulationPresence === String(radioEtcData.insulationPresence[0].id)
}
return !etcChecked && !etcValue
}
@ -518,8 +515,11 @@ const MultiCheck = ({
const { showErrorAlert } = useAlertMsg()
const { roofMaterial, initialized, loading, loadOptions } = useSurveyOptionStore()
const multiCheckData = column === 'supplementaryFacilities' ? supplementaryFacilities : roofMaterial
const etcValue = roofInfo?.[`${column}Etc` as keyof SurveyDetailInfo]
const [isOtherCheck, setIsOtherCheck] = useState<boolean>(Boolean(etcValue))
const [etcValue, setEtcValue] = useState<string | null>(roofInfo?.[`${column}Etc` as keyof SurveyDetailInfo]?.toString() ?? null)
useEffect(() => {
const newValue = roofInfo?.[`${column}Etc` as keyof SurveyDetailInfo]?.toString() ?? null
setEtcValue(newValue)
}, [roofInfo, column])
useEffect(() => {
if (!initialized && !loading) loadOptions()
@ -530,7 +530,7 @@ const MultiCheck = ({
/** 다중 선택 처리 */
const handleCheckbox = (item: { id: number; code: string | null; name: string }) => {
const isOtherSelected = Boolean(etcValue)
const isOtherSelected = etcValue !== null
let newValue: string[]
if (selectedValues.includes(item.code ?? String(item.id))) {
@ -538,7 +538,7 @@ const MultiCheck = ({
} else {
/** 지붕 재료 처리 - 최대 2개 선택 처리 */
if (isRoofMaterial) {
const totalSelected = selectedValues.length + (isOtherSelected || isOtherCheck ? 1 : 0)
const totalSelected = selectedValues.length + (isOtherSelected ? 1 : 0)
if (totalSelected >= 2) {
showErrorAlert(WARNING_MESSAGE.ROOF_MATERIAL_MAX_SELECT)
return
@ -551,21 +551,22 @@ const MultiCheck = ({
/** 기타 선택 처리 */
const handleOtherCheckbox = () => {
setEtcValue(etcValue !== null ? null : '')
const isOtherSelected = etcValue !== null
if (isRoofMaterial) {
const currentSelected = selectedValues.length
if (!isOtherCheck && currentSelected >= 2) {
/** 지붕 재료 기타 선택 포함 최대 2개 선택 처리 */
if (!isOtherSelected && selectedValues.length >= 2) {
showErrorAlert(WARNING_MESSAGE.ROOF_MATERIAL_MAX_SELECT)
setEtcValue(null)
return
}
}
const newIsOtherCheck = !isOtherCheck
setIsOtherCheck(newIsOtherCheck)
/** 기타 선택 해제 시 값도 null로 설정 */
setRoofInfo({
...roofInfo,
[`${column}Etc`]: newIsOtherCheck ? '' : null,
[`${column}Etc`]: isOtherSelected ? null : '',
})
}
@ -576,7 +577,7 @@ const MultiCheck = ({
/** Input box 비활성화 처리 */
const isInputDisabled = () => {
return mode === 'READ' || (!isOtherCheck && !etcValue)
return mode === 'READ' || etcValue === null
}
return (
@ -595,13 +596,7 @@ const MultiCheck = ({
</div>
))}
<div className="check-form-box">
<input
type="checkbox"
id={`${column}Etc`}
checked={isOtherCheck || Boolean(etcValue)}
disabled={mode === 'READ'}
onChange={handleOtherCheckbox}
/>
<input type="checkbox" id={`${column}Etc`} checked={etcValue !== null} disabled={mode === 'READ'} onChange={handleOtherCheckbox} />
<label htmlFor={`${column}Etc`}> ()</label>
</div>
</div>