En-desarrollo #62

Merged
alex merged 14 commits from En-desarrollo into main 2024-10-30 20:14:59 +00:00
2 changed files with 5 additions and 9 deletions
Showing only changes of commit 83ba9f7478 - 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()
) )
); );

View File

@ -76,7 +76,7 @@ values ('9c6f12ba-e333-4e7a-b8a6-caa0982bd8c3', 1, '5c6f11fe-c341-4be7-a9a6-bba0
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance) insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('9d6f12ba-e444-4e7a-b8a6-caa0982bd8d4', 1, '5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 'GOOD_FRIDAY', 'COMPLETED', 1, '2024-03-29', '2024-03-29', '2024-03-29', 1, 0); values ('9d6f12ba-e444-4e7a-b8a6-caa0982bd8d4', 1, '5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 'GOOD_FRIDAY', 'COMPLETED', 1, '2024-03-29', '2024-03-29', '2024-03-29', 1, 0);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance) insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('9e6f12ba-e555-4e7a-b8a6-caa0982bd8e5', 1, '5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 'LABOR_DAY', 'REJECTED', 1, '2025-05-01', '2024-05-01', '2024-05-01', 1, 0); values ('9e6f12ba-e555-4e7a-b8a6-caa0982bd8e5', 1, '5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 'VACATION_CURRENT_MANAGEMENT', 'APPROVED', 30, '2026-11-01', '2024-11-01', '2024-11-30', 30, 0);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance) insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('8c653f2a-f9a3-4d67-b3b6-12ad98fe0983', 1, 'f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 'LABOR_DAY', 'REQUESTED', 1, '2025-05-01', '2024-05-01', '2024-05-01', 1, 0); values ('8c653f2a-f9a3-4d67-b3b6-12ad98fe0983', 1, 'f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 'LABOR_DAY', 'REQUESTED', 1, '2025-05-01', '2024-05-01', '2024-05-01', 1, 0);