-
-
-
-
{children}
+
+
+
+ {headerPathname === '/login' || headerPathname === '/join' ? (
+ {children}
+ ) : (
+
+
-
-
-
- )}
-
-
-
-
+
+ )}
+
+
+
+
+
)
}
diff --git a/src/app/management/ManagementProvider.js b/src/app/management/ManagementProvider.js
index 197b30c0..fb57e948 100644
--- a/src/app/management/ManagementProvider.js
+++ b/src/app/management/ManagementProvider.js
@@ -1,20 +1,18 @@
'ues client'
-import { createContext, useEffect, useState } from 'react'
+import { createContext } from 'react'
-export const ManagementContext = createContext({
- managementState: {},
- setManagementState: () => {},
-})
+export const ManagementContext = createContext({})
const ManagementProvider = ({ children }) => {
- const [managementState, setManagementState] = useState({})
+ // const [managementState, setManagementState] = useState({})
- useEffect(() => {
- console.log('🚀 ~ managementState:', managementState)
- }, [managementState])
+ // useEffect(() => {
+ // console.log('🚀 ~ managementState:', managementState)
+ // }, [managementState])
- return
{children}
+ // return
{children}
+ return
{children}
}
export default ManagementProvider
diff --git a/src/common/common.js b/src/common/common.js
index e2e31889..a28542e9 100644
--- a/src/common/common.js
+++ b/src/common/common.js
@@ -112,6 +112,7 @@ export const POLYGON_TYPE = {
WALL: 'wall',
TRESTLE: 'trestle',
MODULE_SETUP_SURFACE: 'moduleSetupSurface',
+ MODULE: 'module',
}
export const SAVE_KEY = [
diff --git a/src/components/Main.jsx b/src/components/Main.jsx
index 1a436582..5f6c1052 100644
--- a/src/components/Main.jsx
+++ b/src/components/Main.jsx
@@ -41,12 +41,12 @@ export default function MainPage(mainPageProps) {
if (searchRadioType === 'object') {
setStuffSearch({
...stuffSearch,
- schObjectNo: searchTxt,
+ schObjectNo: searchTxt.trim(),
code: 'M',
})
router.push('/management/stuff', { scroll: false })
} else {
- setSearchForm({ ...searchForm, searchValue: searchTxt, mainFlag: 'Y' })
+ setSearchForm({ ...searchForm, searchValue: searchTxt.trim(), mainFlag: 'Y' })
router.push('/community/faq')
}
}
diff --git a/src/components/Playground.jsx b/src/components/Playground.jsx
index e3d185ec..1d5820ff 100644
--- a/src/components/Playground.jsx
+++ b/src/components/Playground.jsx
@@ -1,27 +1,28 @@
'use client'
-import { useRef, useState, useEffect } from 'react'
+import { useRef, useState, useEffect, useContext } from 'react'
+import Image from 'next/image'
import { useRecoilState } from 'recoil'
import { v4 as uuidv4 } from 'uuid'
import { FaAnglesUp } from 'react-icons/fa6'
import { FaAnglesDown } from 'react-icons/fa6'
+import { Button } from '@nextui-org/react'
+import ColorPicker from './common/color-picker/ColorPicker'
+import { cadFileNameState, googleMapFileNameState, useCadFileState, useGoogleMapFileState } from '@/store/canvasAtom'
import { useAxios } from '@/hooks/useAxios'
import { useMessage } from '@/hooks/useMessage'
import { useMasterController } from '@/hooks/common/useMasterController'
-import { convertDwgToPng } from '@/lib/cadAction'
-import { cadFileNameState, googleMapFileNameState, useCadFileState, useGoogleMapFileState } from '@/store/canvasAtom'
-
-import { Button } from '@nextui-org/react'
-import ColorPicker from './common/color-picker/ColorPicker'
import { useSwal } from '@/hooks/useSwal'
-
-import styles from './playground.module.css'
-import Image from 'next/image'
-
+import { convertDwgToPng } from '@/lib/cadAction'
+import { GlobalDataContext } from '@/app/GlobalDataProvider'
import QInput from './common/input/Qinput'
import QSelect from './common/select/QSelect'
import QPagination from './common/pagination/QPagination'
+import QSelectBox from './common/select/QSelectBox'
+import SampleReducer from './sample/SampleReducer'
+
+import styles from './playground.module.css'
export default function Playground() {
const [useCadFile, setUseCadFile] = useRecoilState(useCadFileState)
@@ -36,7 +37,7 @@ export default function Playground() {
const converterUrl = process.env.NEXT_PUBLIC_CONVERTER_API_URL
const { getMessage } = useMessage()
const { swalFire } = useSwal()
- const { getRoofMaterialList, getModuleTypeItemList } = useMasterController()
+ const { getRoofMaterialList, getModuleTypeItemList, getTrestleList, getConstructionList, getTrestleDetailList } = useMasterController()
const [color, setColor] = useState('#ff0000')
@@ -48,6 +49,8 @@ export default function Playground() {
const [users, setUsers] = useState([])
+ const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
+
useEffect(() => {
console.log('textInput:', textInput)
}, [textInput])
@@ -154,6 +157,75 @@ export default function Playground() {
console.log('users:', users)
}, [users])
+ const codes = [
+ {
+ clHeadCd: '203800',
+ clCode: 'HEI_455',
+ clCodeNm: '세로 455mm이하',
+ clPriority: 1,
+ name: '세로 455mm이하',
+ id: 'HEI_455',
+ },
+ {
+ clHeadCd: '203800',
+ clCode: 'HEI_500',
+ clCodeNm: '세로 500mm이하',
+ clPriority: 2,
+ name: '세로 500mm이하',
+ id: 'HEI_500',
+ },
+ {
+ clHeadCd: '203800',
+ clCode: 'HEI_606',
+ clCodeNm: '세로 606mm이하',
+ clPriority: 3,
+ name: '세로 606mm이하',
+ id: 'HEI_606',
+ },
+ {
+ clHeadCd: '203800',
+ clCode: 'WID_606',
+ clCodeNm: '가로 606mm이하',
+ clPriority: 4,
+ name: '가로 606mm이하',
+ id: 'WID_606',
+ },
+ {
+ clHeadCd: '203800',
+ clCode: 'ETC',
+ clCodeNm: '기타',
+ clPriority: 5,
+ name: '기타',
+ id: 'ETC',
+ },
+ ]
+
+ const [myData, setMyData] = useState({
+ roofMatlCd: 'ROOF_ID_WA_53A',
+ roofMatlNm: '화와 A',
+ roofMatlNmJp: '和瓦A',
+ widAuth: 'R',
+ widBase: '265.000',
+ lenAuth: 'R',
+ lenBase: '235.000',
+ roofPchAuth: null,
+ roofPchBase: null,
+ raftAuth: 'C',
+ raftBaseCd: 'HEI_455',
+ id: 'ROOF_ID_WA_53A',
+ name: '화와 A',
+ selected: true,
+ nameJp: '和瓦A',
+ length: 235,
+ width: 265,
+ layout: 'P',
+ hajebichi: null,
+ })
+
+ const handleChangeMyData = () => {
+ setMyData({ ...myData, raftBaseCd: 'HEI_500' })
+ }
+
return (
<>
@@ -166,16 +238,70 @@ export default function Playground() {
}}
>
지붕재 목록 조회 API 호출
-
+ {' '}
{' '}
+ {' '}
+ {' '}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{managementStateLoaded?.objectNo}
+
+
+
+
>
)
diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx
index af50a515..55711929 100644
--- a/src/components/auth/Login.jsx
+++ b/src/components/auth/Login.jsx
@@ -5,7 +5,7 @@ import Image from 'next/image'
import Link from 'next/link'
import { useRecoilState } from 'recoil'
import { useAxios } from '@/hooks/useAxios'
-import { setSession } from '@/lib/authActions'
+import { setSession, login } from '@/lib/authActions'
import { useMessage } from '@/hooks/useMessage'
import { globalLocaleStore } from '@/store/localeAtom'
import { sessionStore } from '@/store/commonAtom'
@@ -36,7 +36,7 @@ export default function Login() {
const result = { ...response, storeLvl: response.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' }
setSession(result)
setSessionState(result)
- router.push('/')
+ login()
} else {
router.push('/login')
}
@@ -97,7 +97,8 @@ export default function Login() {
} else {
Cookies.remove('chkLoginId')
}
- router.push('/')
+ // router.push('/')
+ login()
} else {
alert(res.data.result.resultMsg)
}
diff --git a/src/components/common/color-picker/ColorPickerModal.jsx b/src/components/common/color-picker/ColorPickerModal.jsx
index 62abd2e2..66c0e0b7 100644
--- a/src/components/common/color-picker/ColorPickerModal.jsx
+++ b/src/components/common/color-picker/ColorPickerModal.jsx
@@ -66,7 +66,7 @@ export default function ColorPickerModal(props) {
//치수선색설정 아닐 때만 바로 저장 실행
if (name !== 'DimensionLineColor')
- setSettingsData({
+ setSettingsDataSave({
...settingsData,
color: originColor,
})
diff --git a/src/components/common/popupManager/PopupManager.jsx b/src/components/common/popupManager/PopupManager.jsx
index e84ee610..147e0988 100644
--- a/src/components/common/popupManager/PopupManager.jsx
+++ b/src/components/common/popupManager/PopupManager.jsx
@@ -1,8 +1,11 @@
'use client'
+import { Fragment } from 'react'
import { useRecoilValue } from 'recoil'
import { popupState } from '@/store/popupAtom'
-import { Fragment } from 'react'
+/**
+ * 팝업 관리자
+ */
export default function PopupManager() {
const popup = useRecoilValue(popupState)
diff --git a/src/components/common/select/QSelectBox.jsx b/src/components/common/select/QSelectBox.jsx
index 3da9f30b..9f86474d 100644
--- a/src/components/common/select/QSelectBox.jsx
+++ b/src/components/common/select/QSelectBox.jsx
@@ -1,26 +1,81 @@
'use client'
-import { useEffect, useState } from 'react'
+import { useEffect, useRef, useState } from 'react'
+import { useOnClickOutside } from 'usehooks-ts'
+
+/**
+ *
+ * @param {string} title - 선택 제목 (선택이 없을때 보여질 값)
+ * @param {array} options - 선택 옵션 객체 {}
+ * @param {function} onChange - 선택 변경 함수
+ * @param {object} value - 선택 값 객체 {}
+ * @param {boolean} disabled - 선택 비활성화 여부
+ * @param {string} sourceKey - options에 있는 키
+ * @param {string} targetKey - value에 있는 키
+ * @param {string} showKey - options 있는 키중 보여줄 키
+ * @param {object} params - 추가 파라미터
+ * @returns
+ */
+export default function QSelectBox({
+ title = '',
+ options,
+ onChange,
+ value,
+ disabled = false,
+ sourceKey = '',
+ targetKey = '',
+ showKey = '',
+ params = {},
+}) {
+ /**
+ * 초기 상태 처리
+ * useState 초기 값으로 사용해야 해서 useState 보다 위에 작성
+ * @returns {string} 초기 상태
+ */
+ const handleInitState = () => {
+ //title이 있으면 우선 보여준다(다른 키들 무시)
+ if (title !== '') {
+ return title
+ }
+
+ //value가 없으면 showKey가 있으면 우선 보여준다
+ if (showKey !== '' && !value) {
+ return options[0][showKey]
+ }
+
+ //value가 있으면 sourceKey와 targetKey를 비교하여 보여준다
+ if (showKey !== '' && value) {
+ const option = options.find((option) => option[sourceKey] === value[targetKey])
+ return option[showKey]
+ }
+ }
-export default function QSelectBox({ title = '', options, onChange, value, disabled = false, params = {} }) {
const [openSelect, setOpenSelect] = useState(false)
- const [selected, setSelected] = useState(title === '' ? options[0].name : title)
+ const [selected, setSelected] = useState(handleInitState())
+ const ref = useRef(null)
const handleClickSelectOption = (option) => {
- setSelected(option.name)
+ setSelected(showKey !== '' ? option[showKey] : option.name)
onChange?.(option, params)
}
+ const handleClose = () => {
+ setOpenSelect(false)
+ }
+
useEffect(() => {
- value && handleClickSelectOption(value)
- }, [value])
+ // value && handleClickSelectOption(value)
+ setSelected(handleInitState())
+ }, [value, sourceKey, targetKey, showKey])
+
+ useOnClickOutside(ref, handleClose)
return (
-