<%--
  Class Name : EgovLoginPolicyList.jsp
  Description : EgovLoginPolicyList 화면
  Modification Information

      수정일         수정자                   수정내용
    -------    --------    ---------------------------
     2009.02.01   lee.m.j            최초 생성
     2011.08.31   JJY       경량환경 버전 생성

    author   : 공통서비스 개발팀 lee.m.j
    since    : 2009.02.01
--%>
<%@ page 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="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ page import="itn.com.cmm.LoginVO"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="ko">
<title>회원탈퇴설정관리</title>
<script type="text/javaScript" language="javascript" defer="defer">
$(document).ready(function(){
	$("input[name^=del]").change(function(){
		if(!confirm( $(this).closest('tr').find('.td_siteNm').text().trim()+" 탈퇴설정을 " + $(this).next().next().text().trim()+"(으/로) 변경하시겠습니까?")){
			var beforeValue= $('#withdrawCd_ori').val();
			$(this).parent().find("input[type=radio]:radio[value='"+beforeValue+"']").prop("checked", true);
			return false;
		}
		
		$.ajax({
			 url :"/sym/site/withdrawUpdateAjax.do"
			,type:"post"
			,data:{"idWithdrawCd":$(this).val()}
			,dataType:"json"
			,success:function(data){
				$('#withdrawCd_ori').val(data.siteManagerVO.idWithdrawCd) ;
				alert("정상적으로 저장되었습니다.");
			}
		    ,error:function(request , status, error){
				console.log("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
			}
		});
	  });
});

function linkPage(pageNo){
	var listForm = document.listForm ;
	listForm.pageIndex.value = pageNo ;
	listForm.action = "<c:url value='/sym/site/WithdrawConfig.do'/>";
	listForm.submit();
}
</script>
</head>
<body>
<noscript>자바스크립트를 지원하지 않는 브라우저에서는 일부 기능을 사용하실 수 없습니다.</noscript>
<form name="listForm" action="<c:url value='/sym/site/WithdrawConfig.do'/>" method="post">
	<input type="hidden" name="pageIndex" value="<c:if test="${empty siteManagerVO.pageIndex }">1</c:if><c:if test="${!empty siteManagerVO.pageIndex }"><c:out value='${siteManagerVO.pageIndex}'/></c:if>">
	<input type="hidden" name="searchCondition" value="1" >
	<input type="hidden" name="searchSortCnd" value="<c:out value="${siteManagerVO.searchSortCnd}" />" />
	<input type="hidden" name="searchSortOrd" value="<c:out value="${siteManagerVO.searchSortOrd}" />" />

	<!-- cont -->
	<div class="contWrap">
		<div class="pageTitle">
			<div class="pageIcon"><img src="/pb/img/pageTitIcon4.png" alt=""></div>
			<h2 class="titType1 c_222222 fwBold">회원탈퇴설정관리</h2>
			<p class="tType6 c_999999">현재 사용중인 회원탈퇴설정관리 현황을 파악할 수 있으며, 회원탈퇴설정을 변경할 수 있습니다.</p>
		</div>
		<div class="pageCont">
			<div class="listTop">
				<p class="tType5">총 <span class="tType4 c_456ded fwBold"><fmt:formatNumber value="${paginationInfo.totalRecordCount}" pattern="#,###" /></span>건</p>
				<div class="rightWrap">
					<input type="button" class="printBtn" >
					<select name="pageUnit" id="pageUnit" class="select" title="검색조건선택" onchange="linkPage(1);">
					   <option value='10' <c:if test="${siteManagerVO.pageUnit == '10' or siteManagerVO.pageUnit == ''}">selected</c:if>>10줄</option>
					   <option value='20' <c:if test="${siteManagerVO.pageUnit == '20'}">selected</c:if>>20줄</option>
					   <option value='30' <c:if test="${siteManagerVO.pageUnit == '30'}">selected</c:if>>30줄</option>
					</select>
				</div>
			</div>
			<div class="tableWrap">
				<table class="tbType1">
					<colgroup>
						<col style="width: 10%">
						<col style="width: 25%">
						<col style="width: 30%">
						<col style="width: 40%">
					</colgroup>
					<thead>
						<tr>
							<th>번호<input type="button" class="sort sortBtn" id="sort_frstRegistPnttm"></th>
							<th>사이트아이디<input type="button" class="sort sortBtn" id="sort_siteId"></th>
							<th>사이트이름<input type="button" class="sort sortBtn" id="sort_siteNm"></th>
							<th>설정(삭제/6개월보관/영구보관)<input type="button" class="sort sortBtn" id="sort_idWithdrawCd"></th>
						</tr>
					</thead>
					<tbody>
						<c:forEach var="result" items="${siteWithdrawList}" varStatus="status">
						<tr>
							<td>
								<c:if test="${siteManagerVO.searchSortOrd eq 'desc' }">
		                			<c:out value="${ ( paginationInfo.totalRecordCount - ((siteManagerVO.pageIndex -1)*siteManagerVO.pageUnit) ) - status.index }"/>
			                	</c:if>
			                	<c:if test="${siteManagerVO.searchSortOrd eq 'asc' }">
									<c:out value="${(siteManagerVO.pageIndex - 1) * siteManagerVO.pageUnit + status.count}"/>                		
			                	</c:if>
							</td>
							<td><c:out value="${result.siteId}"/>
								<spring:eval expression="@globalSettings['Globals.homepage.siteId']" />
							</td>
							<td class="td_siteNm"><c:out value="${result.siteNm}"/>
								<spring:eval expression="@globalSettings['Globals.homepage.siteNm']" />
							</td>
							<td>
								<c:forEach var="withdrawList" items="${withdrawList}" varStatus="status">
					    			<input type="radio" name="del" id="${withdrawList.code}" value="${withdrawList.code}"
					    			<c:if test="${result.idWithdrawCd eq withdrawList.code}">
					    				checked="checked"
					    			</c:if>><label for="${withdrawList.code}">&nbsp;&nbsp;${withdrawList.codeNm}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label> 
					    		</c:forEach>
					    		<input type="hidden" id="withdrawCd_ori" value="${result.idWithdrawCd}">
							</td>
							<td>
								<c:out value="${authorGroup.regYn}"/>
		                        <input type="hidden" name="regYn" value="<c:out value="${authorGroup.regYn}"/>">
		                    </td>
						</tr>
						</c:forEach>
						<c:if test="${empty siteWithdrawList}">
		         			<tr><td colspan="8"><spring:message code="common.nodata.msg" /></td></tr>
		         		</c:if>
					</tbody>
				</table>
			</div>
			<!-- 페이지 네비게이션 시작 -->
			<c:if test="${!empty siteWithdrawList}">
			<div class="page" style="margin-top: 10px;">
				<ul class="inline">
					<ui:pagination paginationInfo = "${paginationInfo}"  type="image" jsFunction="linkPage" />
				</ul>
			</div>
			</c:if> 
			<!-- //페이지 네비게이션 끝 -->
		</div>
	</div>
	<!-- //cont -->
</form>
<form name="modiForm" method="get" action="<c:url value='/sym/site/addSiteManagerView.do'/>" >
	<input name="siteId" type="hidden" />
</form>
<form name="searchForm" method="get" action="<c:url value='/sym/site/selectSiteManagerList.do'/>">
	<input name="pageIndex" type="hidden" value="1" />
	<input name="searchCondition" type="hidden" />
	<input name="searchKeyword" type="hidden" />
</form>	
</body>
</html>