Merge branch 'dev' into dev-yj

This commit is contained in:
yjnoh 2024-12-05 14:40:24 +09:00
commit 98e80b5fae
12 changed files with 188 additions and 92 deletions

View File

@ -2,8 +2,6 @@
import { correntObjectNoState } from '@/store/settingAtom' import { correntObjectNoState } from '@/store/settingAtom'
import { notFound, usePathname, useSearchParams } from 'next/navigation' 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 { createContext, useReducer, useState } from 'react'
import { useSetRecoilState } from 'recoil' import { useSetRecoilState } from 'recoil'

View File

@ -3,15 +3,23 @@
import FloorPlanProvider from './FloorPlanProvider' import FloorPlanProvider from './FloorPlanProvider'
import FloorPlan from '@/components/floor-plan/FloorPlan' import FloorPlan from '@/components/floor-plan/FloorPlan'
import CanvasLayout from '@/components/floor-plan/CanvasLayout' import CanvasLayout from '@/components/floor-plan/CanvasLayout'
import { usePathname } from 'next/navigation'
export default function FloorPlanLayout({ children }) { export default function FloorPlanLayout({ children }) {
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:') console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')
const pathname = usePathname()
console.log('🚀 ~ FloorPlanLayout ~ pathname:', pathname)
return ( return (
<> <>
<FloorPlanProvider> <FloorPlanProvider>
<FloorPlan> <FloorPlan>
<CanvasLayout>{children}</CanvasLayout> {pathname.includes('estimate') || pathname.includes('simulator') ? (
<div className="canvas-layout">{children}</div>
) : (
<CanvasLayout>{children}</CanvasLayout>
)}
{/* <CanvasLayout>{children}</CanvasLayout> */}
</FloorPlan> </FloorPlan>
</FloorPlanProvider> </FloorPlanProvider>
</> </>

View File

@ -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 (
<>
<StuffSubHeader type={'temp'} />
<div className="sub-content">
<div className="sub-content-inner">
<div className="sub-content-box">
<StuffDetail />
</div>
</div>
</div>
</>
)
}

View File

@ -1,7 +1,7 @@
'use client' 'use client'
import { useEffect, useState, useContext } from 'react' import { useEffect, useState, useContext } from 'react'
import { useRecoilValue } from 'recoil' import { useRecoilValue, useSetRecoilState } from 'recoil'
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom' import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu' import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
@ -18,6 +18,8 @@ import Select, { components } from 'react-select'
import { convertNumberToPriceDecimal, convertNumberToPriceDecimalToFixed } from '@/util/common-utils' import { convertNumberToPriceDecimal, convertNumberToPriceDecimalToFixed } from '@/util/common-utils'
import ProductFeaturesPop from './popup/ProductFeaturesPop' import ProductFeaturesPop from './popup/ProductFeaturesPop'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { correntObjectNoState } from '@/store/settingAtom'
import { useSearchParams } from 'next/navigation'
export default function Estimate({ params }) { export default function Estimate({ params }) {
const [uniqueData, setUniqueData] = useState([]) const [uniqueData, setUniqueData] = useState([])
@ -74,6 +76,15 @@ export default function Estimate({ params }) {
const { setMenuNumber } = useCanvasMenu() const { setMenuNumber } = useCanvasMenu()
/**
* objectNo 셋팅
* url로 넘어온 objectNo을 리코일에 세팅
*/
const setCurrentObjectNo = useSetRecoilState(correntObjectNoState)
const searchParams = useSearchParams()
const currentObjectNo = searchParams.get('objectNo')
setCurrentObjectNo(currentObjectNo)
// props // props
const fileUploadProps = { const fileUploadProps = {
uploadFiles: files, uploadFiles: files,
@ -139,10 +150,10 @@ export default function Estimate({ params }) {
//detail //detail
//ATTR003,ATTR007 //ATTR003,ATTR007
if (row.code === 'ATTR003') { if (row.code === 'ATTR003') {
row.check = true //row.check = true
} }
if (row.code === 'ATTR007') { if (row.code === 'ATTR007') {
row.check = true //row.check = true
} }
}) })
@ -192,7 +203,6 @@ export default function Estimate({ params }) {
// remark // remark
const settingShowContent = (code) => { const settingShowContent = (code) => {
setShowContentCode(code) setShowContentCode(code)
// event.stopPropagation()
} }
// estimateContextState // estimateContextState
@ -202,20 +212,21 @@ export default function Estimate({ params }) {
files.map((row) => { files.map((row) => {
fileList.push(row.data) fileList.push(row.data)
setEstimateContextState({ fileList: row.data, newFileList: fileList }) setEstimateContextState({ fileList: row.data, newFileList: fileList })
// setEstimateContextState({ fileList: row.data })
}) })
} else { } else {
setEstimateContextState({ fileList: [] }) setEstimateContextState({ fileList: [], newFileList: [] })
} }
}, [files]) }, [files])
useEffect(() => { // useEffect(() => {
// console.log('USEEFFECT originFiles::::::::::', originFiles) // // console.log('USEEFFECT originFiles::::::::::', originFiles)
// if (originFiles.length > 0) { // // if (originFiles.length > 0) {
// setEstimateContextState({ // // setEstimateContextState({
// originFiles: originFiles, // // originFiles: originFiles,
// }) // // })
// } // // }
}, [originFiles]) // }, [originFiles])
// set // set
useEffect(() => { useEffect(() => {
@ -223,6 +234,13 @@ export default function Estimate({ params }) {
// //
setFiles([]) setFiles([])
setOriginFiles(estimateContextState.fileList) setOriginFiles(estimateContextState.fileList)
} else {
// setOriginFiles([])
if (originFiles.length > 0) {
let file
file = originFiles.filter((item) => item.delFlg === '0')
setOriginFiles(file)
}
} }
}, [estimateContextState?.fileList]) }, [estimateContextState?.fileList])
@ -498,7 +516,7 @@ export default function Estimate({ params }) {
setEstimateContextState({ setEstimateContextState({
pkgAsp: pkgAsp, pkgAsp: pkgAsp,
pkgTotPrice: pkgTotPrice.toFixed(3), pkgTotPrice: pkgTotPrice.toFixed(2),
}) })
// //
setItemChangeYn(true) setItemChangeYn(true)
@ -741,14 +759,20 @@ export default function Estimate({ params }) {
delete item.showSaleTotPrice delete item.showSaleTotPrice
if (item.delFlg === '0') { if (item.delFlg === '0') {
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 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') { if (item.moduleFlg === '1') {
const volKw = (item.pnowW * amount) / 1000 const volKw = (item.pnowW * amount) / 1000
totals.totVolKw += volKw totals.totVolKw += volKw
} }
totals.totAmount += amount
totals.supplyPrice += price totals.supplyPrice += price
totals.totAmount += amount
if (item.openFlg === '1') { if (item.openFlg === '1') {
item.showSalePrice = '0' item.showSalePrice = '0'
@ -759,6 +783,8 @@ export default function Estimate({ params }) {
totals.vatPrice = totals.supplyPrice * 0.1 totals.vatPrice = totals.supplyPrice * 0.1
totals.totPrice = totals.supplyPrice + totals.vatPrice totals.totPrice = totals.supplyPrice + totals.vatPrice
// console.log('YJOD:::totlas:::', totals)
} }
const calculateYJSSTotals = (itemList) => { const calculateYJSSTotals = (itemList) => {
@ -768,11 +794,17 @@ export default function Estimate({ params }) {
// console.log('YJSSS::', item) // console.log('YJSSS::', item)
if (item.delFlg === '0') { if (item.delFlg === '0') {
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 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') { if (item.moduleFlg === '1') {
const volKw = (item.pnowW * amount) / 1000 const volKw = (item.pnowW * amount) / 1000
totals.totVolKw += volKw totals.totVolKw += volKw
} }
if (amount === 0) {
salePrice = 0
} else {
salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0
}
totals.totAmount += amount totals.totAmount += amount
if (item.pkgMaterialFlg === '1') { if (item.pkgMaterialFlg === '1') {
@ -793,26 +825,28 @@ export default function Estimate({ params }) {
totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice
totals.vatPrice = totals.supplyPrice * 0.1 totals.vatPrice = totals.supplyPrice * 0.1
totals.totPrice = totals.supplyPrice + totals.vatPrice totals.totPrice = totals.supplyPrice + totals.vatPrice
// console.log('YJOD:::totlas:::', totals)
} }
if (estimateContextState.estimateType === 'YJOD') { if (estimateContextState.estimateType === 'YJOD') {
calculateYJODTotals(estimateContextState.itemList) calculateYJODTotals(estimateContextState.itemList)
setEstimateContextState({ setEstimateContextState({
totAmount: totals.totAmount, totAmount: totals.totAmount,
totVolKw: totals.totVolKw.toFixed(3), totVolKw: totals.totVolKw.toFixed(2),
supplyPrice: totals.supplyPrice.toFixed(3), supplyPrice: totals.supplyPrice.toFixed(2),
vatPrice: totals.vatPrice.toFixed(3), vatPrice: totals.vatPrice.toFixed(2),
totPrice: totals.totPrice.toFixed(3), totPrice: totals.totPrice.toFixed(2),
}) })
} else if (estimateContextState.estimateType === 'YJSS') { } else if (estimateContextState.estimateType === 'YJSS') {
calculateYJSSTotals(estimateContextState.itemList) calculateYJSSTotals(estimateContextState.itemList)
setEstimateContextState({ setEstimateContextState({
pkgTotPrice: totals.pkgTotPrice, pkgTotPrice: totals.pkgTotPrice,
totAmount: totals.totAmount, totAmount: totals.totAmount,
totVolKw: totals.totVolKw.toFixed(3), totVolKw: totals.totVolKw.toFixed(2),
supplyPrice: totals.supplyPrice.toFixed(3), supplyPrice: totals.supplyPrice.toFixed(2),
vatPrice: totals.vatPrice.toFixed(3), vatPrice: totals.vatPrice.toFixed(2),
totPrice: totals.totPrice.toFixed(3), totPrice: totals.totPrice.toFixed(2),
}) })
} }
@ -1026,16 +1060,14 @@ export default function Estimate({ params }) {
let constructSpecificationMulti = estimateContextState?.constructSpecificationMulti?.split('、') let constructSpecificationMulti = estimateContextState?.constructSpecificationMulti?.split('、')
return ( return (
<> <div className={`form-flex-wrap ${style}`} key={`roof_${row}`}>
<div className={`form-flex-wrap ${style}`} key={fixedKey}> <div className="input-wrap mr5" style={{ width: '610px' }}>
<div className="input-wrap mr5" style={{ width: '610px' }} key={`roof${index}`}> <input type="text" className="input-light" value={roofList} readOnly />
<input type="text" className="input-light" value={roofList} readOnly />
</div>
<div className="input-wrap" style={{ width: '200px' }}>
<input type="text" className="input-light" value={constructSpecificationMulti[index]} readOnly />
</div>
</div> </div>
</> <div className="input-wrap" style={{ width: '200px' }}>
<input type="text" className="input-light" value={constructSpecificationMulti[index]} readOnly />
</div>
</div>
) )
})} })}
</td> </td>
@ -1122,7 +1154,8 @@ export default function Estimate({ params }) {
<ul className="file-list"> <ul className="file-list">
{originFiles.map((originFile) => { {originFiles.map((originFile) => {
return ( return (
<li className="file-item" key={uuidv4()}> <li className="file-item" key={originFile.no}>
{/* <li className="file-item" key={uuidv4()}> */}
<div className="file-item-wrap"> <div className="file-item-wrap">
<span <span
style={{ display: originFile.delFlg === '0' ? '' : 'none' }} style={{ display: originFile.delFlg === '0' ? '' : 'none' }}
@ -1185,7 +1218,8 @@ export default function Estimate({ params }) {
{specialNoteList.length > 0 && {specialNoteList.length > 0 &&
specialNoteList.map((row) => { specialNoteList.map((row) => {
return ( return (
<div key={uuidv4()} className="special-note-check-item"> // <div key={uuidv4()} className="special-note-check-item">
<div key={row.code} className="special-note-check-item">
<div className="special-note-check-box"> <div className="special-note-check-box">
<div className="d-check-box light"> <div className="d-check-box light">
<input <input
@ -1193,7 +1227,9 @@ export default function Estimate({ params }) {
id={row.code} id={row.code}
checked={!!row.check} checked={!!row.check}
disabled={row.code === 'ATTR001' || row.pkgYn === '1' ? true : false} disabled={row.code === 'ATTR001' || row.pkgYn === '1' ? true : false}
onClick={(event) => { // readOnly
// onClick={(event) => {
onChange={() => {
setSpecialNoteList((specialNote) => setSpecialNoteList((specialNote) =>
specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)), specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)),
) )
@ -1207,7 +1243,7 @@ export default function Estimate({ params }) {
settingShowContent(row.code) settingShowContent(row.code)
}} }}
> >
{row.codeNm} {row.codeNm} / {row.code}
</span> </span>
</div> </div>
</div> </div>
@ -1224,7 +1260,7 @@ export default function Estimate({ params }) {
if (isObjectNotEmpty(showcontent)) { if (isObjectNotEmpty(showcontent)) {
return ( return (
<dl key={uuidv4()}> <dl key={row.code}>
<dt>{showcontent.codeNm}</dt> <dt>{showcontent.codeNm}</dt>
<dd dangerouslySetInnerHTML={{ __html: showcontent.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd> <dd dangerouslySetInnerHTML={{ __html: showcontent.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd>
</dl> </dl>
@ -1239,12 +1275,23 @@ export default function Estimate({ params }) {
} }
}) })
}) })
return pushData.map((item) => ( //
<dl key={uuidv4()}> let filterData = pushData.filter((item) => uniqueData.includes(item.code))
<dt>{item.codeNm}</dt> if (filterData.length > 0) {
<dd dangerouslySetInnerHTML={{ __html: item.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd> return filterData.map((item) => (
</dl> <dl key={item.code}>
)) <dt>{item.codeNm}</dt>
<dd dangerouslySetInnerHTML={{ __html: item.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd>
</dl>
))
} else {
return pushData.map((item) => (
<dl key={item.code}>
<dt>{item.codeNm}</dt>
<dd dangerouslySetInnerHTML={{ __html: item.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd>
</dl>
))
}
} }
} }
})} })}
@ -1270,7 +1317,7 @@ export default function Estimate({ params }) {
</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, 3)}</div> <div className="estimate-name blue">{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)}</div>
</div> </div>
<div className="estimate-box"> <div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.supplyPrice')}</div> <div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.supplyPrice')}</div>
@ -1316,7 +1363,7 @@ export default function Estimate({ params }) {
</div> </div>
</td> </td>
<th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgWeight')}</th> <th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgWeight')}</th>
<td>{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 3)}</td> <td>{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)}</td>
<th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgPrice')}</th> <th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgPrice')}</th>
<td>{convertNumberToPriceDecimal(estimateContextState?.pkgTotPrice)}</td> <td>{convertNumberToPriceDecimal(estimateContextState?.pkgTotPrice)}</td>
</tr> </tr>
@ -1331,14 +1378,19 @@ export default function Estimate({ params }) {
<div className="select-wrap"> <div className="select-wrap">
{session?.storeLvl === '1' ? ( {session?.storeLvl === '1' ? (
<select <select
key={uuidv4()} // key={uuidv4()}
className="select-light" className="select-light"
onChange={(e) => { onChange={(e) => {
onChangeStorePriceList(e.target.value) onChangeStorePriceList(e.target.value)
}} }}
value={showPriceCd} value={showPriceCd}
> >
{storePriceList.length > 0 && storePriceList.map((row) => <option value={row.priceCd}>{row.priceNm}</option>)} {storePriceList.length > 0 &&
storePriceList.map((row) => (
<option key={row.priceCd} value={row.priceCd}>
{row.priceNm}
</option>
))}
</select> </select>
) : ( ) : (
<select key={uuidv4()} className="select-light"> <select key={uuidv4()} className="select-light">
@ -1448,7 +1500,8 @@ export default function Estimate({ params }) {
<div className="form-flex-wrap"> <div className="form-flex-wrap">
<div className="select-wrap mr5"> <div className="select-wrap mr5">
<Select <Select
id="long-value-select1" // id="long-value-select1"
name="long-value-select1"
instanceId="long-value-select1" instanceId="long-value-select1"
className="react-select-custom" className="react-select-custom"
classNamePrefix="custom" classNamePrefix="custom"

View File

@ -40,9 +40,8 @@ export default function ProductFeaturesPop({ popShowSpecialNoteList, showProduct
{showSpecialNoteList.length > 0 && {showSpecialNoteList.length > 0 &&
showSpecialNoteList.map((row) => { showSpecialNoteList.map((row) => {
return ( return (
<dl> <dl key={row.code}>
<dt>{row.codeNm}</dt> <dt>{row.codeNm}</dt>
{/* <dd dangerouslySetInnerHTML={{ __html: row.remarks }}></dd> */}
<dd dangerouslySetInnerHTML={{ __html: row.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd> <dd dangerouslySetInnerHTML={{ __html: row.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd>
</dl> </dl>
) )

View File

@ -96,7 +96,8 @@ export default function Header(props) {
name: 'header.menus.management', name: 'header.menus.management',
url: '', url: '',
children: [ children: [
{ id: 3, name: 'header.menus.management.newStuff', url: '/management/stuff/tempdetail', children: [] }, // { id: 3, name: 'header.menus.management.newStuff', url: '/management/stuff/tempdetail', children: [] },
{ id: 3, name: 'header.menus.management.newStuff', url: '/management/stuff/tempReg', children: [] },
{ id: 4, name: 'header.menus.management.stuffList', url: '/management/stuff', children: [] }, { id: 4, name: 'header.menus.management.stuffList', url: '/management/stuff', children: [] },
], ],
}, },

View File

@ -75,7 +75,7 @@ export default function StuffDetail() {
installHeight: '', // installHeight: '', //
conType: '0', //( / ) conType: '0', //( / )
remarks: '', // remarks: '', //
tempFlag: 'T', //(1) (0) tempFlg: 'T', //(1) (0)
} }
const { register, setValue, getValues, handleSubmit, resetField, control, watch } = useForm({ const { register, setValue, getValues, handleSubmit, resetField, control, watch } = useForm({
defaultValues: formInitValue, defaultValues: formInitValue,
@ -108,7 +108,6 @@ export default function StuffDetail() {
const [editMode, setEditMode] = useState('NEW') const [editMode, setEditMode] = useState('NEW')
const { managementState, setManagementState } = useContext(ManagementContext) const { managementState, setManagementState } = useContext(ManagementContext)
const [planGridProps, setPlanGridProps] = useState({ const [planGridProps, setPlanGridProps] = useState({
planGridData: [], planGridData: [],
isPageable: false, isPageable: false,
@ -283,6 +282,7 @@ export default function StuffDetail() {
{getMessage('stuff.detail.planGrid.btn1')} {getMessage('stuff.detail.planGrid.btn1')}
</button> </button>
<button <button
style={buttonStyle}
type="button" type="button"
className="grid-btn" className="grid-btn"
onClick={() => { onClick={() => {
@ -516,7 +516,6 @@ export default function StuffDetail() {
firstList = res firstList = res
favList = res.filter((row) => row.priority !== 'B') favList = res.filter((row) => row.priority !== 'B')
otherList = res.filter((row) => row.firstAgentYn === 'N') otherList = res.filter((row) => row.firstAgentYn === 'N')
setSaleStoreList(firstList) setSaleStoreList(firstList)
setFavoriteStoreList(firstList) setFavoriteStoreList(firstList)
setShowSaleStoreList(firstList) setShowSaleStoreList(firstList)
@ -547,6 +546,9 @@ export default function StuffDetail() {
form.setValue('otherSaleStoreLevel', managementState.saleStoreLevel) form.setValue('otherSaleStoreLevel', managementState.saleStoreLevel)
form.setValue('saleStoreLevel', '1') form.setValue('saleStoreLevel', '1')
form.setValue('saleStoreId', managementState.firstAgentId)
setSelOptions(managementState.firstAgentId)
} }
//No. //No.
@ -896,6 +898,8 @@ export default function StuffDetail() {
// //
const setPlanReqInfo = (info) => { const setPlanReqInfo = (info) => {
// console.log('session :::::::', session)
// console.log(' :::::::', info)
form.setValue('planReqNo', info.planReqNo) form.setValue('planReqNo', info.planReqNo)
form.setValue('objectStatusId', info.building) form.setValue('objectStatusId', info.building)
setSelectObjectStatusId(info.building) setSelectObjectStatusId(info.building)
@ -2032,8 +2036,8 @@ export default function StuffDetail() {
onChange={onSelectionChange} onChange={onSelectionChange}
getOptionLabel={(x) => x.saleStoreName} getOptionLabel={(x) => x.saleStoreName}
getOptionValue={(x) => x.saleStoreId} getOptionValue={(x) => x.saleStoreId}
isClearable={managementState.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : false} isClearable={managementState?.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : false}
isDisabled={managementState.tempFlg === '0' ? true : session?.storeLvl !== '1' ? true : false} isDisabled={managementState?.tempFlg === '0' ? true : session?.storeLvl !== '1' ? true : false}
value={saleStoreList.filter(function (option) { value={saleStoreList.filter(function (option) {
return option.saleStoreId === selOptions return option.saleStoreId === selOptions
})} })}
@ -2066,7 +2070,7 @@ export default function StuffDetail() {
getOptionValue={(x) => x.saleStoreId} getOptionValue={(x) => x.saleStoreId}
isClearable={false} isClearable={false}
isDisabled={ isDisabled={
managementState.tempFlg === '0' managementState?.tempFlg === '0'
? true ? true
: session?.storeLvl !== '1' : session?.storeLvl !== '1'
? true ? true
@ -2151,9 +2155,13 @@ export default function StuffDetail() {
getOptionLabel={(x) => x.saleStoreName} getOptionLabel={(x) => x.saleStoreName}
getOptionValue={(x) => x.saleStoreId} getOptionValue={(x) => x.saleStoreId}
isDisabled={ isDisabled={
managementState.tempFlg === '0' ? true : session?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true managementState?.tempFlg === '0'
? true
: session?.storeLvl === '1' && form.watch('saleStoreId') != ''
? false
: true
} }
isClearable={managementState.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : false} isClearable={managementState?.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : false}
value={otherSaleStoreList.filter(function (option) { value={otherSaleStoreList.filter(function (option) {
return option.saleStoreId === otherSelOptions return option.saleStoreId === otherSelOptions
})} })}

View File

@ -564,7 +564,8 @@ export default function StuffSearchCondition() {
<h3>{getMessage('stuff.search.title')}</h3> <h3>{getMessage('stuff.search.title')}</h3>
</div> </div>
<div className="left-unit-box"> <div className="left-unit-box">
<Link href="/management/stuff/tempdetail" scroll={false}> <Link href="/management/stuff/tempReg" scroll={false}>
{/* <Link href="/management/stuff/tempdetail" scroll={false}> */}
<button type="button" className="btn-origin navy mr5"> <button type="button" className="btn-origin navy mr5">
{getMessage('stuff.search.btn.register')} {getMessage('stuff.search.btn.register')}
</button> </button>

View File

@ -3,7 +3,7 @@ import { useContext, useEffect, useReducer, useState } from 'react'
import { useRecoilState, useRecoilValue } from 'recoil' import { useRecoilState, useRecoilValue } from 'recoil'
import { globalLocaleStore } from '@/store/localeAtom' import { globalLocaleStore } from '@/store/localeAtom'
import { estimateState, floorPlanObjectState } from '@/store/floorPlanObjectAtom' import { estimateState, floorPlanObjectState } from '@/store/floorPlanObjectAtom'
import { isObjectNotEmpty, isEmptyArray } from '@/util/common-utils' import { isObjectNotEmpty, isEmptyArray, isNotEmptyArray } from '@/util/common-utils'
import { SessionContext } from '@/app/SessionProvider' import { SessionContext } from '@/app/SessionProvider'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
import { useRouter } from 'next/navigation' import { useRouter } from 'next/navigation'
@ -158,12 +158,18 @@ export const useEstimateController = (planNo) => {
//기존에 첨부된 파일이 있으면 파일첨부관련 통과 //기존에 첨부된 파일이 있으면 파일첨부관련 통과
if (estimateData?.originFiles?.length > 0) { if (estimateData?.originFiles?.length > 0) {
originFileFlg = true let cnt = estimateData.originFiles.filter((file) => file.delFlg === '0').length
if (cnt == 0) {
originFileFlg = false
} else {
originFileFlg = true
}
} }
if (flag) { if (flag) {
if (!originFileFlg) { if (!originFileFlg) {
//기존에 첨부된 파일이 없으면 //기존에 첨부된 파일이 없으면
// if (estimateData.newFileList?.length < 1) {
if (isEmptyArray(estimateData.newFileList)) { if (isEmptyArray(estimateData.newFileList)) {
//새로 첨부한 파일이 없으면 //새로 첨부한 파일이 없으면
if (estimateData.itemList.length > 1) { if (estimateData.itemList.length > 1) {
@ -239,7 +245,6 @@ export const useEstimateController = (planNo) => {
//1. 첨부파일 저장시작 //1. 첨부파일 저장시작
const formData = new FormData() const formData = new FormData()
if (estimateData?.newFileList?.length > 0) { if (estimateData?.newFileList?.length > 0) {
// console.log('새로추가한 첨부파일있음:::', estimateData?.newFileList)
estimateData.newFileList.forEach((file) => { estimateData.newFileList.forEach((file) => {
formData.append('files', file) formData.append('files', file)
}) })
@ -252,6 +257,7 @@ export const useEstimateController = (planNo) => {
setFileList(res) setFileList(res)
}) })
} else { } else {
setFileList([])
realSave() realSave()
} }
} }
@ -312,6 +318,10 @@ export const useEstimateController = (planNo) => {
estimateData.deleteFileList = [] estimateData.deleteFileList = []
} }
if (estimateData.estimateType === 'YJSS') {
estimateData.pkgAsp = estimateData.pkgAsp.replaceAll(',', '')
}
console.log('최종저장::', estimateData) console.log('최종저장::', estimateData)
//2. 상세데이터 저장 //2. 상세데이터 저장
// return // return
@ -319,7 +329,7 @@ export const useEstimateController = (planNo) => {
await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => { await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => {
if (res.status === 201) { if (res.status === 201) {
estimateData.newFileList = [] estimateData.newFileList = []
estimateData.originFileList = [] // estimateData.originFiles = []
alert(getMessage('estimate.detail.save.alertMsg')) alert(getMessage('estimate.detail.save.alertMsg'))
//어디로 보낼지 //어디로 보낼지
fetchSetting(objectRecoil.floorPlanObjectNo, estimateData.planNo) fetchSetting(objectRecoil.floorPlanObjectNo, estimateData.planNo)

View File

@ -1,6 +1,6 @@
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useRecoilState } from 'recoil' import { useRecoilState } from 'recoil'
import { v4 as uuidv4, validate as isValidUUID } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { canvasState, currentCanvasPlanState, plansState, modifiedPlansState, modifiedPlanFlagState } from '@/store/canvasAtom' import { canvasState, currentCanvasPlanState, plansState, modifiedPlansState, modifiedPlanFlagState } from '@/store/canvasAtom'
import { useAxios } from '@/hooks/useAxios' import { useAxios } from '@/hooks/useAxios'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
@ -177,7 +177,7 @@ export function usePlan() {
* objectNo에 해당하는 canvas 목록을 조회 * objectNo에 해당하는 canvas 목록을 조회
*/ */
const getCanvasByObjectNo = async (userId, objectNo) => { const getCanvasByObjectNo = async (userId, objectNo) => {
return get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}/${userId}` }).then((res) => return await get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}/${userId}` }).then((res) =>
res.map((item, index) => ({ res.map((item, index) => ({
id: item.id, id: item.id,
userId: item.userId, userId: item.userId,
@ -234,15 +234,15 @@ export function usePlan() {
/** /**
* id에 해당하는 canvas 데이터를 삭제 * id에 해당하는 canvas 데이터를 삭제
*/ */
const delCanvasById = (id) => { const delCanvasById = async (id) => {
return promiseDel({ url: `/api/canvas-management/canvas-statuses/by-id/${id}` }) return await promiseDel({ url: `/api/canvas-management/canvas-statuses/by-id/${id}` })
} }
/** /**
* objectNo에 해당하는 canvas 데이터들을 삭제 * objectNo에 해당하는 canvas 데이터들을 삭제
*/ */
const delCanvasByObjectNo = (objectNo) => { const delCanvasByObjectNo = async (objectNo) => {
return promiseDel({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}` }) return await promiseDel({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}` })
} }
/** /**
@ -279,19 +279,19 @@ export function usePlan() {
* 새로운 plan 생성 * 새로운 plan 생성
* 현재 plan의 데이터가 있을 경우 복제 여부를 확인 * 현재 plan의 데이터가 있을 경우 복제 여부를 확인
*/ */
const handleAddPlan = (userId, objectNo) => { const handleAddPlan = async (userId, objectNo) => {
JSON.parse(currentCanvasData()).objects.length > 0 JSON.parse(currentCanvasData()).objects.length > 0
? swalFire({ ? swalFire({
text: `Plan ${currentCanvasPlan.ordering} ` + getMessage('plan.message.confirm.copy'), text: `Plan ${currentCanvasPlan.ordering} ` + getMessage('plan.message.confirm.copy'),
type: 'confirm', type: 'confirm',
confirmFn: () => { confirmFn: async () => {
postCanvasStatus(userId, objectNo, currentCanvasData()) await postCanvasStatus(userId, objectNo, currentCanvasData())
}, },
denyFn: () => { denyFn: async () => {
postCanvasStatus(userId, objectNo, '') await postCanvasStatus(userId, objectNo, '')
}, },
}) })
: postCanvasStatus(userId, objectNo, '') : await postCanvasStatus(userId, objectNo, '')
} }
/** /**
@ -314,10 +314,10 @@ export function usePlan() {
/** /**
* plan 삭제 * plan 삭제
*/ */
const handleDeletePlan = (e, id) => { const handleDeletePlan = async (e, id) => {
e.stopPropagation() // 이벤트 버블링 방지 e.stopPropagation() // 이벤트 버블링 방지
delCanvasById(id) await delCanvasById(id)
.then((res) => { .then((res) => {
setPlans((plans) => plans.filter((plan) => plan.id !== id)) setPlans((plans) => plans.filter((plan) => plan.id !== id))
setModifiedPlans((modifiedPlans) => modifiedPlans.filter((planId) => planId !== currentCanvasPlan.id)) setModifiedPlans((modifiedPlans) => modifiedPlans.filter((planId) => planId !== currentCanvasPlan.id))
@ -340,8 +340,8 @@ export function usePlan() {
/** /**
* plan 조회 * plan 조회
*/ */
const loadCanvasPlanData = (userId, objectNo, pid) => { const loadCanvasPlanData = async (userId, objectNo, pid) => {
getCanvasByObjectNo(userId, objectNo).then((res) => { await getCanvasByObjectNo(userId, objectNo).then((res) => {
// console.log('canvas 목록 ', res) // console.log('canvas 목록 ', res)
if (res.length > 0) { if (res.length > 0) {
setPlans(res) setPlans(res)

View File

@ -3,8 +3,8 @@ export const defaultSession = {}
export const sessionOptions = { export const sessionOptions = {
password: process.env.SESSION_SECRET, password: process.env.SESSION_SECRET,
cookieName: 'lama-session', cookieName: 'lama-session',
cookieOptions: { // cookieOptions: {
httpOnly: true, // httpOnly: true,
secure: process.env.NODE_ENV === 'production', // secure: process.env.NODE_ENV === 'production',
}, // },
} }

View File

@ -113,7 +113,7 @@ export const calculateFlowDirection = (canvasAngle) => {
return { return {
down: -canvasAngle, down: -canvasAngle,
up: 180 - canvasAngle, up: 180 - canvasAngle,
left: 90 - canvasAngle, left: 90 - canvasAngle < 180 ? 90 - canvasAngle : 90 - canvasAngle - 360,
right: -90 - canvasAngle, right: -90 - canvasAngle < -180 ? -90 - canvasAngle + 360 : -90 - canvasAngle,
} }
} }