167 lines
5.3 KiB
Plaintext
167 lines
5.3 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>
|
|
<link rel="stylesheet" href="css/basic.css">
|
|
<script>
|
|
$(function(){
|
|
$(document).ready(function(){
|
|
var actionType = "${actionType}";
|
|
if(actionType == 'modify'){
|
|
$('#overlapCheckId').remove();
|
|
$('#overlapStatus').remove();
|
|
}
|
|
});
|
|
|
|
//엔터키로 조회
|
|
$("input").keyup(function(e){
|
|
if(e.keyCode == 13){
|
|
fnc_productSubmit();
|
|
}
|
|
});
|
|
});
|
|
|
|
//공백 및 중복확인
|
|
function fnc_overlapCheck(){
|
|
var result;
|
|
var productName = $('#productName').val();
|
|
var productCode = $('#productCode').val();
|
|
if(!fnc_valitate('form1')){
|
|
$('#overlapStatus').empty();
|
|
}else{
|
|
$.ajax({
|
|
url:"/admin/productOverlapCheck.do",
|
|
type:"POST",
|
|
data:{"search_productName":productName},
|
|
dataType:"json",
|
|
async:false,
|
|
success:function(overlap){
|
|
if(overlap.PRODUCT_NAME == productName){
|
|
$('#overlapStatus').text("등록된 정보입니다.");
|
|
$('#productName').focus();
|
|
}else{
|
|
$('#overlapStatus').text("등록 가능한 정보입니다.");
|
|
$('#productName').focus();
|
|
}
|
|
result = overlap;
|
|
},
|
|
error: function(jqxhr, status, error){
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
}
|
|
|
|
//저장
|
|
function fnc_productSubmit(){
|
|
var productGroupObjid = $('#productGroupObjid').val();
|
|
var productName = $('#productName').val();
|
|
var productObjid = $('#productObjid').val();
|
|
var productCode = $('#productCode').val();
|
|
var productDescription = $('#productDescription').val();
|
|
var status = $('#status').val();
|
|
var actionType = "${param.actionType}";
|
|
|
|
var overlap = fnc_overlapCheck();
|
|
if(overlap.PRODUCT_NAME == productName && actionType == 'regist'){
|
|
Swal.fire("등록된 정보입니다.");
|
|
$('#productName').focus();
|
|
}else if(overlap.OBJID == productObjid || overlap.PRODUCT_NAME == undefined){
|
|
if(confirm("저장하시겠습니까?")){
|
|
$.ajax({
|
|
url:"/admin/mergeProduct.do",
|
|
type:"POST",
|
|
data:{"productName":productName, "productObjid":productObjid, "status":status, "actionType":actionType,
|
|
"productGroupObjid":productGroupObjid, "productCode":productCode, "productDescription":productDescription},
|
|
dataType:"text",
|
|
async:false,
|
|
success:function(data){
|
|
opener.fn_search();
|
|
self.close(0);
|
|
},
|
|
error: function(jqxhr, status, error){
|
|
}
|
|
});
|
|
}
|
|
}else{
|
|
Swal.fire("등록된 정보입니다.");
|
|
}
|
|
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<form id="form1" name="form1" method="post">
|
|
<input type="hidden" id="productObjid" name="productObjid" value="${productInfo.OBJID}">
|
|
<section id="commonSection" class="admin_min">
|
|
<div class="admin_title">
|
|
<h2>제품관리</h2>
|
|
</div>
|
|
<div id="adminPopupFormWrap">
|
|
<table id="adminPopupForm">
|
|
<colgroup>
|
|
<col width="30%">
|
|
<col width="*">
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<td><label>제품군 명</label></td>
|
|
<c:choose>
|
|
<c:when test="${!empty productGroupMngList}">
|
|
<td>
|
|
<select type="select" title="제품군" id="productGroupObjid" name="productGroupObjid" required>
|
|
<option value="">선택</option>
|
|
<c:forEach var="productGroup" items="${productGroupMngList}">
|
|
<option value="${productGroup.OBJID}" ${productInfo.PRODUCT_GROUP_NAME eq productGroup.PRODUCT_GROUP_NAME?'selected':''}>${productGroup.PRODUCT_GROUP_NAME}</option>
|
|
</c:forEach>
|
|
</select>
|
|
</td>
|
|
</c:when>
|
|
<c:otherwise>
|
|
<td><input type="text" value="조회된 정보가 없습니다." style="text-align:center;" readonly></td>
|
|
</c:otherwise>
|
|
</c:choose>
|
|
</tr>
|
|
<tr>
|
|
<td><label>제품 명</label></td>
|
|
<td><input type="text" title="제품" id="productName" name="productName" value="${productInfo.PRODUCT_NAME}" maxlength="60" required></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label>코드</label></td>
|
|
<td><input type="text" title="코드" id="productCode" name="productCode" value="${productInfo.PRODUCT_CODE}" maxlength="5" required></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label>설명</label></td>
|
|
<td><input type="text" id="productDescription" name="productDescription" value="${productInfo.PRODUCT_DESC}" maxlength="20"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label>활성화 여부</label></td>
|
|
<td>
|
|
<select id="status" name="status">
|
|
<option value="active" ${productInfo.STATUS eq 'active'?'selected':''}>활성화</option>
|
|
<option value="inActive" ${productInfo.STATUS eq 'inActive'?'selected':''}>비활성화</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div id="adminPopupBtnWrap">
|
|
<span id="overlapStatus"></span>
|
|
<input type="button" value="저장" class="btns" onclick="javascript:fnc_productSubmit();">
|
|
<input type="button" value="중복확인" class="btns" id="overlapCheckId" onclick="javascript:fnc_overlapCheck();">
|
|
</div>
|
|
</div>
|
|
<div class="btnCenterWrap">
|
|
<div class="center_btns_wrap">
|
|
<input type="button" value="닫기" name="" id="btn_close" class="btns" onclick="javascript:self.close();">
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</form>
|
|
</body>
|
|
</html> |