<%@ 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="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ckeditor" uri="http://ckeditor.com" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="ct" tagdir="/WEB-INF/tags" %>

<form:form commandName="reportSearchVO" name="searchForm" method="get">
	<form:hidden path="orderCol"/>
	<form:hidden path="orderAsc"/>
	<form:hidden path="pageIndex" />
	
	<div class="search2">
		<ul>
		 	<li>
		 		<b><spring:message code="report.search.period" /></b>
		 	</li>
		 	<li class="margin-left">
		 		<form:input path="dateStart" /> ~ <form:input path="dateEnd"/>
		 	</li>
		 	
		 	<li class="margin-left">
		 		<b><spring:message code="report.search.place" /></b>
		 	</li>
		 	<li class="form_search margin-left">
		 		<form:select path="placeGroup">
		 			<c:forEach var="item" items="${placeList}">
		    			<form:option value="${item.code}">${item.name}</form:option>
		    		</c:forEach>
				</form:select>
		 	</li>
			<li>
				<input type="button" value="<spring:message code="button.goSearch" />" onclick="javascript:fn_search();" />
			</li>  
		</ul>
	</div>
</form:form>


<!-- List -->
<div id="table">
	<div class="pageinfo">
		<ct:pageInfo />
		<ul class="right btn-style">
			<li><a href="javascript:fn_get_excel();" class="btn_excel"></a></li>
			<li><a href="#" class="btn_reset" onclick="location.reload();"></a></li>
		</ul>
	</div>
	
	<table class="tbl_list" width="100%" border="0" cellpadding="0" cellspacing="0" summary="게시판 목록을 확인 할 수 있습니다.">
		<caption class="hidden">게시판 목록</caption>
		<thead>
			<tr>
				<th align="center" rowspan="2"><span class="order" value="in_seq"><spring:message code="report.list.num" /><img src="/images/cmmn/blank_1x1.png" /></span></th>
				<th align="center" rowspan="2"><span class="order" value="in_infodate"><spring:message code="report.view.infodate" /><img src="/images/cmmn/blank_1x1.png" /></span></th>
				<th align="center" rowspan="2"><span class="order" value="in_position"><spring:message code="report.view.position" /><img src="/images/cmmn/blank_1x1.png" /></span></th>
				<th align="center" rowspan="2"><span class="order" value="in_name"><spring:message code="report.search.place" /><img src="/images/cmmn/blank_1x1.png" /></span></th>
				<th align="center" rowspan="2"><span class="order" value="in_name"><spring:message code="report.search.reporter" /><img src="/images/cmmn/blank_1x1.png" /></span></th>
				<th align="center" rowspan="2"><span class="order" value="in_subject"><spring:message code="board.header.title" /><img src="/images/cmmn/blank_1x1.png" /></span></th>
				<th align="center" colspan="8" class="tbl_list_col"><spring:message code="report.type.judge" /></th>
			</tr>
			<tr>
				<th align="center"><spring:message code="report.type.newsflash" /></th>
				<th align="center"><spring:message code="report.type.judge" /></th>
				<th align="center"><spring:message code="report.type.middle" /></th>
				<th align="center"><spring:message code="report.type.notice" /></th>
				<th align="center"><spring:message code="report.type.record" /></th>
				<th align="center"><spring:message code="report.type.survey" /></th>
				<th align="center"><spring:message code="report.type.reference" /></th>
				<th align="center"><spring:message code="report.type.worthless" /></th>
			</tr>
		</thead>
		
		<c:forEach var="result" items="${reportList}" varStatus="status">
			<tr>
				<td align="left">
					국제정보분석-<c:out value="${result.inSeq}"/>
				</td>
				<td align="center">
					<c:out value="${result.inInfodate}" />
				</td>
				<td align="center">
					<c:out value="${result.inDuty}" />
				</td>
				<td align="center">
					<c:out value="${result.inPlace1}" /> : <c:out value="${result.inPlace2}" />
				</td>
				<td align="center">
					<c:out value="${result.inName}" />
				</td>
				<td align="left">
					<a href="<c:url value="/report/updateJudge.do"><c:param name="inSeq" value="${result.inSeq}" /></c:url>">
						<c:out value="${result.inSubject}"/>
					</a>
				</td>
				<td align="center">
					<c:out value="${result.isJudge1}" />
				</td>
				<td align="center">
					<c:out value="${result.isJudge2}" />
				</td>
				<td align="center">
					<c:out value="${result.isJudge3}" />
				</td>
				<td align="center">
					<c:out value="${result.isJudge4}" />
				</td>
				<td align="center">
					<c:out value="${result.isJudge5}" />
				</td>
				<td align="center">
					<c:out value="${result.isJudge6}" />
				</td>
				<td align="center">
					<c:out value="${result.isJudge7}" />
				</td>
				<td align="center">
					<c:out value="${result.isJudge8}" />
				</td>
			</tr>
		</c:forEach>
		<c:if test="${reportList.size() <= 0 }">
			<tr><td align="center" colspan="13"><spring:message code="report.nodata" /></td></tr>
		</c:if>
	</table>
</div>
<!-- /List -->

<div id="paging">
	<ui:pagination paginationInfo="${paginationInfo}" type="image" jsFunction="fn_link_page" />
</div>

<script type="text/javascript">
	$(document).ready(function(){
		//날짜 설정
		$('input[id^="date"]').datepicker({dateFormat: 'yy-mm-dd'});

		// 정렬
		if (document.searchForm.orderCol && document.searchForm.orderCol.value.length > 0) {
			$('input[value=' + document.searchForm.orderCol.value + '] img')
				.attr('src', (document.searchForm.orderAsc.value == 'DESC') ? '/images/cmmn/order_desc.gif' : '/images/cmmn/order_asc.gif');
		}
		$('.order').click(function(){
			var ordercode = $(this).attr('value');
			if (document.searchForm.orderCol.value == ordercode) {
				if (document.searchForm.orderAsc.value == 'ASC') {
					document.searchForm.orderAsc.value = 'DESC';
				} else {
					document.searchForm.orderAsc.value = 'ASC';
				}
			} else {
				document.searchForm.orderAsc.value = 'DESC';
			}
			document.searchForm.orderCol.value = ordercode;
			
			document.searchForm.action = "<c:out value='/report/judgeRecord.do' />";
			document.searchForm.submit();
		});
	});

	// 검색하기
	function fn_search() {
		document.searchForm.action = "<c:out value='/report/judgeRecord.do' />";
		document.searchForm.submit();
	}

	// 엑셀받기
	function fn_get_excel() {
		document.searchForm.action = "<c:out value='/report/recordExcel.do' />";
		document.searchForm.submit();
	}

	/* pagination 페이지 링크 function */
	function fn_link_page(pageNo) {
		document.searchForm.pageIndex.value = pageNo;
		document.searchForm.action = "<c:url value='/report/judgeRecord.do'/>";
		document.searchForm.submit();
	}
</script>
