GGWEB/src/main/webapp/js/admin/userinfo.js

93 lines
2.5 KiB
JavaScript

let userInfoModal;
$(function () {
userInfoModal = new bootstrap.Modal(document.getElementById('userInfoModal'));
})
$(document).on('click', '.userInfoModalBtn', function () {
const userid = $(this.parentNode).find(".useridTd")[0].innerText;
$.ajax({
url: '/admin/userInfo/' + userid,
type: 'GET',
dataType: "html",
success: function (html) {
$("#userInfoModalBody").empty().append(html);
userInfoModal.show();
},
error: function () {
}
});
})
function fn_link_page(pageNo) {
document.searchForm.pageIndex.value = pageNo;
document.searchForm.action = "/admin/userInfo";
document.searchForm.submit();
}
function confirmBtn(userid, auth) {
$("#userid").val(userid);
$("#auth").val(auth);
var msg;
if (auth === "2") {
msg = "승인";
} else {
msg = "삭제";
}
if (confirm(msg + " 처리 하시겠습니까?")) {
$("#updateFrm").submit();
} else {
return false;
}
}
$(function () {
$("#changePw").click(function () {
if ($(this).is(":checked")) {
$("#password").attr("disabled", false);
$("#passwordCheck").attr("disabled", false);
} else {
$("#password").attr("disabled", true);
$("#passwordCheck").attr("disabled", true);
}
});
});
function update() {
const changePw = $("#changePw").is(":checked");
const pw1 = $('#password');
const pw2 = $('#passwordCheck');
const name = $('#name');
const company = $('#company');
const tell = $('#phonenum');
const email_1 = $('#email');
if (changePw && pw1.val() === "") {
alert('비밀번호를 입력해주세요');
pw1.focus();
} else if (changePw && pw2.val() === "") {
alert('비밀번호를 입력해주세요');
pw2.focus();
} else if (changePw && (pw1.val() !== pw2.val())) {
alert('비밀번호가 일치하지 않습니다.');
pw1.focus();
} else if (name.val() === "") {
alert('이름을 입력해주세요');
name.focus();
} else if (company.val() === "") {
alert('소속기관을 입력해주세요');
company.focus();
} else if (tell.val() === "") {
alert('연락처를 입력해주세요');
tell.focus();
} else if (email_1.val() === "") {
alert('이메일을 입력해주세요');
email_1.focus();
} else {
$("#updateForm").submit();
}
}