arreglar-funcionalidad #88

Merged
alex merged 5 commits from arreglar-funcionalidad into main 2024-11-28 13:59:32 +00:00
Showing only changes of commit 3acc1426bf - Show all commits

View File

@ -168,16 +168,11 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
private void initializeDateField() { private void initializeDateField() {
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
YearMonth currentMonth = YearMonth.of(today.getYear(), today.getMonth()); LocalDate lastWeekMonday = today.minusWeeks(1).with(java.time.DayOfWeek.MONDAY);
LocalDate startOfMonth = currentMonth.atDay(1);
LocalDate maxSelectableDate = today; LocalDate maxSelectableDate = today;
dateField.setMin(lastWeekMonday);
dateField.setMin(startOfMonth);
dateField.setMax(maxSelectableDate); dateField.setMax(maxSelectableDate);
dateField.setValue(today); dateField.setValue(today);
dateField.addValueChangeListener(event -> { dateField.addValueChangeListener(event -> {
LocalDate selectedDate = event.getValue(); LocalDate selectedDate = event.getValue();
if (selectedDate != null) { if (selectedDate != null) {
@ -191,6 +186,7 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
}); });
} }
private void saveHoursWorked() { private void saveHoursWorked() {
if (isFormValid()) { if (isFormValid()) {
HoursWorked hoursWorked = getEntity(); HoursWorked hoursWorked = getEntity();