From abc98a959287489714c41f01ebe07621d787c1d0 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 13 Feb 2025 15:06:24 +0900 Subject: [PATCH] #728 --- src/components/estimate/Estimate.jsx | 32 +++++++++++-------- .../estimate/popup/EstimateCopyPop.jsx | 5 ++- src/components/floor-plan/CanvasMenu.jsx | 5 +++ .../estimate/useEstimateController.js | 15 +++++++-- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 609ba73e..be1ea754 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -74,7 +74,7 @@ export default function Estimate({}) { const objectRecoil = useRecoilValue(floorPlanObjectState) const currentPid = searchParams.get('pid') //견적서 상세데이터 - const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(currentPid) + const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(currentPid, false) const { selectedPlan } = usePlan() @@ -465,6 +465,10 @@ export default function Estimate({}) { //Pricing 버튼 const handlePricing = async (showPriceCd) => { + //todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요 + if (estimateContextState.estimateType === 'YJSS') { + return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' }) + } const param = { saleStoreId: session.storeId, sapSalesStoreCd: session.custCd, @@ -483,7 +487,7 @@ export default function Estimate({}) { }) if (!pass) { - //Pricing이 누락된 아이템이 있습니다. Pricing을 진행해주세요. + //Pricing이 누락된 아이템이 있습니다. 제품 선택 후 Pricing을 진행해주세요. return swalFire({ text: getMessage('estimate.detail.showPrice.pricingBtn.noItemId'), type: 'alert', @@ -581,7 +585,6 @@ export default function Estimate({}) { //주택PKG input 변경 const onChangePkgAsp = (value) => { if (estimateContextState.estimateType === 'YJSS') { - // let newValue = value.replace(/[^0-9.]/g, '') let newValue = (value || '0').replace(/[^0-9.]/g, '') if (newValue.length > 1) { newValue = newValue.replace(/(^0+)/, '') @@ -605,8 +608,6 @@ export default function Estimate({}) { let totVolKw = estimateContextState.totVolKw * 1000 let pkgTotPrice = parseFloat(pkgAsp?.replaceAll(',', '')) * totVolKw * 1000 - // pkgAsp = formatNumberWithComma(parseFloat(pkgAsp).toFixed(2)) - setEstimateContextState({ pkgAsp: pkgAsp, pkgTotPrice: pkgTotPrice.toFixed(2), @@ -687,6 +688,10 @@ export default function Estimate({}) { // 아이템 자동완성 검색시 아이템 추가/변경시 const onChangeDisplayItem = (itemId, dispOrder, index) => { + //todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요 + if (estimateContextState.estimateType === 'YJSS') { + return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' }) + } const param = { itemId: itemId, coldZoneFlg: estimateContextState?.coldRegionFlg, @@ -740,8 +745,6 @@ export default function Estimate({}) { return { ...item, ...updates, saleTotPrice: '' } } else { if (estimateContextState.estimateType === 'YJSS') { - // return { ...item, ...updates, salePrice: '', saleTotPrice: '' } - //확인 if (updates.pkgMaterialFlg === '1') { return { ...item, ...updates, showSalePrice: updates.salePrice } } else { @@ -1272,7 +1275,7 @@ export default function Estimate({}) {
-
+ {/*
-
+
*/}
{ - setHandlePricingFlag(true) + //todo: 추후 YJSS가 다시 나타날 경우 아래 주석풀기 + // setHandlePricingFlag(true) setEstimateContextState({ estimateType: e.target.value }) }} /> @@ -1576,10 +1580,10 @@ export default function Estimate({}) {
-
+ {/*
{getMessage('estimate.detail.sepcialEstimateProductInfo.totAmount')}
{convertNumberToPriceDecimal(estimateContextState?.totAmount)}
-
+
*/}
{getMessage('estimate.detail.sepcialEstimateProductInfo.totVolKw')}
{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)}
@@ -1599,7 +1603,7 @@ export default function Estimate({}) {
{/* YJOD면 아래영역 숨김 */} -
+ {/*
@@ -1634,7 +1638,7 @@ export default function Estimate({}) {
-
+
*/} {/* 제품정보 끝 */} {/* 가격표시영역시작 */}
diff --git a/src/components/estimate/popup/EstimateCopyPop.jsx b/src/components/estimate/popup/EstimateCopyPop.jsx index 35d8d54b..6ff2e540 100644 --- a/src/components/estimate/popup/EstimateCopyPop.jsx +++ b/src/components/estimate/popup/EstimateCopyPop.jsx @@ -2,7 +2,7 @@ import { useEffect, useState, useContext, useRef } from 'react' import { useMessage } from '@/hooks/useMessage' import { useAxios } from '@/hooks/useAxios' -import Select, { components } from 'react-select' +import Select from 'react-select' import { SessionContext } from '@/app/SessionProvider' import { isEmptyArray, isObjectNotEmpty } from '@/util/common-utils' import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController' @@ -11,7 +11,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) { const { getMessage } = useMessage() const { get } = useAxios() - const { handleEstimateCopy, estimateContextState } = useEstimateController(planNo) + const { handleEstimateCopy, estimateContextState } = useEstimateController(planNo, true) const { session } = useContext(SessionContext) @@ -282,7 +282,6 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) { type="text" className="input-light" required - // defaultValue={estimateContextState?.charger} defaultValue={session?.userNm} onChange={(e) => { setCopyReceiveUser(e.target.value) diff --git a/src/components/floor-plan/CanvasMenu.jsx b/src/components/floor-plan/CanvasMenu.jsx index b80eceac..3dd85620 100644 --- a/src/components/floor-plan/CanvasMenu.jsx +++ b/src/components/floor-plan/CanvasMenu.jsx @@ -354,6 +354,11 @@ export default function CanvasMenu(props) { // 견적서 초기화 버튼 const handleEstimateReset = () => { + //todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요 + if (estimateRecoilState.estimateType === 'YJSS') { + return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' }) + } + swalFire({ text: getMessage('estimate.detail.reset.confirmMsg'), type: 'confirm', diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index c63633cc..b3c4c452 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -18,7 +18,7 @@ const updateItemInList = (itemList, dispOrder, updates) => { return itemList.map((item) => (item.dispOrder === dispOrder ? { ...item, ...updates } : item)) } -export const useEstimateController = (planNo) => { +export const useEstimateController = (planNo, flag) => { const { swalFire } = useSwal() const [fileList, setFileList] = useState([]) const { setIsGlobalLoading } = useContext(QcastContext) @@ -42,7 +42,9 @@ export const useEstimateController = (planNo) => { let recoilObjectNo = objectRecoil.floorPlanObjectNo ? objectRecoil.floorPlanObjectNo : searchParams.get('objectNo') if (recoilObjectNo && planNo) { - fetchSetting(recoilObjectNo, planNo) + if (!flag) { + fetchSetting(recoilObjectNo, planNo) + } } } }, []) @@ -160,6 +162,11 @@ export const useEstimateController = (planNo) => { //견적서 저장 const handleEstimateSubmit = async () => { + //todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요 + if (estimateData.estimateType === 'YJSS') { + return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' }) + } + //0. 필수체크 let flag = true let originFileFlg = false @@ -409,6 +416,10 @@ export const useEstimateController = (planNo) => { * T01관리자 계정 및 1차판매점에게만 제공 */ const handleEstimateCopy = async (sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId) => { + //todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요 + if (estimateData.estimateType === 'YJSS') { + return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' }) + } if (saleStoreId === '') { return swalFire({ text: getMessage('estimate.detail.productFeaturesPopup.requiredStoreId'),