<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="ec" uri="/WEB-INF/tld/ecnet_tld.tld"%>

<link rel="stylesheet" href="/publish/css/estimate.css">
<script src="/publish/js/content.js"></script>
<!-- 스프레드시트(타뷸레이터)관련 js -->
<!-- <script src="/js/user/fax/tabulator.js"></script> -->
<!-- 주소록관련 js -->
<!-- <script src="/js/user/fax/addr.js"></script> -->
<!-- 엑셀불러오기관련 js -->
<!-- <script src="/js/user/fax/exelLoad.js"></script> -->

<!-- 현재 jsp에서 사용하는 file 관련 js  -->
<script>


	$(document).ready(function(){
		
		// pdf 파일 보기
		$('.fax_btn').click(function(){
			var fileNm = $(this).data('info');
			console.log('fileNm : ', fileNm);
			$('#convertForm #faxConvertFilePath').val(fileNm+'.pdf');
			var popWin = window.open('', 'previewPop', 'scrollbars=yes, width=1400, height=800');
			$('#convertForm').attr('action', '/web/mjon/fax/pdfPreview.do');
			$('#convertForm').attr('target', 'previewPop');
			$('#convertForm').submit();
		})
		
		// tif 파일 다운로드
		$('.tip_btn').click(function(){
			var fileNm = $(this).data('info');
			$('#convertForm #faxConvertFilePath').val(fileNm+'.tif');
			$('#convertForm').attr('action', '/web/mjon/fax/tifDownload.do');
			$('#convertForm').attr('target', '');
			$('#convertForm').submit();
		})
		
	});

	//새창 열림
	function fn_preview(fileNm){
	}

	function fn_pageMove(page){
		selectTemplateListLoad(page);
	}
	
	function selectTemplateListLoad(page){
	
		$('#listForm #page').val(page);
		$('#listForm').submit();
	}
	
	/*
	 * 템플린 사용하기 버튼 클릭 이벤트
	 */
	function openerCallTemplateDetail(templateCode){
		opener.fnTemplateDetail(templateCode);
		window.close();
	}
	
	/*
	 * 템플린 사용하기 버튼 클릭 이벤트
	 */
	function fn_close(){
		window.close();
	}




</script>

<form id="faxSendListForm" name="faxSendListForm" action="" method="post">
<%-- 	<input type="hidden" id="pageIndex" name="pageIndex" value="${searchVO.pageIndex}"/> --%>
<%-- 	<input type="hidden" name="searchSortCnd" id="searchSortCnd" value="<c:out value="${searchVO.searchSortCnd}" />" /> --%>
<%-- 	<input type="hidden" name="searchSortOrd" id="searchSortOrd" value="<c:out value="${searchVO.searchSortOrd}" />" /> --%>
<%-- 	<input type="hidden" name="pageUnit" id="pageUnit" value="<c:out value="${searchVO.pageUnit}" />" /> --%>
</form>

<form id="convertForm" name="convertForm" action="">
	<input type="hidden" id="faxConvertFilePath" name="faxConvertFilePath" value="" /> <!-- 변환파일 경로  -->
</form>
<div class="fax_detail_popup">
	<div class="popup_heading">
		<p>발송내역 상세</p>
		<!-- <button type="button" onclick="fn_close()"><img src="/publish/images/content/layerPopup_close.png" alt="팝업 닫기"></button> -->
	</div>
	<div class="tablePrint_wrap" style="width:900px;">
		<div class="list_info">
			<p>총 발송건수 <span class="c_e40000">${paginationInfo.totalRecordCount }</span>건</p>
		</div>
	<div class="tb_wrap">
			<table class="tType4">
				<colgroup>
					<col style="width: 15%;">
					<col style="width: auto;">
					<col style="width: 20%;">
					<col style="width: 13%;">
					<col style="width: 13%;">
				</colgroup>
				<thead>
					<tr>
						<th>수신번호</th>
						<th>전송문서 파일명</th>
						<th>문서보기</th>
						<th>발송금액</th>
						<th>전송결과</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach var="result" items="${faxDetailListVO }">
						<tr>
							<td>${result.addr }</td>
							<td>${result.orignlFileNm }</td>
							<td>
								<button type="button" class="btnType fax_btn" data-info="${result.convertSeq }">
									<span class="c_e40000 fwBold">PDF</span>문서
								</button>
								<button type="button" class="btnType tip_btn" data-info="${result.convertSeq }">
									<span class="c_19b32b fwBold">TIF</span>이미지
								</button>
							</td>
							<td>${result.eachPrice * result.page}</td>
							<td>
							<c:choose>
								<c:when test="${result.result == '정상수신'}">
									<p class="c_002c9a">${result.result }</p>
								</c:when>
								<c:otherwise>
									<p class="c_e40000">${result.result }</p>
								</c:otherwise>
							</c:choose> 
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	<c:if test="${!empty faxDetailListVO}">
	   <ul class="pagination">
	       <ui:pagination paginationInfo = "${paginationInfo}"  type="imageWeb" jsFunction="linkPage" />
	   </ul>
	</c:if>
	<div class="popup_btn_wrap2">
		<button type="button" onclick="fn_close()">닫기</button>
	</div>
</div>
