회원 정보 수정 페이지 모달로 변경.

master
강석 최 2022-03-03 13:11:58 +09:00
parent 24b2c41b10
commit 5a5777a164
6 changed files with 236 additions and 233 deletions

View File

@ -323,7 +323,7 @@ public class AdminController {
UserVO userVO = userService.selectUserInfo(userid);
model.addAttribute("userVO", userVO);
return "admin/userInfoView";
return "admin/html/userInfoView";
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();

View File

@ -5,14 +5,7 @@
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<script src="../../../js/admin/userinfo.js"></script>
<style>
.searchList > li{
display: inline;
}
</style>
<script src="/js/admin/userinfo.js"></script>
<div class="section_title">
<!-- <p>현장 지원 시스템</p> -->
@ -21,7 +14,7 @@
<h1 class="h4 m-3">회원관리</h1>
<form:form commandName="userSearchVO" name="searchForm" action="/admin/userInfo" method="get">
<div class="row justify-content-between bg-white mx-3 py-2"">
<div class="row justify-content-between bg-white mx-3 py-2">
<div class="col-auto">
<ul class="nav nav-pills" role="tablist" style="margin-left: 16px">
<li role="presentation" class="nav-item"><a class="nav-link ${userSearchVO.auth eq '99'?'active':''}" href="/admin/userInfo?auth=99">승인대기<span class="badge"><c:out value='${standByCount}' /></span></a></li>
@ -31,75 +24,69 @@
</div>
<div class="col-auto row">
<div class="col-auto">
<select class="form-select" name="searchCondition">
<option <c:if test="${userSearchVO.searchCondition eq 'all'}">selected</c:if> value="all">통합검색</option>
<option <c:if test="${userSearchVO.searchCondition eq 'name'}">selected</c:if> value="name">이름</option>
<option <c:if test="${userSearchVO.searchCondition eq 'company'}">selected</c:if> value="company">소속</option>
<option <c:if test="${userSearchVO.searchCondition eq 'email'}">selected</c:if> value="email">이메일</option>
<option <c:if test="${userSearchVO.searchCondition eq 'phonenum'}">selected</c:if> value="phonenum">전화번호</option>
</select>
</div>
<div class="col-auto">
<select class="form-select" name="searchCondition">
<option <c:if test="${userSearchVO.searchCondition eq 'all'}">selected</c:if> value="all">통합검색</option>
<option <c:if test="${userSearchVO.searchCondition eq 'name'}">selected</c:if> value="name">이름</option>
<option <c:if test="${userSearchVO.searchCondition eq 'company'}">selected</c:if> value="company">소속</option>
<option <c:if test="${userSearchVO.searchCondition eq 'email'}">selected</c:if> value="email">이메일</option>
<option <c:if test="${userSearchVO.searchCondition eq 'phonenum'}">selected</c:if> value="phonenum">전화번호</option>
</select>
</div>
<div class="col-auto">
<input type="text" class="form-control" name="searchKeyword" value="${userSearchVO.searchKeyword}" />
</div>
<div class="col-auto">
<input class="btn btn-outline-secondary" type="submit" value="검색" />
</div>
</div>
</div>
<div class="col-auto">
<input type="text" class="form-control" name="searchKeyword" value="${userSearchVO.searchKeyword}" />
</div>
<div class="col-auto">
<input class="btn btn-outline-secondary" type="submit" value="검색" />
</div>
</div>
</div>
<div class="row m-3 p-2 bg-white">
<table class="table table-hover text-center">
<thead>
<tr>
<th>아이디</th>
<th>이름</th>
<th>소속</th>
<th>전화번호</th>
<th>이메일</th>
<th>가입일</th>
<c:choose>
<c:when test="${userSearchVO.auth eq '99'}">
<th>상태</th>
</c:when>
<c:otherwise>
<th>권한</th>
</c:otherwise>
</c:choose>
</tr>
</thead>
<tbody>
<c:if test="${count >= 1}">
<c:forEach var="item" items="${userList}" varStatus="idx">
<tr>
<td><a href="/admin/userInfo/<c:out value='${item.userid}' />"><c:out value='${item.userid}' /></a></td>
<td><a href="/admin/userInfo/<c:out value='${item.userid}' />"><c:out value='${item.name}' /></a></td>
<td><a href="/admin/userInfo/<c:out value='${item.userid}' />"><c:out value='${item.company}' /></a></td>
<td><a href="/admin/userInfo/<c:out value='${item.userid}' />"><c:out value='${item.phonenum}' /></a></td>
<td><a href="/admin/userInfo/<c:out value='${item.userid}' />"><c:out value='${item.email}' /></a></td>
<td class="td_date"><c:out value='${item.regdate}' /></a></td>
<td>
<c:choose>
<c:when test="${item.auth eq '1'}">관리자</c:when>
<c:when test="${item.auth eq '2'}">사용자</c:when>
<c:when test="${item.auth eq '99'}">
<input type="button" class="btn btn-outline-success" value="승인" onclick="confirmBtn('${item.userid}','2'); return false;" />
<input type="button" class="btn btn-outline-danger" value="삭제" onclick="confirmBtn('${item.userid}','-1'); return false;" />
</c:when>
</c:choose>
</td>
</tr>
</c:forEach>
</c:if>
<c:if test="${count == 0}">
<tr><td colspan="7">요청한 목록이 없습니다.</td></tr>
</c:if>
</tbody>
</table>
</div>
<div class="row m-3 p-2 bg-white">
<table class="table table-hover text-center">
<thead>
<tr>
<th>아이디</th>
<th>이름</th>
<th>소속</th>
<th>전화번호</th>
<th>이메일</th>
<th>가입일</th>
<th>${userSearchVO.auth eq '99'?'상태':'권한'}</th>
</tr>
</thead>
<tbody>
<c:if test="${count >= 1}">
<c:forEach var="user" items="${userList}" varStatus="idx">
<tr>
<%--<a href="/admin/userInfo/<c:out value='${item.userid}' />"></a>--%>
<td class="clickAbleObj userInfoModalBtn useridTd"><c:out value='${user.userid}' /></td>
<td class="clickAbleObj userInfoModalBtn"><c:out value='${user.name}' /></td>
<td class="clickAbleObj userInfoModalBtn"><c:out value='${user.company}' /></td>
<td class="clickAbleObj userInfoModalBtn"><c:out value='${user.phonenum}' /></td>
<td class="clickAbleObj userInfoModalBtn"><c:out value='${user.email}' /></td>
<td class="clickAbleObj userInfoModalBtn td_date"><c:out value='${user.regdate}' /></td>
<td>
<c:choose>
<c:when test="${user.auth eq '1'}">관리자</c:when>
<c:when test="${user.auth eq '2'}">사용자</c:when>
<c:when test="${user.auth eq '99'}">
<input type="button" class="btn btn-outline-success" value="승인" onclick="confirmBtn('${user.userid}','2'); return false;" />
<input type="button" class="btn btn-outline-danger" value="삭제" onclick="confirmBtn('${user.userid}','-1'); return false;" />
</c:when>
</c:choose>
</td>
</tr>
</c:forEach>
</c:if>
<c:if test="${count == 0}">
<tr><td colspan="7">요청한 목록이 없습니다.</td></tr>
</c:if>
</tbody>
</table>
</div>
<div class="text-page">
<form:hidden path="pageIndex" />
<nav aria-label="Page navigation">
@ -115,3 +102,17 @@
<input type="hidden" id="auth" name="auth" />
</form:form>
</div>
<div class="modal fade" id="userInfoModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="userInfoModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="userInfoModalLabel">회원 정보 수정</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="userInfoModalBody">
</div>
</div>
</div>
</div>

View File

@ -4,91 +4,77 @@
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<script src="../../../js/admin/userinfoView.js"></script>
<div class="row justify-content-between bg-white mx-3 py-2">
<form:form commandName="userVO" name="updateForm" id="updateForm" action="/admin/userUpdate" method="post">
<div class="section_content">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<input type="hidden" name="userid" value="${userVO.userid}" />
<form:form commandName="userVO" name="updateForm" id="updateForm" action="/admin/userUpdate" method="post">
<div class="section_content">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<input type="hidden" name="userid" value="${userVO.userid}" />
<div class="join_top">
<h2> <i class="bi bi-person-circle"></i>&nbsp;회원 정보 수정</h2>
</div>
<table class="join_table">
<tbody>
<tr>
<th>아이디</th>
<td>${userVO.userid}</td>
</tr>
<tr>
<th>비밀번호</th>
<td>
<p><label><input type="checkbox" id="changePw" /> 비밀번호 변경</<label></p>
<input type="password" class="form-control" id="password" name="password" value="" disabled="true" />
</td>
</tr>
<tr>
<th>비밀번호 확인</th>
<td><input type="password" class="form-control" id="passwordCheck" name="passwordCheck" value="" disabled="true" />
</td>
</tr>
<tr>
<th>이름</th>
<td><input type="text" class="form-control" name="name" id="name" value="${userVO.name}" /></td>
</tr>
<tr>
<th>소속기관</th>
<td><input type="text" class="form-control" name="company" id="company" value="${userVO.company}" /></td>
</tr>
<tr>
<th>연락처</th>
<td><input type="text" class="form-control" name="phonenum" id="phonenum" value="${userVO.phonenum}"/></td>
</tr>
<tr>
<th>이메일</th>
<td>
<div>
<input type="text" class="form-control" name="email" id="email" value="${userVO.email}" />
</div>
</td>
</tr>
<c:if test="${userVO.auth ne '99'}">
<tr>
<th>권한</th>
<td>
<label class="auth-label">
<input type="radio" name="auth" value="2"
<c:if test="${userVO.auth eq '2'}">checked</c:if>
/> 사용자
</label>
<label class="auth-label">
<input type="radio" name="auth" value="1"
<c:if test="${userVO.auth eq '1'}">checked</c:if>
/> 관리자
</label>
</td>
</tr>
</c:if>
</tbody>
</table>
<div class="join_top" style="margin-top:20px;">
<p class="search_p1">
<input class="btn btn-primary" type="button" value="목록" onclick="history.go(-1)" />
</p>
<p class="search_p2">
<c:choose>
<c:when test="${userVO.auth eq '99'}">
<input type="button" class="btn btn-success" value="승인" onclick="confirmBtn('${item.userid}','2'); return false;" />
<input type="button" class="btn btn-danger" value="삭제" onclick="confirmBtn('${item.userid}','-1'); return false;" />
</c:when>
<c:otherwise>
<input class="btn btn-success" type="button" value="수정" onclick="update();" />
</c:otherwise>
</c:choose>
</p>
</div>
</div>
</form:form>
<table class="join_table">
<tbody>
<tr>
<th>아이디</th>
<td>${userVO.userid}</td>
</tr>
<tr>
<th><label for="password">비밀번호</label></th>
<td>
<p><label for="changePw"><input type="checkbox" id="changePw" /> 비밀번호 변경</label></p>
<input type="password" class="form-control" id="password" name="password" value="" disabled="true" />
</td>
</tr>
<tr>
<th><label for="passwordCheck">비밀번호 확인</label></th>
<td><input type="password" class="form-control" id="passwordCheck" name="passwordCheck" value="" disabled="true" />
</td>
</tr>
<tr>
<th><label for="name">이름</label></th>
<td><input type="text" class="form-control" name="name" id="name" value="${userVO.name}" /></td>
</tr>
<tr>
<th><label for="company">소속기관</label></th>
<td><input type="text" class="form-control" name="company" id="company" value="${userVO.company}" /></td>
</tr>
<tr>
<th><label for="phonenum">연락처</label></th>
<td><input type="text" class="form-control" name="phonenum" id="phonenum" value="${userVO.phonenum}"/></td>
</tr>
<tr>
<th><label for="email">이메일</label></th>
<td>
<div>
<input type="text" class="form-control" name="email" id="email" value="${userVO.email}" />
</div>
</td>
</tr>
<c:if test="${userVO.auth ne '99'}">
<tr>
<th>권한</th>
<td>
<input type="radio" name="auth" id="auth2" value="2" <c:if test="${userVO.auth eq '2'}">checked</c:if>/>
<label for="auth2" class="auth-label">사용자</label>
<input type="radio" name="auth" id="auth1" value="1" <c:if test="${userVO.auth eq '1'}">checked</c:if>/>
<label for="auth1" class="auth-label">관리자</label>
</td>
</tr>
</c:if>
</tbody>
</table>
<div class="join_top mt-3">
<p class="search_p2">
<c:choose>
<c:when test="${userVO.auth eq '99'}">
<input type="button" class="btn btn-success" value="승인" onclick="confirmBtn('${userVO.userid}','2'); return false;" />
<input type="button" class="btn btn-danger" value="삭제" onclick="confirmBtn('${userVO.userid}','-1'); return false;" />
</c:when>
<c:otherwise>
<input class="btn btn-success" type="button" value="수정" onclick="update();" />
</c:otherwise>
</c:choose>
</p>
</div>
</div>
</form:form>
</div>

View File

@ -718,4 +718,8 @@ a {
background-color: #337ab7;
color:#fff;
}
.clickAbleObj:hover{
cursor:pointer;
}

View File

@ -1,26 +1,92 @@
let userInfoModal;
$(function(){
userInfoModal = new bootstrap.Modal(document.getElementById('userInfoModal'));
})
function fn_link_page(pageNo) {
document.searchForm.pageIndex.value = pageNo;
document.searchForm.action = "<c:url value='/admin/userInfo' />";
document.searchForm.submit();
$(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").append(html);
userInfoModal.show();
},
error:function(){
}
});
})
function fn_link_page(pageNo) {
document.searchForm.pageIndex.value = pageNo;
document.searchForm.action = "<c:url value='/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 confirmBtn(userid, auth){
$("#userid").val(userid);
$("#auth").val(auth);
var msg;
if(auth == 2){
msg = "승인";
$(function(){
$("#changePw").click(function(){
if($(this).is(":checked")){
$("#password").attr("disabled", false);
$("#passwordCheck").attr("disabled", false);
}else{
msg = "삭제";
$("#password").attr("disabled", true);
$("#passwordCheck").attr("disabled", true);
}
});
});
if(confirm(msg+" 처리 하시겠습니까?")){
$("#updateFrm").submit();
}else{
return false;
}
}
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();
}
}

View File

@ -1,54 +0,0 @@
$(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() {
var changePw = $("#changePw").is(":checked");
var pw1 = $('#password').val();
var pw2 = $('#passwordCheck').val();
var name = $('#name').val();
var company = $('#company').val();
var tell = $('#phonenum').val();
var email_1 = $('#email').val();
if (changePw && pw1 == "") {
alert('비밀번호를 입력해주세요');
$('#password').focus();
return;
} else if (changePw && pw2 == "") {
alert('비밀번호를 입력해주세요');
$('#passwordCheck').focus();
return;
} else if (changePw && (pw1 != pw2)) {
alert('비밀번호가 일치하지 않습니다.');
$('#pass').focus();
return;
} else if (name == "") {
alert('이름을 입력해주세요');
$('#name').focus();
return;
} else if (company == "") {
alert('소속기관을 입력해주세요');
$('#company').focus();
return;
} else if (tell == "") {
alert('연락처를 입력해주세요');
$('#phone_num').focus();
return;
} else if (email_1 == "") {
alert('이메일을 입력해주세요');
$('#email').focus();
return;
} else {
$("#updateForm").submit();
}
}