ERP-node/WebContent/WEB-INF/view/admin/application/adminApplicationFormPopup.jsp

174 lines
4.8 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>
<script>
$(function(){
$(document).ready(function(){
var actionType = "${actionType}";
if(actionType == 'modify'){
$('#overlapCheckId').remove();
$('#overlapStatus').remove();
}
});
//닫기
$("#btnClose").click(function(){
self.close(0);
});
//저장
$("#btnSave").click(function(){
if(fn_validate()){
if(confirm("저장하시겠습니까?")){
fnc_applyPointSubmit();
}
}
});
//중복확인
$("#overlapCheckId").click(function(){
fnc_overlapCheck();
});
//엔터키로 조회
$("input").keyup(function(e){
if(e.keyCode == 13){
fnc_applyPointSubmit();
}
});
});
//중복확인
function fnc_overlapCheck(){
var result;
var applyPointName = $('#applyPointName').val();
if(!fnc_valitate('form1')){
$('#overlapStatus').empty();
$('#applyPointName').focus();
}else{
$.ajax({
url:"/admin/applyPointOverlapCheck.do",
type:"POST",
data:{"search_applyPointName":applyPointName},
dataType:"json",
async:false,
success:function(overlap){
if(overlap.APPLY_POINT_NAME == applyPointName){
$('#overlapStatus').text("등록된 정보입니다.");
$('#applyPointName').focus();
}else{
$('#overlapStatus').text("등록 가능한 정보입니다.");
$('#applyPointName').focus();
}
result = overlap;
},
error: function(jqxhr, status, error){
}
});
return result;
}
}
//저장
function fnc_applyPointSubmit(){
var applyPointName = $('#applyPointName').val();
var applyPointDescription = $('#applyPointDescription').val();
var applyPointObjid = $('#applyPointObjid').val();
var status = $('#status').val();
var actionType = "${param.actionType}";
var overlap = fnc_overlapCheck();
if(overlap.APPLY_POINT_NAME == applyPointName && actionType == 'regist'){
Swal.fire("등록된 정보입니다.");
$('#applyPointName').focus();
}else if(overlap.OBJID == applyPointObjid || overlap.APPLY_POINT_NAME == undefined){
$.ajax({
url:"/admin/mergeApplyPoint.do",
type:"POST",
data:{"applyPointName":applyPointName, "applyPointObjid":applyPointObjid, "status":status,
"actionType":actionType, "applyPointDescription":applyPointDescription},
dataType:"text",
async:false,
success:function(data){
opener.fn_search();
self.close(0);
},
error: function(jqxhr, status, error){
}
});
}else{
Swal.fire("등록된 정보입니다.");
}
}
//정합성체크
function fn_validate(){
if($("#applyPointName").val() == null || $("#applyPointName").val() == ""){
Swal.fire("설계적용시점명을 입력해 주시기 바랍니다.");
$("#applyPointName").focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post">
<input type="hidden" id="applyPointObjid" name="applyPointObjid" value="${applyPointInfo.OBJID}">
<section id="commonSection" class="admin_apptime_min">
<div class="admin_title">
<h2>설계적용시점명 관리</h2>
</div>
<div id="adminPopupFormWrap">
<table id="adminPopupForm">
<colgroup>
<col width="37%" />
<col width="63%" />
</colgroup>
<tbody>
<tr>
<td><label>설계적용시점명</label></td>
<td><input type="text" title="설계적용시점" id="applyPointName" value="${applyPointInfo.APPLY_POINT_NAME}" maxlength="16" required></td>
</tr>
<tr>
<td><label>설명</label></td>
<td><input type="text" id="applyPointDescription" value="${applyPointInfo.DESCRIPTION}" maxlength="20"></td>
</tr>
<tr>
<td><label>활성화 여부</label></td>
<td class="no_bottom_border">
<select name="status" id="status">
<option value="active" ${applyPointInfo.STATUS eq 'active'?'selected':''}>활성화</option>
<option value="inActive" ${applyPointInfo.STATUS eq 'inActive'?'selected':''}>비활성화</option>
</select>
</td>
</tr>
</tbody>
</table>
<div id="adminPopupBtnWrap">
<span id="overlapStatus"></span>
<input type="button" value="저장" class="btns" id="btnSave">
<input type="button" value="중복확인" class="btns" id="overlapCheckId" >
</div>
</div>
<div class="btnCenterWrap">
<center class="center_btns_wrap">
<input type="button" value="닫기" name="" id="btnClose" class="btns">
</center>
</div>
</section>
</form>
</body>
</html>