<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer 2</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
	<th:block layout:fragment="header">
		<ul class="navbar-nav mb-2 mb-lg-0">
			<li class="nav-item"><a th:href="@{/}" class="btn btn-secondary btn-icon-silent" target="_blank">Startseite laden</a></li>
		</ul>
	</th:block>
	<th:block layout:fragment="content">
		<div class="mainpage">
			<h1 class="centered cabin">Anmeldung</h1>
			<h3 class="centered cabin" th:text="'zur ' + ${camp.name} + ' ' + ${camp.year}"></h3>
			<div class="card centered-card" style="max-width: 48rem">
				<div class="card-body">
					<form th:action="@{/registration/register}" th:object="${bean}" method="post">
						<span class="error"	th:each="error : ${#fields.errors('fkCamp')}">[[${error}]]<br /></span>
						<input type="hidden" th:field="*{fkCamp}" />
						<div class="container">
							<div class="row">
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('surname')}">[[${error}]]<br /></span>
									<input type="text" placeholder="Vorname" th:field="*{forename}" th:class="${'form-control ' + (#fields.hasErrors('forename') ? 'inputerror' : '')}" />
								</div>
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('forename')}">[[${error}]]<br /></span>
									<input type="text" placeholder="Nachname" th:field="*{surname}" th:class="${'form-control ' + (#fields.hasErrors('surname') ? 'inputerror' : '')}" />
								</div>
							</div>
							<div class="row">
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('sex')}">[[${error}]]<br /></span>
									<select th:field="*{sex}" th:class="${'form-select ' + (#fields.hasErrors('sex') ? 'inputerror' : '')}">
										<option value="">Geschlecht</option>
										<option value="female">weiblich</option>
										<option value="male">männlich</option>
									</select>
								</div>
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('birthDate')}">[[${error}]]<br /></span>
									<input type="date" placeholder="Geburtsdatum" th:field="*{birthDate}" th:class="${'form-control ' + (#fields.hasErrors('birthDate') ? 'inputerror' : '')}" />
								</div>
							</div>
							<div class="row">
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('street')}">[[${error}]]<br /></span>
									<input type="text" placeholder="Straße und Hausnummer" th:field="*{street}" th:class="${'form-control ' + (#fields.hasErrors('street') ? 'inputerror' : '')}" />
								</div>
								<div class="col-sm-2 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('zip')}">[[${error}]]<br /></span>
									<input type="text" placeholder="PLZ" th:field="*{zip}" th:class="${'form-control ' + (#fields.hasErrors('zip') ? 'inputerror' : '')}" />
								</div>
								<div class="col-sm-4 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('city')}">[[${error}]]<br /></span>
									<input type="text" placeholder="Ort" th:field="*{city}" th:class="${'form-control ' + (#fields.hasErrors('city') ? 'inputerror' : '')}" />
								</div>
							</div>
							<div class="row">
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('email')}">[[${error}]]<br /></span>
									<input type="text" placeholder="E-Mail" th:field="*{email}" th:class="${'form-control ' + (#fields.hasErrors('email') ? 'inputerror' : '')}" />
								</div>
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('phone')}">[[${error}]]<br /></span>
									<input type="text" placeholder="Telefonnummer" th:field="*{phone}" th:class="${'form-control' + (#fields.hasErrors('phone') ? 'inputerror' : '')}" />
								</div>
							</div>
							<div class="row">
								<div class="col-sm-6 rowdist">
									<span>mitkommen als</span>
								</div>
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('campRole')}">[[${error}]]<br /></span>
									<select th:field="*{campRole}" th:class="${'form-select' + (#fields.hasErrors('campRole') ? 'inputerror' : '')}">
										<option value="student">Teilnehmer</option>
										<option value="teacher">Mitarbeiter</option>
										<option value="feeder">Küchenteam</option>
										<option value="director">Leiter</option>
									</select>
								</div>
							</div>
							<div class="row">
								<div class="col-sm-12 rowdist">
									<textarea class="form-control" placeholder="Sonstiges" th:field="*{comment}"></textarea>
								</div>
							</div>
							<div class="row" th:if="${#strings.isEmpty(currentUser)}">
								<div class="col-sm-12 rowdist">
									<div class="form-check" title="Die Anmeldedaten können in den Kontoeinstellungen bearbeitet und für die nächsten Freizeitanmeldungen verwendet werden.">
										<input id="save" type="checkbox" class="form-check-input" th:field="*{registerInKeycloak}" onchange="$('#createlogin').toggle();" /> <label class="form-check-label" for="save">Anmeldedaten
											speichern</label>
									</div>
								</div>
							</div>
							<div id="createlogin" class="row" th:if="${#strings.isEmpty(currentUser)}">
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('login')}">[[${error}]]<br /></span>
									<input type="text" placeholder="Login" th:field="*{login}" th:class="${'form-control ' + (#fields.hasErrors('login') ? 'inputerror' : '')}" />
								</div>
								<div class="col-sm-6 rowdist">
									<span class="error"	th:each="error : ${#fields.errors('password')}">[[${error}]]<br /></span>
									<input type="password" placeholder="Passwort" th:field="*{password}" th:class="${'form-control ' + (#fields.hasErrors('password') ? 'inputerror' : '')}" />
								</div>
							</div>
							<div class="row">
								<div class="col-sm-12 rowdist centered">
									<input type="submit" class="btn btn-linda buttonfont" value="jetzt anmelden" />
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</th:block>
</body>
</html>
