itn 2023-08-23
팩스 주소록 메모 수정기능 보완
@b7208fb3e3fb346dba9723af57e97be935d249bd
src/main/java/itn/let/fax/addr/web/FaxAddrController.java
--- src/main/java/itn/let/fax/addr/web/FaxAddrController.java
+++ src/main/java/itn/let/fax/addr/web/FaxAddrController.java
@@ -317,7 +317,43 @@
 		return "/web/fax/addr/FaxAddrListPrint";
 	}
 	
-	
+	/**
+	 * 주소록 상세정보 ajax
+	 * @param addrCheck
+	 * @param request
+	 * @param addrVO
+	 * @param model
+	 * @param redirectAttributes
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/web/mjon/fax/addr/selectFaxAddrDetailAjax.do")
+	public ModelAndView selectAddrDetailAjax(HttpServletRequest request, 
+			FaxAddrVO addrVO, Model model) throws Exception {
+		
+		ModelAndView modelAndView = new ModelAndView();
+		modelAndView.setViewName("jsonView");
+
+		boolean isSuccess = true;
+		String msg = "";		
+		FaxAddrVO addrInfo = null;
+		
+		try {
+			
+			addrInfo = faxAddrService.selectFaxAddrDetail(addrVO);
+
+		} catch (Exception e) {
+			isSuccess = false;
+			msg = e.getMessage();
+		}
+		
+		modelAndView.addObject("isSuccess", isSuccess);
+		modelAndView.addObject("msg", msg);
+		modelAndView.addObject("addrInfo", addrInfo);
+		
+		return modelAndView;
+		
+	}	
 	
 	/**
 	 * 주소록 그룹 삭제 로직 ajax
src/main/webapp/WEB-INF/jsp/web/fax/addr/FaxAddrListAjax.jsp
--- src/main/webapp/WEB-INF/jsp/web/fax/addr/FaxAddrListAjax.jsp
+++ src/main/webapp/WEB-INF/jsp/web/fax/addr/FaxAddrListAjax.jsp
@@ -214,12 +214,32 @@
 }
 
 //메모 레이어 열 때 메모 데이터 전달
-function memoOpen(comment, id) {
+function memoOpen(id) {
 	var form = document.addrMemoForm;
 	form.addrCheck.value=id;
-	$('#textareaMemo').text(comment);
-	
+
+	// 메모내용 가져오기
+	$.ajax({
+		url : "<c:url value='/web/mjon/fax/addr/selectFaxAddrDetailAjax.do'/>", 
+		type : 'POST', 
+		data : {"addrId" : id},
+		dataType:'json',
+		async: false,
+		success : function(data, status){
+			if(data.isSuccess == true) {
+				$('#textareaMemo').text(data.addrInfo.addrComment);
+			} 
+			else {
+				//alert("Message : " + msg);
+			}			
+		},
+		error: function (e) { 
+			console.log("ERROR : ", e); 
+			alert("에러가 발생했습니다.");  
+		}
+	});	
 }
+
 // 메모 저장
 function updateMemo() {
 	var form = document.addrMemoForm;
@@ -672,7 +692,7 @@
 									</p>
 								</td>
 								<td>
-									<button type="button" onclick="memoOpen('<c:out value='${result.addrComment}' />','<c:out value='${result.addrId}' />'); return false;" data-tooltip="adr_popup13">
+									<button type="button" onclick="memoOpen('<c:out value='${result.addrId}' />'); return false;" data-tooltip="adr_popup13">
 										<img src="/publish/images/content/memo_img.png" alt="메모">
 									</button>
 								</td>
Add a comment
List