Add full order data to orders.html table

This commit is contained in:
Mathis Kral 2023-11-05 17:05:56 +01:00 committed by Simon Bruder
parent f5454ddab5
commit b3b817b869
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
2 changed files with 23 additions and 9 deletions

View file

@ -1,10 +1,13 @@
package catering.order; package catering.order;
import com.querydsl.core.Tuple;
import org.aspectj.weaver.ast.Or; import org.aspectj.weaver.ast.Or;
import org.salespointframework.quantity.Quantity; import org.salespointframework.quantity.Quantity;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map; import java.util.Map;
/** /**
@ -60,6 +63,12 @@ public class CustomOrder {
return products; return products;
} }
public Collection<String> getFormattedProducts() {
ArrayList<String> formattedProducts = new ArrayList<>();
getProducts().forEach((k, v) -> formattedProducts.add(k + ": " + v));
return formattedProducts;
}
public boolean invoiceAvailable() { public boolean invoiceAvailable() {
return invoiceAvailable; return invoiceAvailable;
} }

View file

@ -22,11 +22,11 @@
<div> <!--th:unless"${cart.empty}"--> <div> <!--th:unless"${cart.empty}"-->
<table style="width:100%; text-align:left"> <table style="width:100%; text-align:left">
<tr> <tr>
<th>Von</th> <th style="width:10%">Von</th>
<th>Bis</th> <th style="width:10%">Bis</th>
<th>Kunde</th> <th style="width:15%">Kunde</th>
<th>Produktdetails</th> <th style="width:30%">Produktdetails</th>
<th>Rechnung</th> <th style="width:10%">Rechnung</th>
<th>Bezahlt</th> <th>Bezahlt</th>
<th>Preis</th> <th>Preis</th>
<th></th> <th></th>
@ -36,7 +36,12 @@
<td th:text="${order.getFormattedFinish()}"> <td th:text="${order.getFormattedFinish()}">
<td th:text="BeispielKunde"/> <td th:text="BeispielKunde"/>
<td> <td>
<div>
<a href="#productDetails" th:text="${order.getOrderType()}"/> <a href="#productDetails" th:text="${order.getOrderType()}"/>
<ul th:each="product : ${order.getFormattedProducts()}">
<li th:text="${product}"/>
</ul>
</div>
</td> </td>
<td> <td>
<div th:if="${order.invoiceAvailable()}"> <div th:if="${order.invoiceAvailable()}">