50 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{default}">
<body>
<div class="container" layout:fragment="content">
<div>
<a class="btn btn-success button-fixed" href="/student/edit/">
<i class="fa-solid fa-plus"></i> Добавить
</a>
</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">ID</th>
<th scope="col">Имя</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr th:each="student, iterator: ${students}">
<th scope="row" th:text="${iterator.index} + 1"></th>
<td th:text="${student.id}"></td>
<td th:text="${student.firstName} + ' ' + ${student.lastName}" style="width: 60%"></td>
<td style="width: 10%">
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn btn-warning button-fixed button-sm"
th:href="@{/student/edit/{id}(id=${student.id})}">
<i class="fa fa-pencil" aria-hidden="true"></i> Изменить
</a>
<button type="button" class="btn btn-danger button-fixed button-sm"
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${student.id}').click()|">
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
</button>
</div>
<form th:action="@{/student/delete/{id}(id=${student.id})}" method="post">
<button th:id="'remove-' + ${student.id}" type="submit" style="display: none">
Удалить
</button>
</form>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>