<%@ 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="/ptatms/archiveList.do">자료실 관리</a></li>
            </ul>
        </article>
        <article class="contents-wrap">
            <div class="title-box">
                <h2 class="h2-title">자료실</h2>
                <p class="title-info">평택시 교통정보센터</p>
            </div>
            <!--탭버튼-->
            <div class="tab-btn">
                <p><a href="/ptatms/noticeList.do">공지사항</a></p>
                <p><a href="/ptatms/archiveList.do" class="active">자료실</a></p>
                <p><a href="/ptatms/popupList.do">팝업창 관리</a></p>
                <p><a href="/ptatms/modifyInfo.do">계정 정보변경</a></p>
                <p><a href="/ptatms/status.do">접속통계</a></p>
                <p><a href="/ptatms/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">
                            <c:if test="${not empty notice.attatchFiles && not empty notice.attatchFileIds}" >
                                <c:forEach var="attatchFile" items="${notice.attatchFiles}" varStatus="status">
                                    <c:if test="${not empty attatchFile}">
                                        <a class="file${status.count}"
                                            onclick="fileDownload('${notice.attatchFileIds.get(status.index)}', '${attatchFile}', '${notice.boardNo}')" style="cursor:pointer;">
                                            <img src="/images/icon_file.png" class='pt12 pr05' alt="첨부파일${status.count}" />${attatchFile}</a>
                                    </c:if>
                                </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="/ptatms/archiveList.do">목록</a></span>
                        <span><a href="/ptatms/archiveEdit/${notice.boardNo}.do">수정</a></span>
                        <span><a href="javascript:deleteNotice('${notice.boardNo}', '${notice.bSubject}')">삭제</a></span>
                    </p>
                </div>
            </div>
        </article>
    </section>
    <script>
    	function deleteNotice(boarNo, boarTitle){
            let deleteConfirm = confirm("제목 : " + boarTitle + "\n해당 게시물을 삭제하시겠습니까?");
            if (deleteConfirm) {
                location.href = '/ptatms/removeArchive/' + boarNo + '.do';
            }
        }
    </script>
       <!--//contents-->