From c194f44308b4051333ae4e0cfd9c1495ac475eeb Mon Sep 17 00:00:00 2001
From: Hannes
Date: Sun, 7 Jun 2020 13:38:01 +0200
Subject: [PATCH] implement customers detail bookings
---
.../intern/customers/CustomersIndexController.java | 13 ++++++++++++-
.../resources/templates/intern/customers/id.html | 3 +--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/CustomersIndexController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/CustomersIndexController.java
index cf13ae4..72d2893 100644
--- a/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/CustomersIndexController.java
+++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/CustomersIndexController.java
@@ -34,6 +34,12 @@ public class CustomersIndexController {
@Autowired
private final CustomerOrderRepository customerOrderRepository = null;
+ @Autowired
+ private final BookingRepository bookingRepository = null;
+
+ @Autowired
+ private AccountingController accountingController = null;
+
@GetMapping("")
public String internCustomers(Model model) {
@@ -60,7 +66,12 @@ public class CustomersIndexController {
List orders = customerOrderRepository.getOrdersByUserId(id);
model.addAttribute("orders", orders);
- //TODO: Booking!!!!!!!!!!!!
+ List bookings = bookingRepository.customerBookingsReverseChronologically(id);
+ ShortTemplateBookingResult result = accountingController.buildShortTemplate(
+ bookings,
+ account -> account.userAccount != null && account.userAccount.id == id);
+ model.addAttribute("balance", result.balance);
+ model.addAttribute("bookings", result.bookings);
return "intern/customers/id";
}
diff --git a/prototype/src/main/resources/templates/intern/customers/id.html b/prototype/src/main/resources/templates/intern/customers/id.html
index e8aa609..30962fc 100644
--- a/prototype/src/main/resources/templates/intern/customers/id.html
+++ b/prototype/src/main/resources/templates/intern/customers/id.html
@@ -106,10 +106,8 @@
-
-
Bestellungen
+
Buchungen
Kontostand