<!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/location/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">
							<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="inputURL" class="col-sm-2 col-form-label">URL</label>
							<div class="col-sm-10">
								<span class="error" th:each="error : ${#fields.errors('url')}">[[${error}]]<br /></span> <input id="inputURL" type="text" th:field="*{url}"
									th:class="${'form-control ' + (#fields.hasErrors('url') ? 'inputerror' : '')}">
							</div>
						</div>
						<div class="row mb-2">
							<label for="inputDoc" class="col-sm-2 col-form-label">Wegbeschreibung</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>
							</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/location}" class="btn btn-outline-secondary">Abbrechen</a>
								<div class="dropdown" style="display: inline">
									<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/location/delete/{id}(id=${bean.pk})}">Freizeitheim endgültig löschen</a>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</th:block>
</body>
</html>