관리자 목록 퍼블 입히기

This commit is contained in:
주수현
2025-06-14 18:38:25 +09:00
parent d93c7dd864
commit 1a8c35c5d1
2 changed files with 117 additions and 126 deletions

View File

@@ -13,122 +13,118 @@
<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>
<section class="filter-wrap">
<div class="form-area">
<div class="input-group">
<div class="input-label">
<p class="label-txt"><label for="searchField">검색필드</label></p>
</div>
<div class="d-flex">
<div class="component-select">
<select class="select-list" id="searchField" th:field="*{searchField}">
<option selected value="">선택</option>
<option value="id">ID</option>
<option value="email">Email</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="text" placeholder="검색어를 입력하세요."
style="width: 250px;"
th:field="*{searchValue}" >
</div>
</div>
</div>
</div>
<div class="input-group">
<div class="input-label">
<p class="label-txt">권한</p>
</div>
<div class="component-select">
<select class="select-list" 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>
<div class="component-btns">
<div class="btns-row">
<button class="btn" onclick="goSearch();"
type="button">
검색
</button>
<button class="btn" onclick="goInit();"
type="button">초기화
</button>
</div>
</div>
</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>
</section>
<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>
<section>
<table>
<thead>
<tr>
<th >#</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 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 class="underline"><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>
<div th:replace="common/list-components :: pagination(${listOutput})"></div>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button class="btn btn-success" onclick="goExcel();" type="button">엑셀 다운로드</button>
<button class="btn" onclick="location.href='/settings/admins/create';" type="button">등록</button>
<button class="btn" onclick="goRemove();" type="button">삭제</button>
</div>
</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>
<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>
</section>
</form>
<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>
<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">

View File

@@ -11,25 +11,20 @@
-->
<div th:fragment="pagination(items)">
<div class="row">
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item" th:classappend="${!items.pageable.hasPrevious} ? 'disabled'">
<a class="page-link"
th:href="|javascript:goPageable(${items.pageable.pageNumber - 1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|">이전</a>
</li>
<li class="page-item"
th:classappend="${idx == items.pageable.pageNumber} ? 'disabled'"
th:each="idx : ${#numbers.sequence(0, items.totalPages == 0 ? 0 : items.totalPages - 1)}">
<a class="page-link"
th:href="|javascript:goPageable(${idx}, ${items.pageable.pageSize}, '${items.pageable.sort}')|"
th:text="${idx+1}">페이지넘버</a>
</li>
<li class="page-item"
th:classappend="${items.pageable.pageNumber == items.totalPages - 1 or items.totalPages == 0} ? 'disabled'">
<a class="page-link"
th:href="|javascript:goPageable(${items.pageable.pageNumber + 1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|">다음</a>
</li>
</ul>
<nav class="component-pagination" aria-label="페이지네이션">
<a class="pagination-item prev"
th:classappend="${!items.pageable.hasPrevious} ? 'disabled'"
th:href="${items.pageable.hasPrevious} ? 'javascript:goPageable(' + ${items.pageable.pageNumber - 1} + ', ' + ${items.pageable.pageSize} + ', \'' + ${items.pageable.sort ?: 'id,desc'} + '\')' : '#'"></a>
<a class="pagination-item"
th:classappend="${idx == items.pageable.pageNumber} ? 'disabled'"
th:each="idx : ${#numbers.sequence(0, items.totalPages == 0 ? 0 : items.totalPages - 1)}"
th:href="${idx != items.pageable.pageNumber} ? 'javascript:goPageable(' + ${idx} + ', ' + ${items.pageable.pageSize} + ', \'' + ${items.pageable.sort ?: 'id,desc'} + '\')' : '#'"
th:text="${idx + 1}">페이지넘버</a>
<a class="pagination-item next"
th:classappend="${items.pageable.pageNumber >= items.totalPages - 1 or items.totalPages == 0} ? 'disabled'"
th:href="${items.pageable.pageNumber < items.totalPages - 1 and items.totalPages > 0} ? 'javascript:goPageable(' + ${items.pageable.pageNumber + 1} + ', ' + ${items.pageable.pageSize} + ', \'' + ${items.pageable.sort ?: 'id,desc'} + '\')' : '#'"></a>
</nav>
</div>
</div>