From fc51e227a51cac53a22625fd5a8584e8c5e5b167 Mon Sep 17 00:00:00 2001 From: Melina Gutierrez Date: Sat, 23 Nov 2024 19:33:25 -0400 Subject: [PATCH] =?UTF-8?q?a=C3=B1adir=20nuevos=20requisitos=20en=20Emplea?= =?UTF-8?q?do?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../primefactorsolutions/model/HoursWorked.java | 2 +- .../primefactorsolutions/views/EmployeeView.java | 7 ++++--- .../views/HoursWorkedListView.java | 6 +++--- .../views/HoursWorkedView.java | 15 ++++++++++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/primefactorsolutions/model/HoursWorked.java b/src/main/java/com/primefactorsolutions/model/HoursWorked.java index 4ee8934..031bef8 100644 --- a/src/main/java/com/primefactorsolutions/model/HoursWorked.java +++ b/src/main/java/com/primefactorsolutions/model/HoursWorked.java @@ -38,7 +38,7 @@ public class HoursWorked extends BaseEntity { return tareaEspecifica; } - public void setTareaEspecifica(String tareaEspecifica) { + public void setTareaEspecifica(final String tareaEspecifica) { this.tareaEspecifica = tareaEspecifica; } diff --git a/src/main/java/com/primefactorsolutions/views/EmployeeView.java b/src/main/java/com/primefactorsolutions/views/EmployeeView.java index bd8baba..642ef2f 100644 --- a/src/main/java/com/primefactorsolutions/views/EmployeeView.java +++ b/src/main/java/com/primefactorsolutions/views/EmployeeView.java @@ -74,7 +74,8 @@ public class EmployeeView extends BeanValidationForm implements HasUrl private final TextField phoneNumber = createTextField("Teléfono", 8, false); private final EmailField personalEmail = createEmailField("E-mail ejemplo: (ejemplo@gmail.com)"); private final TextField phoneNumberProfesional = createTextField("Teléfono Laboral", 8, false); - private final EmailField profesionalEmail = createEmailField("E-mail Laboral ejemplo: (ejemplo@primerfactorsolutions.com)"); + private final EmailField profesionalEmail = createEmailField("E-mail Laboral ejemplo: " + + "(ejemplo@primerfactorsolutions.com)"); private final TextField emergencyCName = createTextField("Nombres y Apellidos de Contacto", 50, false); private final TextField emergencyCAddress = createTextField("Dirección de Contacto", 50, false); private final TextField emergencyCPhone = createTextField("Teléfono de Contacto", 8, false); @@ -181,7 +182,7 @@ public class EmployeeView extends BeanValidationForm implements HasUrl salaryTotal.addValueChangeListener(event -> calculateSalaryTotal()); dateOfEntry.addValueChangeListener(event -> calculateSeniority()); dateOfExit.addValueChangeListener(event -> { - if(event.getValue() != null){ + if (event.getValue() != null) { status.setValue(Employee.Status.INACTIVE); } else { status.setValue(Employee.Status.ACTIVE); @@ -295,7 +296,7 @@ public class EmployeeView extends BeanValidationForm implements HasUrl } } - private double parseDoubleValue(String value) { + private double parseDoubleValue(final String value) { try { return value != null && !value.isEmpty() ? Double.parseDouble(value) : 0.0; } catch (NumberFormatException e) { diff --git a/src/main/java/com/primefactorsolutions/views/HoursWorkedListView.java b/src/main/java/com/primefactorsolutions/views/HoursWorkedListView.java index 3c83fcb..f314cca 100644 --- a/src/main/java/com/primefactorsolutions/views/HoursWorkedListView.java +++ b/src/main/java/com/primefactorsolutions/views/HoursWorkedListView.java @@ -172,7 +172,7 @@ public class HoursWorkedListView extends BaseView { hoursWorkedGrid.setPageSize(PAGE_SIZE); } - private double calcularHorasPorTareaEspecifica(HoursWorked hoursWorked) { + private double calcularHorasPorTareaEspecifica(final HoursWorked hoursWorked) { List tareas = hoursWorkedService.findListHoursWorkedEmployee( hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber()); return tareas.stream() @@ -181,7 +181,7 @@ public class HoursWorkedListView extends BaseView { .sum(); } - private double calcularHorasPorActividadGeneral(HoursWorked hoursWorked) { + private double calcularHorasPorActividadGeneral(final HoursWorked hoursWorked) { List actividades = hoursWorkedService.findListHoursWorkedEmployee( hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber()); return actividades.stream() @@ -192,7 +192,7 @@ public class HoursWorkedListView extends BaseView { } - private double calcularTotalHorasTareaEspecifica(HoursWorked hoursWorked) { + private double calcularTotalHorasTareaEspecifica(final HoursWorked hoursWorked) { List horasTareas = hoursWorkedService.findListHoursWorkedEmployee( hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber()); return horasTareas.stream() diff --git a/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java b/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java index 249477d..e702791 100644 --- a/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java +++ b/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java @@ -182,7 +182,8 @@ public class HoursWorkedView extends BeanValidationForm implements LocalDate selectedDate = event.getValue(); if (selectedDate != null) { int weekNumber = selectedDate.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR); - Notification.show("Número de la semana: " + weekNumber, 3000, Notification.Position.BOTTOM_CENTER); + Notification.show("Número de la semana: " + weekNumber, + 3000, Notification.Position.BOTTOM_CENTER); if (hoursWorked != null) { hoursWorked.setWeekNumber(weekNumber); } @@ -196,7 +197,8 @@ public class HoursWorkedView extends BeanValidationForm implements String actividad = activityField.getValue(); String tareaEspecifica = tareasEspecificasDropdown.getValue(); if (actividad != null && !actividad.isEmpty() && tareaEspecifica != null) { - Notification.show("Solo puedes elegir una: actividad del proyecto o tarea de la empresa.", 3000, Notification.Position.BOTTOM_CENTER); + Notification.show("Solo puedes elegir una: actividad del proyecto o tarea de la empresa.", + 3000, Notification.Position.BOTTOM_CENTER); return; } if (actividad != null && !actividad.isEmpty()) { @@ -206,7 +208,8 @@ public class HoursWorkedView extends BeanValidationForm implements // Validar que se ingresó una tarea específica en el campo de texto String tareaEspecificaInputValue = tareaEspecificaInput.getValue(); if (tareaEspecificaInputValue == null || tareaEspecificaInputValue.isEmpty()) { - Notification.show("Por favor, ingresa una tarea específica.", 3000, Notification.Position.BOTTOM_CENTER); + Notification.show("Por favor, ingresa una tarea específica.", + 3000, Notification.Position.BOTTOM_CENTER); return; } hoursWorked.setTareaEspecifica(tareaEspecificaInputValue); @@ -214,12 +217,14 @@ public class HoursWorkedView extends BeanValidationForm implements hoursWorked.setTareaEspecifica(tareaEspecifica); } } else { - Notification.show("Por favor, selecciona una actividad o tarea para guardar.", 3000, Notification.Position.BOTTOM_CENTER); + Notification.show("Por favor, selecciona una actividad o tarea para guardar.", + 3000, Notification.Position.BOTTOM_CENTER); return; } setFieldValues(hoursWorked); hoursWorkedService.save(hoursWorked); - Notification.show("Horas trabajadas guardadas correctamente.", 3000, Notification.Position.BOTTOM_CENTER); + Notification.show("Horas trabajadas guardadas correctamente.", + 3000, Notification.Position.BOTTOM_CENTER); closeForm(); } }