<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

    <section class="sub-container">
        <article class="menu-history">
            <ul>
                <li><a href="/main/main.do" class="home">홈</a></li>
                <li><a href="/admin/noticeList.do">공지사항 관리</a></li>
            </ul>
        </article>
        <article class="contents-wrap">
            <div class="title-box">
                <h2 class="h2-title">공지사항</h2>
                <p class="title-info">평택시 교통정보센터 <span>관리자</span></p>
            </div>
            <!--탭버튼-->
            <div class="tab-btn">
                <p><a href="/admin/noticeList.do" class="active">공지사항</a></p>
                <p><a href="/admin/popupList.do">팝업창 관리</a></p>
                <p><a href="/admin/modiAdmin.do">관리자 정보변경</a></p>
                <p><a href="/admin/status.do">접속통계</a></p>
                <p><a href="/admin/logout.do">로그아웃</a></p>
            </div>
            <!--//탭버튼-->
            <div class="board-form">
                <div class="board-view-head">
                    <p>${notice.bSubject}</p>
                </div>
                <div class="board-view">
                    <div class="view-form">
                        <div class="download">
                            <%--									<a href="#">첨부파일명자료.jpg</a>--%>
                            <c:if test="${not empty notice.attatchFiles && not empty notice.attatchFileIds}" >
                                <c:forEach var="attatchFile" items="${notice.attatchFiles}" varStatus="status">
                                     <a class="file${status.count}" onclick="fileDownload('${notice.attatchFileIds.get(status.index)}', '${attatchFile}')" style="cursor:pointer;">
                                        <img src="/images/icon_file.png" class='pt12 pr05' alt="첨부파일${status.count}" />${attatchFile}</a>
                                </c:forEach>
                            </c:if>
                        </div>
                        <p class="day">${notice.regDate}</p>
                    </div>
                    <div class="content">
                        ${notice.bContent}
                    </div>
                </div>
                <div class="prevnext">
                    <p>
                        <span><a href="/admin/noticeList.do">목록</a></span>
                        <span><a href="/admin/editNotice.do?boardNo=${notice.boardNo}">수정</a></span>
                        <span><a href="/admin/deleteNotice.do?boardNo=${notice.boardNo}">삭제</a></span>
                    </p>
                </div>
            </div>
        </article>
    </section>
    <script>
    	function fileDownload(fileId, fileName) {
    		location.href = "/notice/getFile.do?fileId="+ fileId + "&fileName=" + encodeURIComponent(fileName);
    	}
    	
    </script>
       <!--//contents-->