import { useState, useEffect } from 'react' import { useMessage } from '@/hooks/useMessage' import QSelectBox from '@/components/common/select/QSelectBox' import { useModuleTabContents } from '@/hooks/module/useModuleTabContents' import { useRecoilValue } from 'recoil' import { ANGLE_TYPE, currentAngleTypeSelector } from '@/store/canvasAtom' export default function ModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab, tempModuleSelectionData, setTempModuleSelectionData }) { const { getMessage } = useMessage() const [roofMaterial, setRoofMaterial] = useState(addRoof) //지붕재` const currentAngleType = useRecoilValue(currentAngleTypeSelector) const { raftCodes, trestleList, constMthdList, roofBaseList, constructionList, globalPitchText, selectedRaftBase, selectedTrestle, selectedConstMthd, selectedRoofBase, constructionRef, cvrYn, cvrChecked, snowGdPossYn, snowGdChecked, lengthBase, hajebichi, lengthRef, hajebichiRef, handleHajebichiAndLength, handleChangeRaftBase, handleChangeTrestle, handleChangeConstMthd, handleChangeRoofBase, handleConstruction, handleCvrChecked, handleSnowGdChecked, } = useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab, tempModuleSelectionData, setTempModuleSelectionData }) return ( <>
{getMessage('modal.module.basic.setting.module.roof.material')}:{roofMaterial.nameJp}( {currentAngleType === ANGLE_TYPE.SLOPE ? roofMaterial.pitch : roofMaterial.angle} {globalPitchText})
{roofMaterial && ['C'].includes(roofMaterial.lenAuth) && ( <>
L
handleHajebichiAndLength(e, 'length')} disabled={roofMaterial.lenAuth === 'R' ? true : false} ref={lengthRef} />
)}
{roofMaterial && ['C', 'R'].includes(roofMaterial.raftAuth) && ( <>
{getMessage('modal.module.basic.setting.module.rafter.margin')}
{raftCodes.length > 0 && ( )}
)}
{roofMaterial && ['C', 'R'].includes(roofMaterial.roofPchAuth) && ( <>
{getMessage('modal.module.basic.setting.module.hajebichi')}
handleHajebichiAndLength(e, 'hajebichi')} value={hajebichi} ref={hajebichiRef} />
)}
{getMessage('modal.module.basic.setting.module.trestle.maker')}
{trestleList && ( )}
{getMessage('modal.module.basic.setting.module.construction.method')}
{constMthdList && ( )}
{getMessage('modal.module.basic.setting.module.under.roof')}
{roofBaseList && ( )}
{/* 2026-06-05 공법 버튼을 배열 인덱스 대신 constTp로 매핑 — API 응답 항목 추가/순서변경(예: 標準施工(Ⅱ) WORK_LV_ID_-2) 시 인덱스 밀림 방지. 운영(구 API)엔 -2가 없어 optional 은 데이터 있을 때만 렌더 */} {[ // [표시순서변경 2026-06-17] 標準(Ⅱ) 를 標準(Ⅰ) 앞으로 — 사용자 요청 { constTp: 'WORK_LV_ID_-2', label: '標準施工(Ⅱ)', optional: true }, { constTp: 'WORK_LV_ID_-1', label: '標準施工(Ⅰ)' }, { constTp: 'WORK_LV_ID_1', label: '標準施工' }, { constTp: 'WORK_LV_ID_3', label: '強化施工' }, { constTp: 'WORK_LV_ID_4', label: '多設施工' }, { constTp: 'WORK_LV_ID_5', label: '多設施工(II)' }, ].map(({ constTp, label, optional }) => { const index = constructionList.findIndex((c) => c.constTp === constTp) const item = index > -1 ? constructionList[index] : null if (optional && !item) return null const enabled = item && item.constPossYn === 'Y' return ( ) })}
) }