<%@ 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="searchVO" name="searchForm" method="get">
	<div class="search2">
		<ul>
			<li class="margin-left"><label for="place1"><c:out value="구분" /></label></li>
			<li class="form_search2 margin-left">
				<form:select path="place1" cssClass="use">
					<form:option value="" label="전체" />
					<c:forEach var="result" items="${placeList}" varStatus="status">
						<form:option value="${result.code2}" label="${result.codenmYak}" />
					</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;">외사취약지</div>
	<table class="tbl_listview" width="100%" border="0" cellpadding="0" cellspacing="0">
		<caption class="hidden">외사취약지 현황</caption>
		<thead>
			<tr>
				<c:forEach var="item" items="${statsPerPlace}" varStatus="status">
					<th align="center"><c:out value="${item['codenm_yak']}" /></th>
				</c:forEach>
			</tr>
		</thead>
		<tbody>
			<tr>
				<c:forEach var="item" items="${statsPerPlace}" varStatus="status">
					<td align="center"><c:out value="${item['cnt']}" /></td>
				</c:forEach>
			</tr>
		</tbody>
	</table>
	<form:form commandName="weakPlaceList" name="listForm" method="get">
	<input type="hidden" name="idx" />
	<div class="pageinfo">
			<ul class="left">
				<li>&lt; <c:out value="${today}" />현재 &gt;</li>
				<li>검색결과<em>${fn:length(weakPlaceList)}</em>건</li>
			</ul>
			<ul class="right btn-style">
				<li><a class="btn_print" href="javascript:fn_print();"></a></li>
			</ul>	
		</div>
	<!-- List -->
	<div id="table">		
		<table class="tbl_listview" width="100%" border="1" cellpadding="0" cellspacing="0">
			<colgroup>
				<col width="180">
				<col width="80">
				<col width="240">
				<col width="?">
				<col width="120">
			</colgroup>
			<thead>
				<tr>
					<th align="center"><spring:message code="target.wp.place1" /></th>
					<th align="center"><spring:message code="target.wp.wpNo" /></th>
					<th align="center"><spring:message code="target.wp.name" /></th>
					<th align="center"><spring:message code="target.wp.location" /></th>
					<th align="center"><spring:message code="target.wp.filename1" /></th>
				</tr>
			</thead>
			<tbody>
				<c:choose>
				<c:when test="${fn:length(weakPlaceList) > 0}">
					<c:forEach var="result" items="${weakPlaceList}" varStatus="status">
					<tr>
						<td align="left"><c:out value="${result.place1str}" /></td>
						<td align="center" ><c:out value="${result.wpNo}" /></td>
						<td align="left">
							<a href="/target/weakplace/view.do?place1=<c:out value="${result.place1}" />&wpNo=<c:out value="${result.wpNo}" />">
								<c:out value="${result.name}" />
							</a>
						</td>
						<td align="left"><c:out value="${result.location}" /></td>
						<td align="center"><c:out value="${result.filename1viewStr}" /></td>
					</tr>
					</c:forEach>
				</c:when>
				<c:otherwise>
					<tr>
						<td align="center" colspan="8"><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}" >			
			<li><a class="btn_create" href="javascript:fn_addView();"><spring:message code="button.create" /></a></li>
		</c:if>
		</ul>
	</div>
	
	<!-- <div id="sysbtn">
		<ul>
			<c:if test="${loginUserVO.authAdmin == 1}" >
			<li><span class="btn_blue_l"> 
				<a href="javascript:fn_addView();"><spring:message code="button.create" /></a>
				<img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left: 6px;" alt="<spring:message code="button.create" />" />
			</span></li>
			</c:if>
			<li>
        		<span class="btn_blue_l">
              		<a href="javascript:fn_print();"><spring:message code="button.print" /></a>
              		<img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code="button.print" />"/>
        		</span>
   			</li>
		</ul>
	</div> -->
</form:form>

<script type="text/javaScript" defer="defer">
<!--
	/* 글 목록 화면 function */
	function fn_selectList() {
		document.searchForm.action = "<c:url value='/target/weakplace/list.do'/>";
		document.searchForm.submit();
	}

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