<%@ 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">

var tableToExcel = (function(){
	
	var specialElementHandlers = {
            '#bypassme': function (element, renderer) {
                return true;
            }
	};
	
	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>
<!-- 여기가 본 페이지이다 -->
<input type="hidden" id="checkUseList" value=${UseList }>
<c:forEach items="${UseList }" var="temp">
	<input type="hidden" class="useIP" value="${temp }">
</c:forEach>
<div class="row">
	<div class="col-lg-12">
		<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="table-responsive">
	   				<a class="btn btn-outline btn-default" type="button" href="IdcLineListForm.lin">IDCJP회선 및 전용선 사용 현황</a>
	   				<a class="btn btn-outline btn-default" type="button" value="엑셀" onclick="tableToExcel('table','name')">엑셀 출력</a>	   				
					<table class="table table-bordered table-hover table-striped" id="table">
						<thead>
							<tr>
								<td>No</td>
								<td>회선명</td>
								<td>회선번호</td>
								<td>회선구분</td>
								<td>고객명</td>
								<td>IP 대역</td>
								<td>개통일</td>
								<td>해약일</td>
								<td>연락처</td>
								<td>ID</td>
								<td>Password</td>
							</tr>
						</thead>
						<tbody>
								<c:forEach items="${IdcLineDB }" var="temp" varStatus="i">
									<tr>
										<td>${temp.num }</td>
										<td>${temp.line_name }</td>
										<td>${temp.line_code }</td>
										<td>${temp.line_case }</td>
										<td>${temp.line_client_name }</td>
										<td>${temp.line_haveip }</td>
										<td>${temp.line_user_allocatingday }</td>
										<td>${temp.line_user_endday }</td>
										<td>${temp.line_phone }</td>
										<td>${temp.line_id }</td>
										<td>${temp.line_pass }</td>
									</tr>
								</c:forEach>
						</tbody>
						<tfoot>
						</tfoot>
					</table>
				</div>
				<!-- table-responsive -->				
				<!-- UL DIV -->
			</div>
			<!-- panel-body -->
		</div>
		<!-- panel panel-default -->
	</div>
	<!-- col-lg-12 -->
</div>
<!-- row -->
<!-- /#page-wrapper -->
