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

<!-- List -->
<div id="table">
	<div class="pageinfo">
		<ct:pageInfo />	
		<form:form commandName="reportSearchVO" name="searchForm" method="get">	
			<ul class="right btn-style-text">
				<li><a href="javascript:selectAll();"><spring:message code="button.selectAll" /></a></li>
				<li><a href="javascript:unselectAll();"><spring:message code="button.unselectAll" /></a></li>
				<li><a href="javascript:deleteSelectedItem();"><spring:message code="button.delSelected" /></a></li>
				<li><a href="#" onclick="location.reload();">새로고침</a></li>
			</ul>		
			<form:hidden path="pageIndex" />
		</form:form>
	</div>
	<table class="tbl_list" width="100%" border="0" cellpadding="0" cellspacing="0" summary="게시판 목록을 확인 할 수 있습니다.">
		<caption class="hidden">게시판 목록</caption>
		<colgroup>
			<col width="50" >
			<col width="50" >
			<col width="100" >
			<col width="400" >
			<col width="120" >
			<col width="120" >
		</colgroup>
		<thead>
			<tr>
				<th align="center"><spring:message code="board.header.select" /></th>
				<th align="center"><spring:message code="board.header.no" /></th>
				<th align="center"><spring:message code="board.header.reporter" /></th>
				<th align="center"><spring:message code="board.header.title" /></th>
				<th align="center"><spring:message code="board.header.rptdate" /></th>
				<th align="center"><spring:message code="board.header.regdate" /></th>
			</tr>
		</thead>
		
		<c:if test="${empty reportList}">
			<tr>
				<td align="center" class="tdNoData" colspan="6"><spring:message code="report.nodata" arguments="report.title" /></td>
			</tr>
		</c:if>
		
		<c:forEach var="report" items="${reportList}" varStatus="status">
			<tr>
				<td align="center">
					<input type="checkbox" class="cbDeleteReport" name="seletedSeq" value="<c:out value="${report.inSeq}"/>"/>
				</td>
				<td align="center">
					<c:out value="${status.count}" />
				</td>
				<td align="center">
					<c:out value="${report.inDuty}"/>&nbsp;<c:out value="${report.inName}"/>
				</td>
				<td align="left">
					<a href="<c:url value="/report/update.do"><c:param name="inSeq" value="${report.inSeq}" /></c:url>">
						<c:out value="${report.inSubject}"/>
					</a>
				</td>
				<td align="center">
					<fmt:formatDate value="${report.inInfodate}" pattern="yyyy-MM-dd"/>
				</td>
				<td align="center">
					<fmt:formatDate value="${report.inRegdate}" pattern="yyyy-MM-dd"/>
				</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"><spring:message code="button.writeReport" /></a></li>
	</ul>
</div>


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

/* 전체선택 버튼 function */
function selectAll() {
	$('.cbDeleteReport').prop('checked', true);
}

/* 선택해제 버튼 function */
function unselectAll() {
	$('.cbDeleteReport').prop('checked', false);
}

/* 선택삭제 function */
function deleteSelectedItem() {
	if($('.cbDeleteReport:checked').length == 0){
		alert('삭제할 임시 견문을 선택해주십시오.');
	}
	else {
		if (confirm('<spring:message code="report.msg.askDel" arguments="' + $('.cbDeleteReport:checked').length + '" />')) {
			var selectedSeq = $('.cbDeleteReport:checked').map(function(){return {inSeq:$(this).val()}}).get();
			$.ajax({
				url: '<c:out value="/report/delete.do"/>',
				type: 'post',
				data: {selectedSeq: selectedSeq},
				dataType: 'json',
				success: function (data) {
					location.reload();
				}
			});
		}
	}
}
-->
</script>
