ERP-node/WebContent/WEB-INF/view/admin/profitLoss/PreTimeList.jsp

156 lines
4.6 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>기계적 작동시간</title>
<!-- //JSTL 변수선언 -->
<c:set var="prevPage" value="${empty PREV_PAGE?1:PREV_PAGE}" />
<script type="text/javascript">
$(function(){
$(document).ready(function(){
});
//저장
$("#btnSave").click(function(){
fn_regist();
});
//추가
$("#btnAdd").click(function(){
var option="";
$.ajax({
type : "POST",
url : "/admin/makeAreaCd.do",
data : {"codeId" : "0000549"},
dataType:"json",
async: false,
success: function(data){
if(data.RESULT !=""){
option += "<option value=''>선택</option>";
option += data.RESULT;
}
}
});
var length = $("#adminTable tr").length;
var addText ="";
addText +="<tr id='row"+Number(length)+"'>"
addText +="<td><select name='area' id='area' required reqTitle='지역'>"
addText +=option
addText +="</select>"
addText +="</td>"
addText +="<td><input type='text' name='from_value' id='from_value' required reqTitle='from_value'></td>"
addText +="<td><input type='text' name='to_value' id='to_value' required reqTitle='to_value'></td>"
addText +="<td><input type='text' name='person' id='person' required reqTitle='person'></td>"
addText +="<td><input type='text' name='pretime' id='pretime' required reqTitle='pretime'></td>"
addText +="<td><input type='button' class='blue_btn' value='삭제' onclick='fn_deletephone("+Number(length)+");' style='float:none;'></td>"
addText +="</tr>";
$("#adminTable").append(addText);
});
});
function fn_deletephone(num){
$("#row"+num).remove();
}
//상태값 수정
function fn_regist(){
if(fnc_valitate("form1")){
var param = $("#form1").serialize();
/* Swal.fire(param);
return; */
$.ajax({
url:"/admin/PreTimeListSave.do",
type:"POST",
data: param,
dataType:"json",
success:function(data){
if(data=="SUCCESS"){
Swal.fire('저장되었습니다.');
document.location.reload();
}else{
Swal.fire('저장에 실패했습니다 관리자 에게 문의해주세요.');
document.location.reload();
}
},
error: function(jqxhr, status, error){
}
});
}
}
</script>
</head>
<body>
<form name="form1" id="form1" method="POST">
<section id="commonSection" class="admin1">
<div class="admin_title">
<h2>성형 인원 및 준비시간</h2>
</div>
<font color="red">반드시 수정및 삭제후 '수정하기' 버튼을 눌러주세요!!</font>
<div id="adminBtnWrap">
<input type="button" value="추가" class="btns" id="btnAdd">
<input type="button" value="수정" class="btns" id="btnSave">
</div>
<div id="adminTableWrap">
<div id="tableWrap">
<table id="adminTable">
<colgroup>
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="35px" />
</colgroup>
<tr >
<td>지역</td>
<td>구분(이상)</td>
<td>구분(이하)</td>
<td>인원(명)</td>
<td>준비시간(분)</td>
<td></td>
</tr>
<c:choose>
<c:when test="${!empty LIST}">
<c:forEach var="info" items="${LIST}" varStatus="status">
<tr id="row${status.count}">
<td>
<select name="area" id="area" required reqTitle="지역">
<option>선택</option>
${info.area_cd}
</select>
</td>
<td><input type="text" name="from_value" id="from_value" value="${info.FROM_VALUE}" required reqTitle="from_value"></td>
<td><input type="text" name="to_value" id="to_value" value="${info.TO_VALUE}" required reqTitle="to_value"></td>
<td><input type="text" name="person" id="person" value="${info.PERSON}" required reqTitle="person"></td>
<td><input type="text" name="pretime" id="pretime" value="${info.PRETIME}" required reqTitle="pretime"></td>
<td><input type="button" class="blue_btn" value="삭제" onclick="fn_deletephone('${status.count}');" style="float:none;"></td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
</div>
</div>
</section>
</form>
</body>
</html>