This commit is contained in:
parent
24dcbb27f0
commit
abc98a9592
@ -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">
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user