Merge pull request 'feature/survey : 조사매물 작성 및 제출 페이지 수정 사항 반영' (#97) from feature/survey into dev
Reviewed-on: #97
This commit is contained in:
commit
b5e7c94857
@ -277,9 +277,12 @@ export class SurveySalesService {
|
||||
* @returns {Promise<Blob>} PDF Blob
|
||||
*/
|
||||
async createSurveyPdf(survey: SurveyBasicInfo): Promise<Blob | ApiError> {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@ -183,18 +183,6 @@ export default function SurveySaleSubmitPopup() {
|
||||
-施工店名:
|
||||
<span style="color: #417DDC;">${surveyDetail?.constructionPoint ?? ' - '}</span>
|
||||
</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>
|
||||
`
|
||||
|
||||
|
||||
@ -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) {
|
||||
<div className="sale-form-btn-wrap">
|
||||
<div className="btn-flex-wrap">
|
||||
<ListButton />
|
||||
<TempButton handleSave={() => handleSave(true, false)} disabled={buttonDisabled} />
|
||||
<SaveButton handleSave={() => handleSave(false, false)} disabled={buttonDisabled} />
|
||||
{!isSubmit && permissions.isSubmiter && <SubmitButton handleSubmit={handleSubmit} disabled={buttonDisabled} />}
|
||||
<TempButton handleSave={() => handleSave(true)} disabled={buttonDisabled} />
|
||||
<SaveButton handleSave={() => handleSave(false)} disabled={buttonDisabled} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -92,7 +92,7 @@ export default function RoofForm(props: {
|
||||
onChange={(e) => handleUnitInput(e.target.value)}
|
||||
>
|
||||
<option value="" hidden>
|
||||
단위
|
||||
単位
|
||||
</option>
|
||||
<option value="A">A</option>
|
||||
<option value="kVA">kVA</option>
|
||||
|
||||
@ -37,9 +37,6 @@ export const CONFIRM_MESSAGE = {
|
||||
/** 삭제 확인 - "삭제하시겠습니까?" */
|
||||
DELETE_CONFIRM: '削除しますか?',
|
||||
|
||||
/** 저장 및 제출 확인 - "입력한 정보를 저장하고 보내시겠습니까?" */
|
||||
SAVE_AND_SUBMIT_CONFIRM: '記入した情報を保存して送信しますか?',
|
||||
|
||||
/** 문의 저장 확인 메세지 - "문의를 등록 하시겠습니까? 한화재팬 담당자에게 문의 메일이 발송됩니다." */
|
||||
SAVE_INQUIRY_CONFIRM: 'お問い合わせを登録しますか? Hanwha Japanの担当者にお問い合わせメールが送信されます。',
|
||||
}
|
||||
|
||||
@ -37,11 +37,32 @@ export async function sendEmail({ from, to, cc, subject, content, attachments, s
|
||||
'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 += `
|
||||
<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 트랜스포터 생성
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user