diff --git a/src/app/floor-plan/FloorPlanProvider.js b/src/app/floor-plan/FloorPlanProvider.js index ba2a8226..37399ddd 100644 --- a/src/app/floor-plan/FloorPlanProvider.js +++ b/src/app/floor-plan/FloorPlanProvider.js @@ -2,8 +2,6 @@ import { correntObjectNoState } from '@/store/settingAtom' import { notFound, usePathname, useSearchParams } from 'next/navigation' -// import { ErrorBoundary } from 'next/dist/client/components/error-boundary' -// import ServerError from '../error' import { createContext, useReducer, useState } from 'react' import { useSetRecoilState } from 'recoil' diff --git a/src/app/floor-plan/layout.js b/src/app/floor-plan/layout.js index 2a6fb8fd..19c730cf 100644 --- a/src/app/floor-plan/layout.js +++ b/src/app/floor-plan/layout.js @@ -3,15 +3,23 @@ import FloorPlanProvider from './FloorPlanProvider' import FloorPlan from '@/components/floor-plan/FloorPlan' import CanvasLayout from '@/components/floor-plan/CanvasLayout' +import { usePathname } from 'next/navigation' export default function FloorPlanLayout({ children }) { console.log('๐Ÿš€ ~ FloorPlanLayout ~ FloorPlanLayout:') + const pathname = usePathname() + console.log('๐Ÿš€ ~ FloorPlanLayout ~ pathname:', pathname) return ( <> - {children} + {pathname.includes('estimate') || pathname.includes('simulator') ? ( +
{children}
+ ) : ( + {children} + )} + {/* {children} */}
diff --git a/src/app/management/stuff/tempReg/page.jsx b/src/app/management/stuff/tempReg/page.jsx new file mode 100644 index 00000000..ce7e684a --- /dev/null +++ b/src/app/management/stuff/tempReg/page.jsx @@ -0,0 +1,18 @@ +import React from 'react' +import StuffSubHeader from '@/components/management/StuffSubHeader' +import '@/styles/contents.scss' +import StuffDetail from '@/components/management/StuffDetail' +export default function ManagementStuffRegPage() { + return ( + <> + +
+
+
+ +
+
+
+ + ) +} diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 65a24def..bdca2ea6 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -1,7 +1,7 @@ 'use client' import { useEffect, useState, useContext } from 'react' -import { useRecoilValue } from 'recoil' +import { useRecoilValue, useSetRecoilState } from 'recoil' import { floorPlanObjectState } from '@/store/floorPlanObjectAtom' import { useMessage } from '@/hooks/useMessage' import { useCanvasMenu } from '@/hooks/common/useCanvasMenu' @@ -18,6 +18,8 @@ import Select, { components } from 'react-select' import { convertNumberToPriceDecimal, convertNumberToPriceDecimalToFixed } from '@/util/common-utils' import ProductFeaturesPop from './popup/ProductFeaturesPop' import { v4 as uuidv4 } from 'uuid' +import { correntObjectNoState } from '@/store/settingAtom' +import { useSearchParams } from 'next/navigation' export default function Estimate({ params }) { const [uniqueData, setUniqueData] = useState([]) @@ -74,6 +76,15 @@ export default function Estimate({ params }) { const { setMenuNumber } = useCanvasMenu() + /** + * objectNo ์…‹ํŒ… + * url๋กœ ๋„˜์–ด์˜จ objectNo์„ ๋ฆฌ์ฝ”์ผ์— ์„ธํŒ… + */ + const setCurrentObjectNo = useSetRecoilState(correntObjectNoState) + const searchParams = useSearchParams() + const currentObjectNo = searchParams.get('objectNo') + setCurrentObjectNo(currentObjectNo) + //์ƒˆ๋กœ ์ถ”๊ฐ€ํ•œ ์ฒจ๋ถ€ํŒŒ์ผ props const fileUploadProps = { uploadFiles: files, @@ -139,10 +150,10 @@ export default function Estimate({ params }) { //detail๊ณผ ์ƒ๊ด€์—†์ด ๋””ํดํŠธ ์ฒดํฌ๋ชฉ๋ก //ATTR003,ATTR007 if (row.code === 'ATTR003') { - row.check = true + //row.check = true } if (row.code === 'ATTR007') { - row.check = true + //row.check = true } }) @@ -192,7 +203,6 @@ export default function Estimate({ params }) { // ๊ฒฌ์ ํŠน์ด์‚ฌํ•ญ remark ๋ณด์—ฌ์ฃผ๊ธฐ const settingShowContent = (code) => { setShowContentCode(code) - // event.stopPropagation() } // ์ถ”๊ฐ€ํ•œ ์ฒจ๋ถ€ํŒŒ์ผ estimateContextState์— ๋„ฃ๊ธฐ @@ -202,20 +212,21 @@ export default function Estimate({ params }) { files.map((row) => { fileList.push(row.data) setEstimateContextState({ fileList: row.data, newFileList: fileList }) + // setEstimateContextState({ fileList: row.data }) }) } else { - setEstimateContextState({ fileList: [] }) + setEstimateContextState({ fileList: [], newFileList: [] }) } }, [files]) - useEffect(() => { - // console.log('USEEFFECT originFiles::::::::::', originFiles) - // if (originFiles.length > 0) { - // setEstimateContextState({ - // originFiles: originFiles, - // }) - // } - }, [originFiles]) + // useEffect(() => { + // // console.log('USEEFFECT originFiles::::::::::', originFiles) + // // if (originFiles.length > 0) { + // // setEstimateContextState({ + // // originFiles: originFiles, + // // }) + // // } + // }, [originFiles]) //์ƒ์„ธ์—์„œ ๋‚ด๋ ค์˜จ ์ฒจ๋ถ€ํŒŒ์ผ set ๋งŒ๋“ค๊ธฐ useEffect(() => { @@ -223,6 +234,13 @@ export default function Estimate({ params }) { //๋“œ๋ž˜๊ทธ์˜์—ญ ๋น„์›Œ์ฃผ๊ธฐ setFiles([]) setOriginFiles(estimateContextState.fileList) + } else { + // setOriginFiles([]) + if (originFiles.length > 0) { + let file + file = originFiles.filter((item) => item.delFlg === '0') + setOriginFiles(file) + } } }, [estimateContextState?.fileList]) @@ -498,7 +516,7 @@ export default function Estimate({ params }) { setEstimateContextState({ pkgAsp: pkgAsp, - pkgTotPrice: pkgTotPrice.toFixed(3), + pkgTotPrice: pkgTotPrice.toFixed(2), }) //์•„์ดํ…œ๋“ค ์ค‘ ์กฐ๊ฑด์— ๋งž๋Š”์• ๋“ค ๋ฝ‘์•„์„œ ์ƒ๋‹จ ๊ณต๊ธ‰๊ฐ€์•ก ๋ถ€๊ฐ€์„ธ ์ด์•ก ์ˆ˜์ • setItemChangeYn(true) @@ -741,14 +759,20 @@ export default function Estimate({ params }) { delete item.showSaleTotPrice if (item.delFlg === '0') { let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 - let price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0 + // let price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0 + let price + if (amount === 0) { + price = 0 + } else { + price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0 + } if (item.moduleFlg === '1') { const volKw = (item.pnowW * amount) / 1000 totals.totVolKw += volKw } - totals.totAmount += amount totals.supplyPrice += price + totals.totAmount += amount if (item.openFlg === '1') { item.showSalePrice = '0' @@ -759,6 +783,8 @@ export default function Estimate({ params }) { totals.vatPrice = totals.supplyPrice * 0.1 totals.totPrice = totals.supplyPrice + totals.vatPrice + + // console.log('YJOD:::totlas:::', totals) } const calculateYJSSTotals = (itemList) => { @@ -768,11 +794,17 @@ export default function Estimate({ params }) { // console.log('YJSSS::', item) if (item.delFlg === '0') { let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 - let salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0 + // let salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0 + let salePrice if (item.moduleFlg === '1') { const volKw = (item.pnowW * amount) / 1000 totals.totVolKw += volKw } + if (amount === 0) { + salePrice = 0 + } else { + salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0 + } totals.totAmount += amount if (item.pkgMaterialFlg === '1') { @@ -793,26 +825,28 @@ export default function Estimate({ params }) { totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice totals.vatPrice = totals.supplyPrice * 0.1 totals.totPrice = totals.supplyPrice + totals.vatPrice + + // console.log('YJOD:::totlas:::', totals) } if (estimateContextState.estimateType === 'YJOD') { calculateYJODTotals(estimateContextState.itemList) setEstimateContextState({ totAmount: totals.totAmount, - totVolKw: totals.totVolKw.toFixed(3), - supplyPrice: totals.supplyPrice.toFixed(3), - vatPrice: totals.vatPrice.toFixed(3), - totPrice: totals.totPrice.toFixed(3), + totVolKw: totals.totVolKw.toFixed(2), + supplyPrice: totals.supplyPrice.toFixed(2), + vatPrice: totals.vatPrice.toFixed(2), + totPrice: totals.totPrice.toFixed(2), }) } else if (estimateContextState.estimateType === 'YJSS') { calculateYJSSTotals(estimateContextState.itemList) setEstimateContextState({ pkgTotPrice: totals.pkgTotPrice, totAmount: totals.totAmount, - totVolKw: totals.totVolKw.toFixed(3), - supplyPrice: totals.supplyPrice.toFixed(3), - vatPrice: totals.vatPrice.toFixed(3), - totPrice: totals.totPrice.toFixed(3), + totVolKw: totals.totVolKw.toFixed(2), + supplyPrice: totals.supplyPrice.toFixed(2), + vatPrice: totals.vatPrice.toFixed(2), + totPrice: totals.totPrice.toFixed(2), }) } @@ -1026,16 +1060,14 @@ export default function Estimate({ params }) { let constructSpecificationMulti = estimateContextState?.constructSpecificationMulti?.split('ใ€') return ( - <> -
-
- -
-
- -
+
+
+
- +
+ +
+
) })} @@ -1122,7 +1154,8 @@ export default function Estimate({ params }) {