swt23w23/src/main/resources/templates/catalog_editor.html

91 lines
3.7 KiB
HTML

<!--/*-->
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2023 swt23w23
<!--*/-->
<!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='Katalog bearbeiten')}">
<body>
<div layout:fragment="content">
<input type="hidden" name="addCatalog">
<div class="content">
<h2>Dienstleistung</h2>
<label class="form-label" for="events"></label>
<form th:object="${formCatalogEntry}" method="post" th:action="@{/catalog_editor/chooseEvent}">
<select class="form-select w-auto d-inline-block" name="events" id="events">
<option value="event_catering">Eventcatering</option>
<option value="mobile_breakfast">Mobile Breakfast</option>
<option value="rent_a_cook">Rent-a-Cook</option>
</select>
<button class="btn btn-secondary" type="submit">Event auswählen</button>
</form>
Eventbasispreis: 500€
<h2>Mindestzeitraum</h2>
<form th:object="${formCatalogEntry}" method="post" th:action="@{/catalog_editor/addTime}">
<label class="form-label">Mindestzeitraum:</label>
<input type="hidden" th:field="*{eventType}">
<input class="form-control w-auto d-inline-block" th:field="*{minimumTimePeriod}" type="number" min="0" step="1" value="1"/>
<button class="btn btn-secondary" type="submit">Zum Model hinzufügen</button>
</form>
<h2>Basisausstattung</h2>
<table class="table">
<tr>
<th>Produktname</th>
<th>Menge</th>
<th>Stückpreis</th>
</tr>
<tr th:each="item : ${productMap.keySet()}">
<td th:text="${item.getName()}">
<td th:text="${productMap.get(item)}">
<td th:text="${item.getPrice()}">
<td>
<form method="post" th:action="@{/catalog_editor/removeProduct}">
<input class="form-control w-auto d-inline-block" type="hidden" name="id" th:value="${item.getId()}">
<button class="btn btn-danger" type="submit">Entfernen</button>
</form>
</td>
</tr>
</table>
<h2>Produktauswahl</h2>
<table class="table">
<tr>
<th>Produktname</th>
<th>Kosten</th>
<th>Verfügbar</th>
<th>Menge</th>
</tr>
<tr th:each="item : ${inventory}">
<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="@{/catalog_editor/addProduct}" method="post">
<input id="number" type="number" name="number" min="1" 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>
<br>
<h3>Momentane Auswahl</h3>
Eventtyp: <span th:text="${formCatalogEntry.getEventType()}"></span><br>
Mindestzeitraum: <span th:text="${formCatalogEntry.getMinimumTimePeriod()} + ' h'"></span><br>
<span th:text="'Gesamtpreis: ' + ${formCatalogEntry.getTotalCost()} + ' €'">Gesamtpreis</span>
<form method="post" th:action="@{/catalog_editor/addCatalogEntry}" th:object="${formCatalogEntry}">
<input type="hidden" name="eventType" th:value="${formCatalogEntry.getEventType()}">
<input type="hidden" name="products" th:value="${productSet}">
<input type="hidden" name="minimumTimePeriod" th:value="${formCatalogEntry.getMinimumTimePeriod}">
<input type="hidden" name="totalCost" th:value="${formCatalogEntry.getTotalCost()}">
<button class="btn btn-primary" type="submit">Zum Katalog hinzufügen</button>
</form>
</div>
</div>
</body>
</html>