diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index c420f072..749892e4 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -757,7 +757,7 @@ export default function Estimate({ params }) { return ( <> -
+
diff --git a/src/components/estimate/popup/EstimateCopyPop.jsx b/src/components/estimate/popup/EstimateCopyPop.jsx new file mode 100644 index 00000000..632f0851 --- /dev/null +++ b/src/components/estimate/popup/EstimateCopyPop.jsx @@ -0,0 +1,208 @@ +'use client' +import { useEffect, useState, useContext, use } from 'react' +import { useMessage } from '@/hooks/useMessage' +import { useAxios } from '@/hooks/useAxios' +import { useRecoilValue } from 'recoil' +import { floorPlanObjectState } from '@/store/floorPlanObjectAtom' +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 { handleEstimateCopy, state } = useEstimateController(planNo) + + const { session } = useContext(SessionContext) + + // recoil 물건번호 + const objectRecoil = useRecoilValue(floorPlanObjectState) + + const [saleStoreList, setSaleStoreList] = useState([]) // 판매점 리스트 + const [favoriteStoreList, setFavoriteStoreList] = useState([]) //즐겨찾기한 판매점목록 + const [showSaleStoreList, setShowSaleStoreList] = useState([]) //보여줄 판매점목록 + + const estimateRecoilState = useRecoilValue(estimateState) + + const [otherSaleStoreList, setOtherSaleStoreList] = useState([]) + const [originOtherSaleStoreList, setOriginOtherSaleStoreList] = useState([]) + + 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 + let favList + let otherList + if (session.storeId === 'T01') { + url = `/api/object/saleStore/${session?.storeId}/firstList?userId=${session?.userId}` + } else { + if (session.storeLvl === '1') { + url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}` + } else { + url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}` + } + } + + get({ url: url }).then((res) => { + if (!isEmptyArray(res)) { + res.map((row) => { + //자동완성 검색을 위한 필드명 셋팅 + row.value = row.saleStoreId + row.label = row.saleStoreName + }) + + if (session.storeId === 'T01') { + console.log('T01:::::::::::', res) + } else { + if (session.storeLvl === '1') { + console.log('T01아닌 1차점', res) + } else { + console.log('1차점 아님::::::::', res) + } + } + } + }) + }, []) + + useEffect(() => { + if (planNo) { + setSendPlanNo(planNo) + } + }, [planNo]) + return ( +
+
+
+
+

{getMessage('estimate.detail.estimateCopyPopup.title')}

+ +
+
+
+
{getMessage('estimate.detail.estimateCopyPopup.explane')}
+
+
+
+ {getMessage('estimate.detail.estimateCopyPopup.label.saleStoreId')} * +
+ {session.storeId === 'T01' && ( +
+
+ +
+
로그인 1차점 선택한 1차점 아이디
+
+ )} + {session.storeId !== 'T01' && session.storeLvl !== '1' && ( +
+
+ +
+
선택한 2차점 아이디
+
+
+
+
+ {getMessage('estimate.detail.estimateCopyPopup.label.receiveUser')} * +
+
+ { + setSendCharger(e.target.value) + }} + /> +
+
+
+
+
+ + +
+
+
+
+
+ ) +} diff --git a/src/components/floor-plan/CanvasMenu.jsx b/src/components/floor-plan/CanvasMenu.jsx index 4d1d1820..99694f12 100644 --- a/src/components/floor-plan/CanvasMenu.jsx +++ b/src/components/floor-plan/CanvasMenu.jsx @@ -36,6 +36,7 @@ import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateCon import { estimateState } from '@/store/floorPlanObjectAtom' import DocDownOptionPop from '../estimate/popup/DocDownOptionPop' import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider' +import EstimateCopyPop from '../estimate/popup/EstimateCopyPop' export default function CanvasMenu(props) { const { menuNumber, setMenuNumber } = props @@ -60,6 +61,7 @@ export default function CanvasMenu(props) { const { handleEstimateSubmit } = useEstimateController() const estimateRecoilState = useRecoilValue(estimateState) const [estimatePopupOpen, setEstimatePopupOpen] = useState(false) + const [estimateCopyPopupOpen, setEstimateCopyPopupOpen] = useState(false) const { getMessage } = useMessage() const { currentCanvasPlan, saveCanvas } = usePlan() @@ -163,19 +165,6 @@ export default function CanvasMenu(props) { }) } - /** - * 견적서 복사버튼 - * (견적서 번호(estimateRecoilState.docNo)가 생성된 이후 버튼 활성화 ) - * T01관리자 계정 및 1차판매점에게만 제공 - */ - - const handleEstimateCopy = () => { - //objectNo, planNo - console.log('복사') - console.log('물건정보+도면+견적서를 모두 복사') - console.log('견적서 가격은 정가를 표시') - } - useEffect(() => { if (globalLocale === 'ko') { setAppMessageState(KO) @@ -295,10 +284,9 @@ export default function CanvasMenu(props) { {estimateRecoilState?.docNo !== null && (sessionState.storeId === 'T01' || sessionState.storeLvl === '1') && (
{/* 견적서(menuNumber=== 5) 상세화면인경우 문서다운로드 팝업 */} {estimatePopupOpen && } + {/* 견적서(menuNumber ===5)복사 팝업 */} + {estimateCopyPopupOpen && }
) } diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index f99ba2eb..57ffd446 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -201,6 +201,33 @@ export const useEstimateController = (planNo) => { } } + /** + * 견적서 복사버튼 + * (견적서 번호(estimateData.docNo)가 생성된 이후 버튼 활성화 ) + * T01관리자 계정 및 1차판매점에게만 제공 + */ + const handleEstimateCopy = async (sendPlanNo, sendCharger) => { + console.log('입력한 값들!@@@@@', sendPlanNo, sendCharger) + const params = { + saleStoreId: session.storeId, + sapSalesStoreCd: session.custCd, + objectNo: objectRecoil.floorPlanObjectNo, + planNo: sendPlanNo, + copySaleStoreId: 'X11', + copyReceiveUser: sendCharger, + userId: session.userId, + } + console.log('전송파람:::', params) + + return + await promisePost({ url: '/api/estimate/save-estimate-copy', data: params }).then((res) => { + console.log('복사결과::::::::', res) + //물건 번호 새로 내려옴 + //견적서가 복사되었습니다. 복사된 물건정보로 이동합니다. + // alert(getMessage('estimate.detail.estimateCopyPopup.copy.alertMessage')) + }) + } + return { state, setState, @@ -209,5 +236,6 @@ export const useEstimateController = (planNo) => { handleEstimateSubmit, fetchSetting, handleEstimateFileDownload, + handleEstimateCopy, } } diff --git a/src/locales/ja.json b/src/locales/ja.json index 3487baf6..2c0767ac 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -874,6 +874,14 @@ "estimate.detail.docPopup.schDrawingFlg.schDrawingFlg0": "含まない", "estimate.detail.docPopup.close": "閉じる", "estimate.detail.docPopup.docDownload": "文書のダウンロード", + "estimate.detail.estimateCopyPopup.title": "見積もり", + "estimate.detail.estimateCopyPopup.explane": "見積書をコピーする販売店を設定します。見積もりは定価にコピーされます.", + "estimate.detail.estimateCopyPopup.label.saleStoreId": "一次販売店名 / ID", + "estimate.detail.estimateCopyPopup.label.otherSaleStoreId": "二次販売店名 / ID", + "estimate.detail.estimateCopyPopup.label.receiveUser": "担当者", + "estimate.detail.estimateCopyPopup.close": "閉じる", + "estimate.detail.estimateCopyPopup.copyBtn": "見積もり", + "estimate.detail.estimateCopyPopup.copy.alertMessage": "見積書がコピーされました. コピーした商品情報に移動します.", "estimate.detail.productFeaturesPopup.title": "製品特異事項", "estimate.detail.productFeaturesPopup.close": "閉じる", "estimate.detail.save.alertMsg": "保存されている見積書で製品を変更した場合、図面や回路には反映されません.", diff --git a/src/locales/ko.json b/src/locales/ko.json index 96b55238..55ad3b14 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -884,6 +884,14 @@ "estimate.detail.docPopup.schDrawingFlg.schDrawingFlg0": "미포함", "estimate.detail.docPopup.close": "닫기", "estimate.detail.docPopup.docDownload": "문서 다운로드", + "estimate.detail.estimateCopyPopup.title": "견적복사", + "estimate.detail.estimateCopyPopup.explane": "견적서를 복사할 판매점을 설정하십시오. 견적서는 정가로 복사됩니다.", + "estimate.detail.estimateCopyPopup.label.saleStoreId": "1차 판매점명 / ID", + "estimate.detail.estimateCopyPopup.label.otherSaleStoreId": "2차 판매점명 / ID", + "estimate.detail.estimateCopyPopup.label.receiveUser": "담당자", + "estimate.detail.estimateCopyPopup.close": "닫기", + "estimate.detail.estimateCopyPopup.copyBtn": "견적복사", + "estimate.detail.estimateCopyPopup.copy.alertMessage": "견적서가 복사되었습니다. 복사된 물건정보로 이동합니다.", "estimate.detail.productFeaturesPopup.title": "제품특이사항", "estimate.detail.productFeaturesPopup.close": "닫기", "estimate.detail.save.alertMsg": "저장되었습니다. 견적서에서 제품을 변경할 경우, 도면 및 회로에 반영되지 않습니다.",