swt23w23/src/main/resources/templates/inventory-mutate.html
Simon Bruder 2dff2842fc
Adapt inventory to new catalog interface
This also does a major restructuring of the inventory mutate form.

Some things still are not as they should be, but it mostly works like
before. They can be fixed later.

Co-authored-by: Theo Reichert <theo.reichert@mailbox.tu-dresden.de>
2023-11-29 18:42:37 +01:00

46 lines
3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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='Lagerverwaltung')}">
<body>
<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>
</div>
<div class="mb-3">
<label class="form-label" for="name">Produktname</label>
<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>
</div>
<div class="mb-3">
<label class="form-label" for="quantity">Menge im Bestand</label>
<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>
</div>
<!-- the prices arent bound with th:field as they need special formatting -->
<div class="mb-3">
<label class="form-label" for="wholesalePrice">Einkaufspreis</label>
<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>
</div>
<div class="mb-3">
<label class="form-label" for="retailPrice">UVP</label>
<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>
</div>
<div class="mb-3" th:if="${form.getClass().getSimpleName() == 'ConsumableMutateForm'}">
<label class="form-label" for="promotionPrice">Aktionspreis</label>
<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>
</div>
<button class="btn btn-primary" type="submit" th:text="${actionIsAdd ? 'Hinzufügen' : 'Bearbeiten'}"></button>
<!-- KANN: Bild und Beschreibungstext -->
</form>
</div>
</body>
</html>