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 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({}) {
</th>
<td colSpan={3}>
<div className="radio-wrap">
<div className="d-check-radio light mr10">
{/* <div className="d-check-radio light mr10">
<input
type="radio"
name="estimateType"
@ -1286,7 +1289,7 @@ export default function Estimate({}) {
}}
/>
<label htmlFor="YJSS">{getMessage('estimate.detail.estimateType.yjss')}</label>
</div>
</div> */}
<div className="d-check-radio light">
<input
type="radio"
@ -1295,7 +1298,8 @@ export default function Estimate({}) {
value={'YJOD'}
checked={estimateContextState?.estimateType === 'YJOD' ? true : false}
onChange={(e) => {
setHandlePricingFlag(true)
//todo: YJSS
// setHandlePricingFlag(true)
setEstimateContextState({ estimateType: e.target.value })
}}
/>
@ -1576,10 +1580,10 @@ export default function Estimate({}) {
</div>
<div className="esimate-wrap">
<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-name blue">{convertNumberToPriceDecimal(estimateContextState?.totAmount)}</div>
</div>
</div> */}
<div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.totVolKw')}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)}</div>
@ -1599,7 +1603,7 @@ export default function Estimate({}) {
</div>
</div>
{/* 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>
<colgroup>
<col style={{ width: '160px' }} />
@ -1634,7 +1638,7 @@ export default function Estimate({}) {
</tr>
</tbody>
</table>
</div>
</div> */}
{/* 제품정보 끝 */}
{/* 가격표시영역시작 */}
<div className="estimate-product-option">

View File

@ -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)

View File

@ -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',

View File

@ -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'),