<!DOCTYPE html>
<html lang="ru"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/auth}">
<head>
<title>Регистрация</title>
</head>
<body>
<div layout:fragment="content">
<div class="auth-title">
<h2>Создать аккаунт</h2>
<p>Начните управлять обучением эффективно</p>
</div>
<form class="auth-form" method="post" th:action="@{/auth/register}" th:object="${request}">
<!-- Last Name -->
<div class="mb-3">
<label for="lastName" class="form-label">Фамилия <span class="text-danger">*</span></label>
<input type="text"
class="form-control"
th:classappend="${#fields.hasErrors('lastName')} ? 'is-invalid'"
id="lastName"
th:field="*{lastName}"
placeholder="Иванов"
required>
<div class="invalid-feedback" th:if="${#fields.hasErrors('lastName')}" th:errors="*{lastName}"></div>
</div>
<!-- First Name -->
<div class="mb-3">
<label for="firstName" class="form-label">Имя <span class="text-danger">*</span></label>
<input type="text"
class="form-control"
th:classappend="${#fields.hasErrors('firstName')} ? 'is-invalid'"
id="firstName"
th:field="*{firstName}"
placeholder="Иван"
required>
<div class="invalid-feedback" th:if="${#fields.hasErrors('firstName')}" th:errors="*{firstName}"></div>
</div>
<!-- Patronymic -->
<div class="mb-3">
<label for="patronymic" class="form-label">Отчество</label>
<input type="text"
class="form-control"
id="patronymic"
th:field="*{patronymic}"
placeholder="Иванович">
</div>
<!-- Email -->
<div class="mb-3">
<label for="email" class="form-label">Email <span class="text-danger">*</span></label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-envelope"></i></span>
<input type="email"
class="form-control"
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
id="email"
th:field="*{email}"
placeholder="your@email.com"
required>
</div>
<div class="invalid-feedback d-block" th:if="${#fields.hasErrors('email')}" th:errors="*{email}"></div>
</div>
<!-- Phone -->
<div class="mb-3">
<label for="phone" class="form-label">Телефон</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-phone"></i></span>
<input type="tel"
class="form-control"
id="phone"
th:field="*{phone}"
placeholder="+7 (999) 123-45-67">
</div>
</div>
<!-- Password -->
<div class="mb-3">
<label for="password" class="form-label">Пароль <span class="text-danger">*</span></label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock"></i></span>
<input type="password"
class="form-control"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
id="password"
th:field="*{password}"
placeholder="Минимум 6 символов"
required>
<button type="button" class="btn btn-outline-secondary password-toggle" onclick="togglePassword('password')">
<i class="bi bi-eye" id="password-icon"></i>
</button>
</div>
<div class="invalid-feedback d-block" th:if="${#fields.hasErrors('password')}" th:errors="*{password}"></div>
</div>
<!-- Confirm Password -->
<div class="mb-4">
<label for="confirmPassword" class="form-label">Подтвердите пароль <span class="text-danger">*</span></label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock-fill"></i></span>
<input type="password"
class="form-control"
th:classappend="${#fields.hasErrors('confirmPassword')} ? 'is-invalid'"
id="confirmPassword"
th:field="*{confirmPassword}"
placeholder="Повторите пароль"
required>
<button type="button" class="btn btn-outline-secondary password-toggle" onclick="togglePassword('confirmPassword')">
<i class="bi bi-eye" id="confirmPassword-icon"></i>
</button>
</div>
<div class="invalid-feedback d-block" th:if="${#fields.hasErrors('confirmPassword')}" th:errors="*{confirmPassword}"></div>
</div>
<!-- Submit -->
<button type="submit" class="btn btn-auth">
<i class="bi bi-person-plus"></i>
Зарегистрироваться
</button>
</form>
<div class="auth-divider">
<span>или</span>
</div>
<div class="auth-links">
<p class="mb-0">Уже есть аккаунт? <a th:href="@{/auth/login}">Войти</a></p>
</div>
</div>
<th:block layout:fragment="scripts">
<script>
function togglePassword(inputId) {
const input = document.getElementById(inputId);
const icon = document.getElementById(inputId + '-icon');
if (input.type === 'password') {
input.type = 'text';
icon.classList.remove('bi-eye');
icon.classList.add('bi-eye-slash');
} else {
input.type = 'password';
icon.classList.remove('bi-eye-slash');
icon.classList.add('bi-eye');
}
}
</script>
</th:block>
</body>
</html>