<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c:set var="parmeter" value=""></c:set>
<c:if test="${!empty searchType && !empty searchText}">
    <c:set var="parameter" value="?searchType=${searchType}&searchText=${searchText}"></c:set>
</c:if>

<div class="container">
    <div class="subHeader">
        <h1 class="logo">안동시 교통정보센터</h1>
        <div class="pageLocation">
            <%@ include file="/WEB-INF/jsp/egovframework/include/userSubMenu.jsp" %>
        </div>
    </div>
    <div class="subContent">
        <div class="pageTitle">
            <h2>공지사항</h2>
            <p>역사와 미래가 공존하는 <span>안동</span></p>
        </div>

        <div class="boardWrap">
            <form id="boardForm" action="/notice/noticeList.do" method="GET">
                <div class="bod_head">
                    <p class="page_num">현재 페이지
                        <span class="bold red">
                            ${pageMaker.currentPage}
                        </span>
                        &nbsp;/
                        &nbsp;전체 페이지&nbsp;${pageMaker.totalPage}
                    </p>
                    <fieldset class="bod_search">
                        <select id="searchType" name="searchType">
                            <option value="title" selected>제목</option>
                        </select>
                        <label for="searchType"></label>
                        <input id="searchText" name="searchText" type="text" value="${searchText}" placeholder="검색어를 입력하세요">
                        <label for="searchText"></label>
                        <input type="submit" value="검색" title="검색" class="button">
                    </fieldset>
                </div>
                <table class="bod_list gosi">
                    <caption>전체 목록을 번호,  공고번호, 제목, 담당부서, 등록일 항목별 순서대로 안내하는 표입니다.</caption>
                    <colgroup>
                        <col style="width: 10%;">
                        <col style="width: auto;">
                        <col style="width: 10%;">
                        <col style="width: 10%;">
                        <col style="width: 15%;">
                        <col style="width: 10%;">
                    </colgroup>
                    <thead>
                    <tr>
                        <th scope="col">번호</th>
                        <th scope="col">제목</th>
                        <th scope="col">첨부</th>
                        <th scope="col">작성자</th>
                        <th scope="col">작성일</th>
                        <th scope="col">조회수</th>
                    </tr>
                    </thead>
                    <tbody>
                        <c:forEach var="item" items="${noticeList}">
                            <tr>
                                <td class="list_num">${item.boardNo }</td>
                                <td class="list_tit">
                                    <a href="/notice/noticeView/${item.boardNo}.do${parameter}" title="${item.bSubject }">
                                        ${item.bSubject }
                                    </a>
                                </td>
                                <td class="list_file">
                                    <c:if test="${item.attachFile != '||'}">
                                        <img src="/images/contents/ico_file.png" alt="첨부파일"/>
                                    </c:if>
                                </td>
                                <td class="list_writer">${item.bWriter}</td>
                                <td class="list_date">${item.regDate}</td>
                                <td class="list_view">${item.readCount}</td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>
            </form>
            <div class="bod_page">
                <div class="paging">
                    <c:if test="${pageMaker.prev}">
                        <a href="/notice/noticeList/1.do${parameter}" class="pre_end">
                            <img src="/images/contents/btn_pg_first.gif" alt="처음으로">
                        </a>
                        <a href="/notice/noticeList/${pageMaker.startPage - 1}.do${parameter}" class="pre">
                            <img src="/images/contents/btn_pg_prev.gif" alt="이전 5페이지">
                        </a>
                    </c:if>
                    <c:forEach begin="${pageMaker.startPage}" end="${pageMaker.endPage}" var="idx">
                        <c:choose>
                            <c:when test="${pageMaker.currentPage eq idx}">
                                <span title="현재 페이지">${idx}</span>
                            </c:when>
                            <c:otherwise>
                                <a href="/notice/noticeList/${idx}.do${parameter}" title="${idx}페이지">${idx}</a>
                            </c:otherwise>
                        </c:choose>
                    </c:forEach>
                    <c:if test="${pageMaker.next}">
                        <a href="/notice/noticeList/${pageMaker.endPage + 1}.do${parameter}">
                           <img src="/images/contents/btn_pg_next.gif" alt="다음 5페이지">
                        </a>
                        <a href="/notice/noticeList/${pageMaker.totalPage}.do${parameter}" class="next_end">
                            <img src="/images/contents/btn_pg_last.gif" alt="끝으로">
                        </a>
                    </c:if>
                </div>
            </div>
        </div>
    </div>
</div>