ERP-node/WebContent/WEB-INF/view/admin/user/userMainFormPopup.jsp

203 lines
5.7 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">
<link rel="stylesheet" href="css/basic.css">
<title><%=Constants.SYSTEM_NAME%></title>
<script>
var isEditMode = "${empty info?'false':'true'}";
$(function(){
//save
$("#btnSave").click(function(){
var flag = false;
if(isEditMode == "false"){
flag = fn_duplicateUserIdCheck();
}else{
flag = true;
}
if(flag){
if(fn_validate()){
fn_save();
}
}
});
});
</script>
<script>
//검사명 저장
function fn_save(){
if(fn_validate()){
if(confirm("저장하시겠습니까?")){
//if(confirm("로그인 시 사용자 ID 앞에 PLM_ 를 붙여야 로그인이 가능합니다.\n해당 내용을 충분히 숙지 하였습니까?")){
//$("#userId").val("PLM_"+$("#userId").val().toUpperCase());
$.ajax({
url:"/admin/saveUserInfo.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
async:false,
success:function(data){
Swal.fire(data.msg);
//Swal.fire("생성된 계정 정보입니다.\nPLM_"+$("#userId").val());
if(data.result == "true" || data.result == true || data.result){
opener.fn_search();
self.close(0);
}
},
error: function(jqxhr, status, error){
}
});
//}
}
}
}
//User Id 중복체크
function fn_duplicateUserIdCheck(){
var result = false;
var userId = $("#userId").val();
$.ajax({
url:"/admin/checkDuplicateUserId.do",
type:"POST",
data:{"userId":userId},
dataType:"json",
async:false,
success:function(data){
if(data.result == "false" || data.result == false || !data.result){
Swal.fire(data.msg);
$("#userId").focus();
}else{
result = true;
}
},
error: function(jqxhr, status, error){
}
});
return result;
}
function fn_validate(){
if($("#userId").val() == ""){
Swal.fire("사용자 ID를 입력해 주시기 바랍니다.");
$("#userId").focus();
return false;
}
if("${info.USER_ID}"==""){
if($("#password").val() == ""){
Swal.fire("비밀번호를 입력해 주시기 바랍니다.");
$("#password").focus();
return false;
}else{
if(validatePassword($("#password").val())) {
} else {
Swal.fire('비밀번호는 숫자영문특수문자 조합 8자 이상으로 하셔야 합니다.');
return false;
}
}
if($("#password").val() != $("#password2").val()){
Swal.fire("비밀번호를 확인해 주시기 바랍니다.");
$("#password2").focus();
return false;
}
}
if($("#sabun").val() == ""){
Swal.fire("사원번호를 입력해 주시기 바랍니다.");
$("#sabun").focus();
return false;
}
if($("#userName").val() == ""){
Swal.fire("사용자명을 입력해 주시기 바랍니다.");
$("#userName").focus();
return false;
}
/* if($("#deptCode").val() == ""){
Swal.fire("업체를 선택해 주시기 바랍니다.");
$("#deptCode").focus();
return false;
} */
return true;
}
function validatePassword(character) {
return /^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,}$/.test(character)
}
</script>
</head>
<body>
<section id="commonSection">
<div class=admin_title>
<h2>사용자 등록</h2>
</div>
<div id="adminPopupFormWrap">
<form id="form1" name="form1" method="post">
<table id="adminPopupForm">
<colgroup>
<col width="37%" />
<col width="63%" />
</colgroup>
<tbody>
<tr>
<td><label>사용자 ID</label></td>
<td><input type="text" title="사용자 ID" name="userId" id="userId" value="${info.USER_ID}" maxlength="10" ${!empty info?'readonly':''} required></td>
</tr>
<%-- <c:if test="${empty info}"> --%>
<tr>
<td><label>비밀번호</label></td>
<td><input type="password" title="비밀번호" name="password" id="password" value="" maxlength="20" required></td>
</tr>
<tr>
<td><label>비밀번호 확인</label></td>
<td><input type="password" title="비밀번호 확인" name="password2" id="password2" value="" maxlength="20" required></td>
</tr>
<%-- </c:if> --%>
<tr>
<td><label>핸드폰</label></td>
<td><input type="text" title="cellPhone" name="cellPhone" id="cellPhone" value="${info.CELL_PHONE}" maxlength="20" required></td>
</tr>
<tr>
<td><label>E-Mail</label></td>
<td><input type="text" title="email" name="email" id="email" value="${info.EMAIL}" maxlength="40" required></td>
</tr>
<tr>
<td><label>OFFICE NO</label></td>
<td><input type="text" title="tel" name="tel" id="tel" value="${info.TEL}" maxlength="20" required></td>
</tr>
<tr>
<td><label>FAX NO</label></td>
<td><input type="text" title="fax_no" name="fax_no" id="fax_no" value="${info.FAX_NO}" maxlength="20" required></td>
</tr>
</tbody>
</table>
<div id="adminPopupBtnWrap">
</div>
</form>
</div>
<div class="btnCenterWrap">
<center class="center_btns_wrap">
<input type="button" value="저장" class="btns" id="btnSave">
<input type="button" value="닫기" name="" id="btn_close" class="btns" onclick="javascript:self.close();">
</center>
</div>
</secsion>
</body>
</html>