No permitir solicitudes de vacaciones con anticimacion de 3 meses maximo a 15 dias minimo.

This commit is contained in:
jesus.pelaez 2024-11-21 18:52:08 -04:00
parent 17bd54a3f4
commit bf3fadbae3

View File

@ -500,9 +500,14 @@ public class RequestRegisterView extends VerticalLayout {
handleExistingRequests(request); handleExistingRequests(request);
} }
long differentDays = ChronoUnit.DAYS.between(LocalDate.now(), request.getStartDate());
if (differentDays >= -15 && differentDays <= 90) {
requestService.saveTimeOffRequest(request); requestService.saveTimeOffRequest(request);
Notification.show("Solicitud guardada correctamente."); Notification.show("Solicitud guardada correctamente.");
closeForm(); closeForm();
} else {
Notification.show("La fecha de inicio debe encontrarse dentro del rango de 15 días a 3 meses de anticipación.");
}
} }
private TimeOffRequest prepareRequest() { private TimeOffRequest prepareRequest() {