Listado-General-Vacaciones #52

Merged
jesus.pelaez merged 23 commits from Listado-General-Vacaciones into En-desarrollo 2024-10-11 19:30:22 +00:00
13 changed files with 887 additions and 186 deletions

Binary file not shown.

View File

@ -22,17 +22,62 @@
private String lastName;
private LocalDate birthday;
private String birthCity;
@Enumerated(EnumType.STRING)
private MaritalStatus maritalStatus;
private String age;
private String residenceAddress;
private String localAddress;
private String phoneNumber;
private String personalEmail;
private String position;
private String team;
@ManyToOne
@JoinColumn(name = "team_id", nullable = false)
private Team team;
private String emergencyCName;
private String emergencyCAddress;
private String emergencyCPhone;
private String emergencyCEmail;
private String numberOfChildren;
private String ci;
private String issuedIn;
private String pTitle1;
private String pTitle2;
private String pTitle3;
private String pStudy1;
private String pStudy2;
private String pStudy3;
private String certification1;
private String certification2;
private String certification3;
private String certification4;
private String recognition;
private String achievements;
private String language;
private String languageLevel;
private String cod;
private String leadManager;
private String project;
private LocalDate dateOfEntry;
private LocalDate dateOfExit;
private String contractType;
private String seniority;
private String salary;
private String bankName;
private String accountNumber;
private String gpss;
private String sss;
private String beneficiaries;
@Column(columnDefinition = "TEXT")
private String profileImage;
@Enumerated(EnumType.STRING)
@ -77,13 +122,23 @@
ACTIVE,
INACTIVE
}
@Enumerated(EnumType.STRING)
private MaritalStatus maritalStatus;
public enum MaritalStatus {
SINGLE,
MARRIED,
WIDOWED,
DIVORCED
}
@Enumerated(EnumType.STRING)
private Gender gender;
public enum Gender {
MALE,
FEMALE
}
public Status getStatus() {
return status;
}
public void setStatus(final Status status) {

View File

@ -7,7 +7,6 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
@Data
@Entity
@ -18,9 +17,6 @@ public class TimeOffRequest extends BaseEntity {
@ManyToOne
@JoinColumn(name = "employee_id", nullable = false)
private Employee employee;
@ManyToOne
@JoinColumn(name = "team_id", nullable = false)
private Team team;
@Enumerated(EnumType.STRING)
private TimeOffRequestType category;
@Enumerated(EnumType.STRING)
@ -31,8 +27,6 @@ public class TimeOffRequest extends BaseEntity {
private Date endDate;
private Double daysToBeTake;
private Double daysBalance;
// @OneToMany(fetch = FetchType.EAGER, mappedBy = "request", cascade = {CascadeType.ALL})
// private List<TimeOffRequestEntry> entries;
public enum Status {
ALL,
TAKEN,

View File

@ -3,7 +3,9 @@ package com.primefactorsolutions.repositories;
import com.primefactorsolutions.model.TimeOffRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.UUID;
public interface TimeOffRequestRepository extends JpaRepository<TimeOffRequest, UUID> {
List<TimeOffRequest> findByEmployeeId(UUID idEmployee);
}

View File

@ -1,20 +1,12 @@
package com.primefactorsolutions.service;
import com.primefactorsolutions.model.Document;
import com.primefactorsolutions.model.DocumentType;
import com.primefactorsolutions.model.Employee;
import com.primefactorsolutions.model.Team;
import com.primefactorsolutions.repositories.DocumentRepository;
import com.primefactorsolutions.repositories.TeamRepository;
import lombok.AllArgsConstructor;
import org.apache.commons.beanutils.BeanComparator;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
@AllArgsConstructor

View File

@ -3,15 +3,11 @@ package com.primefactorsolutions.service;
import com.primefactorsolutions.model.*;
import com.primefactorsolutions.repositories.TimeOffRequestRepository;
import lombok.AllArgsConstructor;
import org.apache.commons.beanutils.BeanComparator;
import org.springframework.stereotype.Service;
import java.sql.Time;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
@AllArgsConstructor
@ -26,63 +22,16 @@ public class TimeOffRequestService {
timeOffRequestRepository.deleteById(id);
}
public List<TimeOffRequest> getAllTimeOffRequests() {
public List<TimeOffRequest> findAllTimeOffRequests() {
return timeOffRequestRepository.findAll();
}
public TimeOffRequest getTimeOffRequest(final UUID id) {
public TimeOffRequest findTimeOffRequest(final UUID id) {
Optional<TimeOffRequest> timeOffRequest = timeOffRequestRepository.findById(id);
return timeOffRequest.orElse(null);
}
public List<TimeOffRequest> findTimeOffRequests(
final int start, final int pageSize, final String sortProperty, final boolean asc) {
List<TimeOffRequest> timeOffRequests = timeOffRequestRepository.findAll();
int end = Math.min(start + pageSize, timeOffRequests.size());
timeOffRequests.sort(new BeanComparator<>(sortProperty));
if (!asc) {
Collections.reverse(timeOffRequests);
}
return timeOffRequests.subList(start, end);
}
public List<TimeOffRequest> findTimeOffRequests(final int start, final int pageSize) {
List<TimeOffRequest> timeOffRequests = timeOffRequestRepository.findAll();
int end = Math.min(start + pageSize, timeOffRequests.size());
return timeOffRequests.subList(start, end);
}
public List<TimeOffRequest> findTimeOffRequestBy(Employee employee,
Team team,
TimeOffRequestType category,
TimeOffRequest.Status state,
int start, int pageSize) {
List<TimeOffRequest> timeOffRequests = timeOffRequestRepository.findAll();
if (employee != null && !"ALL".equals(employee.getFirstName())) {
timeOffRequests = timeOffRequests.stream()
.filter(req -> req.getEmployee().equals(employee))
.collect(Collectors.toList());
}
if (team != null && !"ALL".equals(team.getName())) {
timeOffRequests = timeOffRequests.stream()
.filter(req -> req.getTeam().equals(team))
.collect(Collectors.toList());
}
if (category != null && !"ALL".equals(category.name())) {
timeOffRequests = timeOffRequests.stream()
.filter(req -> req.getCategory().equals(category))
.collect(Collectors.toList());
}
if (state != null && !"ALL".equals(state.name())) {
timeOffRequests = timeOffRequests.stream()
.filter(req -> req.getState().equals(state))
.collect(Collectors.toList());
}
int end = Math.min(start + pageSize, timeOffRequests.size());
return timeOffRequests.subList(start, end);
public List<TimeOffRequest> findRequestsByEmployeeId(final UUID idEmployee) {
return timeOffRequestRepository.findByEmployeeId(idEmployee);
}
}

View File

@ -45,12 +45,6 @@ import java.util.UUID;
@Route(value = "/employees/:employeeId?/:action?", layout = MainLayout.class)
public class EmployeeView extends BeanValidationForm<Employee> implements HasUrlParameter<String> {
private static final String SAVE_BUTTON_TEXT = "Save";
private static final String EDIT_BUTTON_TEXT = "Edit";
private static final String NOTIFICATION_SAVE_SUCCESS = "Employee saved successfully.";
private static final String NOTIFICATION_VALIDATE_ERROR = "Please complete the required fields correctly.";
private static final String PHONE_NUMBER_ERROR_MESSAGE = "El teléfono debe contener solo números.";
private final EmployeeService employeeService;
private final ReportService reportService;
@ -59,14 +53,23 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
private final TextField firstName = createTextField("Nombres: ", 30, true);
private final TextField lastName = createTextField("Apellidos", 30, true);
private final ComboBox<Employee.Status> status = createStatusComboBox();
private final ComboBox<Employee.Gender> gender = createGenderComboBox();
private final VDatePicker birthday = new VDatePicker("Fecha de Nacimiento");
private final TextField age = createTextField("Edad", 3, false);
private final TextField birthCity = createTextField("Ciudad y País de Nacimiento", 20, false);
private final ComboBox<Employee.MaritalStatus> maritalStatus = createMaritalStatusComboBox();
private final TextField residenceAddress = createTextField("Dirección de Residencia", 50, false);
private final TextField localAddress = createTextField("Dep/Provincia de Residencia", 10, false);
private final ComboBox<Employee.MaritalStatus> maritalStatus = createMaritalStatusComboBox();
private final TextField numberOfChildren = createTextField("Numero de Hijos", 3, false);
private final TextField ci = createTextField("CI", 30, false);
private final TextField issuedIn = createTextField("Expedido en ", 30, false);
private final TextField phoneNumber = createTextField("Teléfono", 8, false);
private final EmailField personalEmail = createEmailField("E-mail");
private final TextField cod = createTextField("Codigo de Empleado", 30, false);
private final TextField position = createTextField("Cargo", 30, false);
private final TextField team = createTextField("Equipo", 30, false);
private final TextField leadManager = createTextField("Lead/Manager", 30, false);
private final TextField project = createTextField("Proyecto", 30, false);
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);
@ -76,15 +79,61 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
private final Upload upload = new Upload(buffer);
private final Image profileImagePreview = new Image();
//INFORMACION PROFESIONAL
private final TextField pTitle1 = createTextField("Título 1", 30, false);
private final TextField pTitle2 = createTextField("Título 2", 30, false);
private final TextField pTitle3 = createTextField("Título 3", 30, false);
private final TextField pStudy1 = createTextField("Estudio 1", 30, false);
private final TextField pStudy2 = createTextField("Estudio 2", 30, false);
private final TextField pStudy3 = createTextField("Estudio 3", 30, false);
private final TextField certification1 = createTextField("Certificación 1", 30, false);
private final TextField certification2 = createTextField("Certificación 2", 30, false);
private final TextField certification3 = createTextField("Certificación 3", 30, false);
private final TextField certification4 = createTextField("Certificación 4", 30, false);
private final TextField recognition = createTextField("Reconocimientos", 30, false);
private final TextField achievements = createTextField("Logros Profesionales", 30, false);
private final TextField language = createTextField("Idioma", 30, false);
private final TextField languageLevel = createTextField("Nivel de Idioma", 30, false);
//INFORMACION DE CONTRATACION
private final VDatePicker dateOfEntry = new VDatePicker("Fecha de Ingreso");
private final VDatePicker dateOfExit = new VDatePicker("Fecha de Retiro");
private final TextField contractType = createTextField("Tipo de Contratación", 30, false);
private final TextField seniority = createTextField("Antiguedad", 30, false);
private final TextField salary = createTextField("Salario", 30, false);
private final TextField bankName = createTextField("Banco", 30, false);
private final TextField accountNumber = createTextField("Nro. de Cuenta", 30, false);
private final TextField gpss = createTextField("Código Único de Asegurado (GPSS)", 30, false);
private final TextField sss = createTextField("Matricula de Asegurado (SSS)", 30, false);
private final TextField beneficiaries = createTextField("Derechohabientes", 30, false);
private static final String SAVE_BUTTON_TEXT = "Save";
private static final String EDIT_BUTTON_TEXT = "Edit";
private static final String NOTIFICATION_SAVE_SUCCESS = "Employee saved successfully.";
private static final String NOTIFICATION_VALIDATE_ERROR = "Please complete the required fields correctly.";
private static final String PHONE_NUMBER_ERROR_MESSAGE = "El teléfono debe contener solo números.";
private final Button saveButton = new Button(SAVE_BUTTON_TEXT, e -> saveEmployee());
private final Button editButton = new Button(EDIT_BUTTON_TEXT, e -> enableEditMode());
private final Button reportButton = new Button("Ficha");
private final Button reportButton = new Button("Generar Ficha");
private final Dialog dialog = new Dialog();
private final PdfViewer pdfViewer = new PdfViewer();
private final H2 mt = new H2("Información General del Empleado");
private final H3 fs = new H3("Información Personal");
private final H3 ss = new H3("Datos de Contacto de Emergencia");
private final H3 si = new H3("Foto del Empleado");
//TITULOS PARA INFORMACION PERSONAL
private final H2 infoPer = new H2("Información Personal");
private final H3 infoGenr = new H3("Información General");
private final H3 contEmerg = new H3("Contacto de Emergencia");
//TITULOS PARA INFORMACIÓN PROFESIONAL
private final H2 infProf = new H2("Información Profesional");
private final H3 titulos = new H3("Titulos Profesionales y Estudios Realizados");
private final H3 certif = new H3("Certificaciones Profesionales");
private final H3 logros = new H3("Otros Logros y Reconocimientos");
private final H3 idioma = new H3("Dominio de Idiomas");
//TITULOS PARA INFORMACIÓN ADMINISTRATIVA
private final H2 infoAdm = new H2("Información Administrativa");
private final H3 infoCont = new H3("Información de Contratación");
private final H3 datBanc = new H3("Datos Bancados");
private final H3 datGest = new H3("Datos Gestora Pública y Seguro Social");
public EmployeeView(final EmployeeService employeeService, final ReportService reportService) {
super(Employee.class);
@ -105,6 +154,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
saveButton.setVisible(true);
editButton.setVisible(true);
reportButton.setVisible(true);
birthday.addValueChangeListener(event -> calculateAge());
reportButton.addClickListener((ComponentEventListener<ClickEvent<Button>>) buttonClickEvent -> {
var employee = getEntity();
@ -117,6 +167,16 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
initDialog();
}
private void calculateAge() {
if (birthday.getValue() != null) {
int currentYear = java.time.LocalDate.now().getYear();
int birthYear = birthday.getValue().getYear();
int ages = currentYear - birthYear;
age.setValue(String.valueOf(ages));
System.out.println(age);
}
}
private void configureUpload() {
upload.setAcceptedFileTypes("image/jpeg", "image/png");
upload.setMaxFileSize(1024 * 1024);
@ -210,6 +270,14 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
return comboBox;
}
private ComboBox<Employee.Gender> createGenderComboBox() {
ComboBox<Employee.Gender> comboBox = new ComboBox<>("Genero");
comboBox.setItems(Employee.Gender.values());
comboBox.setItemLabelGenerator(Employee.Gender::name);
comboBox.setRequiredIndicatorVisible(true);
return comboBox;
}
private boolean validateForm() {
return !firstName.isEmpty() && !lastName.isEmpty() && status.getValue() != null;
}
@ -218,6 +286,8 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
if (validateForm()) {
Employee employee = getEntity();
employee.setStatus(status.getValue());
employee.setAge(age.getValue());
employeeService.createOrUpdate(employee);
Notification.show(NOTIFICATION_SAVE_SUCCESS);
getUI().ifPresent(ui -> ui.navigate(EmployeesListView.class));
@ -278,13 +348,16 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
}
private void setFieldsReadOnly() {
username.setReadOnly(false);
firstName.setReadOnly(true);
lastName.setReadOnly(true);
status.setReadOnly(true);
birthday.setReadOnly(true);
birthCity.setReadOnly(true);
maritalStatus.setReadOnly(true);
residenceAddress.setReadOnly(true);
localAddress.setReadOnly(true);
maritalStatus.setReadOnly(true);
numberOfChildren.setReadOnly(true);
phoneNumber.setReadOnly(true);
personalEmail.setReadOnly(true);
position.setReadOnly(true);
@ -295,16 +368,51 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
emergencyCEmail.setReadOnly(true);
upload.setVisible(true);
profileImagePreview.setVisible(true);
age.setReadOnly(true);
gender.setReadOnly(true);
status.setReadOnly(true);
ci.setReadOnly(true);
issuedIn.setReadOnly(true);
pTitle1.setReadOnly(true);
pTitle2.setReadOnly(true);
pTitle3.setReadOnly(true);
pStudy1.setReadOnly(true);
pStudy2.setReadOnly(true);
pStudy3.setReadOnly(true);
certification1.setReadOnly(true);
certification2.setReadOnly(true);
certification3.setReadOnly(true);
certification4.setReadOnly(true);
recognition.setReadOnly(true);
achievements.setReadOnly(true);
language.setReadOnly(true);
languageLevel.setReadOnly(true);
cod.setReadOnly(true);
leadManager.setReadOnly(true);
project.setReadOnly(true);
dateOfEntry.setReadOnly(true);
dateOfExit.setReadOnly(true);
contractType.setReadOnly(true);
seniority.setReadOnly(true);
salary.setReadOnly(true);
bankName.setReadOnly(true);
accountNumber.setReadOnly(true);
gpss.setReadOnly(true);
sss.setReadOnly(true);
beneficiaries.setReadOnly(true);
}
private void setFieldsEditable() {
username.setReadOnly(false);
firstName.setReadOnly(false);
lastName.setReadOnly(false);
status.setReadOnly(false);
birthday.setReadOnly(false);
birthCity.setReadOnly(false);
maritalStatus.setReadOnly(false);
residenceAddress.setReadOnly(false);
localAddress.setReadOnly(false);
maritalStatus.setReadOnly(false);
numberOfChildren.setReadOnly(false);
phoneNumber.setReadOnly(false);
personalEmail.setReadOnly(false);
position.setReadOnly(false);
@ -313,15 +421,65 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
emergencyCAddress.setReadOnly(false);
emergencyCPhone.setReadOnly(false);
emergencyCEmail.setReadOnly(false);
upload.setVisible(true);
upload.setVisible(false);
age.setReadOnly(false);
gender.setReadOnly(false);
status.setReadOnly(false);
ci.setReadOnly(false);
issuedIn.setReadOnly(false);
pTitle1.setReadOnly(false);
pTitle2.setReadOnly(false);
pTitle3.setReadOnly(false);
pStudy1.setReadOnly(false);
pStudy2.setReadOnly(false);
pStudy3.setReadOnly(false);
certification1.setReadOnly(false);
certification2.setReadOnly(false);
certification3.setReadOnly(false);
certification4.setReadOnly(false);
recognition.setReadOnly(false);
achievements.setReadOnly(false);
language.setReadOnly(false);
languageLevel.setReadOnly(false);
cod.setReadOnly(false);
leadManager.setReadOnly(false);
project.setReadOnly(false);
dateOfEntry.setReadOnly(false);
dateOfExit.setReadOnly(false);
contractType.setReadOnly(false);
seniority.setReadOnly(false);
salary.setReadOnly(false);
bankName.setReadOnly(false);
accountNumber.setReadOnly(false);
gpss.setReadOnly(false);
sss.setReadOnly(false);
beneficiaries.setReadOnly(false);
}
@Override
protected List<Component> getFormComponents() {
return List.of(
mt, fs, username, firstName, lastName, status, birthday, birthCity, maritalStatus,
residenceAddress, phoneNumber, personalEmail, position, team, ss, emergencyCName,
emergencyCAddress, emergencyCPhone, emergencyCEmail, si, upload, profileImagePreview,
username,
infoPer,
infoGenr,
upload, profileImagePreview,
firstName, lastName,
gender, status,
birthday, age,
birthCity, residenceAddress, localAddress,
maritalStatus, ci, issuedIn, numberOfChildren,
phoneNumber, personalEmail,
cod, position, team, leadManager, project,
contEmerg, emergencyCName, emergencyCAddress, emergencyCPhone, emergencyCEmail,
infProf,
titulos, pTitle1, pTitle2, pTitle3, pStudy1, pStudy2, pStudy3,
certif, certification1, certification2, certification3, certification4,
logros, recognition, achievements,
idioma, language, languageLevel,
infoAdm,
infoCont, dateOfEntry, dateOfExit, contractType, seniority, salary,
datBanc, bankName, accountNumber,
datGest, gpss, sss, beneficiaries,
saveButton, editButton, reportButton, dialog
);
}

View File

@ -0,0 +1,197 @@
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.Builder()
.nombre("Actividad 1")
.lunes(3)
.martes(3)
.miercoles(3)
.jueves(3)
.viernes(3)
.sabado(1)
.domingo(2)
.build(),
new Actividad.Builder()
.nombre("Actividad 2")
.lunes(2)
.martes(2)
.miercoles(2)
.jueves(2)
.viernes(2)
.sabado(0)
.domingo(1)
.build(),
new Actividad.Builder()
.nombre("Meeting 1")
.lunes(0)
.martes(0.5)
.miercoles(0.5)
.jueves(0)
.viernes(0)
.sabado(0.5)
.domingo(0)
.build()
);
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 final class Actividad {
private final String nombre;
private final double lunes;
private final double martes;
private final double miercoles;
private final double jueves;
private final double viernes;
private final double sabado;
private final double domingo;
private Actividad(final Builder builder) {
this.nombre = builder.nombre;
this.lunes = builder.lunes;
this.martes = builder.martes;
this.miercoles = builder.miercoles;
this.jueves = builder.jueves;
this.viernes = builder.viernes;
this.sabado = builder.sabado;
this.domingo = builder.domingo;
}
public static class Builder {
private String nombre;
private double lunes;
private double martes;
private double miercoles;
private double jueves;
private double viernes;
private double sabado;
private double domingo;
public Builder nombre(final String nombre) {
this.nombre = nombre;
return this;
}
public Builder lunes(final double lunes) {
this.lunes = lunes;
return this;
}
public Builder martes(final double martes) {
this.martes = martes;
return this;
}
public Builder miercoles(final double miercoles) {
this.miercoles = miercoles;
return this;
}
public Builder jueves(final double jueves) {
this.jueves = jueves;
return this;
}
public Builder viernes(final double viernes) {
this.viernes = viernes;
return this;
}
public Builder sabado(final double sabado) {
this.sabado = sabado;
return this;
}
public Builder domingo(final double domingo) {
this.domingo = domingo;
return this;
}
public Actividad build() {
return new Actividad(this);
}
}
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;
}
}
}

View File

@ -111,6 +111,9 @@ public class MainLayout extends AppLayout {
LineAwesomeIcon.SUN.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());

View File

@ -0,0 +1,156 @@
package com.primefactorsolutions.views;
import com.primefactorsolutions.model.Employee;
import com.primefactorsolutions.model.TimeOffRequest;
import com.primefactorsolutions.model.TimeOffRequestType;
import com.primefactorsolutions.service.EmployeeService;
import com.primefactorsolutions.service.TimeOffRequestService;
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.Div;
import com.vaadin.flow.component.html.H3;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.BeforeEvent;
import com.vaadin.flow.router.HasUrlParameter;
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.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@SpringComponent
@PermitAll
@Scope("prototype")
@PageTitle("Request")
@Route(value = "/requests", layout = MainLayout.class)
public class RequestView extends Div implements HasUrlParameter<String> {
private final TimeOffRequestService requestService;
private final EmployeeService employeeService;
private final Grid<TimeOffRequest> requestGrid = new Grid<>(TimeOffRequest.class);
private List<TimeOffRequest> requests = Collections.emptyList();
private ComboBox<TimeOffRequestType> categoryFilter;
private ComboBox<TimeOffRequest.Status> stateFilter;
private UUID employeeId;
public RequestView(final TimeOffRequestService requestService, final EmployeeService employeeService) {
this.requestService = requestService;
this.employeeService = employeeService;
initializeView();
}
private void initializeView() {
setupFilters();
setupGrid();
add(requestGrid, createSummaryLayout(), createActionButtons());
refreshRequestGrid(null, null);
}
private void setupFilters() {
categoryFilter = createCategoryFilter();
stateFilter = createStateFilter();
add(categoryFilter, stateFilter);
}
private ComboBox<TimeOffRequestType> createCategoryFilter() {
categoryFilter = new ComboBox<>("Category");
categoryFilter.setItems(TimeOffRequestType.values());
categoryFilter.setValue(TimeOffRequestType.values()[0]);
categoryFilter.addValueChangeListener(event -> refreshRequestGrid(event.getValue(), stateFilter.getValue()));
return categoryFilter;
}
private ComboBox<TimeOffRequest.Status> createStateFilter() {
stateFilter = new ComboBox<>("State");
stateFilter.setItems(TimeOffRequest.Status.values());
stateFilter.setValue(TimeOffRequest.Status.values()[0]);
stateFilter.addValueChangeListener(event -> refreshRequestGrid(categoryFilter.getValue(), event.getValue()));
return stateFilter;
}
private void setupGrid() {
requestGrid.setColumns(
"category",
"state",
"availableDays",
"expiration",
"startDate",
"endDate",
"daysToBeTake",
"daysBalance"
);
requestGrid.setAllRowsVisible(true);
}
private VerticalLayout createSummaryLayout() {
int totalVacations = 15;
int totalTimeOff = 2;
int totalAvailableDays = totalVacations + totalTimeOff;
return new VerticalLayout(
new Span("TOTAL HOLIDAYS: " + totalVacations),
new Span("TOTAL TIME OFF: " + totalTimeOff),
new Span("TOTAL AVAILABLE DAYS: " + totalAvailableDays)
);
}
private HorizontalLayout createActionButtons() {
Button viewButton = new Button("View");
Button editButton = new Button("Edit");
Button saveButton = new Button("Save");
Button closeButton = new Button("Close", event -> navigateToRequestsListView());
return new HorizontalLayout(viewButton, editButton, saveButton, closeButton);
}
private void navigateToRequestsListView() {
getUI().ifPresent(ui -> ui.navigate(RequestsListView.class));
}
private void refreshRequestGrid(final TimeOffRequestType category, final TimeOffRequest.Status state) {
List<TimeOffRequest> filteredRequests = allFiltersAreNull(category, state)
? requestService.findRequestsByEmployeeId(employeeId)
: fetchFilteredTimeOffRequests(category, state);
requestGrid.setItems(filteredRequests);
}
private boolean allFiltersAreNull(final TimeOffRequestType category, final TimeOffRequest.Status state) {
return category == null && state == null;
}
private List<TimeOffRequest> fetchFilteredTimeOffRequests(final TimeOffRequestType category,
final TimeOffRequest.Status state) {
requests = requestService.findRequestsByEmployeeId(employeeId);
if (category != null && !"ALL".equals(category.name())) {
requests = requests.stream()
.filter(req -> req.getCategory().equals(category))
.collect(Collectors.toList());
}
if (state != null && !"ALL".equals(state.name())) {
requests = requests.stream()
.filter(req -> req.getState().equals(state))
.collect(Collectors.toList());
}
return requests;
}
@Override
public void setParameter(final BeforeEvent event, final String parameter) {
employeeId = UUID.fromString(parameter);
Employee employee = employeeService.getEmployee(employeeId);
requests = requestService.findRequestsByEmployeeId(employeeId);
setViewTitle(employee.getFirstName() + " " + employee.getLastName(), employee.getTeam().getName());
requestGrid.setItems(requests);
}
private void setViewTitle(final String employeeName, final String employeeTeam) {
addComponentAsFirst(new H3("Name: " + employeeName));
addComponentAtIndex(1, new H3("Team: " + employeeTeam));
}
}

View File

@ -6,11 +6,10 @@ import com.primefactorsolutions.service.TeamService;
import com.primefactorsolutions.service.TimeOffRequestService;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.grid.GridSortOrder;
import com.vaadin.flow.component.html.Main;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.data.provider.SortDirection;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.spring.annotation.SpringComponent;
@ -18,7 +17,10 @@ import jakarta.annotation.security.PermitAll;
import org.springframework.context.annotation.Scope;
import org.vaadin.firitin.components.grid.PagingGrid;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@SpringComponent
@Scope("prototype")
@ -30,17 +32,21 @@ public class RequestsListView extends Main {
private final TimeOffRequestService requestService;
private final EmployeeService employeeService;
private final TeamService teamService;
private final PagingGrid<TimeOffRequest> requestGrid;
private final PagingGrid<TimeOffRequest> requestGrid = new PagingGrid<>(TimeOffRequest.class);
private List<TimeOffRequest> requests = Collections.emptyList();
private ComboBox<Employee> employeeFilter;
private ComboBox<Team> teamFilter;
private ComboBox<TimeOffRequestType> categoryFilter;
private ComboBox<TimeOffRequest.Status> stateFilter;
private UUID selectedEmployeeId;
public RequestsListView(TimeOffRequestService requestService, EmployeeService employeeService, TeamService teamService) {
public RequestsListView(final TimeOffRequestService requestService,
final EmployeeService employeeService,
final TeamService teamService) {
this.requestService = requestService;
this.employeeService = employeeService;
this.teamService = teamService;
this.requestGrid = new PagingGrid<>(TimeOffRequest.class);
this.requests = requestService.findAllTimeOffRequests();
initializeView();
refreshRequestGrid(null, null, null, null);
}
@ -60,61 +66,115 @@ public class RequestsListView extends Main {
}
private void setupRequestGrid() {
requestGrid.setColumns("category", "state", "availableDays", "expiration", "startDate", "endDate", "daysToBeTake", "daysBalance");
requestGrid.setColumns(
"category",
"state",
"availableDays",
"expiration",
"startDate",
"endDate",
"daysToBeTake",
"daysBalance"
);
requestGrid.addComponentColumn(this::createEmployeeSpan).setHeader("Employee");
requestGrid.addComponentColumn(this::createTeamSpan).setHeader("Team");
requestGrid.setPaginationBarMode(PagingGrid.PaginationBarMode.BOTTOM);
requestGrid.setPageSize(5);
requestGrid.asSingleSelect().addValueChangeListener(event -> {
TimeOffRequest selectedRequest = event.getValue();
if (selectedRequest != null) {
selectedEmployeeId = selectedRequest.getEmployee().getId();
}
});
}
private HorizontalLayout createActionButtons() {
Button viewButton = new Button("View");
Button viewButton = new Button("View", event -> {
if (selectedEmployeeId != null) {
navigateToTimeOffRequestView(selectedEmployeeId);
} else {
Notification.show("Please select a request to view.", 3000, Notification.Position.MIDDLE);
}
});
Button editButton = new Button("Edit");
Button saveButton = new Button("Save");
Button closeButton = new Button("Close", event -> closeView());
Button closeButton = new Button("Close", event -> navigateToMainView());
return new HorizontalLayout(viewButton, editButton, saveButton, closeButton);
}
private void refreshRequestGrid(Employee employee, Team team, TimeOffRequestType category, TimeOffRequest.Status state) {
private void refreshRequestGrid(final Employee employee,
final Team team,
final TimeOffRequestType category,
final TimeOffRequest.Status state) {
requestGrid.setPagingDataProvider((page, pageSize) -> {
requests = requestService.findAllTimeOffRequests();
int start = (int) (page * requestGrid.getPageSize());
if (allFiltersAreNull(employee, team, category, state)) {
return fetchTimeOffRequests((int)page, pageSize);
return fetchTimeOffRequests(start, pageSize);
} else {
return fetchFilteredTimeOffRequests((int)page, pageSize, employee, team, category, state);
return fetchFilteredTimeOffRequests(start, pageSize, employee, team, category, state);
}
});
requestGrid.getDataProvider().refreshAll();
}
private boolean allFiltersAreNull(Employee employee, Team team, TimeOffRequestType category, TimeOffRequest.Status state) {
private boolean allFiltersAreNull(final Employee employee,
final Team team,
final TimeOffRequestType category,
final TimeOffRequest.Status state) {
return employee == null && team == null && category == null && state == null;
}
private List<TimeOffRequest> fetchTimeOffRequests(int page, int pageSize) {
int start = page * pageSize;
if (requestGrid.getSortOrder().isEmpty()) {
return requestService.findTimeOffRequests(start, pageSize);
} else {
return fetchSortedTimeOffRequests(start, pageSize);
private List<TimeOffRequest> fetchTimeOffRequests(final int start, final int pageSize) {
int end = start + pageSize;
if (end > requests.size()) {
end = requests.size();
}
return requests.subList(start, end);
}
private List<TimeOffRequest> fetchSortedTimeOffRequests(int start, int pageSize) {
GridSortOrder<TimeOffRequest> sortOrder = requestGrid.getSortOrder().getFirst();
return requestService.findTimeOffRequests(start, pageSize, sortOrder.getSorted().getKey(), sortOrder.getDirection() == SortDirection.ASCENDING);
private List<TimeOffRequest> fetchFilteredTimeOffRequests(final int start,
final int pageSize,
final Employee employee,
final Team team,
final TimeOffRequestType category,
final TimeOffRequest.Status state) {
if (employee != null && !"ALL".equals(employee.getFirstName())) {
requests = requests.stream()
.filter(request -> request.getEmployee().getId().equals(employee.getId()))
.collect(Collectors.toList());
}
if (team != null && !"ALL".equals(team.getName())) {
requests = requests.stream()
.filter(request -> request.getEmployee().getTeam().getId().equals(team.getId()))
.collect(Collectors.toList());
}
if (category != null && !"ALL".equals(category.name())) {
requests = requests.stream()
.filter(request -> request.getCategory().equals(category))
.collect(Collectors.toList());
}
if (state != null && !"ALL".equals(state.name())) {
requests = requests.stream()
.filter(request -> request.getState().equals(state))
.collect(Collectors.toList());
}
int end = start + pageSize;
if (end > requests.size()) {
end = requests.size();
}
return requests.subList(start, end);
}
private List<TimeOffRequest> fetchFilteredTimeOffRequests(int page, int pageSize, Employee employee, Team team, TimeOffRequestType category, TimeOffRequest.Status state) {
return requestService.findTimeOffRequestBy(employee, team, category, state, page, pageSize);
}
private Span createEmployeeSpan(TimeOffRequest timeOffRequest) {
private Span createEmployeeSpan(final TimeOffRequest timeOffRequest) {
Employee employee = timeOffRequest.getEmployee();
return new Span(employee.getFirstName() + " " + employee.getLastName());
}
private Span createTeamSpan(TimeOffRequest timeOffRequest) {
return new Span(timeOffRequest.getTeam().getName());
private Span createTeamSpan(final TimeOffRequest timeOffRequest) {
return new Span(timeOffRequest.getEmployee().getTeam().getName());
}
private ComboBox<Employee> createEmployeeFilter() {
@ -124,7 +184,14 @@ public class RequestsListView extends Main {
employeeFilter.setItems(employees);
employeeFilter.setItemLabelGenerator(this::getEmployeeLabel);
employeeFilter.setValue(employees.getFirst());
employeeFilter.addValueChangeListener(event -> refreshRequestGrid(event.getValue(), teamFilter.getValue(), categoryFilter.getValue(), stateFilter.getValue()));
employeeFilter.addValueChangeListener(event ->
refreshRequestGrid(
event.getValue(),
teamFilter.getValue(),
categoryFilter.getValue(),
stateFilter.getValue()
)
);
return employeeFilter;
}
@ -135,7 +202,14 @@ public class RequestsListView extends Main {
teamFilter.setItems(teams);
teamFilter.setItemLabelGenerator(this::getTeamLabel);
teamFilter.setValue(teams.getFirst());
teamFilter.addValueChangeListener(event -> refreshRequestGrid(employeeFilter.getValue(), event.getValue(), categoryFilter.getValue(), stateFilter.getValue()));
teamFilter.addValueChangeListener(event ->
refreshRequestGrid(
employeeFilter.getValue(),
event.getValue(),
categoryFilter.getValue(),
stateFilter.getValue()
)
);
return teamFilter;
}
@ -143,7 +217,14 @@ public class RequestsListView extends Main {
categoryFilter = new ComboBox<>("Category");
categoryFilter.setItems(TimeOffRequestType.values());
categoryFilter.setValue(TimeOffRequestType.values()[0]);
categoryFilter.addValueChangeListener(event -> refreshRequestGrid(employeeFilter.getValue(), teamFilter.getValue(), event.getValue(), stateFilter.getValue()));
categoryFilter.addValueChangeListener(event ->
refreshRequestGrid(
employeeFilter.getValue(),
teamFilter.getValue(),
event.getValue(),
stateFilter.getValue()
)
);
return categoryFilter;
}
@ -151,7 +232,14 @@ public class RequestsListView extends Main {
stateFilter = new ComboBox<>("State");
stateFilter.setItems(TimeOffRequest.Status.values());
stateFilter.setValue(TimeOffRequest.Status.values()[0]);
stateFilter.addValueChangeListener(event -> refreshRequestGrid(employeeFilter.getValue(), teamFilter.getValue(), categoryFilter.getValue(), event.getValue()));
stateFilter.addValueChangeListener(event ->
refreshRequestGrid(
employeeFilter.getValue(),
teamFilter.getValue(),
categoryFilter.getValue(),
event.getValue()
)
);
return stateFilter;
}
@ -167,15 +255,19 @@ public class RequestsListView extends Main {
return allTeamsOption;
}
private String getEmployeeLabel(Employee employee) {
private String getEmployeeLabel(final Employee employee) {
return "ALL".equals(employee.getFirstName()) ? "ALL" : employee.getFirstName() + " " + employee.getLastName();
}
private String getTeamLabel(Team team) {
private String getTeamLabel(final Team team) {
return "ALL".equals(team.getName()) ? "ALL" : team.getName();
}
private void closeView() {
private void navigateToMainView() {
getUI().ifPresent(ui -> ui.navigate(MainView.class));
}
private void navigateToTimeOffRequestView(final UUID idEmployee) {
getUI().ifPresent(ui -> ui.navigate("requests/" + idEmployee.toString()));
}
}

View File

@ -9,25 +9,6 @@ insert into ASSESSMENT_QUESTIONS (assessment_id, question_id) values ('46b153f4-
insert into ASSESSMENT_QUESTIONS (assessment_id, question_id) values ('46b153f4-23fd-462f-8430-fbe67b83caab', '8a4b213c-ca81-4c38-b56d-d7028c2dde88');
insert into employee (id, version, username, first_name, last_name, status) values ('5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 1, 'bob', 'Bob', 'Test', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('cba3efb7-32bc-44be-9fdc-fc5e4f211254', 1, 'ben', 'Ben', 'Test', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('e99b7af5-7d3a-4c0f-b8bc-e8d0388d8fc4', 1, 'jperez', 'Juan', 'Perez Condori', 'INACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 1, 'agarcia', 'Ana', 'Garcia Rojas', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('2e2293b1-3f9a-4f3d-abc8-32639b0a5e15', 1, 'clopez', 'Carlos', 'Lopez Mendoza', 'INACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('4b1c6c35-4627-4b35-b6e9-dc75c68b2c31', 1, 'mfernandez', 'Maria', 'Fernandez Villca', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('afc5c741-f70a-4394-853b-39d51b118927', 1, 'lgutierrez', 'Luis', 'Gutierrez Mamani', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('b2436b82-7b9f-4f0d-9463-f2c3173a45c3', 1, 'lmartinez', 'Laura', 'Martinez Paredes', 'INACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('6e6a8a4e-9f6b-44eb-8c69-40acfdc86756', 1, 'rsantos', 'Roberto', 'Santos Escobar', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('36b0d1c6-bdc0-4d98-94bb-08b9bce3f0d5', 1, 'vmorales', 'Valeria', 'Morales Ochoa', 'INACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('5a1c6d80-58b3-43e3-a5a5-24b4a2d1d54a', 1, 'jramirez', 'Jorge', 'Ramirez Tapia', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('9d6a5b2e-6d0b-4b89-8d6a-d3f3d1bfc047', 1, 'storres', 'Sandra', 'Torres Huanca', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('f8b3e0c0-0d5a-4e5c-bf9d-207b9b5e8279', 1, 'fquispe', 'Felipe', 'Quispe Huanca', 'INACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('cd80e1d0-9a08-44a6-bd63-2c63eaa003d4', 1, 'grivas', 'Gabriela', 'Rivas Arana', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('62d3c1b7-815e-4e96-8d7e-f8c4236bca55', 1, 'oflores', 'Oscar', 'Flores Quiroga', 'INACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('f20b7c5a-5a67-44f0-9ec1-4c1b8e80de05', 1, 'mvargas', 'Marta', 'Vargas Soria', 'ACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('19b5a76e-d7b1-4b76-8b02-4d0748e85809', 1, 'aespinoza', 'Andres', 'Espinoza Chura', 'INACTIVE');
insert into employee (id, version, username, first_name, last_name, status) values ('5c1a7b82-832d-4f24-8377-54b77b91b6a8', 1, 'cvillanueva', 'Carla', 'Villanueva Arce', 'ACTIVE');
INSERT INTO team (id, version, name) VALUES ('b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 1, 'ABC');
INSERT INTO team (id, version, name) VALUES ('6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 1, 'XYZ');
@ -35,33 +16,53 @@ INSERT INTO team (id, version, name) VALUES ('c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3
INSERT INTO team (id, version, name) VALUES ('8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 1, 'GHI');
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('9d6f12ba-e341-4e7a-b8a6-cab0982bd8c1', 1, '5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'VACATION', 'TAKEN', 15, '2025-12-31', '2024-10-01', '2024-10-10', 5, 10);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('2fa314bc-f547-4b12-a8b6-bb789feabc12', 1, '19b5a76e-d7b1-4b76-8b02-4d0748e85809', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'BIRTHDAY', 'APPROVED', 15, '2025-12-31', '2024-12-01', '2024-12-15', 7, 8);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('d5f6341a-913d-4e7f-a0b2-cfe0786acd34', 1, 'cba3efb7-32bc-44be-9fdc-fc5e4f211254', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FIXED_HOLIDAY', 'IN_USE', 20, '2025-11-30', '2024-11-10', '2024-11-20', 10, 10);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('4f913b23-ff23-4527-bcd6-adfe01234567', 1, 'e99b7af5-7d3a-4c0f-b8bc-e8d0388d8fc4', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MATERNITY', 'TAKEN', 18, '2025-06-30', '2024-07-01', '2024-07-15', 10, 8);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('8c653f2a-f9a3-4d67-b3b6-12ad98fe0983', 1, 'f6ab3c6d-7078-45f6-9b22-4e37637bfec6', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'VACATION', 'REQUESTED', 10, '2025-10-31', '2024-09-15', '2024-09-20', 5, 5);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('fb9d9d75-b2ab-4ea4-b8b3-0a8f89e5c123', 1, '2e2293b1-3f9a-4f3d-abc8-32639b0a5e15', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FIXED_HOLIDAY', 'IN_USE', 12, '2025-08-31', '2024-08-05', '2024-08-15', 6, 6);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('1c913a12-46e9-47b7-9e31-ab903fedc789', 1, '4b1c6c35-4627-4b35-b6e9-dc75c68b2c31', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'BIRTHDAY', 'TAKEN', 14, '2025-12-31', '2024-10-20', '2024-10-25', 5, 9);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('b1249d3a-cc34-4954-88d9-1e4f67fe2436', 1, 'afc5c741-f70a-4394-853b-39d51b118927', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MATERNITY', 'APPROVED', 20, '2025-11-30', '2024-11-05', '2024-11-12', 7, 13);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('6fdc47a8-127b-41c4-8d12-7fc12098ab12', 1, 'b2436b82-7b9f-4f0d-9463-f2c3173a45c3', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'VACATION', 'TAKEN', 18, '2025-06-30', '2024-07-10', '2024-07-20', 8, 10);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('12ec8b74-983d-4a17-b67e-134f45ae904c', 1, '5c1a7b82-832d-4f24-8377-54b77b91b6a8', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FIXED_HOLIDAY', 'PENDING', 15, '2025-12-31', '2024-09-01', '2024-09-05', 4, 11);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('89bc4b2a-943f-487c-a9f3-bacf78145e67', 1, 'cba3efb7-32bc-44be-9fdc-fc5e4f211254', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'VACATION', 'APPROVED', 20, '2025-11-30', '2024-10-25', '2024-11-05', 9, 11);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('37adfc2a-7463-4b2d-a7c1-fae04567cdef', 1, 'e99b7af5-7d3a-4c0f-b8bc-e8d0388d8fc4', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'BIRTHDAY', 'TAKEN', 18, '2025-06-30', '2024-06-01', '2024-06-10', 6, 12);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('2bc138ea-12db-4b89-a0b4-78e045e34b4e', 1, 'f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MATERNITY', 'REQUESTED', 10, '2025-10-31', '2024-10-01', '2024-10-10', 3, 7);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('14de1a56-6893-4e12-90f3-4faec457f002', 1, 'cd80e1d0-9a08-44a6-bd63-2c63eaa003d4', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'FIXED_HOLIDAY', 'PENDING', 22, '2025-08-31', '2024-07-15', '2024-07-25', 8, 14);
insert into time_off_request (id, version, employee_id, team_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('fb08a6c9-cd17-42e8-b9e2-734ec834cae2', 1, '4b1c6c35-4627-4b35-b6e9-dc75c68b2c31', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'VACATION', 'TAKEN', 16, '2025-12-31', '2024-09-30', '2024-10-05', 4, 12);
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 1, 'bob', 'Bob', 'Test', 'ACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('cba3efb7-32bc-44be-9fdc-fc5e4f211254', 1, 'ben', 'Ben', 'Test', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('e99b7af5-7d3a-4c0f-b8bc-e8d0388d8fc4', 1, 'jperez', 'Juan', 'Perez Condori', 'INACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 1, 'agarcia', 'Ana', 'Garcia Rojas', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('2e2293b1-3f9a-4f3d-abc8-32639b0a5e15', 1, 'clopez', 'Carlos', 'Lopez Mendoza', 'INACTIVE', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('4b1c6c35-4627-4b35-b6e9-dc75c68b2c31', 1, 'mfernandez', 'Maria', 'Fernandez Villca', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('afc5c741-f70a-4394-853b-39d51b118927', 1, 'lgutierrez', 'Luis', 'Gutierrez Mamani', 'ACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('b2436b82-7b9f-4f0d-9463-f2c3173a45c3', 1, 'lmartinez', 'Laura', 'Martinez Paredes', 'INACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('6e6a8a4e-9f6b-44eb-8c69-40acfdc86756', 1, 'rsantos', 'Roberto', 'Santos Escobar', 'ACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('36b0d1c6-bdc0-4d98-94bb-08b9bce3f0d5', 1, 'vmorales', 'Valeria', 'Morales Ochoa', 'INACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('5a1c6d80-58b3-43e3-a5a5-24b4a2d1d54a', 1, 'jramirez', 'Jorge', 'Ramirez Tapia', 'ACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('9d6a5b2e-6d0b-4b89-8d6a-d3f3d1bfc047', 1, 'storres', 'Sandra', 'Torres Huanca', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('f8b3e0c0-0d5a-4e5c-bf9d-207b9b5e8279', 1, 'fquispe', 'Felipe', 'Quispe Huanca', 'INACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('cd80e1d0-9a08-44a6-bd63-2c63eaa003d4', 1, 'grivas', 'Gabriela', 'Rivas Arana', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('62d3c1b7-815e-4e96-8d7e-f8c4236bca55', 1, 'oflores', 'Oscar', 'Flores Quiroga', 'INACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('f20b7c5a-5a67-44f0-9ec1-4c1b8e80de05', 1, 'mvargas', 'Marta', 'Vargas Soria', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('19b5a76e-d7b1-4b76-8b02-4d0748e85809', 1, 'aespinoza', 'Andres', 'Espinoza Chura', 'INACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa');
insert into employee (id, version, username, first_name, last_name, status, team_id) values ('5c1a7b82-832d-4f24-8377-54b77b91b6a8', 1, 'cvillanueva', 'Carla', 'Villanueva Arce', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28');
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('9d6f12ba-e341-4e7a-b8a6-cab0982bd8c1', 1, '5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 'VACATION', 'TAKEN', 15, '2025-12-31', '2024-10-01', '2024-10-10', 5, 10);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('2fa314bc-f547-4b12-a8b6-bb789feabc12', 1, '19b5a76e-d7b1-4b76-8b02-4d0748e85809', 'BIRTHDAY', 'APPROVED', 15, '2025-12-31', '2024-12-01', '2024-12-15', 7, 8);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('d5f6341a-913d-4e7f-a0b2-cfe0786acd34', 1, 'cba3efb7-32bc-44be-9fdc-fc5e4f211254', 'FIXED_HOLIDAY', 'IN_USE', 20, '2025-11-30', '2024-11-10', '2024-11-20', 10, 10);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('4f913b23-ff23-4527-bcd6-adfe01234567', 1, 'e99b7af5-7d3a-4c0f-b8bc-e8d0388d8fc4', 'MATERNITY', 'TAKEN', 18, '2025-06-30', '2024-07-01', '2024-07-15', 10, 8);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('8c653f2a-f9a3-4d67-b3b6-12ad98fe0983', 1, 'f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 'VACATION', 'REQUESTED', 10, '2025-10-31', '2024-09-15', '2024-09-20', 5, 5);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('fb9d9d75-b2ab-4ea4-b8b3-0a8f89e5c123', 1, '2e2293b1-3f9a-4f3d-abc8-32639b0a5e15', 'FIXED_HOLIDAY', 'IN_USE', 12, '2025-08-31', '2024-08-05', '2024-08-15', 6, 6);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('1c913a12-46e9-47b7-9e31-ab903fedc789', 1, '4b1c6c35-4627-4b35-b6e9-dc75c68b2c31', 'BIRTHDAY', 'TAKEN', 14, '2025-12-31', '2024-10-20', '2024-10-25', 5, 9);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('b1249d3a-cc34-4954-88d9-1e4f67fe2436', 1, 'afc5c741-f70a-4394-853b-39d51b118927', 'MATERNITY', 'APPROVED', 20, '2025-11-30', '2024-11-05', '2024-11-12', 7, 13);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('6fdc47a8-127b-41c4-8d12-7fc12098ab12', 1, 'b2436b82-7b9f-4f0d-9463-f2c3173a45c3', 'VACATION', 'TAKEN', 18, '2025-06-30', '2024-07-10', '2024-07-20', 8, 10);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('12ec8b74-983d-4a17-b67e-134f45ae904c', 1, '5c1a7b82-832d-4f24-8377-54b77b91b6a8', 'FIXED_HOLIDAY', 'PENDING', 15, '2025-12-31', '2024-09-01', '2024-09-05', 4, 11);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('89bc4b2a-943f-487c-a9f3-bacf78145e67', 1, 'cba3efb7-32bc-44be-9fdc-fc5e4f211254', 'VACATION', 'APPROVED', 20, '2025-11-30', '2024-10-25', '2024-11-05', 9, 11);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('37adfc2a-7463-4b2d-a7c1-fae04567cdef', 1, 'e99b7af5-7d3a-4c0f-b8bc-e8d0388d8fc4', 'BIRTHDAY', 'TAKEN', 18, '2025-06-30', '2024-06-01', '2024-06-10', 6, 12);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('2bc138ea-12db-4b89-a0b4-78e045e34b4e', 1, 'f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 'MATERNITY', 'REQUESTED', 10, '2025-10-31', '2024-10-01', '2024-10-10', 3, 7);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('14de1a56-6893-4e12-90f3-4faec457f002', 1, 'cd80e1d0-9a08-44a6-bd63-2c63eaa003d4', 'FIXED_HOLIDAY', 'PENDING', 22, '2025-08-31', '2024-07-15', '2024-07-25', 8, 14);
insert into time_off_request (id, version, employee_id, category, state, available_days, expiration, start_date, end_date, days_to_be_take, days_balance)
values ('fb08a6c9-cd17-42e8-b9e2-734ec834cae2', 1, '4b1c6c35-4627-4b35-b6e9-dc75c68b2c31', 'VACATION', 'TAKEN', 16, '2025-12-31', '2024-09-30', '2024-10-05', 4, 12);

View File

@ -5,22 +5,124 @@
size: 7in 9.25in;
margin: 27mm 16mm 27mm 16mm;
}
body {
font-family: Arial, sans-serif;
font-size: 12px;
}
h3 {
text-align: center;
font-weight: bold;
margin-bottom: 15px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
td, th {
border: 1px solid black;
padding: 8px;
text-align: left;
}
</style>
</head>
<body>
<div style="clear:both;"></div>
<h3 style="text-align:center;">Empleado</h3>
<div style="width: 100%; margin-bottom: 2em; margin-top: 2em;">
<dl>
<dt>Nombre</dt>
<dd>${firstName!""}</dd>
<dt>Telefono</dt>
<dd>${phoneNumber!""}</dd>
</dl>
</div>
<div style="clear:both;"></div>
<h2>FICHA DE CONTRATACIÓN</h2>
<h3>Información General</h3>
<table>
<tr>
<td>Nombre Completo:</td>
<td>${firstName!""} ${lastName!""}</td>
<td>Sexo:</td>
<td>${gender!""}</td>
</tr>
<tr>
<td>Fecha de Nacimiento:</td>
<td>${birthday!""}</td>
<td>Edad:</td>
<td>${age!""}</td>
</tr>
<tr>
<td>Ciudad y País de Nacimiento:</td>
<td>${birthCity!""}</td>
</tr>
<tr>
<td>Dirección / Domicilio Actual:</td>
<td>${residenceAddress!""}</td>
</tr>
<tr>
<td>Estado Civil:</td>
<td>${maritalStatus!""}</td>
<td>Nro. CI:</td>
<td>${ci!""}</td>
<td>Expedido en:</td>
<td>${issuedIn!""}</td>
</tr>
<tr>
<td>Nro. Hijos:</td>
<td>${numberOfChildren!""}</td>
</tr>
<tr>
<td>Nro. Celular:</td>
<td>${phoneNumber!""}</td>
</tr>
<tr>
<td>Email:</td>
<td>${personalEmail!""}</td>
</tr>
<tr>
<td>Código de Empleado:</td>
<td>${cod!""}</td>
</tr>
<tr>
<td>Cargo:</td>
<td>${position!""}</td>
</tr>
<tr>
<td>Equipo:</td>
<td>${team!""}</td>
</tr>
</table>
<h3>Información de Contratación</h3>
<table>
<tr>
<td>Fecha de Ingreso:</td>
<td>${dateOfEntry!""}</td>
</tr>
<tr>
<td>Tipo de Contrato:</td>
<td>${contractType!""}</td>
</tr>
<tr>
<td>Salario:</td>
<td>${salary!""}</td>
</tr>
</table>
<h3>Datos Bancarios</h3>
<table>
<tr>
<td>Banco:</td>
<td>${bankName!""}</td>
</tr>
<tr>
<td>Nro. Cuenta:</td>
<td>${accountNumber!""}</td>
</tr>
</table>
<h3>Datos de Gestora Pública y Seguro Social</h3>
<table>
<tr>
<td>Código Único de Asegurado (GPSS):</td>
<td>${gpss!""}</td>
</tr>
<tr>
<td>Derechohabientes:</td>
<td>${beneficiaries!""}</td>
</tr>
</table>
</body>
</html>