Admin: users page with search and full cascade delete (identity + progress + files)

This commit is contained in:
2026-10-02 11:53:01 +03:00
parent b94538cb7e
commit c0cf11a5a3
14 changed files with 370 additions and 1 deletions

View 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>