implement customers detail bookings

This commit is contained in:
Hannes Huber 2020-06-07 13:38:01 +02:00
parent fc68e231d3
commit c194f44308
2 changed files with 13 additions and 3 deletions

View File

@ -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<CustomerOrder> orders = customerOrderRepository.getOrdersByUserId(id);
model.addAttribute("orders", orders);
//TODO: Booking!!!!!!!!!!!!
List<Booking> 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";
}

View File

@ -106,10 +106,8 @@
</button>
</form>
</p>
</div>
<h2>Bestellungen</h2>
<p>
<table id="main-table">
@ -129,6 +127,7 @@
</tr>
</table>
</p>
<h2>Buchungen</h2>
<div>
<h4> Kontostand </h4>