diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx
index db98cdc5..d57c99c2 100644
--- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx
+++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx
@@ -48,74 +48,61 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
}, [])
useEffect(() => {
- if (basicSetting.roofs.length > 0) {
+ if (addedRoofs.length > 0) {
setBasicSettings({
...basicSetting,
roofsData: {
roofApply: true,
- roofSeq: 1,
- roofMatlCd: basicSetting.roofs[0].roofMatlCd,
- roofWidth: basicSetting.roofs[0].width,
- roofHeight: basicSetting.roofs[0].length,
- roofHajebichi: basicSetting.roofs[0].hajebichi,
- roofGap: basicSetting.roofs[0].raft,
- roofLayout: basicSetting.roofs[0].layout,
+ roofSeq: 0,
+ roofMatlCd: addedRoofs[0].roofMatlCd,
+ roofWidth: addedRoofs[0].width,
+ roofHeight: addedRoofs[0].length,
+ roofHajebichi: addedRoofs[0].hajebichi,
+ roofGap: addedRoofs[0].raft,
+ roofLayout: addedRoofs[0].layout,
},
})
}
- }, [basicSetting.roofs, basicSetting.roofSizeSet, basicSetting.roofAngleSet])
+ }, [basicSetting.roofSizeSet, basicSetting.roofAngleSet, addedRoofs])
const changeInput = (value, e) => {
const { name } = e.target
- console.log('π ~ changeInput ~ value name :', value, name)
- setBasicSettings({
- ...basicSetting,
- roofs: basicSetting.roofs.map((roof) => ({
- ...roof,
- [name]: Number(value),
- })),
- });
+ setAddedRoofs(addedRoofs.map((roof) => ({
+ ...roof,
+ [name]: Number(value),
+ })))
}
// Function to update the roofType and corresponding values
const handleRoofTypeChange = (value) => {
const selectedRoofMaterial = roofMaterials.find((roof) => roof.roofMatlCd === value)
- setBasicSettings({
- ...basicSetting,
- roofs: [selectedRoofMaterial], // μ νλ λ°μ΄ν°λ‘ roofs λ°°μ΄ μ΄κΈ°ν
- });
+ setAddedRoofs([selectedRoofMaterial])
}
const handleRafterChange = (value) => {
- setBasicSettings({
- ...basicSetting,
- roofs: basicSetting.roofs.map((roof) => ({
- ...roof,
- raft: value,
- })),
- });
+ setAddedRoofs(addedRoofs.map((roof) => ({
+ ...roof,
+ raft: value,
+ })))
}
const handleRoofLayoutChange = (value) => {
- setBasicSettings({
- ...basicSetting,
- roofs: basicSetting.roofs.map((roof) => ({
- ...roof,
- layout: value,
- })),
- });
+ setAddedRoofs(addedRoofs.map((roof) => ({
+ ...roof,
+ layout: value,
+ })))
}
const handleSaveBtn = () => {
const roofInfo = {
- ...basicSetting.roofs,
+ ...addedRoofs,
roofCd: roofRef.roofCd.current?.value,
width: roofRef.width.current?.value,
length: roofRef.length.current?.value,
hajebichi: roofRef.hajebichi.current?.value,
//raft: roofRef.rafter.current?.value,
selected: true,
- layout: basicSetting.roofs[0].layout,
+ layout: addedRoofs[0].layout,
index: 0,
}
@@ -139,16 +126,16 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
// μ νλ μ§λΆμ¬ μ 보
...roofInfo,
},
- roofs: addedRoofs,
+ //roofs: addedRoofs,
roofsData: {
roofApply: true,
- roofSeq: 1,
- roofMatlCd: basicSetting.roofs[0].roofMatlCd,
- roofWidth: basicSetting.roofs[0].width,
- roofHeight: basicSetting.roofs[0].length,
- roofHajebichi: basicSetting.roofs[0].hajebichi,
- roofGap: basicSetting.roofs[0].raft,
- roofLayout: basicSetting.roofs[0].layout,
+ roofSeq: 0,
+ roofMatlCd: addedRoofs[0].roofMatlCd,
+ roofWidth: addedRoofs[0].width,
+ roofHeight: addedRoofs[0].length,
+ roofHajebichi: addedRoofs[0].hajebichi,
+ roofGap: addedRoofs[0].raft,
+ roofLayout: addedRoofs[0].layout,
},
})
@@ -261,14 +248,14 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
{
return { ...roof, name: globalLocale === 'ko' ? roof.roofMatlNm : roof.roofMatlNmJp }
})}
//value={roofMaterials.find((r) => r.roofMatlCd === basicSetting.roofs[0]?.roofMatlCd)}
//title={basicSetting.roofs[0]?.roofMatlNm}
- value={basicSetting.roofSizeSet == 3 ? null : basicSetting.roofs[0]?.roofMatlCd}
+ value={basicSetting.roofSizeSet == 3 ? null : addedRoofs[0]?.roofMatlCd}
onChange={(e) => handleRoofTypeChange(e.roofMatlCd)}
//sourceKey="id"
//targetKey="id"
@@ -293,7 +280,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
})}
*/}
- {basicSetting && ['R', 'C'].includes(basicSetting.roofs[0]?.widAuth) && (
+ {basicSetting && ['R', 'C'].includes(addedRoofs[0]?.widAuth) && (
W
@@ -302,9 +289,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
className="input-origin block"
name={`width`}
ref={roofRef.width}
- value={parseInt(basicSetting.roofs[0]?.width)}
+ value={parseInt(addedRoofs[0]?.width)}
onChange={(e) => onlyNumberInputChange(e, changeInput)}
- readOnly={basicSetting.roofs[0]?.widAuth === 'R'}
+ readOnly={addedRoofs[0]?.widAuth === 'R'}
disabled={basicSetting.roofSizeSet == 3}
/>
@@ -318,7 +305,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
*/}
)}
- {basicSetting && ['R', 'C'].includes(basicSetting.roofs[0]?.lenAuth) && (
+ {basicSetting && ['R', 'C'].includes(addedRoofs[0]?.lenAuth) && (
L
@@ -327,9 +314,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
className="input-origin block"
name={`length`}
ref={roofRef.length}
- value={parseInt(basicSetting.roofs[0]?.length)}
+ value={parseInt(addedRoofs[0]?.length)}
onChange={(e) => onlyNumberInputChange(e, changeInput)}
- readOnly={basicSetting.roofs[0]?.lenAuth === 'R'}
+ readOnly={addedRoofs[0]?.lenAuth === 'R'}
disabled={basicSetting.roofSizeSet == 3}
/>
@@ -343,18 +330,18 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
*/}
)}
- {basicSetting && ['C', 'R'].includes(basicSetting.roofs[0]?.raftAuth) && (
+ {basicSetting && ['C', 'R'].includes(addedRoofs[0]?.raftAuth) && (
{getMessage('modal.placement.initial.setting.rafter')}
{raftCodes.length > 0 && (
r.clCode === (basicSetting.roofs[0]?.raft === undefined ? basicSetting.roofs[0]?.raftBaseCd : basicSetting.roofs[0]?.raft))?.clCodeNm}
- value={basicSetting.roofs[0]?.raft === undefined ? basicSetting.roofs[0]?.raftBaseCd : basicSetting.roofs[0]?.raft}
+ title={raftCodes.find((r) => r.clCode === (addedRoofs[0]?.raft === undefined ? addedRoofs[0]?.raftBaseCd : addedRoofs[0]?.raft))?.clCodeNm}
+ value={addedRoofs[0]?.raft === undefined ? addedRoofs[0]?.raftBaseCd : addedRoofs[0]?.raft}
onChange={(e) => handleRafterChange(e.clCode)}
sourceKey="clCode"
- targetKey={basicSetting.roofs[0]?.raft ? 'raft' : 'raftBaseCd'}
+ targetKey={addedRoofs[0]?.raft ? 'raft' : 'raftBaseCd'}
showKey="clCodeNm"
disabled={basicSetting.roofSizeSet == 3}
/>
@@ -371,7 +358,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
)}
)}
- {basicSetting && ['C', 'R'].includes(basicSetting.roofs[0]?.roofPchAuth) && (
+ {basicSetting && ['C', 'R'].includes(addedRoofs[0]?.roofPchAuth) && (
{getMessage('hajebichi')}
@@ -380,9 +367,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
className="input-origin block"
name={`hajebichi`}
ref={roofRef.hajebichi}
- value={parseInt(basicSetting.roofs[0]?.hajebichi)}
+ value={parseInt(addedRoofs[0]?.hajebichi)}
onChange={(e) => onlyNumberInputChange(e, changeInput)}
- readOnly={basicSetting.roofs[0]?.roofPchAuth === 'R'}
+ readOnly={addedRoofs[0]?.roofPchAuth === 'R'}
disabled={basicSetting.roofSizeSet == 3}
/>
@@ -392,7 +379,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set