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

<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/adminSubMenu.jsp" %>
        </div>
    </div>
    <div class="subContent">
        <%@ include file="/WEB-INF/jsp/egovframework/include/adminMenu.jsp" %>
        <!--// 어드민 탭메뉴 -->
        <div class="pageTitle">
            <h2>공지사항 관리</h2>
            <p>안동시 첨단교통센터 <span>관리자</span> 정보입니다.</p>
        </div>
        <div class="adminWrap">
            <div class="boardWrap">
                <div class='view-head'>
                    <p>${notice.bSubject}</p>
                </div>
                <div class='view-contents'>
                    <div class='view-infoBox'>
                        <p class='download'>
                        <c:if test="${not empty notice.attachFiles && not empty notice.attachFileIds}" >
                            <c:forEach var="attachFile" items="${notice.attachFiles}" varStatus="status">
                                <c:if test="${not empty attachFile}">
                                    <a class="file${status.count}" onclick="fileDownload('${notice.attachFileIds.get(status.index)}', '${attachFile}')" style="cursor:pointer;">
                                        <img src="/images/contents/ico_file.png" class='pt12 pr05' alt="첨부파일${status.count}" />${attachFile}</a>
                                </c:if>
                            </c:forEach>
                        </c:if>
                        </p>
<%--                        <a href='#download'>첨부파일명자료.jpg</a></p>--%>
                        <p class="info">
                            <span class='writer'>${notice.bWriter}</span>
                            <span class='day'>${notice.regDate}</span>
                            <span class='visited'>${notice.readCount}</span>
                        </p>
                    </div>
                    <div class="text-area">
                        ${notice.bContent}
                    </div>
                </div>
                ${parmeter}
                <div class="prevnext">
                    <p>
                        <c:if test="${!empty notice.nextNo}"><span><a href="/admin/noticeView/${notice.nextNo}.do${parameter}" class="button">&lt; 이전으로</a></span></c:if>
                        <c:if test="${!empty notice.prevNo}"><span><a href="/admin/noticeView/${notice.prevNo}.do${parameter}" class="button"> 다음으로 &gt;</a></span></c:if>
                    </p>
                    <p>
                        <span><a href="/admin/noticeList.do${parameter}" class="button">목록</a></span>
                        <span><a href="/admin/editNotice/${notice.boardNo}.do" class="button">수정</a></span>
                        <span><a href="javascript:deleteNotice('${notice.boardNo}', '${notice.bSubject}')" class="button">삭제</a></span>
                    </p>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function deleteNotice(boarNo, boarTitle){
        let deleteConfirm = confirm("제목 : " + boarTitle + "\n해당 게시물을 삭제하시겠습니까?");
        if (deleteConfirm) {
            location.href = '/admin/deleteNotice/' + boarNo + '.do';
        }
    }
</script>
<!--//contents-->