mejorar-detalles #77

Open
melina.gutierrez wants to merge 6 commits from mejorar-detalles into main
4 changed files with 18 additions and 12 deletions
Showing only changes of commit 72e82fd906 - Show all commits

View File

@ -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;
}

View File

@ -74,7 +74,8 @@ public class EmployeeView extends BeanValidationForm<Employee> 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);
@ -295,7 +296,7 @@ public class EmployeeView extends BeanValidationForm<Employee> 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) {

View File

@ -161,7 +161,7 @@ public class HoursWorkedListView extends BaseView {
});
}
private double calcularHorasPorTareaEspecifica(HoursWorked hoursWorked) {
private double calcularHorasPorTareaEspecifica(final HoursWorked hoursWorked) {
List<HoursWorked> tareas = hoursWorkedService.findListHoursWorkedEmployee(
hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber());
return tareas.stream()
@ -170,7 +170,7 @@ public class HoursWorkedListView extends BaseView {
.sum();
}
private double calcularHorasPorActividadGeneral(HoursWorked hoursWorked) {
private double calcularHorasPorActividadGeneral(final HoursWorked hoursWorked) {
List<HoursWorked> actividades = hoursWorkedService.findListHoursWorkedEmployee(
hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber());
return actividades.stream()
@ -181,7 +181,7 @@ public class HoursWorkedListView extends BaseView {
}
private double calcularTotalHorasTareaEspecifica(HoursWorked hoursWorked) {
private double calcularTotalHorasTareaEspecifica(final HoursWorked hoursWorked) {
List<HoursWorked> horasTareas = hoursWorkedService.findListHoursWorkedEmployee(
hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber());
return horasTareas.stream()

View File

@ -182,7 +182,8 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> 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<HoursWorked> 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<HoursWorked> 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<HoursWorked> 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();
}
}