Add employee query to order controller

This was simply forgotten before cross-testing.
This commit is contained in:
Mathis Kral 2024-01-09 09:01:11 +01:00 committed by Mathis
parent 8ab01fd65f
commit f961071265
2 changed files with 5 additions and 3 deletions

View file

@ -6,6 +6,7 @@ import catering.catalog.CateringCatalog;
import catering.catalog.Consumable;
import catering.catalog.Rentable;
import catering.staff.Employee;
import catering.staff.JobType;
import catering.staff.StaffManagement;
import org.salespointframework.catalog.Product;
import org.salespointframework.inventory.UniqueInventory;
@ -28,6 +29,7 @@ import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Controller
@ -125,7 +127,9 @@ public class OrderController {
inventory,
customOrderRepository))));
model.addAttribute("allStaff", staffManagement.findAll().stream().toList());
model.addAttribute("allStaff", Stream.concat(
staffManagement.getAvailableStaffByJob(JobType.COOK, cart.getStart(), cart.getFinish()).stream(),
staffManagement.getAvailableStaffByJob(JobType.SERVICE, cart.getStart(), cart.getFinish()).stream()).toList());
model.addAttribute("duration", cart.getDurationInHours());

View file

@ -139,14 +139,12 @@ SPDX-FileCopyrightText: 2023 swt23w23
<th>Name</th>
<th>Typ</th>
<th>Stundensatz</th>
<th>Verfügbar</th>
<td></td>
</tr>
<tr th:each="employee : ${allStaff}">
<td th:text="${employee.getName()}"></td>
<td th:text="${employee.getJob()}"></td>
<td th:text="${employee.getWage()}"></td>
<td style="color: green" th:text="Verfügbar"></td>
<td>
<form th:action="@{/event/addEmployee}" method="post">
<input type="hidden" name="sid" th:value="${employee.getId()}"/>