<!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 Business</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
	<th:block layout:fragment="content">
		<div class="mainpage">
			<div class="container" style="max-width: 100%">
				<div class="row">
					<div class="col">
						<div class="card" style="width: 480px" th:if="${camp != null}">
							<div class="card-header">
								<span th:text="${camp.name}"></span> von <span th:text="${#numbers.formatInteger(camp.year, 0)}"></span>
							</div>
							<div class="card-body">
								<table class="table table-striped">
									<tbody>
										<tr>
											<td>Freizeitname</td>
											<th th:text="${camp.name}"></th>
										</tr>
										<tr>
											<td>Zeit</td>
											<th><span th:text="${#temporals.format(camp.arrive, 'dd.MM.')}"></span> - <span th:text="${#temporals.format(camp.depart, 'dd.MM.yyyy')}"></span></th>
										<tr>
											<td>Ort</td>
											<th th:text="${camp.locationName}"></th>
										</tr>
										<tr>
											<td>Preis</td>
											<th><pre th:utext="${camp.price}"></pre></th>
										</tr>
										<tr>
											<td>bestätigt</td>
											<th th:text="${booking.approved}"></th>
										</tr>
										<tr>
											<td>abgelehnt</td>
											<th th:text="${booking.rejected}"></th>
										</tr>
										<tr>
											<td>offen</td>
											<th th:text="${booking.open}"></th>
										</tr>
										<tr>
											<td>Beiträge</td>
											<th><span th:text="${#numbers.formatDecimal(booking.paid, 1, 2) + ' €'}" th:if="${booking.paid != null}"></span></th>
									</tbody>
								</table>
							</div>
						</div>
					</div>
					<div class="col" sec:authorize="hasRole('business_booking')">
						<div class="card">
							<div class="card-header">Angemeldete Personen</div>
							<div class="card-body">
								<table id="bookers" class="table table-striped">
									<thead>
										<tr>
											<th>Name</th>
											<th>Geschlecht</th>
											<th>Rolle</th>
											<th>Kontostand</th>
											<th>Status</th>
											<th>Bestätigt</th>
										</tr>
									</thead>
									<tbody>
										<th:block th:each="b : ${bookers}">
											<tr>
												<td><a class="tablelink" th:href="@{/business/bookings_by_id/{id}(id=${b.pk})}" title="bearbeiten" th:text="${b.name}"></a></td>
												<td th:text="${b.sex}"></td>
												<td th:text="${b.role}"></td>
												<td><span th:text="${#numbers.formatDecimal(b.paid, 1, 2) + ' €'}" th:if="${b.paid != null}"></span></td>
												<td th:text="${#temporals.format(b.bookingDate, 'dd.MM.yyyy')}"></td>
												<td th:text="${b.progress}"></td>
											</tr>
										</th:block>
									</tbody>
								</table>
								<script>
									$(document).ready(function() {
										$("#bookers").DataTable({
											language : locale_de
										});
									});
								</script>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="alert alert-danger" role="alert" th:if="${camp == null}">Es wurde keine Freizeit gefunden, die über diese ID angesprochen werden kann.</div>
		</div>
	</th:block>
</body>
</html>