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 { 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'

View File

@ -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 (
<>
<FloorPlanProvider>
<FloorPlan>
<CanvasLayout>{children}</CanvasLayout>
{pathname.includes('estimate') || pathname.includes('simulator') ? (
<div className="canvas-layout">{children}</div>
) : (
<CanvasLayout>{children}</CanvasLayout>
)}
{/* <CanvasLayout>{children}</CanvasLayout> */}
</FloorPlan>
</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'
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 (
<>
<div className={`form-flex-wrap ${style}`} key={fixedKey}>
<div className="input-wrap mr5" style={{ width: '610px' }} key={`roof${index}`}>
<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 className={`form-flex-wrap ${style}`} key={`roof_${row}`}>
<div className="input-wrap mr5" style={{ width: '610px' }}>
<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>
)
})}
</td>
@ -1122,7 +1154,8 @@ export default function Estimate({ params }) {
<ul className="file-list">
{originFiles.map((originFile) => {
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">
<span
style={{ display: originFile.delFlg === '0' ? '' : 'none' }}
@ -1185,7 +1218,8 @@ export default function Estimate({ params }) {
{specialNoteList.length > 0 &&
specialNoteList.map((row) => {
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="d-check-box light">
<input
@ -1193,7 +1227,9 @@ export default function Estimate({ params }) {
id={row.code}
checked={!!row.check}
disabled={row.code === 'ATTR001' || row.pkgYn === '1' ? true : false}
onClick={(event) => {
// readOnly
// onClick={(event) => {
onChange={() => {
setSpecialNoteList((specialNote) =>
specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)),
)
@ -1207,7 +1243,7 @@ export default function Estimate({ params }) {
settingShowContent(row.code)
}}
>
{row.codeNm}
{row.codeNm} / {row.code}
</span>
</div>
</div>
@ -1224,7 +1260,7 @@ export default function Estimate({ params }) {
if (isObjectNotEmpty(showcontent)) {
return (
<dl key={uuidv4()}>
<dl key={row.code}>
<dt>{showcontent.codeNm}</dt>
<dd dangerouslySetInnerHTML={{ __html: showcontent.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd>
</dl>
@ -1239,12 +1275,23 @@ export default function Estimate({ params }) {
}
})
})
return pushData.map((item) => (
<dl key={uuidv4()}>
<dt>{item.codeNm}</dt>
<dd dangerouslySetInnerHTML={{ __html: item.remarks }} style={{ whiteSpace: 'pre-wrap' }}></dd>
</dl>
))
//
let filterData = pushData.filter((item) => uniqueData.includes(item.code))
if (filterData.length > 0) {
return filterData.map((item) => (
<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 className="estimate-box">
<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 className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.supplyPrice')}</div>
@ -1316,7 +1363,7 @@ export default function Estimate({ params }) {
</div>
</td>
<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>
<td>{convertNumberToPriceDecimal(estimateContextState?.pkgTotPrice)}</td>
</tr>
@ -1331,14 +1378,19 @@ export default function Estimate({ params }) {
<div className="select-wrap">
{session?.storeLvl === '1' ? (
<select
key={uuidv4()}
// key={uuidv4()}
className="select-light"
onChange={(e) => {
onChangeStorePriceList(e.target.value)
}}
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 key={uuidv4()} className="select-light">
@ -1448,7 +1500,8 @@ export default function Estimate({ params }) {
<div className="form-flex-wrap">
<div className="select-wrap mr5">
<Select
id="long-value-select1"
// id="long-value-select1"
name="long-value-select1"
instanceId="long-value-select1"
className="react-select-custom"
classNamePrefix="custom"

View File

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

View File

@ -96,7 +96,8 @@ export default function Header(props) {
name: 'header.menus.management',
url: '',
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: [] },
],
},

View File

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

View File

@ -564,7 +564,8 @@ export default function StuffSearchCondition() {
<h3>{getMessage('stuff.search.title')}</h3>
</div>
<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">
{getMessage('stuff.search.btn.register')}
</button>

View File

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

View File

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

View File

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

View File

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