From 8001a027efe345b772958da270778ce545b507a6 Mon Sep 17 00:00:00 2001
From: keyy1315
Date: Tue, 8 Jul 2025 14:16:44 +0900
Subject: [PATCH 1/5] fix: delete PDF download links at submit mail and added
PDF download defense handling
---
src/app/api/survey-sales/service.ts | 11 ++++----
.../popup/SurveySaleSubmitPopup.tsx | 12 ---------
src/libs/mailer.ts | 27 ++++++++++++++++---
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/src/app/api/survey-sales/service.ts b/src/app/api/survey-sales/service.ts
index b9bfbd8..6619e7c 100644
--- a/src/app/api/survey-sales/service.ts
+++ b/src/app/api/survey-sales/service.ts
@@ -277,9 +277,12 @@ export class SurveySalesService {
* @returns {Promise} PDF Blob
*/
async createSurveyPdf(survey: SurveyBasicInfo): Promise {
- const convertedSurvey = convertToCamelCase(survey) as SurveyBasicInfo
- const content = React.createElement(Document, null, React.createElement(SurveySalePdf, { survey: convertedSurvey }))
+ if (!survey) {
+ return new ApiError(HttpStatusCode.NotFound, ERROR_MESSAGE.NOT_FOUND)
+ }
try {
+ const convertedSurvey = convertToCamelCase(survey) as SurveyBasicInfo
+ const content = React.createElement(Document, null, React.createElement(SurveySalePdf, { survey: convertedSurvey }))
const pdfBlob = await pdf(content).toBlob()
const arrayBuffer = await pdfBlob.arrayBuffer()
return new Blob([arrayBuffer], { type: 'application/pdf' })
@@ -427,9 +430,7 @@ export class SurveySalesService {
private checkAdminSubRole(survey: any, storeId: string | null, storeNm: string | null): boolean {
if (!storeId) return false
return survey.SUBMISSION_STATUS
- ? survey.SUBMISSION_TARGET_ID === storeId ||
- survey.SUBMISSION_TARGET_NM === storeNm ||
- survey.STORE_ID === storeId
+ ? survey.SUBMISSION_TARGET_ID === storeId || survey.SUBMISSION_TARGET_NM === storeNm || survey.STORE_ID === storeId
: survey.STORE_ID === storeId
}
diff --git a/src/components/popup/SurveySaleSubmitPopup.tsx b/src/components/popup/SurveySaleSubmitPopup.tsx
index db5cbe3..4c8b4fa 100644
--- a/src/components/popup/SurveySaleSubmitPopup.tsx
+++ b/src/components/popup/SurveySaleSubmitPopup.tsx
@@ -183,18 +183,6 @@ export default function SurveySaleSubmitPopup() {
-施工店名:
${surveyDetail?.constructionPoint ?? ' - '}
-
-
- 現地調査結果PDFダウンロード
-
-
-
- ※リンクをクリックしてローカル調査結果PDFをダウンロードできます。
-
`
diff --git a/src/libs/mailer.ts b/src/libs/mailer.ts
index 10baec3..67bab86 100644
--- a/src/libs/mailer.ts
+++ b/src/libs/mailer.ts
@@ -31,17 +31,38 @@ export async function sendEmail({ from, to, cc, subject, content, attachments, s
*/
let surveyPdfBuffer: Buffer | null = null
if (surveyPdf) {
- const resp = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/survey-sales/${surveyPdf.id}?isPdf=true`, {
+ const resp = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/survey-sales/${0}?isPdf=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/pdf',
},
})
- const pdfBlob = await resp.blob()
- surveyPdfBuffer = Buffer.from(await pdfBlob.arrayBuffer())
+ if (resp.status == 200) {
+ const pdfBlob = await resp.blob()
+ surveyPdfBuffer = Buffer.from(await pdfBlob.arrayBuffer())
+ }
}
const surveyPdfAttachment = surveyPdfBuffer ? [{ filename: '[HANASYS現地調査]' + surveyPdf?.filename + '.pdf', content: surveyPdfBuffer }] : []
+ if (!surveyPdfBuffer && surveyPdf) {
+ content += `
+
+ `
+ }
+
/**
* @description SMTP 트랜스포터 생성
*/
--
2.47.2
From df6d5e964cf6c93c3cabcb0570909f670bb041b5 Mon Sep 17 00:00:00 2001
From: keyy1315
Date: Tue, 8 Jul 2025 14:17:10 +0900
Subject: [PATCH 2/5] fix: delete submit button at regist, edit form
---
.../survey-sale/detail/ButtonForm.tsx | 25 ++++++-------------
.../survey-sale/detail/DetailForm.tsx | 9 -------
src/hooks/useAlertMsg.ts | 3 ---
3 files changed, 8 insertions(+), 29 deletions(-)
diff --git a/src/components/survey-sale/detail/ButtonForm.tsx b/src/components/survey-sale/detail/ButtonForm.tsx
index d7063da..cbc7497 100644
--- a/src/components/survey-sale/detail/ButtonForm.tsx
+++ b/src/components/survey-sale/detail/ButtonForm.tsx
@@ -95,13 +95,13 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
}
/** 저장 로직 */
- const handleSave = (isTemporary: boolean, isSubmitProcess: boolean) => {
+ const handleSave = (isTemporary: boolean) => {
const emptyField = validateSurveyDetail(data.roof)
if (isTemporary) {
tempSaveProcess()
} else {
- saveProcess(emptyField, isSubmitProcess)
+ saveProcess(emptyField)
}
}
@@ -133,15 +133,11 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
}
/** 저장 로직 */
- const saveProcess = async (emptyField: string | null, isSubmitProcess?: boolean) => {
+ const saveProcess = async (emptyField: string | null) => {
if (emptyField?.trim() === '') {
- if (!isSubmitProcess) {
- showConfirm(CONFIRM_MESSAGE.SAVE_CONFIRM, async () => {
- await handleSuccessfulSave(isSubmitProcess)
- })
- } else {
- await handleSuccessfulSave(isSubmitProcess)
- }
+ showConfirm(CONFIRM_MESSAGE.SAVE_CONFIRM, async () => {
+ await handleSuccessfulSave()
+ })
} else {
handleFailedSave(emptyField)
}
@@ -208,10 +204,6 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
return
}
popupController.setSurveySaleSubmitPopup(true)
- } else {
- showConfirm(CONFIRM_MESSAGE.SAVE_AND_SUBMIT_CONFIRM, async () => {
- handleSave(false, true)
- })
}
}
@@ -254,9 +246,8 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
- handleSave(true, false)} disabled={buttonDisabled} />
- handleSave(false, false)} disabled={buttonDisabled} />
- {!isSubmit && permissions.isSubmiter && }
+ handleSave(true)} disabled={buttonDisabled} />
+ handleSave(false)} disabled={buttonDisabled} />
)}
diff --git a/src/components/survey-sale/detail/DetailForm.tsx b/src/components/survey-sale/detail/DetailForm.tsx
index 2034ede..a0f6dcc 100644
--- a/src/components/survey-sale/detail/DetailForm.tsx
+++ b/src/components/survey-sale/detail/DetailForm.tsx
@@ -102,15 +102,6 @@ export default function DetailForm() {
return
}, [modeset, id, pathname])
- /** 제출 팝업 처리 - createSurvey 이후 popup 처리 시 노드 삽입 오류로 인해 별도 처리 */
- useEffect(() => {
- const show = searchParams.get('show')
- if (show === 'true' && !isLoadingSurveyDetail) {
- popupController.setSurveySaleSubmitPopup(true)
- router.replace(pathname)
- }
- }, [searchParams, pathname, isLoadingSurveyDetail])
-
/** 세션 데이터가 변경될 때 기본 정보 업데이트 */
useEffect(() => {
if (!session?.isLoggedIn) return
diff --git a/src/hooks/useAlertMsg.ts b/src/hooks/useAlertMsg.ts
index 43b7313..a1281b1 100644
--- a/src/hooks/useAlertMsg.ts
+++ b/src/hooks/useAlertMsg.ts
@@ -37,9 +37,6 @@ export const CONFIRM_MESSAGE = {
/** 삭제 확인 - "삭제하시겠습니까?" */
DELETE_CONFIRM: '削除しますか?',
- /** 저장 및 제출 확인 - "입력한 정보를 저장하고 보내시겠습니까?" */
- SAVE_AND_SUBMIT_CONFIRM: '記入した情報を保存して送信しますか?',
-
/** 문의 저장 확인 메세지 - "문의를 등록 하시겠습니까? 한화재팬 담당자에게 문의 메일이 발송됩니다." */
SAVE_INQUIRY_CONFIRM: 'お問い合わせを登録しますか? Hanwha Japanの担当者にお問い合わせメールが送信されます。',
}
--
2.47.2
From 81d14c3248bda7f44bb669dd2ad2a6b1db188354 Mon Sep 17 00:00:00 2001
From: keyy1315
Date: Tue, 8 Jul 2025 14:17:39 +0900
Subject: [PATCH 3/5] fix: update unit labelt from Korean to Japanese
---
src/components/survey-sale/detail/RoofForm.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/survey-sale/detail/RoofForm.tsx b/src/components/survey-sale/detail/RoofForm.tsx
index d00d2c7..d6d97e0 100644
--- a/src/components/survey-sale/detail/RoofForm.tsx
+++ b/src/components/survey-sale/detail/RoofForm.tsx
@@ -92,7 +92,7 @@ export default function RoofForm(props: {
onChange={(e) => handleUnitInput(e.target.value)}
>
--
2.47.2
From b1ae275e177c21a5d79e1c9dfee787fce8935f3a Mon Sep 17 00:00:00 2001
From: keyy1315
Date: Tue, 8 Jul 2025 14:26:06 +0900
Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=EC=A1=B0=EC=82=AC=EB=A7=A4=EB=AC=BC?=
=?UTF-8?q?=20PDF=20=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20=EB=A7=81?=
=?UTF-8?q?=ED=81=AC=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/libs/mailer.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/libs/mailer.ts b/src/libs/mailer.ts
index 67bab86..aafa586 100644
--- a/src/libs/mailer.ts
+++ b/src/libs/mailer.ts
@@ -31,7 +31,7 @@ export async function sendEmail({ from, to, cc, subject, content, attachments, s
*/
let surveyPdfBuffer: Buffer | null = null
if (surveyPdf) {
- const resp = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/survey-sales/${0}?isPdf=true`, {
+ const resp = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/survey-sales/${surveyPdf.id}?isPdf=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/pdf',
@@ -62,6 +62,7 @@ export async function sendEmail({ from, to, cc, subject, content, attachments, s
`
}
+ console.log('content:: ', content)
/**
* @description SMTP 트랜스포터 생성
--
2.47.2
From 3b17d3df0f3288e1650d1cd8c3d40e5a5521388e Mon Sep 17 00:00:00 2001
From: keyy1315
Date: Tue, 8 Jul 2025 14:32:52 +0900
Subject: [PATCH 5/5] =?UTF-8?q?fix:=20console.log=20=EA=B5=AC=EB=AC=B8=20?=
=?UTF-8?q?=EC=82=AD=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/libs/mailer.ts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/libs/mailer.ts b/src/libs/mailer.ts
index aafa586..02de6bb 100644
--- a/src/libs/mailer.ts
+++ b/src/libs/mailer.ts
@@ -62,8 +62,7 @@ export async function sendEmail({ from, to, cc, subject, content, attachments, s
`
}
- console.log('content:: ', content)
-
+
/**
* @description SMTP 트랜스포터 생성
*/
--
2.47.2