From 8001a027efe345b772958da270778ce545b507a6 Mon Sep 17 00:00:00 2001
From: keyy1315
Date: Tue, 8 Jul 2025 14:16:44 +0900
Subject: [PATCH 1/3] 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/3] 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/3] 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