<!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 class="tablebox" sec:authorize="hasRole('admin')">
			<table id="docs" class="table table-striped" style="width: 100% !important">
				<thead>
					<tr>
						<td>Name</td>
						<td>Ort</td>
						<td>Zeitraum</td>
						<td>Bestätigung</td>
					</tr>
				</thead>
				<tbody>
					<tr th:each="c : ${camps}">
						<td><a th:href="@{/admin/camp/edit/{id}(id=${c.pk})}"><i class="fas fa-pen beforetext"></i><span th:text="${c.name}"></span></a></td>
						<td><th:block th:each="l : ${locations}">
								<span th:if="${l.pk == c.fkLocation}" th:text="${l.name}"></span>
							</th:block></td>
						<td><span th:text="${#temporals.format(c.arrive, 'dd.MM.')}"></span>&nbsp;-&nbsp;<span th:text="${#temporals.format(c.depart, 'dd.MM.yyyy')}"></span></td>
						<td><a th:href="@{/document/{id}(id=${c.fkDocument})}"><i class="fas fa-download beforetext"></i>anzeigen</a></td>
					</tr>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="4" style="text-align: center"><a th:href="@{/admin/camp/add}" class="btn btn-outline-primary">neue Freizeit anlegen</a></td>
					</tr>
				</tfoot>
			</table>
			<script>
				$(document).ready(function() {
					$("#docs").DataTable({
						language : locale_de
					});
				});
			</script>
		</div>
	</th:block>
</body>
</html>