#10-Registro-Informacion-Profesional #38
@ -0,0 +1,120 @@
|
||||
package com.primefactorsolutions.views;
|
||||
|
||||
import com.vaadin.flow.component.datepicker.DatePicker;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
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.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.html.H2;
|
||||
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.time.LocalDate;
|
||||
|
||||
@SpringComponent
|
||||
@PermitAll
|
||||
@Scope("prototype")
|
||||
@PageTitle("Hours Worked")
|
||||
@Route(value = "/hours-worked/me", layout = MainLayout.class)
|
||||
public class HoursWorkedView extends VerticalLayout {
|
||||
public HoursWorkedView() {
|
||||
H2 title = new H2("Registro de Horas Trabajadas");
|
||||
|
||||
DatePicker datePicker = new DatePicker("Selecciona una fecha");
|
||||
datePicker.setValue(LocalDate.now());
|
||||
|
||||
ComboBox<String> equipoDropdown = new ComboBox<>("Equipo");
|
||||
equipoDropdown.setItems("Equipo 1", "Equipo 2", "Equipo 3"); // Ejemplo de datos
|
||||
|
||||
TextField empleadoSearch = new TextField("Empleado (Search)");
|
||||
|
||||
HorizontalLayout filtersLayout = new HorizontalLayout(equipoDropdown, empleadoSearch);
|
||||
|
||||
Grid<Actividad> grid = new Grid<>(Actividad.class, false);
|
||||
grid.addColumn(Actividad::getNombre).setHeader("Actividad");
|
||||
grid.addColumn(Actividad::getLunes).setHeader("Lunes");
|
||||
grid.addColumn(Actividad::getMartes).setHeader("Martes");
|
||||
grid.addColumn(Actividad::getMiercoles).setHeader("Miércoles");
|
||||
grid.addColumn(Actividad::getJueves).setHeader("Jueves");
|
||||
grid.addColumn(Actividad::getViernes).setHeader("Viernes");
|
||||
grid.addColumn(Actividad::getSabado).setHeader("Sábado");
|
||||
grid.addColumn(Actividad::getDomingo).setHeader("Domingo");
|
||||
|
||||
grid.setItems(
|
||||
new Actividad("Actividad 1", 3, 3, 3, 3, 3, 1, 2),
|
||||
new Actividad("Actividad 2", 2, 2, 2, 2, 2, 0, 1),
|
||||
new Actividad("Meeting 1", 0, 0.5, 0.5, 0, 0, 0.5, 0)
|
||||
);
|
||||
|
||||
Button actualizarButton = new Button("Actualizar");
|
||||
Button guardarButton = new Button("Guardar");
|
||||
Button cerrarButton = new Button("Cerrar");
|
||||
|
||||
HorizontalLayout buttonsLayout = new HorizontalLayout(actualizarButton, guardarButton, cerrarButton);
|
||||
|
||||
add(title, datePicker, filtersLayout, grid, buttonsLayout);
|
||||
}
|
||||
|
||||
public static class Actividad {
|
||||
final private String nombre;
|
||||
final private double lunes;
|
||||
final private double martes;
|
||||
final private double miercoles;
|
||||
final private double jueves;
|
||||
final private double viernes;
|
||||
final private double sabado;
|
||||
final private double domingo;
|
||||
|
||||
public Actividad(
|
||||
final String nombre, final double lunes,
|
||||
final double martes, final double miercoles,
|
||||
final double jueves, final double viernes,
|
||||
final double sabado, final double domingo)
|
||||
{
|
||||
this.nombre = nombre;
|
||||
this.lunes = lunes;
|
||||
this.martes = martes;
|
||||
this.miercoles = miercoles;
|
||||
this.jueves = jueves;
|
||||
this.viernes = viernes;
|
||||
this.sabado = sabado;
|
||||
this.domingo = domingo;
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
|
||||
public double getLunes() {
|
||||
return lunes;
|
||||
}
|
||||
|
||||
public double getMartes() {
|
||||
return martes;
|
||||
}
|
||||
|
||||
public double getMiercoles() {
|
||||
return miercoles;
|
||||
}
|
||||
|
||||
public double getJueves() {
|
||||
return jueves;
|
||||
}
|
||||
|
||||
public double getViernes() {
|
||||
return viernes;
|
||||
}
|
||||
|
||||
public double getSabado() {
|
||||
return sabado;
|
||||
}
|
||||
|
||||
public double getDomingo() {
|
||||
return domingo;
|
||||
}
|
||||
}
|
||||
}
|
@ -109,6 +109,9 @@ public class MainLayout extends AppLayout {
|
||||
LineAwesomeIcon.PLANE_DEPARTURE_SOLID.create());
|
||||
SideNavItem timesheet = new SideNavItem("My Timesheet", TimesheetView.class,
|
||||
LineAwesomeIcon.HOURGLASS_START_SOLID.create());
|
||||
timesheet.addItem(new SideNavItem("Hours Worked", HoursWorkedView.class,
|
||||
LineAwesomeIcon.ID_CARD_SOLID.create()));
|
||||
|
||||
SideNavItem profile = new SideNavItem("My Profile", ProfileView.class,
|
||||
LineAwesomeIcon.USER_EDIT_SOLID.create());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user