mejorar-detalles #77
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
@ -181,7 +182,7 @@ public class EmployeeView extends BeanValidationForm<Employee> 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<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) {
|
||||
|
@ -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()
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user