From 9827c079ddf2797f3d11577fdec8bb66f56396e5 Mon Sep 17 00:00:00 2001 From: ricardo051199 Date: Wed, 20 Nov 2024 10:33:11 -0400 Subject: [PATCH] Limitar a 10 dias maximo para tomar vacaciones por gestion --- .../views/RequestRegisterView.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/primefactorsolutions/views/RequestRegisterView.java b/src/main/java/com/primefactorsolutions/views/RequestRegisterView.java index eb24c27..e32feba 100644 --- a/src/main/java/com/primefactorsolutions/views/RequestRegisterView.java +++ b/src/main/java/com/primefactorsolutions/views/RequestRegisterView.java @@ -100,9 +100,12 @@ public class RequestRegisterView extends VerticalLayout { updateDatePickerMinValues(); }); endDatePicker.addValueChangeListener(event -> { + if (startDatePicker.getValue() != null) { + endDatePicker.setMin(startDatePicker.getValue()); + } LocalDate selectedDate = event.getValue(); if (selectedDate != null && (selectedDate.getDayOfWeek().getValue() == 6 || selectedDate.getDayOfWeek().getValue() == 7)) { - startDatePicker.setValue(selectedDate.minusDays(1)); + endDatePicker.setValue(selectedDate.minusDays(1)); } calculateDays(); }); @@ -408,6 +411,12 @@ public class RequestRegisterView extends VerticalLayout { if (balanceDays < 0.0) { clearFields(); } + + if (daysToBeTakenField.getValue() > 10 + && (categoryComboBox.getValue() == TimeOffRequestType.VACACION_GESTION_ANTERIOR + || categoryComboBox.getValue() == TimeOffRequestType.VACACION_GESTION_ACTUAL)) { + clearFields(); + } } }