diff --git a/src/main/java/com/primefactorsolutions/views/HoursWorkedMonthView.java b/src/main/java/com/primefactorsolutions/views/HoursWorkedMonthView.java new file mode 100644 index 0000000..a4e575f --- /dev/null +++ b/src/main/java/com/primefactorsolutions/views/HoursWorkedMonthView.java @@ -0,0 +1,78 @@ +package com.primefactorsolutions.views; + + +import com.vaadin.flow.component.button.Button; +import com.vaadin.flow.component.combobox.ComboBox; +import com.vaadin.flow.component.grid.Grid; +import com.vaadin.flow.component.html.H2; +import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.component.textfield.TextField; +import com.vaadin.flow.router.PageTitle; +import com.vaadin.flow.router.Route; +import com.vaadin.flow.spring.annotation.SpringComponent; +import jakarta.annotation.security.PermitAll; +import org.springframework.context.annotation.Scope; + +import java.util.List; + +@SpringComponent +@PermitAll +@Scope("prototype") +@PageTitle("Hours Worked Month") +@Route(value = "/hours-worked-month/me", layout = MainLayout.class) +public class HoursWorkedMonthView extends VerticalLayout { + + private final Grid grid; + private final ComboBox equipoComboBox; + private final TextField empleadoSearch; + private final Button actualizarButton; + private final Button guardarButton; + private final Button cerrarButton; + + public HoursWorkedMonthView() { + add(new H2("Registro de Horas Trabajadas")); + + Label mesLabel = new Label("SEPTIEMBRE 2024, MES 9"); + add(mesLabel); + + equipoComboBox = new ComboBox<>("Equipo"); + equipoComboBox.setItems(getEquipos()); + add(equipoComboBox); + + empleadoSearch = new TextField("Empleado (Search):"); + add(empleadoSearch); + + grid = new Grid<>(HoursWorkedView.Actividad.class); + grid.setItems(getActividades()); + grid.setColumns("lunes", "martes", "miercoles", "jueves", "viernes", "sabado", "domingo", "totalSem"); + add(grid); + + actualizarButton = new Button("Actualizar", e -> actualizar()); + guardarButton = new Button("Guardar", e -> guardar()); + cerrarButton = new Button("Cerrar", e -> cerrar()); + + add(actualizarButton, guardarButton, cerrarButton); + } + + private List getEquipos() { + return List.of("Equipo A", "Equipo B", "Equipo C"); + } + + private List getActividades() { + return List.of( + new HoursWorkedView.Actividad(1, 7, 8, 8, 8, 8, 1, 40), + new HoursWorkedView.Actividad(2, 1, 7, 8, 8, 8, 1, 40) + ); + } + + private void actualizar() { + grid.setItems(getActividades()); + } + + private void guardar() { + } + + private void cerrar() { + } +} \ No newline at end of file