관리자 작업 중

This commit is contained in:
kangsunlee
2025-06-10 19:22:38 +09:00
parent a8e29ec69c
commit 43ed02600c
25 changed files with 527 additions and 421 deletions

View File

@@ -4,136 +4,144 @@
<section class="fw-bold" layout:fragment="content">
<form
method="post"
th:action="@{/settings/admins/create}"
th:object="${bindingVO}">
<form
method="post"
th:action="@{/settings/admins/create}"
th:object="${bindingVO}">
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="id">ID *</label>
<div class="col-sm-4">
<input class="form-control" id="id" th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
th:field="*{id}"/>
<div class="invalid-feedback fw-bold" th:errors="*{id}" th:if="${#fields.hasErrors('id')}">
에러 메세지
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="password">Password *</label>
<div class="col-sm-4">
<input class="form-control" id="password" th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'" th:field="*{password}"
type="password"/>
<div class="invalid-feedback fw-bold" th:errors="*{password}"
th:if="${#fields.hasErrors('password')}">
에러 메세지
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="id">ID *</label>
<div class="col-sm-4">
<input class="form-control" id="id"
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
th:field="*{id}"/>
<div class="invalid-feedback fw-bold" th:errors="*{id}"
th:if="${#fields.hasErrors('id')}">
에러 메세지
</div>
</div>
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="password">Password *</label>
<div class="col-sm-4">
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="email">Email *</label>
<div class="col-sm-4">
<input class="form-control" id="email" th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" th:field="*{email}"
type="email"/>
<div class="invalid-feedback fw-bold" th:errors="*{email}"
th:if="${#fields.hasErrors('email')}">
에러 메세지
</div>
</div>
</div>
<input class="form-control" id="password"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
th:field="*{password}"
type="password"/>
<div class="invalid-feedback fw-bold" th:errors="*{password}"
th:if="${#fields.hasErrors('password')}">
에러 메세지
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
<div class="col-sm-4">
<select class="form-control" id="roleIds" multiple th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
th:field="*{roleIds}"
onchange="onRoleChange(this);">
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
</div>
<div class="row mb-3 regionMainCodeArea" style="display: none;">
<label class="col-sm-2 col-form-label" for="regionMainCode">실사</label>
<div class="col-sm-4">
<select class="form-select" id="regionMainCode" name="regionMainCode" th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="email">Email *</label>
<div class="col-sm-4">
<input class="form-control" id="email"
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
th:field="*{email}"
type="email"/>
<div class="invalid-feedback fw-bold" th:errors="*{email}"
th:if="${#fields.hasErrors('email')}">
에러 메세지
</div>
</div>
</div>
<!-- 활성화 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio1" name="accountDisabled"
type="radio" value="true">
<label class="form-check-label" for="inlineRadio1">비활성화</label>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
<div class="col-sm-4">
<select class="form-control" id="roleIds" multiple
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
th:field="*{roleIds}"
onchange="onRoleChange(this);">
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<div class="form-check form-check-inline">
<input checked class="form-check-input" id="inlineRadio2"
name="accountDisabled" type="radio" value="false">
<label class="form-check-label" for="inlineRadio2">활성화</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<!-- 계정잠김 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="accountLocked1">계정잠김 여부*</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked1" name="accountLocked"
type="radio" value="true">
<label class="form-check-label" for="accountLocked1">Locked</label>
<div class="row mb-3 regionMainCodeArea" style="display: none;">
<label class="col-sm-2 col-form-label" for="regionMainCode">실사 *</label>
<div class="col-sm-4">
<select class="form-select" id="regionMainCode" name="regionMainCode"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
</div>
<div class="form-check form-check-inline">
<input checked class="form-check-input" id="accountLocked2"
name="accountLocked" type="radio" value="false">
<label class="form-check-label" for="accountLocked2">Unlocked</label>
<!-- 활성화 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio1" name="accountDisabled"
type="radio" value="true">
<label class="form-check-label" for="inlineRadio1">비활성화</label>
</div>
<div class="form-check form-check-inline">
<input checked class="form-check-input" id="inlineRadio2"
name="accountDisabled" type="radio" value="false">
<label class="form-check-label" for="inlineRadio2">활성화</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
<!-- 계정잠김 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="accountLocked1">계정잠김 여부*</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked1" name="accountLocked"
type="radio" value="true">
<label class="form-check-label" for="accountLocked1">Locked</label>
</div>
<div class="form-check form-check-inline">
<input checked class="form-check-input" id="accountLocked2"
name="accountLocked" type="radio" value="false">
<label class="form-check-label" for="accountLocked2">Unlocked</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
</div>
</div>
<button class="btn btn-primary float-end" type="submit">저장</button>
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동</button>
</form>
<button class="btn btn-primary float-end" type="submit">저장</button>
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동
</button>
</form>
<script>
function gotoList() {
document.prevAdminParamForm ? document.prevAdminParamForm.submit()
: location.href = '/settings/admins';
}
</script>
<script>
function gotoList() {
document.prevAdminParamForm ? document.prevAdminParamForm.submit()
: location.href = '/settings/admins';
}
</script>
<script>
const onRoleChange = (el) => {
$('.regionMainCodeArea').toggle(el.value !== "ROLE_ADMIN");
}
</script>
<script>
const onRoleChange = (el) => {
$('.regionMainCodeArea').toggle(el.value !== "ROLE_ADMIN");
}
</script>
</section>

View File

@@ -4,200 +4,210 @@
<section layout:fragment="content">
<form method="post" name="adminParamForm" onsubmit="goSearch();"
th:action="@{/settings/admins}"
th:object="${listStatus}">
<form method="post" name="adminParamForm" onsubmit="goSearch();"
th:action="@{/settings/admins}"
th:object="${listStatus}">
<!-- hidden parameters -->
<input name="page" th:value="${listOutput.pageable.pageNumber}" type="hidden"/>
<input name="sort" th:value="${listOutput.pageable.sort}" type="hidden"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<!-- hidden parameters -->
<input name="page" th:value="${listOutput.pageable.pageNumber}" type="hidden"/>
<input name="sort" th:value="${listOutput.pageable.sort}" type="hidden"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
<div class="col-5">
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
<select class="form-select d-inline w-25" id="searchField" th:field="*{searchField}">
<option selected value="">선택</option>
<option value="id">ID</option>
<option value="email">Email</option>
</select>
<label>
<input class="form-control d-inline" placeholder="검색어를 입력하세요." style="width: 250px;"
th:field="*{searchValue}" type="text">
</label>
</div>
<div class="col">
<label class="col-sm-2 col-form-label" for="searchRole">권한</label>
<select class="form-select d-inline w-50" id="searchRole" th:field="*{searchRole}">
<option selected value="">전체</option>
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
</div>
<div class="col text-end">
<button class="btn btn-outline-secondary" onclick="goSearch();"
type="button">
<i class="bi bi-search"></i>
</button>
<button class="btn btn-outline-secondary" onclick="goInit();"
type="button">초기화
</button>
</div>
</div>
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
<div class="col-5">
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
<select class="form-select d-inline w-25" id="searchField"
th:field="*{searchField}">
<option selected value="">선택</option>
<option value="id">ID</option>
<option value="email">Email</option>
</select>
<label>
<input class="form-control d-inline" placeholder="검색어를 입력하세요."
style="width: 250px;"
th:field="*{searchValue}" type="text">
</label>
</div>
<div class="col">
<label class="col-sm-2 col-form-label" for="searchRole">권한</label>
<select class="form-select d-inline w-50" id="searchRole" th:field="*{searchRole}">
<option selected value="">전체</option>
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
</div>
<div class="col text-end">
<button class="btn btn-outline-secondary" onclick="goSearch();"
type="button">
<i class="bi bi-search"></i>
</button>
<button class="btn btn-outline-secondary" onclick="goInit();"
type="button">초기화
</button>
</div>
</div>
<div class="row">
<div class="col text-start">
<div class="fw-bolder text-muted">Total: <span
th:text="${listOutput.totalElements}"></span></div>
</div>
<div class="col text-end">
<i class="bi bi-list-ol"></i>
<label>
<select class="form-select form-select-sm" id="pageSize" name="pageSize"
onchange="goSearch()">
<option
th:each="item : ${pageRows}"
th:selected="${#strings.toString(listOutput.pageable.pageSize) eq item.codeValue}" th:text="${item.codeText}"
th:value="${item.codeValue}"></option>
</select>
</label>
</div>
</div>
<div class="row">
<div class="col text-start">
<div class="fw-bolder text-muted">Total: <span
th:text="${listOutput.totalElements}"></span></div>
</div>
<div class="col text-end">
<i class="bi bi-list-ol"></i>
<label>
<select class="form-select form-select-sm" id="pageSize" name="pageSize"
onchange="goSearch()">
<option
th:each="item : ${pageRows}"
th:selected="${#strings.toString(listOutput.pageable.pageSize) eq item.codeValue}"
th:text="${item.codeText}"
th:value="${item.codeValue}"></option>
</select>
</label>
</div>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">
<label><input class="form-check-input" onchange="toggleCheckbox(this);" type="checkbox"/></label>
</th>
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
<th class="text-secondary" scope="col">권한</th>
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a></th>
<th scope="col"><a class="order-able" data-sort-field="accountDisabled" href="#">활성화</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="accountLocked" href="#">계정잠김</a></th>
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a></th>
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a></th>
</tr>
</thead>
<tbody>
<tr th:each="item, status : ${listOutput.content}">
<th scope="row"
th:text="${status.count + (listOutput.pageable.pageNumber * listOutput.pageable.pageSize)}">
게시물번호
</th>
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
type="checkbox"/></label>
</td>
<td><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a></td>
<td>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">
<label><input class="form-check-input" onchange="toggleCheckbox(this);"
type="checkbox"/></label>
</th>
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
<th class="text-secondary" scope="col">권한</th>
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="accountDisabled"
href="#">활성화</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="accountLocked"
href="#">계정잠김</a></th>
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a>
</th>
</tr>
</thead>
<tbody>
<tr th:each="item, status : ${listOutput.content}">
<th scope="row"
th:text="${status.count + (listOutput.pageable.pageNumber * listOutput.pageable.pageSize)}">
게시물번호
</th>
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
type="checkbox"/></label>
</td>
<td><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a>
</td>
<td>
<span th:each="role, status : ${item.roles}"
th:text="${role.getId()} + ${!status.last ? ', ': ''}"></span>
</td>
<td th:text="${item.email}">이메일</td>
<td th:text="${item.accountDisabled == null || !item.accountDisabled ? 'Y' : 'N' }"></td>
<td th:text="${item.accountLocked == null || !item.accountLocked ? 'N' : 'Y' }"></td>
<td th:text="${#temporals.format(item.createdAt, 'yyyy-MM-dd hh:mm')}">등록일</td>
<td th:text="${#temporals.format(item.updatedAt, 'yyyy-MM-dd hh:mm')}">수정일</td>
</tr>
</tbody>
</table>
</td>
<td th:text="${item.email}">이메일</td>
<td th:text="${item.accountDisabled == null || !item.accountDisabled ? 'Y' : 'N' }"></td>
<td th:text="${item.accountLocked == null || !item.accountLocked ? 'N' : 'Y' }"></td>
<td th:text="${#temporals.format(item.createdAt, 'yyyy-MM-dd hh:mm')}">등록일</td>
<td th:text="${#temporals.format(item.updatedAt, 'yyyy-MM-dd hh:mm')}">수정일</td>
</tr>
</tbody>
</table>
</form>
</form>
<div th:replace="common/list-components :: pagination(${listOutput})"></div>
<div th:replace="common/list-components :: pagination(${listOutput})"></div>
<div class="row">
<div class="col text-start">
<button class="btn btn-success" onclick="goExcel();" type="button">엑셀 다운로드</button>
<div class="row">
<div class="col text-start">
<button class="btn btn-success" onclick="goExcel();" type="button">엑셀 다운로드</button>
</div>
<div class="col text-end mb-2">
<button class="btn btn-primary" onclick="location.href='/settings/admins/create';"
type="button">등록
</button>
<button class="btn btn-danger" onclick="goRemove();" type="button">삭제</button>
</div>
</div>
<div class="col text-end mb-2">
<button class="btn btn-primary" onclick="location.href='/settings/admins/create';"
type="button">등록
</button>
<button class="btn btn-danger" onclick="goRemove();" type="button">삭제</button>
</div>
</div>
</section>
<section layout:fragment="script">
<script th:inline="javascript">
// 목록 정렬 표기 및 갱신 기능 적용
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
[[${listOutput.pageable.sort.toString()}]]);
</script>
<script th:inline="javascript">
// 목록 정렬 표기 및 갱신 기능 적용
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
[[${listOutput.pageable.sort.toString()}]]);
</script>
<script th:inline="javascript">
// 검색
function goSearch() {
const f = document.adminParamForm;
f.action = '/settings/admins';
f.page.value = 0;
f.sort.value = convertToPageableSortValue(f.sort.value);
f.method = 'get';
f.submit();
}
// 초기화
function goInit() {
const f = document.adminParamForm;
f.searchField.value = '';
f.searchValue.value = '';
f.searchRole.value = '';
}
// 수정페이지 이동
function goUpdate(adminId) {
const f = document.adminParamForm;
f.action = '/settings/admins/update/' + adminId;
f.method = 'get';
f.submit();
}
// 체크박스 선택/해제
function toggleCheckbox(oj) {
$('input[name=checkedIds]').prop("checked", oj.checked);
}
function goRemove() {
if (!$('input[name=checkedIds]').is(':checked')) {
alert(/*[[#{operation.common.remove.choose}]]*/);
return;
}
if (confirm(/*[[#{operation.common.remove.ask}]]*/)) {
const f = document.adminParamForm;
const data = $(f).serializeObject();
$.ajax({
'method': 'DELETE',
'url': '/api/settings/admin/remove',
'data': {
'checkedIds': data.checkedIds
},
beforeSend: function (xhr) {
xhr.setRequestHeader(
$("meta[name='_csrf_header']").attr("content"),
$("meta[name='_csrf']").attr("content"));
},
success(res) {
alert('선택한 관리자가 삭제되었습니다.');
<script th:inline="javascript">
// 검색
function goSearch() {
const f = document.adminParamForm;
f.action = '/settings/admins';
f.page.value = 0;
f.sort.value = convertToPageableSortValue(f.sort.value);
f.method = 'get';
f.submit();
}
});
}
}
}
function goExcel() {
const f = document.adminParamForm;
f.action = '/settings/admins/excel';
f.sort.value = convertToPageableSortValue(f.sort.value);
f.method = 'post';
f.submit();
}
</script>
// 초기화
function goInit() {
const f = document.adminParamForm;
f.searchField.value = '';
f.searchValue.value = '';
f.searchRole.value = '';
}
// 수정페이지 이동
function goUpdate(adminId) {
const f = document.adminParamForm;
f.action = '/settings/admins/update/' + adminId;
f.method = 'get';
f.submit();
}
// 체크박스 선택/해제
function toggleCheckbox(oj) {
$('input[name=checkedIds]').prop("checked", oj.checked);
}
function goRemove() {
if (!$('input[name=checkedIds]').is(':checked')) {
alert(/*[[#{operation.common.remove.choose}]]*/);
return;
}
if (confirm(/*[[#{operation.common.remove.ask}]]*/)) {
const f = document.adminParamForm;
const data = $(f).serializeObject();
$.ajax({
'method': 'DELETE',
'url': '/api/settings/admin/remove',
'data': {
'checkedIds': data.checkedIds
},
beforeSend: function (xhr) {
xhr.setRequestHeader(
$("meta[name='_csrf_header']").attr("content"),
$("meta[name='_csrf']").attr("content"));
},
success(res) {
alert('선택한 관리자가 삭제되었습니다.');
f.method = 'get';
f.submit();
}
});
}
}
function goExcel() {
const f = document.adminParamForm;
f.action = '/settings/admins/excel';
f.sort.value = convertToPageableSortValue(f.sort.value);
f.method = 'post';
f.submit();
}
</script>
</section>
</html>

View File

@@ -4,144 +4,177 @@
<section class="fw-bold" layout:fragment="content">
<form
method="post"
th:action="${'/settings/admins/update/' + bindingVO.id}"
th:object="${bindingVO}">
<form
method="post"
th:action="${'/settings/admins/update/' + bindingVO.id}"
th:object="${bindingVO}">
<input type="hidden" name="seq" th:field="*{seq}"/>
<input type="hidden" name="seq" th:field="*{seq}"/>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="id">ID *</label>
<div class="col-sm-4">
<input class="form-control" id="id" readonly="readonly"
th:field="*{id}"/>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="password">Password *</label>
<div class="col-sm-4">
<input class="form-control" id="password" placeholder="암호를 변경하고 싶다면 입력하세요"
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
th:field="*{updatePassword}"
type="password"/>
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
th:if="${#fields.hasErrors('updatePassword')}">
에러 메세지
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="id">ID *</label>
<div class="col-sm-4">
<input class="form-control" id="id" readonly="readonly"
th:field="*{id}"/>
</div>
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="email">Email *</label>
<div class="col-sm-4">
<input class="form-control" id="email" th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" th:field="*{email}"
type="email"/>
<div class="invalid-feedback fw-bold" th:errors="*{email}"
th:if="${#fields.hasErrors('email')}">
에러 메세지
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="password">Password *</label>
<div class="col-sm-4">
<input class="form-control" id="password" placeholder="암호를 변경하고 싶다면 입력하세요"
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
th:field="*{updatePassword}"
type="password"/>
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
th:if="${#fields.hasErrors('updatePassword')}">
에러 메세지
</div>
</div>
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
<div class="col-sm-4">
<select class="form-control" id="roleIds" multiple th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
th:field="*{roleIds}">
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="email">Email *</label>
<div class="col-sm-4">
<input class="form-control" id="email"
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
th:field="*{email}"
type="email"/>
<div class="invalid-feedback fw-bold" th:errors="*{email}"
th:if="${#fields.hasErrors('email')}">
에러 메세지
</div>
</div>
</div>
</div>
</div>
<!-- 활성화 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio1" th:field="*{accountDisabled}"
type="radio" value="true">
<label class="form-check-label" for="inlineRadio1">비활성화</label>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
<div class="col-sm-4">
<select class="form-control" id="roleIds" multiple
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
th:field="*{roleIds}"
onchange="onRoleChange(this);">
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio2" th:field="*{accountDisabled}"
type="radio" value="false">
<label class="form-check-label" for="inlineRadio2">활성화</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<!-- 계정잠김 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="accountLocked1">계정잠김 여부*</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked1" th:field="*{accountLocked}"
type="radio" value="true">
<label class="form-check-label" for="accountLocked1">Locked</label>
<div class="row mb-3 regionMainCodeArea"
th:style="${#lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'display: none;' : 'display: flex;'">
<label class="col-sm-2 col-form-label" for="regionMainCode">실사 *</label>
<div class="col-sm-4">
<select class="form-select" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</div>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked2" th:field="*{accountLocked}"
type="radio" value="false">
<label class="form-check-label" for="accountLocked2">Unlocked</label>
<!-- 활성화 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio1" th:field="*{accountDisabled}"
type="radio" value="true">
<label class="form-check-label" for="inlineRadio1">비활성화</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio2" th:field="*{accountDisabled}"
type="radio" value="false">
<label class="form-check-label" for="inlineRadio2">활성화</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
<!-- 계정잠김 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="accountLocked1">계정잠김 여부*</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked1" th:field="*{accountLocked}"
type="radio" value="true">
<label class="form-check-label" for="accountLocked1">Locked</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked2" th:field="*{accountLocked}"
type="radio" value="false">
<label class="form-check-label" for="accountLocked2">Unlocked</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
</div>
</div>
<div class="row w-50">
<!-- audit area -->
<div th:replace="common/components :: auditArea"></div>
</div>
<div class="row w-50">
<!-- audit area -->
<div th:replace="common/components :: auditArea"></div>
</div>
<button class="btn btn-primary float-end" type="submit">저장</button>
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동</button>
</form>
<button class="btn btn-primary float-end" type="submit">저장</button>
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동
</button>
</form>
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
<form method="get" name="prevAdminParamForm"
th:action="@{/settings/admins}"
th:object="${listStatus}">
<input th:field="*{searchField}" type="hidden">
<input th:field="*{searchValue}" type="hidden">
<input th:field="*{searchRole}" type="hidden">
<th:block th:if="${pageable != null}">
<input name="page" th:value="${pageable.page}" type="hidden"/>
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
<th:block th:if="${listStatus != null}">
<form method="get" name="prevAdminParamForm"
th:action="@{/settings/admins}"
th:object="${listStatus}">
<input th:field="*{searchField}" type="hidden">
<input th:field="*{searchValue}" type="hidden">
<input th:field="*{searchRole}" type="hidden">
<th:block th:if="${pageable != null}">
<input name="page" th:value="${pageable.page}" type="hidden"/>
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
</th:block>
</form>
</th:block>
</form>
<script th:inline="javascript">
function gotoList() {
if (document.prevParamForm) {
const f = document.prevParamForm;
f.sort.value = convertToPageableSortValue(f.sort.value);
f.submit();
} else {
location.href = '/settings/admins';
}
}
<script th:inline="javascript">
function gotoList() {
if (document.prevAdminParamForm) {
const f = document.prevAdminParamForm;
f.sort.value = convertToPageableSortValue(f.sort.value);
f.submit();
} else {
location.href = '/settings/admins';
}
}
$(document).ready(() => {
showAudit([[${bindingVO.id}]], [[${bindingVO.createdBy}]],
[[${#temporals.format(bindingVO.createdAt, "yyyy-MM-dd'T'HH:mm:ss")}]],
[[${bindingVO.updatedBy}]],
[[${#temporals.format(bindingVO.updatedAt, "yyyy-MM-dd'T'HH:mm:ss")}]]);
});
</script>
$(document).ready(() => {
showAudit([[${bindingVO.id}]], [[${bindingVO.createdBy}]],
[[${#temporals.format(bindingVO.createdAt, "yyyy-MM-dd'T'HH:mm:ss")}]],
[[${bindingVO.updatedBy}]],
[[${#temporals.format(bindingVO.updatedAt, "yyyy-MM-dd'T'HH:mm:ss")}]]);
});
</script>
<script>
const onRoleChange = (el) => {
$('.regionMainCodeArea').toggle(el.value !== "ROLE_ADMIN");
}
</script>
</section>