<%@ 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="ct" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<div class="search2">	
	<form:form commandName="reportSearchVO" name="searchForm" method="get">
		<form:hidden path="pageIndex" />	
		<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="board.header.title" /></b> 　</li>
		 	<li class="w-300">
		 		<form:input path="subject"/>
		 	</li>
			<li>
				<span class="btn_blue"> 
					<a href="javascript:fn_search();"><spring:message code="button.goSearch" /></a>
				</span>
			</li>
		</ul>	  
	</form:form>	
</div>

<!-- 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>
	<input type="hidden" name="inSeq" />
	<!-- List -->
		<table class="tbl_list3" width="100%" border="0" cellpadding="0" cellspacing="0" summary="게시판 목록을 확인 할 수 있습니다.">
			<caption class="hidden">게시판 목록</caption>
			<colgroup>
				<col width="110">
				<col width="100">
				<col width="230">
				<col width="90">
			</colgroup>
			<thead>
				<tr>
				<th align="center" rowspan="2"><span class="order">문서번호</span></th>
				<th align="center" rowspan="2"><span class="order">보고자</span></th>
				<th align="center" rowspan="2"><span class="order">제목</span></th>
				<th align="center" rowspan="2"><span class="order">보고일</span></th>
				<th align="center" colspan="2" class="tbl_list3_col">결재</th>
				<th align="center" colspan="8" class="tbl_list3_col">판단</th>
				<th align="center" rowspan="2"><span class="order">분야1</span></th>
				<th align="center" rowspan="2"><span class="order">분야2</span></th>
			</tr>
			<tr>
				<th align="center">팀장</th>
				<th align="center">담당관</th>
				<th align="center">특보</th>
				<th align="center">판단</th>
				<th align="center">중보</th>
				<th align="center">통보</th>
				<th align="center">기록</th>
				<th align="center">조사</th>
				<th align="center">참고</th>
				<th align="center">무가치</th>
			</tr>
			</thead>
			<c:forEach var="result" items="${reportList}" varStatus="status">
				<tr>
					<td align="center">국제정보분석-<c:out value="${result.inPlaceNum}" /></td>
					<td align="center"><c:out value="${result.inDuty}" /> <c:out value="${result.inName}" /></td>
					<td align="left"><a href="<c:url value="/report/updateMyReport.do"><c:param name="inSeq" value="${result.inSeq}" /></c:url>"><c:out value="${result.inSubject}" /></a></td>
					<td align="center"><c:out value="${result.inInfoYear}" />.<c:out value="${result.inInfoMonth}" />.<c:out value="${result.inInfoDay}" /></td>
					<td align="center"><c:if test="${fn:endsWith(result.inStateCode, 2) or fn:endsWith(result.inStateCode, 4)}">O</c:if> </td>
					<td align="center"><c:if test="${fn:endsWith(result.inStateCode, 3) or fn:endsWith(result.inStateCode, 4)}">O</c:if></td>
					<td align="center"><c:if test="${result.inJudge eq '1'}">O</c:if></td>
					<td align="center"><c:if test="${result.inJudge eq '2'}">O</c:if></td>
					<td align="center"><c:if test="${result.inJudge eq '3'}">O</c:if></td>
					<td align="center"><c:if test="${result.inJudge eq '4'}">O</c:if></td>
					<td align="center"><c:if test="${result.inJudge eq '5'}">O</c:if></td>
					<td align="center"><c:if test="${result.inJudge eq '6'}">O</c:if></td>
					<td align="center"><c:if test="${result.inJudge eq '7'}">O</c:if></td>
					<td align="center"><c:if test="${result.inJudge eq '8'}">O</c:if></td>
					<td align="center"><c:out value="${result.inCategory1Str}" /></td>
					<td align="center"><c:out value="${result.inCategory2Str}" /></td>
				</tr>
				<c:if test="${reportList.size() <= 0 }">
					<tr><td align="center" colspan="15"><spring:message code="report.nodata" /></td></tr>
				</c:if>
				<%-- <tr>
					<td align="center" class="listtd">
					<c:if test="${result.bdIdx eq result.bdIdxGrp or result.bdIdxGrp eq '0'}">
					<c:out value="${result.bdIdx}" />
					</c:if>
					</td>
					<td align="left" class="listtd">
					<a href="javascript:fn_select('<c:out value="${result.bdIdx}"/>')">
					<c:if test="${result.bdIdx ne result.bdIdxGrp and result.bdIdxGrp ne '0'}">
						┖ [답글]
					</c:if>
						<c:out value="${result.bdSubject}" />
					</a></td>
					<td align="center" class="listtd"><c:out value="${result.grpName}" /></td>
					<td align="center" class="listtd"><b><c:out value="${result.usrName}" /></b></td>
					<td align="center" class="listtd"><fmt:formatDate value="${result.regdate}" pattern="yyyy-MM-dd" />&nbsp;</td>
					<td align="center" class="listtd"><c:if test="${not empty result.bdFileNames}">O</c:if></td>
					<td align="center" class="listtd"><c:out value="${result.bdCount}" /></td>
				</tr> --%>
			</c:forEach>
		</table>
	</div>
	<!-- /List -->
	<div id="paging">
		<ui:pagination paginationInfo="${paginationInfo}" type="image" jsFunction="fn_link_page" />
	</div>
	<div class="board_buttom">
	<ul class="btn-style right">
		<li><a href="/report/add.do" class="btn_create">견문작성</a></li>
	</ul>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		//날짜 설정
		$('input[id^="date"]').datepicker({dateFormat: 'yy-mm-dd'});
		
		// 조건보기
		$('#btnCondigion').click(function(){
			$('#tbCondition').toggle();
		});

		// 정렬
		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/myList.do' />";
			document.searchForm.submit();
		});
	});

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

	//견문 엑셀받기
	function fn_get_excel() {
		document.searchForm.action = "<c:out value='/report/myListExcel.do' />";
		document.searchForm.submit();
	}
	
	/* pagination 페이지 링크 function */
	function fn_link_page(pageNo) {
		document.searchForm.pageIndex.value = pageNo;
		document.searchForm.action = "<c:url value='/report/myList.do'/>";
		document.searchForm.submit();
	}
</script>