<!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">
<body>
	<th:block layout:fragment="content">
		<div sec:authorize="hasRole('admin')">
			<form th:action="@{/admin/camp/update}" th:object="${bean}" method="post" enctype="multipart/form-data">
				<div class="tablebox">
					<div class="container">
						<input type="hidden" th:field="*{pk}" />
						<div class="row mb-2">
							<div class="col-sm-12">
								<div class="alert alter-danger" th:if="${error}" th:text="${error}"></div>
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputName" class="col-sm-2 col-form-label">Name</label>
							<div class="col-sm-10">
								<span class="error" th:each="error : ${#fields.errors('name')}">[[${error}]]<br /></span> <input id="inputName" type="text" th:field="*{name}"
									th:class="${'form-control ' + (#fields.hasErrors('name') ? 'inputerror' : '')}">
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputLocation" class="col-sm-2 col-form-label">Ort</label>
							<div class="col-sm-10">
								<span class="error" th:each="error : ${#fields.errors('fkLocation')}">[[${error}]]<br /></span> <select id="inputLocation" th:field="*{fkLocation}"
									th:class="${'form-select ' + (#fields.hasErrors('fkLocation') ? 'inputerror' : '')}">
									<option value="">--- bitte wählen ---</option>
									<option th:each="l : ${locations}" th:value="${l.pk}" th:text="${l.name}"></option>
								</select>
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputArrive" class="col-sm-2 col-form-label">von</label>
							<div class="col-sm-4">
								<span class="error" th:each="error : ${#fields.errors('arrive')}">[[${error}]]<br /></span> <input id="inputArrive" type="date" th:field="*{arrive}"
									th:class="${'form-control ' + (#fields.hasErrors('arrive') ? 'inputerror' : '')}">
							</div>
							<label for="inputDepart" class="col-sm-2 col-form-label">bis</label>
							<div class="col-sm-4">
								<span class="error" th:each="error : ${#fields.errors('depart')}">[[${error}]]<br /></span> <input id="inputDepart" type="date" th:field="*{depart}"
									th:class="${'form-control ' + (#fields.hasErrors('depart') ? 'inputerror' : '')}">
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputMinAge" class="col-sm-2 col-form-label">Mindestalter</label>
							<div class="col-sm-4">
								<span class="error" th:each="error : ${#fields.errors('minAge')}">[[${error}]]<br /></span> <input id="inputMinAge" type="number" th:field="*{minAge}"
									th:class="${'form-control ' + (#fields.hasErrors('minAge') ? 'inputerror' : '')}">
							</div>
							<label for="inputMaxAge" class="col-sm-2 col-form-label">Maximalalter</label>
							<div class="col-sm-4">
								<span class="error" th:each="error : ${#fields.errors('maxAge')}">[[${error}]]<br /></span> <input id="inputMaxAge" type="number" th:field="*{maxAge}"
									th:class="${'form-control ' + (#fields.hasErrors('maxAge') ? 'inputerror' : '')}">
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputPrice" class="col-sm-2 col-form-label">Preis</label>
							<div class="col-sm-10">
								<span class="error" th:each="error : ${#fields.errors('price')}">[[${error}]]<br /></span>
								<textarea id="inputPrice" th:field="*{price}" th:class="${'form-control ' + (#fields.hasErrors('price') ? 'inputerror' : '')}"></textarea>
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputCountries" class="col-sm-2 col-form-label">Ferien in</label>
							<div class="col-sm-10">
								<span class="error" th:each="error : ${#fields.errors('countriesList')}">[[${error}]]<br /></span> <select id="inputCountries" th:field="*{countriesList}"
									th:class="${'form-select ' + (#fields.hasErrors('countriesList') ? 'inputerror' : '')}" multiple="multiple">
									<option value="Baden-Württemberg">Baden-Württemberg</option>
									<option value="Bayern">Bayern</option>
									<option value="Berlin">Berlin</option>
									<option value="Brandenburg">Brandenburg</option>
									<option value="Bremen">Bremen</option>
									<option value="Hamburg">Hamburg</option>
									<option value="Hessen">Hessen</option>
									<option value="Mecklenburg-Vorpommern">Mecklenburg-Vorpommern</option>
									<option value="Niedersachsen">Niedersachsen</option>
									<option value="Nordrhein-Westfalen">Nordrhein-Westfalen</option>
									<option value="Rheinland-Pfalz">Rheinland-Pfalz</option>
									<option value="Saarland">Saarland</option>
									<option value="Sachsen">Sachsen</option>
									<option value="Sachsen-Anhalt">Sachsen-Anhalt</option>
									<option value="Schleswig-Holstein">Schleswig-Holstein</option>
									<option value="Thüringen">Thüringen</option>
								</select>
							</div>
							<script type="text/javascript">
								$(document).ready(function() {
									$("#inputCountries").select2();
								});
							</script>
						</div>
						<div class="row mb-2">
							<label for="inputDoc" class="col-sm-2 col-form-label">Bestätigung</label>
							<div class="col-sm-10">
								<span class="error" th:each="error : ${#fields.errors('fkDocument')}">[[${error}]]<br /></span> <select id="inputDoc" th:field="*{fkDocument}"
									th:class="${'form-select ' + (#fields.hasErrors('fkDocument') ? 'inputerror' : '')}">
									<option value="">--- bitte wählen ---</option>
									<option th:each="d : ${documents}" th:value="${d.pk}" th:text="${d.name}"></option>
								</select>
								<script type="text/javascript">
									$("#inputDoc").select2({
										theme : 'bootstrap-5',
									});
								</script>
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputProfile" class="col-sm-2 col-form-label mb-2">Verantwortlicher</label>
							<div class="col-sm-4 mb-2">
								<span class="error" th:each="error : ${#fields.errors('fkProfile')}">[[${error}]]<br /></span> <select id="inputProfile" th:field="*{fkProfile}"
									th:class="${'form-select ' + (#fields.hasErrors('fkProfile') ? 'inputerror' : '')}">
									<option value="">--- bitte wählen ---</option>
									<option th:each="p : ${profiles}" th:value="${p.pk}" th:text="${p.forename} + ' ' + ${p.surname}"></option>
								</select>
								<script type="text/javascript">
									$("#inputProfile").select2({
										theme : 'bootstrap-5',
									});
								</script>
							</div>
							<label for="startBooking" class="col-sm-2 col-form-label mb-2">Buchungsbeginn</label>
							<div class="col-sm-4 mb-2">
								<span class="error" th:each="error : ${#fields.errors('startBooking')}">[[${error}]]<br /></span>
								<input id="startBooking" type="datetime-local" th:field="*{startBooking}"
									th:class="${'form-control ' + (#fields.hasErrors('startBooking') ? 'inputerror' : '')}" />
							</div>
							<label for="inputBedsFemale" class="col-sm-2 col-form-label mb-2">Anzahl Betten für Mädchen</label>
							<div class="col-sm-4 mb-2">
								<span class="error" th:each="error : ${#fields.errors('bedsFemale')}">[[${error}]]<br /></span> <input type="number" class="form-control" th:field="*{bedsFemale}" />
							</div>
							<label for="inputBedsMale" class="col-sm-2 col-form-label">Anzahl Betten für Jungen</label>
							<div class="col-sm-4">
								<span class="error" th:each="error : ${#fields.errors('bedsMale')}">[[${error}]]<br /></span> <input type="number" class="form-control" th:field="*{bedsMale}" />
							</div>
							<label for="inputBlockedBedsFemale" class="col-sm-2 col-form-label">Reservierte Betten für Mädchen</label>
							<div class="col-sm-4">
								<span class="error" th:each="error : ${#fields.errors('blockedBedsFemale')}">[[${error}]]<br /></span> <input type="number" class="form-control" th:field="*{blockedBedsFemale}" />
							</div>
							<label for="inputBlockedBedsMale" class="col-sm-2 col-form-label">Reservierte Betten für Jungen</label>
							<div class="col-sm-4">
								<span class="error" th:each="error : ${#fields.errors('blockedBedsMale')}">[[${error}]]<br /></span> <input type="number" class="form-control" th:field="*{blockedBedsMale}" />
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputLockSales" class="col-sm-2 col-form-label">Kassenschluss</label>
							<div class="col-sm-10">
								<input id="lockSales" type="checkbox" name="lockSales" th:checked="*{lockSales}" /> <label for="lockSales">Abrechnung abgeschlossen</label>
							</div>
						</div>
						<div class="row mb-2">
							<div class="col-sm-2"></div>
							<div class="col-sm-10">
								<input type="submit" class="btn btn-success" value="Ok" /> <a th:href="@{/admin/camp}" class="btn btn-outline-secondary">Abbrechen</a>
								<div class="dropdown" style="display: inline" th:if="${bean.pk}">
									<button class="btn btn-outline-danger dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
										<i class="fas fa-trash-alt"></i>
									</button>
									<ul class="dropdown-menu">
										<li><a class="dropdown-item" th:href="@{/admin/camp/delete/{id}(id=${bean.pk})}">Freizeit endgültig löschen</a>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</th:block>
</body>
</html>