En-desarrollo #62

Merged
alex merged 14 commits from En-desarrollo into main 2024-10-30 20:14:59 +00:00
Showing only changes of commit 860b453138 - Show all commits

View File

@ -51,7 +51,7 @@ public class RequestsListView extends Main {
this.vacationService = vacationService; this.vacationService = vacationService;
this.employees = employeeService.findAllEmployees(); this.employees = employeeService.findAllEmployees();
initializeView(); initializeView();
refreshGeneralRequestGrid(null, null, null, null); refreshGeneralRequestGrid(null, null, null);
} }
private void initializeView() { private void initializeView() {
@ -97,7 +97,6 @@ public class RequestsListView extends Main {
private void refreshGeneralRequestGrid(final Employee employee, private void refreshGeneralRequestGrid(final Employee employee,
final Team team, final Team team,
final TimeOffRequestType category,
final Status state) { final Status state) {
requestGrid.setPagingDataProvider((page, pageSize) -> { requestGrid.setPagingDataProvider((page, pageSize) -> {
int start = (int) (page * requestGrid.getPageSize()); int start = (int) (page * requestGrid.getPageSize());
@ -110,7 +109,7 @@ public class RequestsListView extends Main {
final int pageSize, final int pageSize,
final Employee employee, final Employee employee,
final Team team, final Team team,
final Status employeeState) { final Status state) {
List<Employee> filteredEmployees = employeeService.findAllEmployees(); List<Employee> filteredEmployees = employeeService.findAllEmployees();
if (employee != null && !"ALL".equals(employee.getFirstName())) { if (employee != null && !"ALL".equals(employee.getFirstName())) {
@ -125,12 +124,12 @@ public class RequestsListView extends Main {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
if (employeeState != null && employeeState != Status.ALL) { if (state != null && state != Status.ALL) {
filteredEmployees = filteredEmployees.stream() filteredEmployees = filteredEmployees.stream()
.filter(emp -> { .filter(emp -> {
Optional<TimeOffRequest> request = requestService Optional<TimeOffRequest> request = requestService
.findByEmployeeAndState(emp.getId(), TimeOffRequestStatus.TAKEN); .findByEmployeeAndState(emp.getId(), TimeOffRequestStatus.TAKEN);
return employeeState == Status.IDLE ? request.isPresent() : request.isEmpty(); return state == Status.IDLE ? request.isPresent() : request.isEmpty();
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@ -197,7 +196,6 @@ public class RequestsListView extends Main {
refreshGeneralRequestGrid( refreshGeneralRequestGrid(
event.getValue(), event.getValue(),
teamFilter.getValue(), teamFilter.getValue(),
categoryFilter.getValue(),
stateFilter.getValue() stateFilter.getValue()
) )
); );
@ -215,7 +213,6 @@ public class RequestsListView extends Main {
refreshGeneralRequestGrid( refreshGeneralRequestGrid(
employeeFilter.getValue(), employeeFilter.getValue(),
event.getValue(), event.getValue(),
categoryFilter.getValue(),
stateFilter.getValue() stateFilter.getValue()
) )
); );
@ -230,7 +227,6 @@ public class RequestsListView extends Main {
refreshGeneralRequestGrid( refreshGeneralRequestGrid(
employeeFilter.getValue(), employeeFilter.getValue(),
teamFilter.getValue(), teamFilter.getValue(),
categoryFilter.getValue(),
event.getValue() event.getValue()
) )
); );