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 @Autowired
private final CustomerOrderRepository customerOrderRepository = null; private final CustomerOrderRepository customerOrderRepository = null;
@Autowired
private final BookingRepository bookingRepository = null;
@Autowired
private AccountingController accountingController = null;
@GetMapping("") @GetMapping("")
public String internCustomers(Model model) { public String internCustomers(Model model) {
@ -60,7 +66,12 @@ public class CustomersIndexController {
List<CustomerOrder> orders = customerOrderRepository.getOrdersByUserId(id); List<CustomerOrder> orders = customerOrderRepository.getOrdersByUserId(id);
model.addAttribute("orders", orders); 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"; return "intern/customers/id";
} }

View File

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