diff --git a/src/components/floor-plan/CanvasMenu.jsx b/src/components/floor-plan/CanvasMenu.jsx index 435fc762..7ecb1d6a 100644 --- a/src/components/floor-plan/CanvasMenu.jsx +++ b/src/components/floor-plan/CanvasMenu.jsx @@ -16,7 +16,13 @@ import { canvasSettingState, canvasState, canvasZoomState, currentMenuState, ver import { sessionStore } from '@/store/commonAtom' import { outerLinePointsState } from '@/store/outerLineAtom' import { appMessageStore, globalLocaleStore } from '@/store/localeAtom' -import { settingModalFirstOptionsState } from '@/store/settingAtom' +import { + addedRoofsSelector, + basicSettingState, + roofMaterialsSelector, + selectedRoofMaterialSelector, + settingModalFirstOptionsState, +} from '@/store/settingAtom' import KO from '@/locales/ko.json' import JA from '@/locales/ja.json' @@ -75,10 +81,14 @@ export default function CanvasMenu(props) { // const { initEvent, addCanvasMouseEventListener, addDocumentEventListener } = useContext(EventContext) const commonUtils = useRecoilValue(commonUtilsState) const { commonFunctions } = useCommonUtils() - const SelectOption = [{ name: '瓦53A' }, { name: '瓦53A' }] + + const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector) const { floorPlanState, setFloorPlanState } = useContext(FloorPlanContext) const { restoreModuleInstArea } = useModuleBasicSetting() + const addedRoofs = useRecoilValue(addedRoofsSelector) + const [basicSetting, setBasicSetting] = useRecoilState(basicSettingState) + //견적서버튼 노출용 const [buttonStyle, setButtonStyle] = useState('') @@ -112,6 +122,10 @@ export default function CanvasMenu(props) { if (pathname !== '/floor-plan') router.push('/floor-plan') } + const changeSelectedRoofMaterial = (e) => { + setBasicSetting({ ...basicSetting, selectedRoofMaterial: e }) + } + const settingsModalOptions = useRecoilState(settingModalFirstOptionsState) useEffect(() => { @@ -292,9 +306,11 @@ export default function CanvasMenu(props) { -
- -
+ {addedRoofs.length > 0 && ( +
+ { roof.selected)} options={addedRoofs} onChange={changeSelectedRoofMaterial} />} +
+ )}
{['R', 'C'].includes(currentRoofMaterial.widAuth) && ( - <> -
- W -
- +
+
+ W +
+
- +
)} {['R', 'C'].includes(currentRoofMaterial.lenAuth) && (
- L -
- +
+ L +
+ +
)} @@ -201,33 +227,30 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
{getMessage('modal.placement.initial.setting.rafter')}
- + {raftCodes.map((raft, index) => { + return ( + + ) + })}
)} {['C', 'R'].includes(currentRoofMaterial.roofPchAuth) && (
- {getMessage('hajebichi')} -
- +
+ {getMessage('hajebichi')} +
+ +
)} @@ -238,7 +261,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
-
diff --git a/src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx b/src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx index f6f1e6f1..1477a89b 100644 --- a/src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx +++ b/src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx @@ -3,16 +3,27 @@ import WithDraggable from '@/components/common/draggable/WithDraggable' import QSelectBox from '@/components/common/select/QSelectBox' import { useRoofAllocationSetting } from '@/hooks/roofcover/useRoofAllocationSetting' import { usePopup } from '@/hooks/usePopup' -import { useRecoilValue } from 'recoil' +import { useRecoilState, useRecoilValue } from 'recoil' import { contextPopupPositionState } from '@/store/popupAtom' +import { useEffect, useState } from 'react' +import { basicSettingState } from '@/store/settingAtom' +import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting' export default function RoofAllocationSetting(props) { const contextPopupPosition = useRecoilValue(contextPopupPositionState) const { id, pos = contextPopupPosition } = props const { getMessage } = useMessage() const { closePopup } = usePopup() - const { handleSave, onAddRoofMaterial, onDeleteRoofMaterial, values, roofMaterials, selectedRoofMaterial, setSelectedRoofMaterial } = - useRoofAllocationSetting(id) + const { + handleSave, + onAddRoofMaterial, + onDeleteRoofMaterial, + roofMaterials, + setCurrentRoofMaterial, + roofList, + handleDefaultRoofMaterial, + handleChangeRoofMaterial, + } = useRoofAllocationSetting(id) return ( @@ -28,7 +39,13 @@ export default function RoofAllocationSetting(props) {
{getMessage('modal.roof.alloc.select.roof.material')}
- setSelectedRoofMaterial(e)} /> + { + const selected = roofMaterials.find((roofMaterial) => roofMaterial.roofMatlCd === e.id) + setCurrentRoofMaterial(selected) + }} + />
- {values.map((value, index) => ( -
-
- - -
-
-
-
-
- -
- {index === 0 && 基本屋根材} - {index !== 0 && } -
+ {roofList.map((roof, index) => { + return ( +
+
+ +
-
- {value.type === 'A' ? ( - <> +
+
+
+
+ r.id === roof.id)} + onChange={(e) => handleChangeRoofMaterial(e, index)} + /> +
+ {index === 0 && 基本屋根材} + {index !== 0 && } +
+
+
+ {roof.widAuth && (
W
@@ -68,6 +94,8 @@ export default function RoofAllocationSetting(props) {
+ )} + {roof.lenAuth && (
L
@@ -76,6 +104,8 @@ export default function RoofAllocationSetting(props) {
+ )} + {roof.raftAuth && (
{getMessage('modal.placement.initial.setting.rafter')}
@@ -84,9 +114,8 @@ export default function RoofAllocationSetting(props) {
- - ) : value.type === 'B' ? ( - <> + )} + {roof.roofPchAuth && (
{getMessage('hajebichi')}
@@ -95,63 +124,23 @@ export default function RoofAllocationSetting(props) {
-
- {getMessage('modal.placement.initial.setting.rafter')} -
- -
-
- - ) : value.type === 'C' ? ( - <> -
- {getMessage('hajebichi')} -
- -
-
- - ) : value.type === 'D' ? ( - <> -
- L -
- -
-
-
- {getMessage('modal.placement.initial.setting.rafter')} -
- -
-
- - ) : ( - '' - )} -
-
-
- - + )} +
+
+
+ + +
-
- ))} + ) + })}