En-desarrollo #65
@ -1,15 +1,15 @@
|
|||||||
package com.primefactorsolutions.model;
|
package com.primefactorsolutions.model;
|
||||||
|
|
||||||
public enum TimeOffRequestStatus {
|
public enum TimeOffRequestStatus {
|
||||||
ALL,
|
TODOS,
|
||||||
TAKEN,
|
TOMADO,
|
||||||
REQUESTED,
|
SOLICITADO,
|
||||||
APPROVED,
|
APROBADO,
|
||||||
IN_USE,
|
EN_USO,
|
||||||
UNDER_REVIEW,
|
EN_REVISION,
|
||||||
PENDING,
|
PENDIENTE,
|
||||||
REJECTED,
|
RECHAZADO,
|
||||||
COMPLETED,
|
COMPLETADO,
|
||||||
CANCELLED,
|
CANCELADO,
|
||||||
EXPIRED
|
VENCIDO
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
|
|||||||
: fetchFilteredTimeOffRequests(category, state);
|
: fetchFilteredTimeOffRequests(category, state);
|
||||||
for (TimeOffRequest request : filteredRequests) {
|
for (TimeOffRequest request : filteredRequests) {
|
||||||
if (request.getExpiration().isBefore(LocalDate.now())) {
|
if (request.getExpiration().isBefore(LocalDate.now())) {
|
||||||
request.setState(TimeOffRequestStatus.EXPIRED);
|
request.setState(TimeOffRequestStatus.VENCIDO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (TimeOffRequest request : filteredRequests) {
|
for (TimeOffRequest request : filteredRequests) {
|
||||||
|
@ -148,10 +148,10 @@ public class RequestRegisterView extends VerticalLayout {
|
|||||||
if (category == TimeOffRequestType.HEALTH_PERMIT
|
if (category == TimeOffRequestType.HEALTH_PERMIT
|
||||||
|| category == TimeOffRequestType.VACATION_CURRENT_MANAGEMENT
|
|| category == TimeOffRequestType.VACATION_CURRENT_MANAGEMENT
|
||||||
|| category == TimeOffRequestType.VACATION_PREVIOUS_MANAGEMENT) {
|
|| category == TimeOffRequestType.VACATION_PREVIOUS_MANAGEMENT) {
|
||||||
return latestRequest.getState() == TimeOffRequestStatus.EXPIRED
|
return latestRequest.getState() == TimeOffRequestStatus.VENCIDO
|
||||||
|| (latestRequest.getState() == TimeOffRequestStatus.TAKEN && latestRequest.getDaysBalance() > 0);
|
|| (latestRequest.getState() == TimeOffRequestStatus.TOMADO && latestRequest.getDaysBalance() > 0);
|
||||||
} else {
|
} else {
|
||||||
return latestRequest.getState() == TimeOffRequestStatus.EXPIRED;
|
return latestRequest.getState() == TimeOffRequestStatus.VENCIDO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,13 +181,13 @@ public class RequestRegisterView extends VerticalLayout {
|
|||||||
if (vacation != null) {
|
if (vacation != null) {
|
||||||
TimeOffRequest requestWithBalance = requests.stream()
|
TimeOffRequest requestWithBalance = requests.stream()
|
||||||
.filter(request -> request.getDaysBalance() > 0
|
.filter(request -> request.getDaysBalance() > 0
|
||||||
&& request.getState() != TimeOffRequestStatus.EXPIRED)
|
&& request.getState() != TimeOffRequestStatus.VENCIDO)
|
||||||
.max(Comparator.comparing(TimeOffRequest::getStartDate))
|
.max(Comparator.comparing(TimeOffRequest::getStartDate))
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (requestWithBalance != null) {
|
if (requestWithBalance != null) {
|
||||||
if (requestWithBalance.getState() == TimeOffRequestStatus.TAKEN) {
|
if (requestWithBalance.getState() == TimeOffRequestStatus.TOMADO) {
|
||||||
availableDaysField.setValue(requestWithBalance.getDaysBalance());
|
availableDaysField.setValue(requestWithBalance.getDaysBalance());
|
||||||
} else if (requestWithBalance.getState() == TimeOffRequestStatus.EXPIRED) {
|
} else if (requestWithBalance.getState() == TimeOffRequestStatus.VENCIDO) {
|
||||||
availableDaysField.setValue(vacation.getDuration());
|
availableDaysField.setValue(vacation.getDuration());
|
||||||
}
|
}
|
||||||
} else if (vacation.getCategory() == TimeOffRequestType.VACATION_CURRENT_MANAGEMENT) {
|
} else if (vacation.getCategory() == TimeOffRequestType.VACATION_CURRENT_MANAGEMENT) {
|
||||||
@ -330,7 +330,7 @@ public class RequestRegisterView extends VerticalLayout {
|
|||||||
} else {
|
} else {
|
||||||
request.setExpiration(endDate);
|
request.setExpiration(endDate);
|
||||||
}
|
}
|
||||||
request.setState(TimeOffRequestStatus.REQUESTED);
|
request.setState(TimeOffRequestStatus.SOLICITADO);
|
||||||
|
|
||||||
List<TimeOffRequest> existingRequests =
|
List<TimeOffRequest> existingRequests =
|
||||||
requestService.findByEmployeeAndCategory(employee.getId(), request.getCategory());
|
requestService.findByEmployeeAndCategory(employee.getId(), request.getCategory());
|
||||||
|
@ -130,7 +130,7 @@ public class RequestsListView extends Main {
|
|||||||
filteredEmployees = filteredEmployees.stream()
|
filteredEmployees = filteredEmployees.stream()
|
||||||
.filter(emp -> {
|
.filter(emp -> {
|
||||||
Optional<TimeOffRequest> request = requestService
|
Optional<TimeOffRequest> request = requestService
|
||||||
.findByEmployeeAndState(emp.getId(), TimeOffRequestStatus.IN_USE);
|
.findByEmployeeAndState(emp.getId(), TimeOffRequestStatus.EN_USO);
|
||||||
return state == Status.EN_DESCANSO ? request.isPresent() : request.isEmpty();
|
return state == Status.EN_DESCANSO ? request.isPresent() : request.isEmpty();
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@ -155,7 +155,7 @@ public class RequestsListView extends Main {
|
|||||||
|
|
||||||
private String getEmployeeStatus(final Employee employee) {
|
private String getEmployeeStatus(final Employee employee) {
|
||||||
Optional<TimeOffRequest> activeRequest = requestService
|
Optional<TimeOffRequest> activeRequest = requestService
|
||||||
.findByEmployeeAndState(employee.getId(), TimeOffRequestStatus.IN_USE);
|
.findByEmployeeAndState(employee.getId(), TimeOffRequestStatus.EN_USO);
|
||||||
return activeRequest.isPresent() ? "EN_DESCANSO" : "ACTIVO";
|
return activeRequest.isPresent() ? "EN_DESCANSO" : "ACTIVO";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user