Newer
Older
teacher-diary / src / main / resources / templates / subject / form.html
@malexple malexple 19 days ago 1 KB add groups
<!DOCTYPE html>
<html lang="ru" xmlns:th="http://www.thymeleaf.org"
      th:replace="~{layout/main :: html(pageTitle=${pageTitle}, activeMenu='subjects', content=~{::content}, scripts=~{})}">
<body>
<th:block th:fragment="content">
    <div class="card">
        <div class="card-body">
            <div th:if="${error}" class="alert alert-danger" th:text="${error}"></div>

            <form th:action="${request.id != null} ? @{/subjects/{id}/edit(id=${request.id})} : @{/subjects/new}"
                  method="post" th:object="${request}">

                <div class="mb-3">
                    <label for="name" class="form-label">Название <span class="text-danger">*</span></label>
                    <input type="text" class="form-control" id="name" th:field="*{name}"
                           th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
                           placeholder="Математика, Английский язык..." required>
                    <div class="invalid-feedback" th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></div>
                </div>

                <div class="mb-3">
                    <label for="description" class="form-label">Описание</label>
                    <textarea class="form-control" id="description" th:field="*{description}" rows="3"
                              placeholder="Краткое описание предмета..."></textarea>
                </div>

                <div class="d-flex gap-2">
                    <button type="submit" class="btn btn-primary">
                        <i class="bi bi-check-lg me-1"></i> Сохранить
                    </button>
                    <a th:href="@{/subjects}" class="btn btn-outline-secondary">Отмена</a>
                </div>
            </form>
        </div>
    </div>
</th:block>
</body>
</html>