swt23w23/src/main/resources/templates/event.html
Mathis Kral f50fbb5ac4 Add basic order-staff-relation
Works on #73
This contains changes on multiple files to associate
multiple employees with an order and make customers
able to add employees to their order.
Because of SQL JPA things, this will not be final.
2023-11-26 20:34:23 +01:00

134 lines
4.9 KiB
HTML

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout.html(title='Event konfigurieren')}">
<body>
<div layout:fragment="content">
<form th:action="@{/event/changeOrderType}" method="post">
<select class="form-select w-auto d-inline-block" name="type">
<option disabled="disabled" selected value="NULL" th:text="${event.getOrderType()}"/>
<option th:value="'SE'" th:text="'Something else'"/>
<option th:value="'RaK'" th:text="Rent-a-Cook"/>
<option th:value="'EK'" th:text="Eventcatering"/>
<option th:value="'SN'" th:text="'Sushi Night'"/>
<option th:value="'MB'" th:text="'Mobile Breakfase'"/>
</select>
<button class="btn btn-primary" type="submit">Eventtypen ändern</button>
</form>
<!-- I NEED SPACE -->
<br>
<form th:action="@{/event/changeDate}" method="post">
<label th:text="'Wählen sie ihren gewünschten Zeitraum aus (min. 7 Tage im voraus):'"/><br>
<input type="date" th:value="${event.getStart().toLocalDate()}" th:min="${event.getStart().toLocalDate()}" name="startDate"/>
<select class="i do not know" name="startHour">
<option disabled="disabled" selected value="NULL" th:text="${event.getStart().getHour()} + ' Uhr'"/>
<option th:each="i : ${#numbers.sequence(0, 23)}" th:value="${i}" th:text="${i} + ' Uhr'"></option>
</select>
<input type="date" th:value="${event.getFinish().toLocalDate()}" th:min="${event.getFinish().toLocalDate()}" name="finishDate"/>
<select class="i do not know" name="finishHour">
<option disabled="disabled" selected value="NULL" th:text="${event.getFinish().getHour() + ' Uhr'}"/>
<option th:each="i : ${#numbers.sequence(0, 23)}" th:value="${i}" th:text="${i} + ' Uhr'"></option>
</select>
<button class="btn btn-primary" type="submit">Wunschdatum überprüfen</button>
</form>
<!-- I NEED SPACE -->
<br>
<table class="table">
<tr>
<th>Produkt</th>
<th>Anzahl</th>
<th>Preis</th>
<th></th>
</tr>
<tr th:each="item : ${items}">
<td th:text="${item.getProductName()}">Sake Nigiri</td>
<td th:text="${item.getQuantity()}">200</td>
<td th:text="${item.getPrice().getNumber().doubleValue()} +'€'">10€</td>
<td>
<form method="post" th:action="@{/event/removeProduct}">
<input type="hidden" th:value="${item.getId()}" name="itemId"/>
<button class="btn btn-danger" type="submit" >Produkt entfernen</button>
</form>
</td>
</tr>
<th>Angestellter</th>
<th>Typ</th>
<th>Preis</th>
<th></th>
<tr th:each="staff : ${event.getStaff()}">
<td th:text="${staff.getName()}">Name</td>
<td th:text="${staff.getJob()}">Job</td>
<td th:text="${event.getDurationInHoursTimesRate(12.0)} + '€'">Preis</td> <!--TODO: get from staff-->
<td>
<form method="post" th:action="@{/event/removeStaff}">
<input type="hidden" th:value="${staff.getId()}" name="sid"/>
<button class="btn btn-danger" type="submit">Angestellten entfernen</button>
</form>
</td>
</tr>
</table>
<span th:text="'Gesamt: ' + ${totalPrice}">Price</span>
<form method="post" th:action="@{/event/checkout}">
<button class="btn btn-primary" type="submit">Kostenpflichtig bestellen</button>
</form>
<!-- I NEED SPACE -->
<br>
<br>
<h4>Produkt hinzufügen</h4>
<table class="table">
<tr>
<th>Name</th>
<th>Preis/Stück</th>
<th>Verfügbar</th>
<th>Menge</th>
</tr>
<tr th:each="item : ${invItems}">
<td th:text="${item.getProduct().getName()}">Name</td>
<td th:text="${item.getProduct().getPrice()}">Preis</td>
<td th:text="${item.getQuantity()}">Verfügbar</td>
<td>
<form th:action="@{/event/addProduct}" method="post">
<input id="number" type="number" name="number" min="1" th:max="${item.getQuantity()}" value="1"/>
<input type="hidden" name="pid" th:value="${item.getProduct().getId()}"/>
<input class="btn btn-primary" type="submit" th:value="Hinzufügen"/>
</form>
</td>
</tr>
</table>
<h4>Angestellte hinzufügen</h4>
<table class="table">
<tr>
<th>Name</th>
<th>Typ</th>
<th>Stundensatz</th>
<th>Verfügbar</th>
<td></td>
</tr>
<tr th:each="staff : ${allStaff}">
<td th:text="${staff.getName()}">Name</td>
<td th:text="${staff.getJob()}">Job</td>
<td th:text="'12€/h'">12€</td> <!--TODO: get from staff-->
<td style="color: green" th:text="Verfügbar">Verfügbar</td> <!--TODO: get from staff-->
<td>
<form th:action="@{/event/addStaff}" method="post">
<input type="hidden" name="sid" th:value="${staff.getId()}"/>
<input class="btn btn-primary" type="submit" th:value="Hinzufügen"/>
</form>
</td>
</tr>
</table>
</div>
</html>