<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="kcg.faics.sec.LoginUserVO"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="ct" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<script type="text/javaScript" defer="defer">
	<!--
	
	$(document).ready(function(){
		
		if (document.searchForm.ordercode && document.searchForm.ordercode.value.length > 0) {
			$('.order[value=' + document.searchForm.ordercode.value + '] img')
				.attr('src', (document.searchForm.ordertype.value == '1') ? '/images/cmmn/order_desc.gif' : '/images/cmmn/order_asc.gif');
		}
		
		$('.order').click(function(){
			var ordercode = $(this).attr('value');
			if (document.searchForm.ordercode.value == ordercode) {
				if (document.searchForm.ordertype.value == 1) {
					document.searchForm.ordertype.value = 0;
				} else {
					document.searchForm.ordertype.value = 1;
				}
			} else {
				document.searchForm.ordertype.value = 0;
			}
			document.searchForm.ordercode.value = ordercode;
			fn_searchList();
		});
		
		$("#name").keydown(function(e){
			if (e.keyCode == 13){
				fn_link_page(1);
			}
		});
	});
	
	/* 글 상세 화면 function */
	function fn_select(id) {
		document.listForm.userid.value = id;
		document.listForm.action = "<c:url value='/admin/faMemberInfo.do'/>";
	   	document.listForm.submit();
	}
	
	/* 글 목록 화면 function */
    function fn_searchList() {
       	document.searchForm.action = "<c:url value='/admin/faMemberList.do'/>";
       	document.searchForm.submit();
    }
	
	/* 검색초기화 function */
    function fn_selectList() {
       	location.href = "/admin/faMemberList.do";
    }
	
    /* 엑셀 다운로드 function */
    function fn_goExcel() {
       	document.searchForm.method = "post";
       	document.searchForm.action = "<c:url value='/admin/faMemberListExcel.do'/>";
       	document.searchForm.submit();
    }
	
	/* pagination 페이지 링크 function */
	function fn_link_page(pageNo) {
		document.searchForm.pageIndex.value = pageNo;
		document.searchForm.action = "<c:url value='/admin/faMemberList.do'/>";
		document.searchForm.submit();
	}
	
	/* 수정 화면 function */
	function fn_modify(userid){
	   	document.menuForm.userid.value = userid;
	   	document.menuForm.action = "<c:url value='/admin/faMemberUpdateView.do'/>";
	   	document.menuForm.submit();
	}
	
	//-->
</script>
<% 
	LoginUserVO userVO = (LoginUserVO) session.getAttribute("userVO");
%>
<form:form commandName="memberSearchVO" name="searchForm" method="get">	
	<div class="search2">
		<ul>
			<li><b>소속</b> 　</li>
			<li class="form_search margin-left">
				<form:select path="place1" cssClass="use">
      					<form:option value="" label="전체" />
					<c:forEach var="item" items="${place1List}">
		    			<form:option value="${item.code2}">${item.codenm}</form:option>
		    		</c:forEach>
	 			</form:select>
		 	</li>
		 	<li class="margin-left"><b>이름</b> 　</li>
		 	<li class="margin-left"><form:input path="name"/></li>	 
			<li>
				<span class="btn_blue"> 
					<a href="javascript:fn_link_page(1);"><spring:message code="button.goSearch" /></a>
				</span>
			</li>
			<li>
				<span class="btn_gray"> 
					<a href="javascript:fn_selectList();"><spring:message code="button.initSearch" /></a>
				</span>
			</li>
		</ul>	       	       
	</div>
<form:hidden path="pageIndex" />
<form:hidden path="ordertype" />
<form:hidden path="ordercode" />
</form:form>
<form:form name="listForm" method="get">
		<input type="hidden" name="userid" />
       	<!-- List -->
		<div id="table">
			<div class="pageinfo">
				<ct:pageInfo />
				<ul class="right btn-style">		
					<li><a class="btn_excel" href="javascript:fn_goExcel();"></a></li>
					<li><a href="#" class="btn_reset" onclick="location.reload();"></a></li>	
				</ul>
			</div>
			<table class="tbl_list" width="100%" border="0" cellpadding="0" cellspacing="0">
				<colgroup>
					<col width="70" >
					<col width="200" >
					<col width="110" >
					<col width="100" >					
					<col width="100" >					
					<col width="100" >					
					<col width="100" >										
					<col width="80" >					
					<col width="80" >
				</colgroup>
				<thead>
				<tr>
					<th align="center"><spring:message code="member.view.seq" /></th>
					<th align="center">
						<span class="order" value="<spring:message code="member.value.order.place1"/>">
							<spring:message code="member.view.place1" />
							<img src="/images/cmmn/blank_1x1.png" />
						</span>
					</th>
					<th align="center">
						<span class="order" value="<spring:message code="member.value.order.position"/>">
							<spring:message code="member.view.position" />
							<img src="/images/cmmn/blank_1x1.png" />
						</span>
					</th>
					<th align="center">
						<span class="order" value="<spring:message code="member.value.order.name"/>">
							<spring:message code="member.view.name" />
							<img src="/images/cmmn/blank_1x1.png" />
						</span>
					</th>
					<th align="center">
						<span class="order" value="<spring:message code="member.value.order.userid"/>">
							<spring:message code="member.view.userid" />
							<img src="/images/cmmn/blank_1x1.png" />
						</span>
					</th>
					<th align="center">
						<span class="order" value="<spring:message code="member.value.order.totalcareer"/>">
							<spring:message code="member.view.totalcareer" />
							<img src="/images/cmmn/blank_1x1.png" />
						</span>
					</th>
					<th align="center">
						<span class="order" value="<spring:message code="member.value.order.inout"/>">
							<spring:message code="member.view.inout" />
							<img src="/images/cmmn/blank_1x1.png" />
						</span>
					</th>
					<th align="center">
						<span class="order" value="<spring:message code="member.value.order.jobtype"/>">
							<spring:message code="member.view.jobtype" />
							<img src="/images/cmmn/blank_1x1.png" />
						</span>
					</th>
					<th align="center">
						<span class="order" value="<spring:message code="member.value.order.usegrade"/>">
							<spring:message code="member.view.usegrade" />
							<img src="/images/cmmn/blank_1x1.png" />
						</span>
					</th>
					<c:if test="${userVO.isSysAdmin == true}">
					<th align="center">수정</th>
					</c:if>
				</tr>
				</thead>
				<c:forEach var="result" items="${resultList}" varStatus="status">
					<tr>
						<td align="center"><c:out value="${result.rnum}" /></td>
						<td align="left"><c:out value="${result.place3Str}" /></td>
						<td align="center"><c:out value="${result.positionStr}" /></td>
						<td align="center">
							<a href="javascript:fn_select('<c:out value="${result.userid}"/>')"><c:out value="${result.name}" /></a>
						</td>
						<td align="center"><c:out value="${result.userid}" /></td>
						<td align="center"><c:out value="${result.totalexcareer_y}" />년 <c:out value="${result.totalexcareer_m}" />개월</td>
						<td align="center">
							<c:choose>
								<c:when test="${result.inout == 'i'}">
									<spring:message code="member.view.inout.i" />
								</c:when>
								<c:when test="${result.inout == 'o'}">
									<spring:message code="member.view.inout.o" />
								</c:when>
								<c:when test="${result.inout == 'd'}">
									<spring:message code="member.view.inout.d" />
								</c:when>
							</c:choose>
						</td>
						<td align="center"><c:out value="${result.jobtypeStr}" /></td>
						<td align="center"><c:out value="${result.usegrade}" /></td>
					<c:if test="${userVO.isSysAdmin == true}">
						<td align="center"><a href="javascript:fn_modify('${result.userid}');">수정</a></td>
					</c:if>
					</tr>
				</c:forEach>
			</table>
		</div>
		<!-- /List -->
		<div id="paging">
			<ui:pagination paginationInfo="${paginationInfo}" type="image" jsFunction="fn_link_page" />
		</div>
</form:form>
<form name="menuForm" method="post">
	<input type="hidden" name="userid" value=""/>
</form>