diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateList_new.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateList_new.jsp index 0916623..99d3a5d 100644 --- a/WebContent/WEB-INF/view/contractMgmt/estimateList_new.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/estimateList_new.jsp @@ -190,19 +190,8 @@ $(document).ready(function(){ return false; } - // 메일 발송 확인 - Swal.fire({ - title: '견적서 메일 발송', - text: "최종 차수의 견적서를 발송하시겠습니까?", - icon: 'question', - showCancelButton: true, - confirmButtonText: '발송', - cancelButtonText: '취소' - }).then((result) => { - if(result.isConfirmed){ - fn_sendEstimateMail(objId); - } - }); + // 메일 작성 팝업 열기 + fn_openMailFormPopup(objId); } }); @@ -683,309 +672,42 @@ function fn_showSerialNoPopup(serialNoString){ }); } -// 견적서 메일 발송 -function fn_sendEstimateMail(contractObjId){ +// 메일 작성 팝업 열기 +function fn_openMailFormPopup(contractObjId){ if(!contractObjId || contractObjId === ''){ Swal.fire("잘못된 요청입니다."); return; } - // 1단계: 견적서 템플릿 정보 조회 - Swal.fire({ - title: '견적서 조회 중...', - text: '잠시만 기다려주세요.', - allowOutsideClick: false, - onOpen: () => { - Swal.showLoading(); - } - }); + var popup_width = 950; + var popup_height = 800; + var url = "/contractMgmt/estimateMailFormPopup.do?contractObjId=" + contractObjId; - $.ajax({ - url: "/contractMgmt/getEstimateTemplateList.do", - type: "POST", - data: { objId: contractObjId }, - dataType: "json", - success: function(data){ - if(data.result === "success" && data.list && data.list.length > 0){ - // 최종 차수 견적서 찾기 - var latestEstimate = data.list[0]; // 이미 차수 내림차순으로 정렬되어 있음 - var templateObjId = latestEstimate.OBJID || latestEstimate.objid; - var templateType = latestEstimate.TEMPLATE_TYPE || latestEstimate.template_type || latestEstimate.templateType; - - // 2단계: 견적서 페이지를 새 창으로 열고 PDF 생성 - fn_generatePdfAndSendMail(contractObjId, templateObjId, templateType); - } else { - Swal.close(); - Swal.fire({ - title: '오류', - text: '견적서를 찾을 수 없습니다.', - icon: 'error' - }); - } - }, - error: function(xhr, status, error){ - Swal.close(); - console.error("견적서 조회 오류:", xhr, status, error); - Swal.fire({ - title: '오류', - text: '견적서 조회 중 오류가 발생했습니다.', - icon: 'error' - }); - } - }); + window.open(url, "estimateMailForm", "width="+popup_width+",height="+popup_height+",menubar=no,scrollbars=yes,resizable=yes"); } -// PDF 생성 및 메일 발송 +/* + * 아래 함수들은 자동 메일 발송 기능을 위한 것입니다. + * 현재는 메일 작성 팝업을 사용하므로 주석 처리합니다. + * 필요시 참고용으로 남겨둡니다. + */ + +/* +// PDF 생성 및 메일 발송 (자동) function fn_generatePdfAndSendMail(contractObjId, templateObjId, templateType){ - Swal.fire({ - title: 'PDF 생성 중...', - text: '견적서를 PDF로 변환하고 있습니다.', - allowOutsideClick: false, - onOpen: () => { - Swal.showLoading(); - } - }); - - // 견적서 페이지 URL 생성 - var url = ""; - if(templateType === "1"){ - url = "/contractMgmt/estimateTemplate1.do?templateObjId=" + templateObjId; - } else if(templateType === "2"){ - url = "/contractMgmt/estimateTemplate2.do?templateObjId=" + templateObjId; - } - - // 숨겨진 iframe으로 페이지 로드 - var iframe = $('