#46 Perfil de Empleado - Registro Mensual

This commit is contained in:
Melina Gutierrez 2024-10-16 15:26:31 -04:00
parent b4826f1720
commit b19496ca15

View File

@ -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<HoursWorkedView.Actividad> grid;
private final ComboBox<String> 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<String> getEquipos() {
return List.of("Equipo A", "Equipo B", "Equipo C");
}
private List<HoursWorkedView.Actividad> 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() {
}
}