<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ 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"%>

<form:form commandName="searchVO" name="searchForm" method="get">
	<div class="search2">
		<ul>
			<li class="margin-left"><b><label for="year"><spring:message code="equip.stateWaiting.year" /></label></b></li>
			<li class="form_search2 margin-left">
				<form:select path="year" cssClass="use">
					<c:forEach var="result" items="${yearList}" varStatus="status">
						<form:option value="${result}" label="${result}" />
					</c:forEach>				
				</form:select>
		 	</li>
			<li>
				<span class="btn_blue"> 
					<a href="javascript:fn_searchList();"><spring:message code="button.inquiry" /></a>
				</span>
			</li>
		</ul>	       	       
	</div>
</form:form>

<form:form name="listForm" method="get">
	<!-- List -->
	<div id="table">		
		<table class="tbl_list" width="100%" border="0" cellpadding="0" cellspacing="0" summary="사용실적 결재목록을 확인 할 수 있습니다.">
			<caption class="hidden">사용실적 결재목록</caption>
			<colgroup>
				<col width="340">
				<col width="*">
				<col width="*">
			</colgroup>
			<thead>
				<tr>
					<th align="center"><spring:message code="equip.stateWaiting.division" /></th>
					<th align="center"><spring:message code="equip.stateWaiting.state" /></th>
					<th align="center"><spring:message code="equip.stateWaiting.approvalDate" /></th>
				</tr>
			</thead>
			<tbody>
			<c:choose>
			<c:when test="${fn:length(stateWaitingList) > 0}">
			<c:forEach var="result" items="${stateWaitingList}" varStatus="status">
				<tr>
					<td align="center" class="listtd">
						<a href="<c:url value="/equip/useStateApprove.do">
              					<c:param name="police" value="${result.police}" />
              					<c:param name="year" value="${result.year}" />
              					<c:param name="quater" value="${result.quater}" />
              				 </c:url>">
							<c:out value="${result.year}" />년 <c:out value="${result.quater}" />분기 사용실적
						</a> 
					</td>
					<td align="center" class="listtd">
						<c:choose>
						<c:when test="${result.approvalSeq ne 0}">
							<spring:message code="equip.approval.complete" />
						</c:when>
						<c:otherwise>
							<spring:message code="equip.approval.wait" />	
						</c:otherwise>
						</c:choose>
					</td>
					<td align="center" class="listtd">
						<fmt:formatDate value="${result.approvalDate}" pattern="yyyy-MM-dd" />
					</td>
				</tr>
			</c:forEach>
			</c:when>
			<c:otherwise>
				<tr>
					<td class="listtd" align="center" colspan="3">
						<spring:message code="msg.nodata" />
					</td>
				</tr>
			</c:otherwise>
			</c:choose>
			</tbody>
		</table>
	</div>
	<!-- /List -->
</form:form>

<script type="text/javascript" defer="defer">
	function fn_searchList() {
		document.searchForm.submit();
	}
</script>