<!DOCTYPE html>
<html lang="ru" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{default}">

<head>
    <title>Изменение данных</title>
</head>

<body th:with="bodyClass='bg-white', mainClass='my-0'">
    <main layout:fragment="content">
        <div class="row gy-3 justify-content-center">
            <div class="col-12 mt-4">
                <div class="block d-flex justify-content-center mb-3 mb-sm-4" id="reg-title">
                    Обновление данных
                </div>
            </div>
            <form class="col-lg-8 col-xl-7 col-xxl-6 m-0 mt-2 mt-sm-3 d-flex flex-column gap-2" action="#"
                th:action="@{/profile/edit(page=${page})}" th:object="${user}" method="post">
                <div class="mb-3">
                    <label for="login" class="form-label">Имя пользователя (логин)</label>
                    <input type="text" th:field="*{login}" id="login" class="form-control">
                    <div th:if="${#fields.hasErrors('login')}" th:errors="*{login}" class="invalid-feedback"></div>
                </div>
                <div class="mb-3">
                    <label for="password" class="form-label">Пароль</label>
                    <input type="password" id="password" th:field="*{password}" class="form-control">
                    <div th:if="${#fields.hasErrors('password')}" th:errors="*{password}" class="invalid-feedback"></div>
                </div>
                <div class="mb-3">
                    <label for="firstname" class="form-label">Имя</label>
                    <input type="text" th:field="*{firstname}" id="firstname" class="form-control">
                    <div th:if="${#fields.hasErrors('firstname')}" th:errors="*{firstname}" class="invalid-feedback">
                    </div>
                </div>
                <div class="mb-3">
                    <label for="lastname" class="form-label">Фамилия</label>
                    <input type="text" th:field="*{lastname}" id="lastname" class="form-control">
                    <div th:if="${#fields.hasErrors('lastname')}" th:errors="*{lastname}" class="invalid-feedback">
                    </div>
                </div>
                <div class="mb-3">
                    <label for="email" class="form-label">Почта</label>
                    <input type="email" th:field="*{email}" id="email" class="form-control">
                    <div th:if="${#fields.hasErrors('email')}" th:errors="*{email}" class="invalid-feedback">
                    </div>
                </div>
                <div class="text-center d-flex flex-column align-items-center mb-3">
                    <button class="btn btn-primary w-50 rounded-5 reg-btn mb-3" type="submit">Сохранить</button>
                    <a class="btn btn-secondary w-25 rounded-5 reg-btn" th:href="@{/profile(page=${page})}">Отмена</a>
                </div>
            </form>
        </div>
    </main>
</body>

</html>