Admin: users page with search and full cascade delete (identity + progress + files)
This commit is contained in:
47
web/src/main/resources/templates/admin/users.html
Normal file
47
web/src/main/resources/templates/admin/users.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru" xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/base :: layout(~{::title}, ~{::#content})}">
|
||||
<head><title>Пользователи — LMS</title></head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1 class="page-title">Пользователи</h1>
|
||||
|
||||
<form class="flex flex-wrap items-center gap-2 mb-4" method="get" th:action="@{/admin/users}">
|
||||
<input class="input input-sm" name="q" th:value="${query}" placeholder="Поиск по ФИО, логину, номеру или группе…" aria-label="Поиск пользователей">
|
||||
<button class="btn btn-secondary btn-sm" type="submit">Найти</button>
|
||||
<a class="btn btn-secondary btn-sm" th:href="@{/admin/users}" th:if="${!#strings.isEmpty(query)}">Сбросить</a>
|
||||
<span class="text-sm text-muted">Найдено: <span th:text="${#lists.size(users)}">0</span></span>
|
||||
</form>
|
||||
|
||||
<div class="card card-flush">
|
||||
<table id="users-table" class="tablekit">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="th-sortable is-asc" title="ФИО — по возрастанию">ФИО</th>
|
||||
<th>Логин</th>
|
||||
<th>Номер</th>
|
||||
<th>Группа</th>
|
||||
<th class="text-right" data-nosort>Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="u : ${users}">
|
||||
<td class="font-medium" th:text="${u.fullName}">—</td>
|
||||
<td class="font-mono" th:text="${u.login}">—</td>
|
||||
<td class="font-mono" th:text="${u.studentNo}">—</td>
|
||||
<td><a th:if="${u.groupId}" th:href="@{/admin/groups/{id}(id=${u.groupId})}" th:text="${u.groupName}">—</a><span th:unless="${u.groupId}" class="text-muted">без группы</span></td>
|
||||
<td class="text-right">
|
||||
<form class="inline-form" th:action="@{/admin/users/{id}/delete(id=${u.id})}" method="post"
|
||||
onsubmit="return confirm('Удалить пользователя безвозвратно? Будут удалены аккаунт, группа, оценки с комментариями, сдачи с файлами и задания защит.');">
|
||||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||||
<input type="hidden" name="q" th:value="${query}">
|
||||
<button class="btn btn-danger btn-sm" type="submit">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${#lists.isEmpty(users)}"><td colspan="5" class="empty">Никого не нашли.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -92,6 +92,7 @@
|
||||
<nav class="nav">
|
||||
<th:block th:if="${currentUser != null}">
|
||||
<a th:if="${currentUser.admin}" th:href="@{/admin/groups}" class="nav-link">Группы</a>
|
||||
<a th:if="${currentUser.admin}" th:href="@{/admin/users}" class="nav-link">Пользователи</a>
|
||||
<a th:if="${currentUser.admin}" th:href="@{/admin/labs}" class="nav-link">Лабораторные</a>
|
||||
<a th:unless="${currentUser.admin}" th:href="@{/student/labs}" class="nav-link">Лабораторные</a>
|
||||
<a th:href="@{/change-password}" class="nav-link">Смена пароля</a>
|
||||
|
||||
Reference in New Issue
Block a user