<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
$(function()
{
	$("#searchDiv > ul > li > a").click(function()
	{
		$("#searchBtn").html($(this).html());
		$("#serverHidden").val($(this).attr("value"));
	});
	
	$("#format_filter").val($("#temp").val());
	
	$("#format_filter").change(function(){
		var format_filter = $(this).val();			
		//alert(format_filter);
		var url="serverList.ser";			
		window.location=url+"?format_filter="+format_filter;
	});
		
	$("#select_date").change(function(){
		var temp = $(this).val();
		if(temp != null && temp != ""){
			window.location="serverList.ser?select_date="+temp;
		}
		
		
	});
			
			
});

		
var tableToExcel = (function(){
	var uri = 'data:application/vnd.ms-excel;base64,'
	    , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>'
	    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
	    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
	  return function(table, name) {
	    if (!table.nodeType) table = document.getElementById(table)
	    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
	    window.location.href = uri + base64(format(template, ctx))
	  }
})();

</script>

<style>
@media screen and (max-width:800px) {	
	}
}

.tdcenter{
	 text-align: center;
	 vertical-align: text-bottom;
}
</style>

<!-- 여기가 본 페이지이다 -->
<div class="row">
	<div class="col-lg-12" style="min-width:600px">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h4><i class="fa fa-desktop fa-fw"></i> 전체 서버 리스트</h4>
			</div>
			<div class="panel-body">
				<div class="row">
					<!-- 윗줄 ㅇㅇ -->
					<div class="col-lg-12">											
						 <form class="form-inline" role="form" action="serverList.ser" method="get">
						 	<div class="input-group">
						 		<div class="input-group-btn">
									<a class="btn btn-outline btn-default" href="serverWriteForm.ser">새 장비 등록</a>
									<a class="btn btn-outline btn-default" href="usableServerList.ser">가용장비 리스트</a>
									<a class="btn btn-outline btn-default"  href="serverListExcel.ser">엑셀</a>
								</div>
								<div class="input-group-btn" id="searchDiv">
									<input type="hidden" id="serverHidden" value="${searchOption }" name="searchOption">
									<button type="button" class="btn btn-info" data-toggle="dropdown" id="searchBtn">${searchOptionName }</button>
									<ul class="dropdown-menu" role="menu" id="search_li">
									    <li><a class="btn btn-default" value="mkall">전체검색</a></li>
										<li><a class="btn btn-default" value="server_use_status">가용</a></li>
										<li><a class="btn btn-default" value="server_code">장비명</a></li>
										<li><a class="btn btn-default" value="server_cpuname">cpu</a></li>										
									</ul>
						 		</div>						 		
						        	<input type="text" class="form-control" placeholder="검색어입력" name="searchContent" value="${searchContent }">						        						        						        							        						        
						      	<div class="input-group-btn">
							    	<button type="submit" class="btn btn-outline btn-info">검색</button>
					  			</div>					  				
						 	</div>
						</form>
					</div>
				</div>
				<!-- row -->
	   			<div class="table-responsive"  id="table"> 	   				
					<table class="table table-bordered table-hover table-striped">
						<thead>
							<tr>
								<td class="tdcenter"  style="text-align:center;width:52px;">NO</td>
								<td class="tdcenter"  style="text-align:center;width:52px;">가용
									<input type="hidden" id="temp" value="${format_filter}"/>									
									<!-- <select name="format_filter" id="format_filter">
										<option value="">구분</option>
										<option value="all">전체</option>
										<option value="normal">사용가능</option>
										<option value="format">포맷보류</option>								
									</select> -->
								</td>
								<td class="tdcenter" style="text-align:center;width:120px;">장비번호</td>
								<td class="tdcenter" style="text-align:center;width:52px;">밴더</td>
								<td class="tdcenter" style="text-align:center;width:150px;">SPEC</td>
								<td class="tdcenter" style="text-align:center;width:50px;">Hz</td>
								<td class="tdcenter" style="text-align:center;width:50px;">CPU</td>
								<td class="tdcenter" style="text-align:center;width:250px;">MEM/HDD</td>
								
								<!-- <td class="tdcenter">위치정보</td>-->
								<td class="tdcenter" style="text-align:center;width:150px;">입고일</td>
								<td class="tdcenter" style="text-align:center;width:150px;">포맷보류
									<!--  <input type="date" name="date" id="select_date" value="${select_date}" />-->
								</td>								
								<!-- <td class="tdcenter">출고일</td>-->
								<td class="tdcenter" style="text-align:center;width:450px;">비고</td>
								<!-- <td class="tdcenter" style="text-align:center;width:250px;">폐기일</td>-->
								<td class="tdcenter" style="text-align:center;width:50px;">수정</td>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${idcServerList}" var="dto">
								<tr>
									<td style="text-align:center;">${dto.number}</td>
									
									<td style="text-align:center;">${dto.server_use_status}</td>
									
									<td style="text-align:center;">${dto.server_code}</td>
									<td style="text-align:center;">${dto.server_brand}</td>
									<td style="text-align:center;">${dto.server_process}</td>
									<td style="text-align:center;">${dto.server_spec}</td>
									<td style="text-align:center;">${dto.server_cpuname}</td>
									<td style="text-align:center;">${dto.server_ram}/${dto.server_hdd}</td>
									
									<!-- <td>${dto.server_location}</td>-->
									
									<td style="text-align:center;">${dto.server_recieve_date}</td>
									<td style="text-align:center;">${dto.server_fomat_date}</td>
									<!-- <td>${dto.server_release_date}</td>-->
									<td>${dto.server_note}</td>
									<!-- <td>${dto.server_disuse_date}</td>-->
									<td align="center"><a href="serverRead.ser?server_num=${dto.server_num}" type="button" class="fa fa-edit"></a></td>				
								</tr>
							</c:forEach>
						</tbody>
						<tfoot>
						<!-- 
							<td>
								<a class="btn btn-outline btn-default" href="serverList.ser">첫 페이지로</a>
							</td>
							<td colspan="11">
							</td>
							<tr>
								<td colspan="12" align="center">
								</td>
							</tr>	
							 -->	
						</tfoot>
					</table>
				</div>
				<!--	 table-responsive-->
				<div>
					<ul class="pagination" style="margin:0px;">
						<li>
							<a href="serverList.ser?curPage=1&searchOption=${searchOption }&searchContent=${searchContent}">
								<i class="fa fa-angle-double-left "></i>
							</a>
						</li>
						<li>
							<c:if test="${curPage!=1 }">
								<a class="btn btn-outline_btn-default" href="serverList.ser?curPage=${curPage-1 }&searchOption=${searchOption }&searchContent=${sc}">
									<i class="fa fa-angle-left"></i>
								</a>
							</c:if>
							<c:if test="${curPage==1 }">
								<a class="btn btn-outline_btn-default" href="serverList.ser?curPage=1&searchOption=${searchOption }&searchContent=${sc}">
									<i class="fa fa-angle-left"></i>
								</a>
							</c:if>
						</li>
						<c:forEach var="i" begin="${firstPage }" end="${endPage}">
							<li>
								<a  href="serverList.ser?curPage=${i}&searchOption=${searchOption }&searchContent=${searchContent}">
									${i}
								</a>
							</li>
						</c:forEach>
						<li>
							<c:if test="${curPage!=pageCnt }">
								<a class="btn btn-outline_btn-default" href="serverList.ser?curPage=${curPage+1 }&searchOption=${searchOption }&searchContent=${sc}">
									<i class="fa fa-angle-right"></i>
								</a>
							</c:if>
							<c:if test="${curPage==pageCnt }">
								<a class="btn btn-outline_btn-default" href="serverList.ser?curPage=${pageCnt }&searchOption=${searchOption }&searchContent=${sc}">
									<i class="fa fa-angle-right"></i>
								</a>
							</c:if>
						</li>
						<li >
							<a href="serverList.ser?curPage=${pageCnt }&searchOption=${searchOption }&searchContent=${searchContent}">
								<i class="fa fa-angle-double-right "></i>
							</a>
						</li>
					</ul>
				</div>
			</div>
			<!-- panel-body -->
		</div>
		<!-- panel panel-default -->
	</div>
	<!-- col-lg-12 -->
</div>
<!-- row -->
<!-- /#page-wrapper -->
