feature/survey : 조사매물 작성 및 제출 페이지 수정 사항 반영 #97

Merged
seul merged 5 commits from feature/survey into dev 2025-07-08 14:41:55 +09:00
7 changed files with 38 additions and 49 deletions

View File

@ -277,9 +277,12 @@ export class SurveySalesService {
* @returns {Promise<Blob>} PDF Blob * @returns {Promise<Blob>} PDF Blob
*/ */
async createSurveyPdf(survey: SurveyBasicInfo): Promise<Blob | ApiError> { async createSurveyPdf(survey: SurveyBasicInfo): Promise<Blob | ApiError> {
const convertedSurvey = convertToCamelCase(survey) as SurveyBasicInfo if (!survey) {
const content = React.createElement(Document, null, React.createElement(SurveySalePdf, { survey: convertedSurvey })) return new ApiError(HttpStatusCode.NotFound, ERROR_MESSAGE.NOT_FOUND)
}
try { 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 pdfBlob = await pdf(content).toBlob()
const arrayBuffer = await pdfBlob.arrayBuffer() const arrayBuffer = await pdfBlob.arrayBuffer()
return new Blob([arrayBuffer], { type: 'application/pdf' }) 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 { private checkAdminSubRole(survey: any, storeId: string | null, storeNm: string | null): boolean {
if (!storeId) return false if (!storeId) return false
return survey.SUBMISSION_STATUS return survey.SUBMISSION_STATUS
? survey.SUBMISSION_TARGET_ID === storeId || ? survey.SUBMISSION_TARGET_ID === storeId || survey.SUBMISSION_TARGET_NM === storeNm || survey.STORE_ID === storeId
survey.SUBMISSION_TARGET_NM === storeNm ||
survey.STORE_ID === storeId
: survey.STORE_ID === storeId : survey.STORE_ID === storeId
} }

View File

@ -183,18 +183,6 @@ export default function SurveySaleSubmitPopup() {
-: -:
<span style="color: #417DDC;">${surveyDetail?.constructionPoint ?? ' - '}</span> <span style="color: #417DDC;">${surveyDetail?.constructionPoint ?? ' - '}</span>
</p> </p>
<p>
<a
style="font-size: 13px; font-weight: 400; color: #1259CB; margin-bottom: 5px; text-decoration: underline;"
href="${process.env.NEXT_PUBLIC_API_URL}/api/survey-sales/${surveyDetail?.id}?isPdf=true"
target="_blank"
>
調PDFダウンロード
</a>
</p>
<p style="font-size: 13px; font-weight: 400; color: #2e3a59;">
調PDFをダウンロードできます
</p>
</div> </div>
` `

View File

@ -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) const emptyField = validateSurveyDetail(data.roof)
if (isTemporary) { if (isTemporary) {
tempSaveProcess() tempSaveProcess()
} else { } 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 (emptyField?.trim() === '') {
if (!isSubmitProcess) { showConfirm(CONFIRM_MESSAGE.SAVE_CONFIRM, async () => {
showConfirm(CONFIRM_MESSAGE.SAVE_CONFIRM, async () => { await handleSuccessfulSave()
await handleSuccessfulSave(isSubmitProcess) })
})
} else {
await handleSuccessfulSave(isSubmitProcess)
}
} else { } else {
handleFailedSave(emptyField) handleFailedSave(emptyField)
} }
@ -208,10 +204,6 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
return return
} }
popupController.setSurveySaleSubmitPopup(true) 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) {
<div className="sale-form-btn-wrap"> <div className="sale-form-btn-wrap">
<div className="btn-flex-wrap"> <div className="btn-flex-wrap">
<ListButton /> <ListButton />
<TempButton handleSave={() => handleSave(true, false)} disabled={buttonDisabled} /> <TempButton handleSave={() => handleSave(true)} disabled={buttonDisabled} />
<SaveButton handleSave={() => handleSave(false, false)} disabled={buttonDisabled} /> <SaveButton handleSave={() => handleSave(false)} disabled={buttonDisabled} />
{!isSubmit && permissions.isSubmiter && <SubmitButton handleSubmit={handleSubmit} disabled={buttonDisabled} />}
</div> </div>
</div> </div>
)} )}

View File

@ -102,15 +102,6 @@ export default function DetailForm() {
return return
}, [modeset, id, pathname]) }, [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(() => { useEffect(() => {
if (!session?.isLoggedIn) return if (!session?.isLoggedIn) return

View File

@ -92,7 +92,7 @@ export default function RoofForm(props: {
onChange={(e) => handleUnitInput(e.target.value)} onChange={(e) => handleUnitInput(e.target.value)}
> >
<option value="" hidden> <option value="" hidden>
</option> </option>
<option value="A">A</option> <option value="A">A</option>
<option value="kVA">kVA</option> <option value="kVA">kVA</option>

View File

@ -37,9 +37,6 @@ export const CONFIRM_MESSAGE = {
/** 삭제 확인 - "삭제하시겠습니까?" */ /** 삭제 확인 - "삭제하시겠습니까?" */
DELETE_CONFIRM: '削除しますか?', DELETE_CONFIRM: '削除しますか?',
/** 저장 및 제출 확인 - "입력한 정보를 저장하고 보내시겠습니까?" */
SAVE_AND_SUBMIT_CONFIRM: '記入した情報を保存して送信しますか?',
/** 문의 저장 확인 메세지 - "문의를 등록 하시겠습니까? 한화재팬 담당자에게 문의 메일이 발송됩니다." */ /** 문의 저장 확인 메세지 - "문의를 등록 하시겠습니까? 한화재팬 담당자에게 문의 메일이 발송됩니다." */
SAVE_INQUIRY_CONFIRM: 'お問い合わせを登録しますか? Hanwha Japanの担当者にお問い合わせメールが送信されます。', SAVE_INQUIRY_CONFIRM: 'お問い合わせを登録しますか? Hanwha Japanの担当者にお問い合わせメールが送信されます。',
} }

View File

@ -37,11 +37,32 @@ export async function sendEmail({ from, to, cc, subject, content, attachments, s
'Content-Type': 'application/pdf', 'Content-Type': 'application/pdf',
}, },
}) })
const pdfBlob = await resp.blob() if (resp.status == 200) {
surveyPdfBuffer = Buffer.from(await pdfBlob.arrayBuffer()) const pdfBlob = await resp.blob()
surveyPdfBuffer = Buffer.from(await pdfBlob.arrayBuffer())
}
} }
const surveyPdfAttachment = surveyPdfBuffer ? [{ filename: '[HANASYS現地調査]' + surveyPdf?.filename + '.pdf', content: surveyPdfBuffer }] : [] const surveyPdfAttachment = surveyPdfBuffer ? [{ filename: '[HANASYS現地調査]' + surveyPdf?.filename + '.pdf', content: surveyPdfBuffer }] : []
if (!surveyPdfBuffer && surveyPdf) {
content += `
<div>
<p>
<a
style="font-size: 13px; font-weight: 400; color: #1259CB; margin-bottom: 5px; text-decoration: underline;"
href="${process.env.NEXT_PUBLIC_API_URL}/api/survey-sales/${surveyPdf.id}?isPdf=true"
target="_blank"
>
調PDFダウンロード
</a>
</p>
<p style="font-size: 13px; font-weight: 400; color: #2e3a59;">
調PDFをダウンロードできます
</p>
</div>
`
}
/** /**
* @description SMTP * @description SMTP
*/ */