not yet finished manipulations of camp registrations

This commit is contained in:
Jottyfan
2023-03-19 23:36:41 +01:00
parent bc7cd88c2f
commit 502e616c44
8 changed files with 673 additions and 5 deletions

View File

@ -0,0 +1,41 @@
<!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})}"><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"></i></a></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6" 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>

View File

@ -0,0 +1,122 @@
<!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" type="text" 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"><!-- TODO: input helper for finding Bundesland by typing -->
<span class="error" th:each="error : ${#fields.errors('countries')}">[[${error}]]<br /></span> <textarea id="inputCountries" type="text" th:field="*{countries}"
th:class="${'form-control ' + (#fields.hasErrors('countries') ? 'inputerror' : '')}"></textarea>
</div>
</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">Verantwortlicher</label>
<div class="col-sm-10">
<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>
</div>
<!-- TODO: lock sales - boolean - Kassenschluss -->
<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>

View File

@ -123,6 +123,7 @@
<li><a th:href="@{/admin/mail}" class="dropdown-item menufont">Testmail</a></li>
<li><a th:href="@{/admin/document}" class="dropdown-item menufont">Dokumente</a></li>
<li><a th:href="@{/admin/location}" class="dropdown-item menufont">Freizeitheime</a></li>
<li><a th:href="@{/admin/camp}" class="dropdown-item menufont">Freizeiten</a>
</ul>
</div>
</li>