<%@ 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="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<form:form commandName="equipSearchVO" name="searchForm" method="get" action="/equip/equipList.do">
	<div class="search2">
		<ul>
			<li class="margin-left"><label for="place"><spring:message code="equip.equipType" /></label></li>
			<li class="form_search margin-left">
				<form:select id="type" name="type" path="type" cssClass="use">
					<c:forEach var="result" items="${equipList}" varStatus="status">
						<form:option value="${result.code2}" label="${result.codenm}" />
					</c:forEach>
    			</form:select>
		 	</li>		 
			<li>
				<span class="btn_blue"> 
					<a href="javascript:fn_selectList();"><spring:message code="button.goSearch" /></a> 
				</span>
			</li>		
		</ul>	       	       
	</div>	
</form:form>
<div id="divPrintArea">
	<div id ="divPrintTitle" style="display: none;margin: 10px 0 10px 0;"><spring:message code="target.divmng" /></div>
	<form:form name="listForm" method="get">
		<input type="hidden" name="idx" />
		<div class="pageinfo">
			<ul class="left">
				<li>검색결과<em>${fn:length(equipmentList)}</em>건</li>
			</ul>
			<ul class="right btn-style">					
				<li><a class="btn_print" href="javascript:fn_print();"></a></li>
				<li><a class="btn_excel"  href="javascript:fn_downloadExcel();" /></a></li>
			</ul>	
		</div>
		<!-- List -->
		<div id="table">			
			<table class="tbl_listview" width="100%" border="1" cellpadding="0" cellspacing="0" summary="<spring:message code="target.divmng" /> 목록을 확인 할 수 있습니다.">
				<colgroup>
					<col width="80">
					<col width="200">
					<col width="200">
					<col width="?">
					<col width="140">					
				</colgroup>
				<thead>
					<tr>
						<th align="center"><spring:message code="equip.num" /></th>
						<th align="center"><spring:message code="equip.police" /></th>
						<th align="center"><spring:message code="equip.equipType" /></th>
						<th align="center"><spring:message code="equip.equipName" /></th>						
						<th align="center"><spring:message code="equip.buyDate" /></th>
					</tr>
				</thead>
				<tbody>
					<c:choose>
					<c:when test="${fn:length(equipmentList) > 0}">
						<c:forEach var="result" items="${equipmentList}" varStatus="status">
						<tr>
							<td align="center"><c:out value="${result.num}" /></td>
							<td align="left"><c:out value="${result.policeStr}" /></td>
							<td align="center"><c:out value="${result.equipTypeName}" /></td>
							<td align="center">
								<a href="<c:url value="/equip/equipView.do">
											<c:param name="serNo" value="${result.serNo}" />
											<c:param name="num" value="${result.num}" />
										 </c:url>">
									<c:out value="${result.equipName}" />
								</a>
							</td>							
							<td align="center"><c:out value="${result.buyDate}" /></td>
						</tr>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<tr>
							<td align="center" colspan="6">
								<spring:message code="msg.nodata" />
							</td>
						</tr>
					</c:otherwise>
					</c:choose>
				</tbody>
			</table>
		</div>
		<!-- /List -->
	</form:form>
</div>
<!-- /PrintArea -->
<form:form name="menuForm" method="get">
	<div class="board_buttom">
		<ul class="btn-style right">
		<c:if test="${loginUserVO.authAdmin == 1 or loginUserVO.place1 eq 'PS00' }">
			<li><a class="btn_create" href="<c:url value="/equip/equipAdd.do" />"><spring:message code="button.create" /></a></li>
		</c:if>
		
		</ul>
	</div>
	
	
</form:form>

<script type="text/javaScript" defer="defer">
<!--
	/* 목록 화면 function */
	function fn_selectList() {
		document.searchForm.submit();
	}

	/* 글 등록 화면 function */
	function fn_addView() {
		document.menuForm.action = "<c:url value='/target/corp/add.do'/>";
		document.menuForm.submit();
	}
	
	/* 목록 화면 function */
	function fn_downloadExcel() {
		document.searchForm.action = "/equip/listtoexcel.do";
		document.searchForm.submit();
	}
	
	/* 출력 */
	function fn_print(){
		var divPrintTitle = document.getElementById("divPrintTitle");
		divPrintTitle.style.display = "inline";
		printDiv($("#divPrintArea").html());
		divPrintTitle.style.display = "none";
	}
//-->
</script>