ERP-node/WebContent/WEB-INF/view/admin/template/templateList.jsp

301 lines
8.9 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" %>
<%
String supply_name = CommonUtils.checkNull(request.getParameter("supply_name"));
String temp_name = CommonUtils.checkNull(request.getParameter("temp_name"));
String searchStatus = CommonUtils.checkNull(request.getParameter("searchStatus"));
%>
<!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>
$(document).ready(function(){
fnc_datepick();
//엔터키로 조회
$("input").keyup(function(e){
if(e.keyCode == 13){
$("#page").val("1");
fn_search();
}
});
// 전체 선택
$("#firstCheck").click(function(){
if($("#firstCheck").prop("checked")){
$("input[name=oemCheck]").prop("checked",true);
}else{
$("input[name=oemCheck]").prop("checked",false);
}
})
// 부분체크해제
$("input[name=oemCheck]").click(function(){
if($("#firstCheck").is(":checked")){
$("#firstCheck").prop("checked",false);
}
})
$("#btnSearch").click(function(){
$("#page").val("1");
fn_search();
});
//삭제
$("#btnDelete").click(function(){
fn_delete();
});
});
</script>
<script type="text/javascript">
function fn_delete(){
if(0 < $("input[name=oemCheck]:checked").length){
if(confirm("선택한 템플릿을 삭제하시겠습니까?")){
var param = $("#form1").serialize();
$.ajax({
type : "POST",
url : "/admin/deletetemplateInfo.do",
data: param,
dataType:"json",
success:function(data){
if(data.result == 'true'){
Swal.fire("삭제되었습니다.");
fn_search();
};
}
,error: function(jqxhr, status, error){
}
});
}
}else{
Swal.fire("선택한 항목이 없습니다.");
}
}
function templatePopUp(objid){
// Swal.fire(objid)
if(""!=objid){
window.open("","templatePopUp","width=720 height=850 menubar=no status=no");
var hiddenForm = document.hiddenForm;
hiddenForm.objid.value = objid;
hiddenForm.detail.value = "Y";
hiddenForm.target = "templatePopUp";
hiddenForm.action = "/admin/templateFormPopUp.do";
hiddenForm.submit();
hiddenForm.detail.value = "";
}else{
window.open("","templatePopUp","width=720 height=850 menubar=no status=no");
var hiddenForm = document.hiddenForm;
hiddenForm.objid.value = objid;
hiddenForm.target = "templatePopUp";
hiddenForm.action = "/admin/templateFormPopUp.do";
hiddenForm.submit();
}
}
//고객사의 상태를 변경한다.
function changeOEMStatus(objid,status){
if("" == objid || "" == status){
Swal.fire("잘못된 접근입니다.");
return false;
}else if("" != objid && "" != status){
if(confirm("상태를 변경하시겠습니까?")){
var hiddenForm = document.hiddenForm;
hiddenForm.objid.value = objid;
hiddenForm.status.value = status;
var param = $("#hiddenForm").serialize();
$.ajax({
type : "POST",
url : "/admin/changeTemplateStatus.do",
data : param,
dataType:"json",
complete:function(xhr){
Swal.fire("변경하였습니다.");
fn_search();
}
});
}
}
}
function multiChangeOEMStatus(status){
if("" == status){
Swal.fire("잘못된 접근입니다.");
return false;
}else if("" != status){
var choice = [];
$("input[name='oemCheck']:checked").each(function(i){
choice.push($(this).val());
});
if(choice == ''){
Swal.fire("고객사를 선택하세요.")
}
else if(confirm("변경하시겠습니까?")){
document.form1.status.value = status;
document.form1.action = "/admin/multiChangeOEMStatus.do";
document.form1.submit();
}
}
}
function fn_search(){
var form = document.form1;
form.action="/admin/templateList.do";
form.submit();
}
function fn_openHistory(objid){
if(null != objid){
window.open("/admin/supMgmtInfoHistoryList.do?objid="+objid, "", "width=1200, height=500");
}else{
Swal.fire("잘못된 접근입니다.");
}
}
</script>
</head>
<body>
<form name="hiddenForm" id="hiddenForm">
<input type="hidden" name="objid">
<input type="hidden" name="detail">
<input type="hidden" name="status">
</form>
<form name="form1" id="form1" method="post">
<input type="hidden" name="status" id="status">
<section id="commonSection" class="admin1">
<div class="admin_title">
<h2>템플릿 관리</h2>
</div>
<div id="adminFormWrap">
<table id="adminForm">
<tbody>
<tr>
<td class="label"><label for="">탬플릿 이름</label></td>
<td><input type="text" name="temp_name" id="temp_name" value="<%=temp_name%>"></td>
<td class="label"><label for="">상태</label></td>
<td>
<select name="searchStatus" id="searchStatus">
<option value="">선택</option>
<option value="active" <%=("active".equals(searchStatus)) ? "selected" : "" %>>활성화</option>
<option value="inActive" <%=("inActive".equals(searchStatus)) ? "selected" : "" %>>비활성화</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
<div id="adminBtnWrap">
<input type="button" value="조회" class="btns" id="btnSearch">
<input type="button" value="템플릿등록" class="btns" onclick="javascript:templatePopUp('');">
<input type="button" value="삭제" class="btns" id="btnDelete">
</div>
<div id="adminTableWrap">
<div id="tableWrap">
<table id="adminTable">
<colgroup>
<col width="3%" />
<col width="4%" />
<col width="21%" />
<col width="10%" />
<col width="10%" />
</colgroup>
<tr>
<td><input type="checkbox" name="" value="" id="firstCheck" onclick="javascript:allCheck(this,'oemCheck')"></td>
<td>No</td>
<td>템플릿 코드</td>
<td>등록일</td>
<td>상태</td>
</tr>
<c:choose>
<c:when test="${0 < supplyInfoList.size()}">
<c:forEach var="oemInfo" items="${supplyInfoList}">
<tr>
<td><input type="checkbox" name="oemCheck" value="${oemInfo.OBJID}"></td>
<td>${oemInfo.RNUM}</td>
<td><a href="#" onclick="javascript:templatePopUp('${oemInfo.OBJID}')">${oemInfo.TEMPLATE_CODE_DETAIL_NAME}</a></td>
<td>${oemInfo.REG_DATE}</td>
<td>
<select name="" id="" onchange="javascript:changeOEMStatus('${oemInfo.OBJID}',this.value);">
<option value="active" ${oemInfo.STATUS eq 'active' ? 'selected' : ''}>활성화</option>
<option value="inActive" ${oemInfo.STATUS eq 'inActive' ? 'selected' : ''}>비활성화</option>
</select>
</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="5">조회된 정보가 없습니다.</td>
</tr>
</c:otherwise>
</c:choose>
</table>
</div>
</div>
<div class="pdm_page">
<input type="hidden" name="page" id="page" value="${nPage}">
<c:if test="${!empty supplyInfoList}">
<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>
</section>
</form>
</body>
</html>