diff --git a/src/components/estimate/popup/EstimateCopyPop.jsx b/src/components/estimate/popup/EstimateCopyPop.jsx index 632f0851..8e2e4251 100644 --- a/src/components/estimate/popup/EstimateCopyPop.jsx +++ b/src/components/estimate/popup/EstimateCopyPop.jsx @@ -8,14 +8,15 @@ import Select, { components } from 'react-select' import { SessionContext } from '@/app/SessionProvider' import { isEmptyArray } from '@/util/common-utils' import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController' -import { ManagementContext } from '@/app/management/ManagementProvider' import { estimateState } from '@/store/floorPlanObjectAtom' export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) { const { getMessage } = useMessage() const { get, promisePost } = useAxios() - const { managementState } = useContext(ManagementContext) + + const [selOptions, setSelOptions] = useState('') //선택한 1차점 전송할 + const { handleEstimateCopy, state } = useEstimateController(planNo) const { session } = useContext(SessionContext) @@ -35,15 +36,6 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) { const [sendPlanNo, setSendPlanNo] = useState('1') const [sendCharger, setSendCharger] = useState('') - // useEffect(() => { - // console.log(originState) - // }, [originState]) - - useEffect(() => { - if (state) { - console.log('state::::::::', state) - } - }, [state]) useEffect(() => { let url let firstList @@ -72,6 +64,15 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) { } else { if (session.storeLvl === '1') { console.log('T01아닌 1차점', res) + firstList = res + favList = res.filter((row) => row.priority !== 'B') + otherList = res.filter((row) => row.firstAgentYn === 'N') + setSaleStoreList(firstList) + setFavoriteStoreList(firstList) + setShowSaleStoreList(firstList) + setSelOptions(firstList[0].saleStoreId) + + setOtherSaleStoreList(otherList) } else { console.log('1차점 아님::::::::', res) } @@ -85,6 +86,28 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) { setSendPlanNo(planNo) } }, [planNo]) + + useEffect(() => { + if (state?.charger) { + setSendCharger(state.charger) + } + }, [state.charger]) + + // 1차점 변경 이벤트 + const onSelectionChange = (key) => { + if (isObjectNotEmpty(key)) { + if (key.saleStoreId === selOptions) { + return + } + } + + if (isObjectNotEmpty(key)) { + console.log('KEY::', key) + } else { + console.log('XXXXXXXXXXX') + } + } + return (