<!DOCTYPE html>
<html lang="ru" xmlns:th="http://www.thymeleaf.org"
th:replace="~{layout/main :: html(pageTitle='Группы', activeMenu='groups', content=~{::content}, scripts=~{})}">
<body>
<th:block th:fragment="content">
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<span class="text-muted" th:text="'Всего: ' + ${groups.size()}"></span>
</div>
<a th:href="@{/groups/new}" class="btn btn-primary">
<i class="bi bi-plus-lg me-1"></i> Создать группу
</a>
</div>
<div th:if="${success}" class="alert alert-success" th:text="${success}"></div>
<div class="card">
<div class="table-responsive" th:if="${!groups.isEmpty()}">
<table class="table table-hover mb-0">
<thead>
<tr>
<th>Название</th>
<th>Предмет</th>
<th>Учеников</th>
<th>Цена за занятие</th>
<th width="100"></th>
</tr>
</thead>
<tbody>
<tr th:each="group : ${groups}">
<td>
<a th:href="@{/groups/{id}(id=${group.id})}" class="fw-medium text-decoration-none" th:text="${group.name}"></a>
</td>
<td>
<span class="badge bg-primary" th:text="${group.subjectName}"></span>
</td>
<td>
<span class="badge bg-secondary" th:text="${group.studentCount}"></span>
</td>
<td th:text="${group.pricePerLesson != null} ? ${#numbers.formatDecimal(group.pricePerLesson, 0, 0)} + ' ₽' : '—'"></td>
<td>
<a th:href="@{/groups/{id}(id=${group.id})}" class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div th:if="${groups.isEmpty()}" class="card-body text-center py-5">
<i class="bi bi-folder text-muted" style="font-size: 48px;"></i>
<p class="text-muted mt-3 mb-0">Групп пока нет</p>
<a th:href="@{/groups/new}" class="btn btn-primary mt-3">Создать первую группу</a>
</div>
</div>
</th:block>
</body>
</html>