añadir nuevos requisitos en Empleado
Some checks failed
PR Builder / Build-PR (pull_request) Failing after 2m42s

This commit is contained in:
Melina Gutierrez 2024-11-23 19:33:25 -04:00
parent 77c64ee7e8
commit 72e82fd906
4 changed files with 18 additions and 12 deletions

View File

@ -38,7 +38,7 @@ public class HoursWorked extends BaseEntity {
return tareaEspecifica; return tareaEspecifica;
} }
public void setTareaEspecifica(String tareaEspecifica) { public void setTareaEspecifica(final String tareaEspecifica) {
this.tareaEspecifica = 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 TextField phoneNumber = createTextField("Teléfono", 8, false);
private final EmailField personalEmail = createEmailField("E-mail ejemplo: (ejemplo@gmail.com)"); private final EmailField personalEmail = createEmailField("E-mail ejemplo: (ejemplo@gmail.com)");
private final TextField phoneNumberProfesional = createTextField("Teléfono Laboral", 8, false); 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 emergencyCName = createTextField("Nombres y Apellidos de Contacto", 50, false);
private final TextField emergencyCAddress = createTextField("Dirección 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); private final TextField emergencyCPhone = createTextField("Teléfono de Contacto", 8, false);
@ -181,7 +182,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
salaryTotal.addValueChangeListener(event -> calculateSalaryTotal()); salaryTotal.addValueChangeListener(event -> calculateSalaryTotal());
dateOfEntry.addValueChangeListener(event -> calculateSeniority()); dateOfEntry.addValueChangeListener(event -> calculateSeniority());
dateOfExit.addValueChangeListener(event -> { dateOfExit.addValueChangeListener(event -> {
if(event.getValue() != null){ if (event.getValue() != null) {
status.setValue(Employee.Status.INACTIVE); status.setValue(Employee.Status.INACTIVE);
} else { } else {
status.setValue(Employee.Status.ACTIVE); status.setValue(Employee.Status.ACTIVE);
@ -295,7 +296,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
} }
} }
private double parseDoubleValue(String value) { private double parseDoubleValue(final String value) {
try { try {
return value != null && !value.isEmpty() ? Double.parseDouble(value) : 0.0; return value != null && !value.isEmpty() ? Double.parseDouble(value) : 0.0;
} catch (NumberFormatException e) { } 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( List<HoursWorked> tareas = hoursWorkedService.findListHoursWorkedEmployee(
hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber()); hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber());
return tareas.stream() return tareas.stream()
@ -170,7 +170,7 @@ public class HoursWorkedListView extends BaseView {
.sum(); .sum();
} }
private double calcularHorasPorActividadGeneral(HoursWorked hoursWorked) { private double calcularHorasPorActividadGeneral(final HoursWorked hoursWorked) {
List<HoursWorked> actividades = hoursWorkedService.findListHoursWorkedEmployee( List<HoursWorked> actividades = hoursWorkedService.findListHoursWorkedEmployee(
hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber()); hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber());
return actividades.stream() 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( List<HoursWorked> horasTareas = hoursWorkedService.findListHoursWorkedEmployee(
hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber()); hoursWorked.getEmployee().getId(), hoursWorked.getWeekNumber());
return horasTareas.stream() return horasTareas.stream()

View File

@ -182,7 +182,8 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
LocalDate selectedDate = event.getValue(); LocalDate selectedDate = event.getValue();
if (selectedDate != null) { if (selectedDate != null) {
int weekNumber = selectedDate.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR); 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) { if (hoursWorked != null) {
hoursWorked.setWeekNumber(weekNumber); hoursWorked.setWeekNumber(weekNumber);
} }
@ -196,7 +197,8 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
String actividad = activityField.getValue(); String actividad = activityField.getValue();
String tareaEspecifica = tareasEspecificasDropdown.getValue(); String tareaEspecifica = tareasEspecificasDropdown.getValue();
if (actividad != null && !actividad.isEmpty() && tareaEspecifica != null) { 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; return;
} }
if (actividad != null && !actividad.isEmpty()) { 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 // Validar que se ingresó una tarea específica en el campo de texto
String tareaEspecificaInputValue = tareaEspecificaInput.getValue(); String tareaEspecificaInputValue = tareaEspecificaInput.getValue();
if (tareaEspecificaInputValue == null || tareaEspecificaInputValue.isEmpty()) { 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; return;
} }
hoursWorked.setTareaEspecifica(tareaEspecificaInputValue); hoursWorked.setTareaEspecifica(tareaEspecificaInputValue);
@ -214,12 +217,14 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
hoursWorked.setTareaEspecifica(tareaEspecifica); hoursWorked.setTareaEspecifica(tareaEspecifica);
} }
} else { } 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; return;
} }
setFieldValues(hoursWorked); setFieldValues(hoursWorked);
hoursWorkedService.save(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(); closeForm();
} }
} }