ERP-node/WebContent/WEB-INF/view/board/notice/noticeList.jsp

285 lines
9.4 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<!-- //JSTL 변수선언 -->
<c:set var="totalCount" value="${empty TOTAL_COUNT?0:TOTAL_COUNT}" />
<c:set var="maxPage" value="${empty MAX_PAGE_SIZE?1:MAX_PAGE_SIZE}" />
<c:set var="nPage" value="${empty param.page?1:param.page}" />
<c:set var="pageIndex" value="${(nPage-1)/10}" />
<c:set var="nextPage" value="${empty NEXT_PAGE?1:NEXT_PAGE}" />
<c:set var="prevPage" value="${empty PREV_PAGE?1:PREV_PAGE}" />
<script type="text/javascript">
$(document).ready(function(){
fnc_datepick();
//체크박스 전체선택/전체해제
$("#allCheck").click(function() {
if ($("#allCheck").prop("checked")) {
$("input[name=ListCheck]").prop("checked", true);
} else {
$("input[name=ListCheck]").prop("checked", false);
}
});
$("#btnSearch").click(function(){
$("#page").val("1");
fn_search();
});
});
$(document).ready(function(){
fnc_datepick();
$("input").keyup(function(e){
if(e.keyCode == 13){
fn_search();
}
});
});
//게시물쓰기
function fn_openNoticeFormPopUp(objId, writer){
if('${reqWriter}' == writer || "true" == "${isAdmin}" || (objId == "" && writer == "")){
window.open("","openNoticeFormPopUp","width=800 height=600 resizable=no menubar=no status=no");
//댓글정보를 가져온다
var url = "/notice/openNoticeFormPopUp.do";
var form = document.form1;
form.objId.value = objId;
form.target = "openNoticeFormPopUp";
form.action = url;
form.submit();
}else {
window.open("","openNoticeFormPopUp","width=800 height=600 resizable=no menubar=no status=no");
//공지사항 상세화면 불러오기
var url = "/notice/openNoticeDetailPopUp.do";
var form = document.form1;
form.objId.value = objId;
form.target = "openNoticeFormPopUp";
form.action = url;
form.submit();
}
}
function search(){
document.form1.action="/notice/getNoticeList.do"; //form데이터를 서버로 보낼 때 해당 데이터가 도착할 URL명시
document.form1.target="_self"; //서버로부터 받은 응답을 현재 프레임의 부모 프레임에서 보여줌
document.form1.submit(); // 주로 폼을 서버로 전송하기 전에 내용을 검증하거나 폼 전송을 취소할 때 사용
}
function fn_search(){
search();
}
/* 게시물 체크리스트 삭제 */
function fn_delete(){
if($("input[name=ListCheck]:checked").length > 0){
if(confirm("해당 댓글을 게시물을 삭제하시겠습니까?")){
$.ajax({
url:"/notice/delNoticeList.do",
type:"POST",
data:$('#form1').serialize(),
dataType:"json",
async:false,
success:function(data){
Swal.fire(data.msg);
// 게시물 삭제 성공시 페이지 새로고침
window.location.reload()
},
error: function(jqxhr, status, error){
}
});
}
}else{
Swal.fire("선택된 댓글이 없습니다.");
return false;
}
}
</script>
</head>
<body class="backcolor">
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="objid" value="${item.OBJID}" />
<input type="hidden" name="objId" id="objId">
<input type="hidden" name="search_boardType" value="notice" />
<section>
<div class="plm_menu_name_gdnsi">
<h2>
<span>공지사항</span>
</h2>
<div class="btnArea">
<input type="button" value="조회" class="plm_btns" onclick="search();">
<input type="button" value="등록" class="plm_btns" id="btn_reg_notice" onclick="fn_openNoticeFormPopUp('','');" >
<input type="button" id="btnDelete" value="삭제" class="plm_btns" onclick="javascript:fn_delete()">
</div>
</div>
<div id="plmSearchZon">
<table>
<tr>
<%--
<td class="">
<label for="" class="">구분</label>
</td>
<td>
<select name="search_boardType" id="search_boardType">
<option value="">전체</option>
<option value="qna" ${'qna' eq param.search_boardType?'selected':''}>QnA</option>
<option value="notice" ${'notice' eq param.search_boardType?'selected':''}>공지사항</option>
</select>
</td>
<td class="">
<label for="" class="">카테고리</label>
</td>
--%>
<td>
<select name="search_category" id="search_category">
<option value="">전체</option>
</select>
</td>
<td class="">
<label for="" class="">제목</label>
</td>
<td>
<input type="text" name="search_title" id="search_title" value="${param.search_title}">
</td>
<td class="">
<label for="" class="">작성일</label>
</td>
<td>
<input type="text" id="search_reqDateFrom" name="search_reqDateFrom" class="date_margin" value="${param.search_reqDateFrom}"> ~ <input type="text" id="search_reqDateTo" name="search_reqDateTo" value="${param.search_reqDateTo}">
</td>
<td class="">
<label for="" class="">중요</label>
</td>
<td style="width:50px;">
<input type="checkbox" name="search_important" id="search_important" value="checked" ${empty param.search_important?'':'checked'}>
</td>
</tr>
</table>
</div>
<div class="contents_page_basic_margin">
<!--
<div class="btn_wrap">
<div class="plm_btn_wrap">
<input type="button" value="조회" class="plm_btns" onclick="search();">
<input type="button" value="등록" class="plm_btns" id="btn_reg_notice" onclick="fn_openNoticeFormPopUp('','');" >
<input type="button" id="btnDelete" value="삭제" class="plm_btns" onclick="javascript:fn_delete()">
</div>
</div>
-->
<div class="plm_table_wrap">
<div>
<table class="plm_table">
<colgroup>
<col width="2.8%" />
<!--
<col width="4%" />
-->
<col width="10%" />
<col width="*" />
<col width="15%" />
<col width="15%" />
</colgroup>
<thead>
<tr class="plm_thead">
<td><input type="checkbox" id="allCheck" class="checkBox"></td>
<td>No</td>
<!--
<td>구분</td>
-->
<td>제목</td>
<td>작성자</td>
<td>등록일</td>
</tr>
</thead>
<c:choose>
<c:when test="${empty LIST}">
<tr style="text-align:center;">
<td align="center" colspan="5">조회된 데이터가 없습니다.</td>
</tr>
</c:when>
<c:otherwise>
<c:forEach var="item" items="${LIST}" varStatus="varStatus">
<tr style="text-align:center;${'checked' eq item.IMPORTANT?'font-weight:bold;color:red;':''};">
<td><input type='checkbox' name='ListCheck' value="${item.OBJID}"></td>
<td>${item.RNUM}</td>
<%--
<td>${item.BOARD_TYPE}</td>
<td>${item.CATEGORY}</td>
--%>
<td class="align_l4">
<a href="#" onclick="fn_openNoticeFormPopUp('${item.OBJID}', '${item.REQ_WRITER}');" style="${'checked' eq item.IMPORTANT?'font-weight:bold;color:red;':''};">${item.TITLE}</a>
<a href="#" onclick="fn_openNoticeFormPopUp('${item.OBJID}', '${item.REQ_WRITER}');" style="color:red; background-color:ivory">${'true' eq item.CHECK_COMMENTS ? '[Re : ..]' : ''}</a>
<%-- <a href="#" onclick="fn_openNoticeFormPopUp('${item.OBJID}', '${item.REQ_WRITER}');" style="color:red; background-color:ivory">${item.COMM_CONTENTS}</a>
<a href="#" onclick="fn_openNoticeFormPopUp('${item.OBJID}', '${item.REQ_WRITER}');" style="color:red; background-color:ivory">${null ne item.COMM_CONTENTS ? ']' : ''}</a> --%>
</td>
<td>${item.REQ_DEPT_NAME} / ${item.REQ_USER_NAME}</td>
<td>${item.REQ_REGDATE_TITLE}</td>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
</div>
</div>
<div class="pdm_page">
<input type="hidden" name="page" id="page" value="${nPage}">
<c:if test="${!empty LIST}">
<div class="page_pro">
<table>
<tr>
<c:choose>
<c:when test="${nPage > 1}">
<td><a href="javascript:fnc_goPrev('${prevPage}');">prev</a></td>
</c:when>
<c:otherwise>
<td class="no_more_page">prev</td>
</c:otherwise>
</c:choose>
<c:forEach var="v" begin="${nPage>5?nPage-5:1}"
end="${nPage>5?nPage+4:10}" step="1" varStatus="status">
<c:if test="${status.index -1 < maxPage}">
<c:choose>
<c:when test="${status.index eq nPage}">
<td><a href="#" class="now_page">${nPage}</a></td>
</c:when>
<c:otherwise>
<td><a href="javascript:fnc_goPage('${status.index}');">${status.index}</a></td>
</c:otherwise>
</c:choose>
</c:if>
</c:forEach>
<c:choose>
<c:when test="${nPage < maxPage}">
<td><a href="javascript:fnc_goNext('${nextPage}');">next</a></td>
</c:when>
<c:otherwise>
<td class="no_more_page">next</td>
</c:otherwise>
</c:choose>
</tr>
</table>
<p id="adminPageCount">총 ${totalCount}건</p>
</div>
</c:if>
</div>
</div>
</section>
</form>
</body>
</html>