<%--
  Class Name : SendNumberList.jsp
  Description : 발신번호 리스트 조회 페이지
  Modification Information

      수정일         수정자                   수정내용
    -------    --------    ---------------------------
    2021.03.31    신명섭          최초 생성

    Copyright (C) 2009 by ITN  All right reserved.
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ 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"%>
<script src="/publish/js/content.js"></script>
<script>
$(document).ready(function(){
	/* 목록 정렬 항목 아이콘 표시 */ 
	var searchSortCnd = $("[name='searchSortCnd']").val();
	var searchSortOrd = $("[name='searchSortOrd']").val();
	if (searchSortCnd != "" && searchSortOrd != "" && searchSortCnd  != undefined && searchSortOrd  != undefined) {
		var $sort_div = $("#sort_"+ searchSortCnd);
		var sortClass = 'sortBtn' ;
		if (searchSortOrd == "desc") sortClass = "sortBtnDesc";
		$sort_div.replaceClass('sortBtn' , sortClass) ;
		$sort_div.attr("sortOrd", searchSortOrd);
	}

	// 정렬 항목 이벤트
	$(".sort").click(function(e) {
		listSortOrd(this);
	});

	//목록 정렬 항목 클릭
	function listSortOrd(obj){
		var sortOrd = $(obj).attr("sortOrd");
		var sortCnd = $(obj).attr("id");
		 
		$("[name='searchSortCnd']").val(sortCnd.substring(5)); // 구분자 제거
		if (sortOrd == "desc") $("[name='searchSortOrd']").val("asc");
		else $("[name='searchSortOrd']").val("desc");
		linkPage('1');  //각 JSP마다 다를때 메소드 정의해 줘야됨
	}
	
	
	
});

</script>
<form name="listForm" action="<c:url value='/web/mjon/addrBlock/selectBlockList.do'/>" method="post">
	<input name="pageIndex" type="hidden" value="<c:out value='${searchVO.pageIndex}'/>"/>
	<input type="hidden" name="pageType" />	
	<input type="hidden" name="searchSortCnd" value="<c:out value="${searchVO.searchSortCnd}" />" />
	<input type="hidden" name="searchSortOrd" value="<c:out value="${searchVO.searchSortOrd}" />" />
	<input type="hidden" name="selectedId" />
	<input type="hidden" name="blockType" id="blockType" />
	
	<!-- content 영역 -->
    <div class="price_history_cont current" id="listTab2_1">
        <div class="excel_middle">
            <div class="select_btnWrap clearfix">
                <div class="btn_left">
                    <span class="cal_label">기간선택</span>
					<div class="calendar_wrap">
						<input type="text" class="startDate inp calendar" title="검색 시작일" id="startDate" name="startDate" value="<c:out value="${searchVO.startDate}" />" data-datecontrol="true">
						<span class="dateEtc">~</span>
						<input type="text" class="endDate inp calendar" title="검색 종료일" id="endDate" name="endDate" value="<c:out value="${searchVO.endDate}" />" data-datecontrol="true">
					</div>
						<button type="button" onclick="setCalVal(lastfulstday,'startDate');setCalVal( lastfuledday,'endDate'); return false;"  class="btnType btnType19">전월</button>
						<button type="button" onclick="setCalVal(thisfulstlday,'startDate');setCalVal( thisfuledtlday,'endDate'); return false;"  class="btnType btnType19">당월</button>
						<button type="button" onclick="linkPage(1); return false;" class="btnType btnType6">조회</button>
						<button type="button" onclick="$('input[name=startDate]').val(''); $('input[name=endDate]').val('') ;return false;" class="btnType btnType17">기간 초기화</button>
                </div>
                <div class="btn_right">
                    <div class="search">
                        <label for="searchNameUserId" class="label"></label>
                        <input type="text" name="searchNameUserId" placeholder="성명 또는 수신번호" onfocus="this.placeholder=''" onblur="this.placeholder='성명 또는 수신번호'">
                        <button type="button" class="btnType btnType2" onclick="linkPage(1); return false;">검색</button>
                    </div>
                </div>
            </div>
        </div>
                            		
		
        <div class="table_cont current adr_2">
            <div class="list_info">
                <p>총 <span class="c_e40000"><fmt:formatNumber value="${paginationInfo.totalRecordCount}" pattern="#,###"/></span>건</p>
                <div>
					<button type="button" id="btnBlockDel" class="btnType btnType15"><i class="remove_img"></i>수신거부 목록에서 삭제</button>
					<button type="button" id="btnAddrDel" class="btnType btnType15"><i class="remove_img"></i>주소록에서 삭제</button>
					<button type="button" id="btnBlockExcel" class="excel_btn btnType"><i class="downroad"></i>엑셀 다운로드</button>
					<label for="pageUnit" class="label">검색조건 선택</label> <select name="pageUnit" id="pageUnit"
						class="selType2" onchange="linkPage(1);">
						<option value='10' <c:if test="${searchVO.pageUnit == '10' or searchVO.pageUnit == ''}">selected</c:if>>10줄</option>
						<option value='20' <c:if test="${searchVO.pageUnit == '20'}">selected</c:if>>20줄</option>
						<option value='30' <c:if test="${searchVO.pageUnit == '30'}">selected</c:if>>30줄</option>
					</select>
                </div>
            </div>
        </div>		
		

		<div class="tb_wrap">
			<table class="tType4">
				<colgroup>
                  <col style="width: 40px;">
                  <col style="width: 12%;">
                  <col style="width: 20%;">
                  <col style="width: 20%;">
                  <col style="width: 20%;">
                  <col style="width: autopx;">
				</colgroup>
				<thead>
					<tr>
						<th>
							<label for="" class="label">전체 선택</label>
							<input type="checkbox" id="chkAll">
						</th>
						<th>
							번호
							<div class="sort_wrap">
								<input type="button" class="sort sortBtn" id="sort_blockId">
							</div>
						</th>
						<th>
							거부번호
							<div class="sort_wrap">
								<input type="button" class="sort sortBtn" id="sort_phone">
							</div>
						</th>
						<th>
							수신자
							<div class="sort_wrap">
								<input type="button" class="sort sortBtn" id="sort_name">
							</div>
						</th>						
						<th>
							등록일시
							<div class="sort_wrap">
								<input type="button" class="sort sortBtn" id="sort_regDate">
							</div>
						</th>
						<th>
							결과알림
						</th>
					</tr>
				</thead>
				<tbody>
				<c:choose>
					<c:when test="${not empty resultList}">
						<c:forEach var="result" items="${resultList}" varStatus="status">
						<tr>
							<td>
								<label for="" class="label">한 줄 전체 선택</label> 
								<c:if test="${result.blockType eq '1'}">
									<input type="checkbox" name="blockCheck" value="${result.blockId}" class="080Check">
								</c:if>
								<c:if test="${result.blockType eq '2'}">
									<input type="checkbox" name="blockCheck" value="${result.blockId}" class="SelfCheck">
								</c:if>									
							</td>						
							<td>
								<c:if test="${searchVO.searchSortOrd eq 'desc' }">
		                			<c:out value="${ ( paginationInfo.totalRecordCount - ((paginationInfo.currentPageNo -1)*paginationInfo.recordCountPerPage) ) - status.index }"/>
			                	</c:if>
			                	<c:if test="${searchVO.searchSortOrd eq 'asc' }">
									<c:out value="${(paginationInfo.currentPageNo - 1) * paginationInfo.recordCountPerPage + status.count}"/>
			                	</c:if>
							</td>
							<td><p><c:out value="${result.phone}"/></p></td>
							<td><p><c:out value="${result.name}"/></p></td>
							<td><c:out value="${result.regDate}"/></td>
							<td>
								<c:if test="${result.blockType eq '1'}">
									<c:if test="${result.isBlockResult eq '0'}">
		                                <button class="btnType btnType20" data-tooltip="adr_popup11" onclick="SetBlockResultMode(this, '<c:out value="${result.blockId}"/>'); return false;">결과전송 <span class="adr2_hover">?</span></button>
		                                <div class="adr2_hover_cont">
		                                    <p>결과전송이란?</p>
		                                    <span>정보통신망에 관한 법률 제50조제7항및제62조의2 (영리목적의 광고성 정보를 전송하려는 사업자는 수신거부를 표시한 날로부터 14일 이내에 수신거부 결과를 통보해야 함)</span>
		                                </div>									
									</c:if>
									<c:if test="${result.isBlockResult eq '1'}">
										전송완료
									</c:if>									
								</c:if>
								<c:if test="${result.blockType eq '2'}">
									-
								</c:if>																						
							</td>
						</tr>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<tr>
							<td colspan="6">
								<spring:message code="common.nodata.msg" />
							</td>
						</tr>
					</c:otherwise>
				</c:choose>
				</tbody>
			</table>
		</div>
		
		<!-- pagination -->
		<c:if test="${!empty resultList}">
			<ul class="pagination">
				<ui:pagination paginationInfo = "${paginationInfo}"  type="imageWeb" jsFunction="linkPage" />
			</ul>
		</c:if>
		<!-- pagination -->
	</div>

 	<!-- Workaround to avoid corrupted XHR2 request body in IE10 / IE11 -->
 	<input type="hidden" name="_dontcare">
</form>


