swt23w23/src/main/resources/templates/inventory-mutate.html

58 lines
3.6 KiB
HTML
Raw Normal View History

<!--/*-->
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2023 swt23w23
<!--*/-->
2023-11-05 16:11:36 +01:00
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
2023-11-13 20:09:39 +01:00
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout.html(title='Lagerverwaltung')}">
2023-11-05 16:11:36 +01:00
<body>
2023-11-15 17:27:04 +01:00
<div layout:fragment="content">
<h2 th:text="${'Produkt ' + (actionIsAdd ? 'anlegen' : 'bearbeiten')}"></h2>
<form method="post" th:object="${form}">
<div class="mb-3" th:if="${actionIsAdd}">
<a th:href="@{/inventory/add?type=Consumable}" class="btn" th:classappend="${form.getClass().getSimpleName() == 'ConsumableMutateForm' ? 'btn-primary' : 'btn-secondary'}">Verbrauchsmaterial</a>
<a th:href="@{/inventory/add?type=Rentable}" class="btn" th:classappend="${form.getClass().getSimpleName() == 'RentableMutateForm' ? 'btn-primary' : 'btn-secondary'}">Leihmaterial</a>
2023-11-13 20:09:39 +01:00
</div>
2023-11-15 17:27:04 +01:00
<div class="mb-3">
<label class="form-label" for="name">Produktname</label>
2023-11-20 23:26:47 +01:00
<input class="form-control" type="text" th:field="*{name}" th:errorclass="is-invalid" required/>
<div th:if="${#fields.hasErrors('name')}" class="invalid-feedback">Ungültiger Name.</div>
2023-11-13 20:09:39 +01:00
</div>
2023-11-15 17:27:04 +01:00
<div class="mb-3">
<label class="form-label" for="quantity">Menge im Bestand</label>
2023-11-20 23:26:47 +01:00
<input class="form-control" type="number" th:field="*{quantity}" th:errorclass="is-invalid" required/>
<div th:if="${#fields.hasErrors('quantity')}" class="invalid-feedback">Ungültige Menge.</div>
2023-11-13 20:09:39 +01:00
</div>
<!-- the prices arent bound with th:field as they need special formatting -->
2023-11-15 17:27:04 +01:00
<div class="mb-3">
<label class="form-label" for="wholesalePrice">Einkaufspreis</label>
2023-11-20 23:26:47 +01:00
<input class="form-control" type="number" name="wholesalePrice" th:value="${#numbers.formatDecimal(form.wholesalePrice, 1, 2)}" th:errorclass="is-invalid" step="0.01" min="0" required/>
<div th:if="${#fields.hasErrors('wholesalePrice')}" class="invalid-feedback">Ungültiger Einkaufspreis.</div>
2023-11-13 20:09:39 +01:00
</div>
2023-11-15 17:27:04 +01:00
<div class="mb-3">
<label class="form-label" for="retailPrice">UVP</label>
2023-11-20 23:26:47 +01:00
<input class="form-control" type="number" name="retailPrice" th:value="${#numbers.formatDecimal(form.retailPrice, 1, 2)}" th:errorclass="is-invalid" step="0.01" min="0" required/>
<div th:if="${#fields.hasErrors('retailPrice')}" class="invalid-feedback">Ungültiger Verkaufspreis.</div>
2023-11-13 20:09:39 +01:00
</div>
<div class="mb-3" th:if="${form.getClass().getSimpleName() == 'ConsumableMutateForm'}">
2023-11-15 17:27:04 +01:00
<label class="form-label" for="promotionPrice">Aktionspreis</label>
2023-11-20 23:26:47 +01:00
<input class="form-control" type="number" name="promotionPrice" th:value="${#numbers.formatDecimal(form.promotionPrice.orElse(null), 1, 2)}" th:errorclass="is-invalid" step="0.01" min="0"/>
<div th:if="${#fields.hasErrors('promotionPrice')}" class="invalid-feedback">Ungültiger Aktionspreis.</div>
2023-11-13 20:09:39 +01:00
</div>
<div class="mb-3">
<label class="form-label" for="orderTypes">Buchungstypen</label>
<select class="form-select" multiple th:field="*{orderTypes}" th:errorclass="is-invalid">
<option th:each="orderType : ${T(catering.order.OrderType).values()}" th:value="${orderType}" th:text="${orderType.toHumanReadable()}"/>
</select>
<div th:if="${#fields.hasErrors('orderTypes')}" class="invalid-feedback">Ungültiger Buchungstyp.</div>
<div class="form-text">Mehrfachauswahl ist mit Umschalt- bzw. Steuerungstaste möglich.</div>
</div>
<button class="btn btn-primary" type="submit" th:text="${actionIsAdd ? 'Hinzufügen' : 'Bearbeiten'}"></button>
2023-11-13 20:09:39 +01:00
<!-- KANN: Bild und Beschreibungstext -->
</form>
2023-11-15 17:27:04 +01:00
</div>
2023-11-05 16:11:36 +01:00
</body>
</html>