Newer
Older
teacher-diary / src / main / resources / templates / student / list.html
<!DOCTYPE html>
<html lang="ru" xmlns:th="http://www.thymeleaf.org"
      th:replace="~{layout/main :: html(pageTitle='Ученики', activeMenu='students', 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="'Всего: ' + ${students.size()} + ' учеников'"></span>
        </div>
        <a th:href="@{/students/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="${!students.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="student : ${students}">
                    <td>
                        <a th:href="@{/students/{id}(id=${student.id})}" class="fw-medium text-decoration-none" th:text="${student.fullName}"></a>
                    </td>
                    <td th:text="${student.phone ?: '—'}"></td>
                    <td><span class="badge bg-secondary" th:text="${student.groupCount}"></span></td>
                    <td><span class="badge bg-info" th:text="${student.parentCount}"></span></td>
                    <td>
                        <a th:href="@{/students/{id}(id=${student.id})}" class="btn btn-sm btn-outline-primary">
                            <i class="bi bi-eye"></i>
                        </a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>

        <div th:if="${students.isEmpty()}" class="card-body text-center py-5">
            <i class="bi bi-people text-muted" style="font-size: 48px;"></i>
            <p class="text-muted mt-3 mb-0">Учеников пока нет</p>
            <a th:href="@{/students/new}" class="btn btn-primary mt-3">Добавить первого ученика</a>
        </div>
    </div>
</th:block>
</body>
</html>