This commit is contained in:
basssy 2025-02-13 15:06:24 +09:00
parent 24dcbb27f0
commit abc98a9592
4 changed files with 38 additions and 19 deletions

View File

@ -74,7 +74,7 @@ export default function Estimate({}) {
const objectRecoil = useRecoilValue(floorPlanObjectState) const objectRecoil = useRecoilValue(floorPlanObjectState)
const currentPid = searchParams.get('pid') const currentPid = searchParams.get('pid')
// //
const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(currentPid) const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(currentPid, false)
const { selectedPlan } = usePlan() const { selectedPlan } = usePlan()
@ -465,6 +465,10 @@ export default function Estimate({}) {
//Pricing //Pricing
const handlePricing = async (showPriceCd) => { 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 = { const param = {
saleStoreId: session.storeId, saleStoreId: session.storeId,
sapSalesStoreCd: session.custCd, sapSalesStoreCd: session.custCd,
@ -483,7 +487,7 @@ export default function Estimate({}) {
}) })
if (!pass) { if (!pass) {
//Pricing . Pricing . //Pricing . Pricing .
return swalFire({ return swalFire({
text: getMessage('estimate.detail.showPrice.pricingBtn.noItemId'), text: getMessage('estimate.detail.showPrice.pricingBtn.noItemId'),
type: 'alert', type: 'alert',
@ -581,7 +585,6 @@ export default function Estimate({}) {
//PKG input //PKG input
const onChangePkgAsp = (value) => { const onChangePkgAsp = (value) => {
if (estimateContextState.estimateType === 'YJSS') { if (estimateContextState.estimateType === 'YJSS') {
// let newValue = value.replace(/[^0-9.]/g, '')
let newValue = (value || '0').replace(/[^0-9.]/g, '') let newValue = (value || '0').replace(/[^0-9.]/g, '')
if (newValue.length > 1) { if (newValue.length > 1) {
newValue = newValue.replace(/(^0+)/, '') newValue = newValue.replace(/(^0+)/, '')
@ -605,8 +608,6 @@ export default function Estimate({}) {
let totVolKw = estimateContextState.totVolKw * 1000 let totVolKw = estimateContextState.totVolKw * 1000
let pkgTotPrice = parseFloat(pkgAsp?.replaceAll(',', '')) * totVolKw * 1000 let pkgTotPrice = parseFloat(pkgAsp?.replaceAll(',', '')) * totVolKw * 1000
// pkgAsp = formatNumberWithComma(parseFloat(pkgAsp).toFixed(2))
setEstimateContextState({ setEstimateContextState({
pkgAsp: pkgAsp, pkgAsp: pkgAsp,
pkgTotPrice: pkgTotPrice.toFixed(2), pkgTotPrice: pkgTotPrice.toFixed(2),
@ -687,6 +688,10 @@ export default function Estimate({}) {
// / // /
const onChangeDisplayItem = (itemId, dispOrder, index) => { 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 = { const param = {
itemId: itemId, itemId: itemId,
coldZoneFlg: estimateContextState?.coldRegionFlg, coldZoneFlg: estimateContextState?.coldRegionFlg,
@ -740,8 +745,6 @@ export default function Estimate({}) {
return { ...item, ...updates, saleTotPrice: '' } return { ...item, ...updates, saleTotPrice: '' }
} else { } else {
if (estimateContextState.estimateType === 'YJSS') { if (estimateContextState.estimateType === 'YJSS') {
// return { ...item, ...updates, salePrice: '', saleTotPrice: '' }
//
if (updates.pkgMaterialFlg === '1') { if (updates.pkgMaterialFlg === '1') {
return { ...item, ...updates, showSalePrice: updates.salePrice } return { ...item, ...updates, showSalePrice: updates.salePrice }
} else { } else {
@ -1272,7 +1275,7 @@ export default function Estimate({}) {
</th> </th>
<td colSpan={3}> <td colSpan={3}>
<div className="radio-wrap"> <div className="radio-wrap">
<div className="d-check-radio light mr10"> {/* <div className="d-check-radio light mr10">
<input <input
type="radio" type="radio"
name="estimateType" name="estimateType"
@ -1286,7 +1289,7 @@ export default function Estimate({}) {
}} }}
/> />
<label htmlFor="YJSS">{getMessage('estimate.detail.estimateType.yjss')}</label> <label htmlFor="YJSS">{getMessage('estimate.detail.estimateType.yjss')}</label>
</div> </div> */}
<div className="d-check-radio light"> <div className="d-check-radio light">
<input <input
type="radio" type="radio"
@ -1295,7 +1298,8 @@ export default function Estimate({}) {
value={'YJOD'} value={'YJOD'}
checked={estimateContextState?.estimateType === 'YJOD' ? true : false} checked={estimateContextState?.estimateType === 'YJOD' ? true : false}
onChange={(e) => { onChange={(e) => {
setHandlePricingFlag(true) //todo: YJSS
// setHandlePricingFlag(true)
setEstimateContextState({ estimateType: e.target.value }) setEstimateContextState({ estimateType: e.target.value })
}} }}
/> />
@ -1576,10 +1580,10 @@ export default function Estimate({}) {
</div> </div>
<div className="esimate-wrap"> <div className="esimate-wrap">
<div className="estimate-list-wrap one"> <div className="estimate-list-wrap one">
<div className="estimate-box"> {/* <div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.totAmount')}</div> <div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.totAmount')}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimal(estimateContextState?.totAmount)}</div> <div className="estimate-name blue">{convertNumberToPriceDecimal(estimateContextState?.totAmount)}</div>
</div> </div> */}
<div className="estimate-box"> <div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.totVolKw')}</div> <div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.totVolKw')}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)}</div> <div className="estimate-name blue">{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)}</div>
@ -1599,7 +1603,7 @@ export default function Estimate({}) {
</div> </div>
</div> </div>
{/* YJOD면 아래영역 숨김 */} {/* YJOD면 아래영역 숨김 */}
<div className="common-table bt-able" style={{ display: estimateContextState?.estimateType === 'YJSS' ? '' : 'none' }}> {/* <div className="common-table bt-able" style={{ display: estimateContextState?.estimateType === 'YJSS' ? '' : 'none' }}>
<table> <table>
<colgroup> <colgroup>
<col style={{ width: '160px' }} /> <col style={{ width: '160px' }} />
@ -1634,7 +1638,7 @@ export default function Estimate({}) {
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div> */}
{/* 제품정보 끝 */} {/* 제품정보 끝 */}
{/* 가격표시영역시작 */} {/* 가격표시영역시작 */}
<div className="estimate-product-option"> <div className="estimate-product-option">

View File

@ -2,7 +2,7 @@
import { useEffect, useState, useContext, useRef } from 'react' import { useEffect, useState, useContext, useRef } from 'react'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
import { useAxios } from '@/hooks/useAxios' import { useAxios } from '@/hooks/useAxios'
import Select, { components } from 'react-select' import Select from 'react-select'
import { SessionContext } from '@/app/SessionProvider' import { SessionContext } from '@/app/SessionProvider'
import { isEmptyArray, isObjectNotEmpty } from '@/util/common-utils' import { isEmptyArray, isObjectNotEmpty } from '@/util/common-utils'
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController' import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
@ -11,7 +11,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
const { getMessage } = useMessage() const { getMessage } = useMessage()
const { get } = useAxios() const { get } = useAxios()
const { handleEstimateCopy, estimateContextState } = useEstimateController(planNo) const { handleEstimateCopy, estimateContextState } = useEstimateController(planNo, true)
const { session } = useContext(SessionContext) const { session } = useContext(SessionContext)
@ -282,7 +282,6 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
type="text" type="text"
className="input-light" className="input-light"
required required
// defaultValue={estimateContextState?.charger}
defaultValue={session?.userNm} defaultValue={session?.userNm}
onChange={(e) => { onChange={(e) => {
setCopyReceiveUser(e.target.value) setCopyReceiveUser(e.target.value)

View File

@ -354,6 +354,11 @@ export default function CanvasMenu(props) {
// //
const handleEstimateReset = () => { const handleEstimateReset = () => {
//todo: YJSS swalFire
if (estimateRecoilState.estimateType === 'YJSS') {
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
}
swalFire({ swalFire({
text: getMessage('estimate.detail.reset.confirmMsg'), text: getMessage('estimate.detail.reset.confirmMsg'),
type: 'confirm', type: 'confirm',

View File

@ -18,7 +18,7 @@ const updateItemInList = (itemList, dispOrder, updates) => {
return itemList.map((item) => (item.dispOrder === dispOrder ? { ...item, ...updates } : item)) return itemList.map((item) => (item.dispOrder === dispOrder ? { ...item, ...updates } : item))
} }
export const useEstimateController = (planNo) => { export const useEstimateController = (planNo, flag) => {
const { swalFire } = useSwal() const { swalFire } = useSwal()
const [fileList, setFileList] = useState([]) const [fileList, setFileList] = useState([])
const { setIsGlobalLoading } = useContext(QcastContext) const { setIsGlobalLoading } = useContext(QcastContext)
@ -42,7 +42,9 @@ export const useEstimateController = (planNo) => {
let recoilObjectNo = objectRecoil.floorPlanObjectNo ? objectRecoil.floorPlanObjectNo : searchParams.get('objectNo') let recoilObjectNo = objectRecoil.floorPlanObjectNo ? objectRecoil.floorPlanObjectNo : searchParams.get('objectNo')
if (recoilObjectNo && planNo) { if (recoilObjectNo && planNo) {
fetchSetting(recoilObjectNo, planNo) if (!flag) {
fetchSetting(recoilObjectNo, planNo)
}
} }
} }
}, []) }, [])
@ -160,6 +162,11 @@ export const useEstimateController = (planNo) => {
//견적서 저장 //견적서 저장
const handleEstimateSubmit = async () => { const handleEstimateSubmit = async () => {
//todo: 추후 YJSS가 다시 나타날 경우 아래 swalFire 제거 필요
if (estimateData.estimateType === 'YJSS') {
return swalFire({ text: getMessage('estimate.detail.save.requiredEstimateType'), type: 'alert', icon: 'warning' })
}
//0. 필수체크 //0. 필수체크
let flag = true let flag = true
let originFileFlg = false let originFileFlg = false
@ -409,6 +416,10 @@ export const useEstimateController = (planNo) => {
* T01관리자 계정 1차판매점에게만 제공 * T01관리자 계정 1차판매점에게만 제공
*/ */
const handleEstimateCopy = async (sendPlanNo, copyReceiveUser, saleStoreId, otherSaleStoreId) => { 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 === '') { if (saleStoreId === '') {
return swalFire({ return swalFire({
text: getMessage('estimate.detail.productFeaturesPopup.requiredStoreId'), text: getMessage('estimate.detail.productFeaturesPopup.requiredStoreId'),