<%@ 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="place">소속</label></li>
			<li class="form_search2 margin-left">
				<form:select path="place" cssClass="use">
					<c:forEach var="result" items="${placeList}" 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(divMngList)}</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="<c:url value="/target/divmng/listtoexcel.do"><c:param name="place" value="${searchVO.place}" /></c:url>"></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="?">
					<col width="100">
					<col width="100">
					<col width="140">
				</colgroup>
				<thead>
					<tr>
						<th align="center">번호</th>
						<th align="center"><spring:message code="target.divmng.place" /></th>
						<th align="center"><spring:message code="target.divmng.local" /></th>
						<th align="center"><spring:message code="target.divmng.gubun" /></th>
						<th align="center"><spring:message code="target.divmng.staffNum" /></th>
						<th align="center"><spring:message code="target.divmng.tel" /></th>
					</tr>
				</thead>
				<tbody>
					<c:choose>
					<c:when test="${fn:length(divMngList) > 0}">
						<c:forEach var="result" items="${divMngList}" varStatus="status">
						<tr>
							<td align="center"><c:out value="${status.index+1}" /></td>
							<td align="left"><c:out value="${result.placeStr}" /></td>
							<td align="left">
								<a href="<c:url value="/target/divmng/view.do">
											<c:param name="place" value="${result.place}" />
											<c:param name="no" value="${result.no}" />
										 </c:url>">
									<c:out value="${result.local}" />
								</a>
							</td>
							<td align="center"><c:out value="${result.gubunStr}" /></td>
							<td align="center"><c:out value="${result.staffNum}" />명</td>
							<td align="center"><c:out value="${result.tel}" /></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.isAdmin}" >
			<li><a class="btn_create" href="<c:url value="/target/divmng/add.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 fn_print(){
		var divPrintTitle = document.getElementById("divPrintTitle");
		divPrintTitle.style.display = "inline";
		printDiv($("#divPrintArea").html());
		divPrintTitle.style.display = "none";
	}
//-->
</script>