<!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" sec:authorize="hasRole('business_booking')">
							<div class="card-header">Angemeldete Person</div>
							<div class="card-body">
								<table class="table table-striped">
									<tbody>
										<tr>
											<th>Name</th>
											<td th:text="${booker.name}"></td>
										</tr>
										<tr>
											<th>Geschlecht</th>
											<td th:text="${booker.sex}"></td>
										</tr>
										<tr>
											<th>Freizeit</th>
											<td><a class="tablelink" th:href="@{/business/camp/{id}(id=${booker.campId})}" th:text="${booker.camp}"></a></td>
										</tr>
										<tr>
											<th>Rolle</th>
											<td th:text="${booker.role}"></td>
										</tr>
										<tr>
											<th>Angemeldet</th>
											<td th:text="${#temporals.format(booker.bookingDate, 'dd.MM.yyyy')}"></td>
										</tr>
										<tr>
											<th>Status</th>
											<td th:text="${booker.progress}"></td>
										</tr>
										<tr>
											<th>Freizeitpreis</th>
											<td th:text="${booker.price}" />
										</tr>
										<tr th:if="${booker.requiredPrice}">
											<th>davon für <span th:text="${booker.name}"></span></th>
											<td th:text="${#numbers.formatDecimal(booker.requiredPrice, 1, 2) + ' €'}"></td>
										</tr>
										<tr>
											<th>Kontostand</th>
											<td><span th:text="${#numbers.formatDecimal(booker.paid, 1, 2) + ' €'}" th:if="${booker.paid != null}"></span></td>
										</tr>
										<tr style="display: none"><!-- insert field not yet implemented -->
											<th>zu zahlen</th>
											<td><span th:text="${#numbers.formatDecimal(booker.requiredPrice, 1, 2) + ' €'}" th:if="${booker.requiredPrice != null}"></span></td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="card" style="width: 480px" sec:authorize="hasRole('business_booking')">
							<div class="card-header">Einzahlung</div>
							<div class="card-body">
								<div class="alert alert-primary alert-dismissible fade show" role="alert">
									Ein negativer Betrag kommt einer Auszahlung gleich.
									<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Schließen"></button>
								</div>
								<form action="#" th:action="@{'/business/bookings/payment/' + ${booker.pk}}" th:object="${addBean}" method="post">
									<div class="container">
										<div class="row">
											<div class="col-sm-8">
												<input type="number" class="form-control" step="0.01" th:field="*{payment}" />
											</div>
											<div class="col-sm-4">
												<input type="submit" class="btn btn-outline-primary" value="einzahlen">
											</div>
										</div>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</th:block>
</body>
</html>