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