-
+
+ {/* */}
diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js
index dea8c9aa..28037be5 100644
--- a/src/hooks/floorPlan/estimate/useEstimateController.js
+++ b/src/hooks/floorPlan/estimate/useEstimateController.js
@@ -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)
diff --git a/src/hooks/usePlan.js b/src/hooks/usePlan.js
index 7e76cac5..b12468b4 100644
--- a/src/hooks/usePlan.js
+++ b/src/hooks/usePlan.js
@@ -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)
diff --git a/src/lib/session.js b/src/lib/session.js
index ff5a2078..bcedecf4 100644
--- a/src/lib/session.js
+++ b/src/lib/session.js
@@ -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',
+ // },
}
diff --git a/src/util/common-utils.js b/src/util/common-utils.js
index fd8f6ca5..06b96b60 100644
--- a/src/util/common-utils.js
+++ b/src/util/common-utils.js
@@ -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,
}
}