From addba4b70fa3732b6cf689d07f4334e1cbc090ef Mon Sep 17 00:00:00 2001 From: Melina Gutierrez Date: Wed, 13 Nov 2024 16:08:20 -0400 Subject: [PATCH] crear tabla para visuaizar las actividades creadas --- package.json | 56 +++++++++---------- .../primefactorsolutions/model/Actividad.java | 20 +++---- .../model/ActividadesHours.java | 12 ++-- .../model/HoursWorked.java | 19 +++---- .../ActividadesHoursRepository.java | 2 +- .../views/HoursWorkedView.java | 13 +++-- 6 files changed, 62 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index 209a580..18cb231 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "type": "module", "dependencies": { "@f0rce/ace-widget": "1.0.2", - "@polymer/polymer": "3.5.2", + "@polymer/polymer": "3.5.1", "@vaadin-component-factory/vcf-pdf-viewer": "2.0.1", "@vaadin/bundles": "24.5.1", "@vaadin/common-frontend": "0.0.19", @@ -19,30 +19,30 @@ "@vaadin/vaadin-usage-statistics": "2.1.3", "construct-style-sheets-polyfill": "3.1.0", "date-fns": "2.29.3", - "lit": "3.2.1", + "lit": "3.1.4", "print-js": "1.6.0", "proj4": "2.12.1", "react": "18.3.1", "react-dom": "18.3.1", - "react-router-dom": "6.26.2" + "react-router-dom": "6.23.1" }, "devDependencies": { - "@babel/preset-react": "7.25.7", + "@babel/preset-react": "7.24.7", "@preact/signals-react-transform": "0.4.0", - "@rollup/plugin-replace": "6.0.1", - "@rollup/pluginutils": "5.1.2", - "@types/react": "18.3.11", - "@types/react-dom": "18.3.1", - "@vitejs/plugin-react": "4.3.3", - "async": "3.2.6", - "glob": "10.4.5", + "@rollup/plugin-replace": "5.0.7", + "@rollup/pluginutils": "5.1.0", + "@types/react": "18.3.3", + "@types/react-dom": "18.3.0", + "@vitejs/plugin-react": "4.3.1", + "async": "3.2.5", + "glob": "10.4.1", "rollup-plugin-brotli": "3.1.0", "rollup-plugin-visualizer": "5.12.0", "strip-css-comments": "5.0.0", "transform-ast": "2.4.4", - "typescript": "5.6.3", - "vite": "5.4.9", - "vite-plugin-checker": "0.8.0", + "typescript": "5.4.5", + "vite": "5.3.3", + "vite-plugin-checker": "0.6.4", "workbox-build": "7.1.1", "workbox-core": "7.1.0", "workbox-precaching": "7.1.0" @@ -50,7 +50,7 @@ "vaadin": { "dependencies": { "@f0rce/ace-widget": "1.0.2", - "@polymer/polymer": "3.5.2", + "@polymer/polymer": "3.5.1", "@vaadin-component-factory/vcf-pdf-viewer": "2.0.1", "@vaadin/bundles": "24.5.1", "@vaadin/common-frontend": "0.0.19", @@ -65,30 +65,30 @@ "@vaadin/vaadin-usage-statistics": "2.1.3", "construct-style-sheets-polyfill": "3.1.0", "date-fns": "2.29.3", - "lit": "3.2.1", + "lit": "3.1.4", "print-js": "1.6.0", "proj4": "2.12.1", "react": "18.3.1", "react-dom": "18.3.1", - "react-router-dom": "6.26.2" + "react-router-dom": "6.23.1" }, "devDependencies": { - "@babel/preset-react": "7.25.7", + "@babel/preset-react": "7.24.7", "@preact/signals-react-transform": "0.4.0", - "@rollup/plugin-replace": "6.0.1", - "@rollup/pluginutils": "5.1.2", - "@types/react": "18.3.11", - "@types/react-dom": "18.3.1", - "@vitejs/plugin-react": "4.3.3", - "async": "3.2.6", - "glob": "10.4.5", + "@rollup/plugin-replace": "5.0.7", + "@rollup/pluginutils": "5.1.0", + "@types/react": "18.3.3", + "@types/react-dom": "18.3.0", + "@vitejs/plugin-react": "4.3.1", + "async": "3.2.5", + "glob": "10.4.1", "rollup-plugin-brotli": "3.1.0", "rollup-plugin-visualizer": "5.12.0", "strip-css-comments": "5.0.0", "transform-ast": "2.4.4", - "typescript": "5.6.3", - "vite": "5.4.9", - "vite-plugin-checker": "0.8.0", + "typescript": "5.4.5", + "vite": "5.3.3", + "vite-plugin-checker": "0.6.4", "workbox-build": "7.1.1", "workbox-core": "7.1.0", "workbox-precaching": "7.1.0" diff --git a/src/main/java/com/primefactorsolutions/model/Actividad.java b/src/main/java/com/primefactorsolutions/model/Actividad.java index 7c7df34..55402f4 100644 --- a/src/main/java/com/primefactorsolutions/model/Actividad.java +++ b/src/main/java/com/primefactorsolutions/model/Actividad.java @@ -25,7 +25,7 @@ public class Actividad extends BaseEntity { private String tarea; private double horas; - public Actividad() {} + public Actividad() { } public Actividad(final Builder builder) { this.nombre = builder.nombre; @@ -49,46 +49,46 @@ public class Actividad extends BaseEntity { return nombre; } - public void setLunes(double lunes) { + public void setLunes(final double lunes) { this.lunes = lunes; return; } - public void setMartes(double martes) { + public void setMartes(final double martes) { this.martes = martes; return; } - public void setMiercoles(double miercoles) { + public void setMiercoles(final double miercoles) { this.miercoles = miercoles; return; } - public void setJueves(double jueves) { + public void setJueves(final double jueves) { this.jueves = jueves; return; } - public void setViernes(double viernes) { + public void setViernes(final double viernes) { this.viernes = viernes; return; } - public void setSabado(double sabado) { + public void setSabado(final double sabado) { this.sabado = sabado; return; } - public void setDomingo(double domingo) { + public void setDomingo(final double domingo) { this.domingo = domingo; return; } - public void setTarea(String tarea) { + public void setTarea(final String tarea) { this.tarea = tarea; return; } - public void setHoras(double horas) { + public void setHoras(final double horas) { this.horas = horas; return; } diff --git a/src/main/java/com/primefactorsolutions/model/ActividadesHours.java b/src/main/java/com/primefactorsolutions/model/ActividadesHours.java index 5a93ec4..dc3ec9f 100644 --- a/src/main/java/com/primefactorsolutions/model/ActividadesHours.java +++ b/src/main/java/com/primefactorsolutions/model/ActividadesHours.java @@ -35,7 +35,7 @@ public class ActividadesHours { return id; } - public void setId(UUID id) { + public void setId(final UUID id) { this.id = id; } @@ -43,7 +43,7 @@ public class ActividadesHours { return employee; } - public void setEmployee(Employee employee) { + public void setEmployee(final Employee employee) { this.employee = employee; } @@ -51,7 +51,7 @@ public class ActividadesHours { return actividad; } - public void setActividad(Actividad actividad) { + public void setActividad(final Actividad actividad) { this.actividad = actividad; } @@ -59,7 +59,7 @@ public class ActividadesHours { return totalHours; } - public void setTotalHours(double totalHours) { + public void setTotalHours(final double totalHours) { this.totalHours = totalHours; } @@ -67,7 +67,7 @@ public class ActividadesHours { return weekNumber; } - public void setWeekNumber(int weekNumber) { + public void setWeekNumber(final int weekNumber) { this.weekNumber = weekNumber; } @@ -75,7 +75,7 @@ public class ActividadesHours { return fecha; } - public void setFecha(LocalDate fecha) { + public void setFecha(final LocalDate fecha) { this.fecha = fecha; } } diff --git a/src/main/java/com/primefactorsolutions/model/HoursWorked.java b/src/main/java/com/primefactorsolutions/model/HoursWorked.java index 0c2b9ad..5b9bd79 100644 --- a/src/main/java/com/primefactorsolutions/model/HoursWorked.java +++ b/src/main/java/com/primefactorsolutions/model/HoursWorked.java @@ -28,7 +28,7 @@ public class HoursWorked extends BaseEntity { private double totalHours; private LocalDate fecha; - public HoursWorked() {} + public HoursWorked() { } // Getters y Setters public UUID getId() { @@ -84,20 +84,19 @@ public class HoursWorked extends BaseEntity { } // Método adicional para calcular el número de semana basado en la fecha - private int calculateWeekNumber(LocalDate date) { + private int calculateWeekNumber(final LocalDate date) { WeekFields weekFields = WeekFields.of(Locale.getDefault()); return date.get(weekFields.weekOfWeekBasedYear()); } @Override public String toString() { - return "HoursWorked{" + - "id=" + id + - ", employee=" + (employee != null ? employee.getFirstName() : "N/A") + - ", actividad=" + (actividad != null ? actividad.getNombre() : "N/A") + - ", weekNumber=" + weekNumber + - ", totalHours=" + totalHours + - ", fecha=" + fecha + - '}'; + return "HoursWorked{" + + "id=" + id + + ", employee=" + (employee != null ? employee.getFirstName() : "N/A") + + ", actividad=" + (actividad != null ? actividad.getNombre() : "N/A") + + ", weekNumber=" + weekNumber + + ", totalHours=" + totalHours + + ", fecha=" + fecha + '}'; } } diff --git a/src/main/java/com/primefactorsolutions/repositories/ActividadesHoursRepository.java b/src/main/java/com/primefactorsolutions/repositories/ActividadesHoursRepository.java index 40a0d84..8e3b430 100644 --- a/src/main/java/com/primefactorsolutions/repositories/ActividadesHoursRepository.java +++ b/src/main/java/com/primefactorsolutions/repositories/ActividadesHoursRepository.java @@ -2,5 +2,5 @@ package com.primefactorsolutions.repositories; import com.primefactorsolutions.model.ActividadesHours; import org.springframework.data.jpa.repository.JpaRepository; import java.util.UUID; -public interface ActividadesHoursRepository extends JpaRepository { +public interface ActividadesHoursRepository extends JpaRepository { } diff --git a/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java b/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java index 33c2930..e40b39c 100644 --- a/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java +++ b/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java @@ -69,7 +69,8 @@ public class HoursWorkedView extends VerticalLayout { private final Label totalCompletadoLabel = new Label(); private final Label horasPendientesLabel = new Label(); - public HoursWorkedView(final EmployeeService employeeService, final HoursWorkedService hoursWorkedService) { + public HoursWorkedView(final EmployeeService employeeService, + final HoursWorkedService hoursWorkedService) { this.employeeService = employeeService; this.hoursWorkedService = hoursWorkedService; configurarVista(); @@ -121,7 +122,8 @@ public class HoursWorkedView extends VerticalLayout { employeeComboBox.setWidth("250px"); employeeComboBox.setPlaceholder("Buscar empleado..."); employeeComboBox.setItems(employeeService.findAllEmployees()); - employeeComboBox.setItemLabelGenerator(employee -> employee.getFirstName() + " " + employee.getLastName()); + employeeComboBox.setItemLabelGenerator(employee -> employee.getFirstName() + + " " + employee.getLastName()); employeeComboBox.setAllowCustomValue(false); employeeComboBox.addCustomValueSetListener(event -> Notification.show("Selecciona un empleado válido de la lista.") @@ -192,7 +194,6 @@ public class HoursWorkedView extends VerticalLayout { add(fechaPicker, filtersLayout, actividadFormLayout, equipoLabel, grid, empresaLabel, tareasEspecificasLayout, gridActividadesEspecificas, buttonsLayout, totalesLayout); - } private void configurarGrid() { @@ -470,7 +471,8 @@ public class HoursWorkedView extends VerticalLayout { hoursWorked.setFecha(LocalDate.now()); // Establecer la fecha actual o la seleccionada si es otra // Mostrar información de la actividad para depuración - System.out.println("Guardando actividad: " + actividad.getNombre() + " con " + totalHorasSemana + " horas."); + System.out.println("Guardando actividad: " + actividad.getNombre() + + " con " + totalHorasSemana + " horas."); try { // Guardar en el servicio @@ -478,7 +480,8 @@ public class HoursWorkedView extends VerticalLayout { savedHoursWorked.add(hoursWorked); // Agregar a la lista de registros guardados Notification.show("Actividad guardada correctamente: " + actividad.getNombre()); } catch (Exception e) { - Notification.show("Error al guardar la actividad: " + actividad.getNombre() + " - " + e.getMessage()); + Notification.show("Error al guardar la actividad: " + actividad.getNombre() + + " - " + e.getMessage()); } }