This commit is contained in:
parent
118813c8e4
commit
6e87c1795c
Binary file not shown.
@ -3,7 +3,6 @@ package com.primefactorsolutions.model;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Year;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.IsoFields;
|
||||
import java.time.temporal.WeekFields;
|
||||
@ -40,7 +39,7 @@ public record Week(LocalDate from, LocalDate to) {
|
||||
|
||||
private static LocalDate getFirstDayOfWeek(final int weekNumber) {
|
||||
return LocalDate
|
||||
.of(Year.now().getValue(), 2, 1)
|
||||
.now()
|
||||
.with(WeekFields.of(Locale.US).getFirstDayOfWeek())
|
||||
.with(WeekFields.of(Locale.US).weekOfWeekBasedYear(), weekNumber);
|
||||
}
|
||||
|
@ -9,12 +9,15 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.spring.security.AuthenticationContext;
|
||||
import org.vaadin.firitin.form.BeanValidationForm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class BaseEntityForm<T> extends BeanValidationForm<T> {
|
||||
private final AuthenticationContext authenticationContext;
|
||||
private Button editButton;
|
||||
private EditHandler<T> editHandler;
|
||||
|
||||
public BaseEntityForm(final AuthenticationContext authenticationContext, final Class<T> entityType) {
|
||||
super(entityType);
|
||||
@ -23,7 +26,26 @@ public abstract class BaseEntityForm<T> extends BeanValidationForm<T> {
|
||||
|
||||
@Override
|
||||
public HorizontalLayout getToolbar() {
|
||||
return new HorizontalLayout(getCancelButton(), getSaveButton());
|
||||
return new HorizontalLayout(getCancelButton(), getEditButton(), getSaveButton());
|
||||
}
|
||||
|
||||
public Button getEditButton() {
|
||||
if (editButton == null) {
|
||||
editButton = new Button("Edit");
|
||||
editButton.setEnabled(false);
|
||||
editButton.addClickListener(__ -> {
|
||||
if (editHandler != null) {
|
||||
editHandler.onEdit(getEntity());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return editButton;
|
||||
}
|
||||
|
||||
public void setEditHandler(final EditHandler<T> editHandler) {
|
||||
this.editHandler = editHandler;
|
||||
getEditButton().setEnabled(editHandler != null);
|
||||
}
|
||||
|
||||
protected Button getCancelButton() {
|
||||
@ -41,4 +63,9 @@ public abstract class BaseEntityForm<T> extends BeanValidationForm<T> {
|
||||
protected Optional<UUID> getEmployeeId() {
|
||||
return AuthUtils.getEmployeeId(this.authenticationContext);
|
||||
}
|
||||
|
||||
public interface EditHandler<T> extends Serializable {
|
||||
|
||||
void onEdit(T entity);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class CandidatesListView extends BaseView {
|
||||
hl.add(addCandidate);
|
||||
|
||||
final VGrid<Candidate> grid = new VGrid<>(Candidate.class);
|
||||
grid.setColumns("id", "email");
|
||||
grid.setColumns("email");
|
||||
grid.setAllRowsVisible(true);
|
||||
grid.addComponentColumn(candidate ->
|
||||
MenuBarUtils.menuBar(Map.of(Pair.of("Edit", VaadinIcon.PENCIL), menuItemClickEvent ->
|
||||
|
@ -38,7 +38,7 @@ public class QuestionsListView extends BaseView {
|
||||
hl.add(addQuestion);
|
||||
|
||||
final VGrid<Question> grid = new VGrid<>(Question.class);
|
||||
grid.setColumns("id", "title");
|
||||
grid.setColumns("title", "description", "timeMinutes");
|
||||
grid.addComponentColumn(question ->
|
||||
MenuBarUtils.menuBar(Pair.of("Edit", __ ->
|
||||
getUI().flatMap(ui -> ui.navigate(QuestionView.class, question.getId().toString())))));
|
||||
|
@ -6,7 +6,6 @@ import com.primefactorsolutions.model.*;
|
||||
import com.primefactorsolutions.service.EmployeeService;
|
||||
import com.primefactorsolutions.service.ReportService;
|
||||
import com.primefactorsolutions.service.TeamService;
|
||||
import com.primefactorsolutions.service.TimeOffRequestService;
|
||||
import com.primefactorsolutions.views.BaseEntityForm;
|
||||
import com.primefactorsolutions.views.MainLayout;
|
||||
import com.vaadin.componentfactory.pdfviewer.PdfViewer;
|
||||
@ -57,30 +56,25 @@ import java.util.UUID;
|
||||
public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlParameter<String> {
|
||||
private final EmployeeService employeeService;
|
||||
private final ReportService reportService;
|
||||
private final TimeOffRequestService requestService;
|
||||
private final TeamService teamService;
|
||||
// TODO: campo usado para registrar al empleado en LDAP. Este campo podria estar en otro form eventualmente.
|
||||
private final TextField username = createTextField("Username: ", 30, true);
|
||||
private final TextField firstName = createTextField("Nombres: ", 30, true);
|
||||
private final TextField username = createTextField("Username", 30, true);
|
||||
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 ejemplo: (Ciudad, País) ",
|
||||
30, false);
|
||||
private final TextField birthCity = createTextField("Ciudad y País de Nacimiento", 30, false);
|
||||
private final TextField residenceAddress = createTextField("Dirección de Residencia", 50, false);
|
||||
private final TextField localAddress = createTextField("Departamento y Provincia de Residencia "
|
||||
+ " ejemplo: (Departamento-Provincia)", 30, false);
|
||||
private final TextField localAddress = createTextField("Departamento y Provincia de Residencia", 30, false);
|
||||
private final ComboBox<Employee.MaritalStatus> maritalStatus = createMaritalStatusComboBox();
|
||||
private final TextField numberOfChildren = createTextField("Numero de Hijos", 1, false);
|
||||
private final TextField ci = createTextField("CI", 10, false);
|
||||
private final TextField issuedIn = createTextField("Expedido en ", 10, false);
|
||||
private final TextField issuedIn = createTextField("Lugar de Expedicion", 10, false);
|
||||
private final TextField phoneNumber = createTextField("Teléfono", 8, false);
|
||||
private final EmailField personalEmail = createEmailField("E-mail ejemplo: (ejemplo@gmail.com)");
|
||||
private final EmailField personalEmail = createEmailField("E-mail");
|
||||
private final TextField phoneNumberProfesional = createTextField("Teléfono Laboral", 8, false);
|
||||
private final EmailField profesionalEmail = createEmailField("E-mail Laboral ejemplo: "
|
||||
+ "(ejemplo@primerfactorsolutions.com)");
|
||||
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);
|
||||
@ -148,12 +142,10 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
public EmployeeView(final AuthenticationContext authenticationContext,
|
||||
final EmployeeService employeeService,
|
||||
final ReportService reportService,
|
||||
final TeamService teamService,
|
||||
final TimeOffRequestService requestService) {
|
||||
final TeamService teamService) {
|
||||
super(authenticationContext, Employee.class);
|
||||
this.employeeService = employeeService;
|
||||
this.reportService = reportService;
|
||||
this.requestService = requestService;
|
||||
this.teamService = teamService;
|
||||
excelReportButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||
configureComponents();
|
||||
@ -163,7 +155,7 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
ui.navigate(EmployeeReportView.class, getEntity().getId().toString())
|
||||
)
|
||||
);
|
||||
setSavedHandler(e -> saveEmployee(e));
|
||||
setSavedHandler(this::saveEmployee);
|
||||
}
|
||||
|
||||
private void makeUpperCase(final TextField textField) {
|
||||
@ -415,7 +407,6 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private VerticalLayout createContentLayout() {
|
||||
VerticalLayout contentLayout = new VerticalLayout();
|
||||
contentLayout.setWidth("100%");
|
||||
@ -521,7 +512,7 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
profileImagePreview.setVisible(true);
|
||||
salaryTotal.setValue(BigDecimal.valueOf(0.0));
|
||||
} else {
|
||||
Employee employee = null;
|
||||
final Employee employee;
|
||||
|
||||
if (s != null) {
|
||||
final UUID employeeId = UUID.fromString(s);
|
||||
@ -532,6 +523,7 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
|
||||
if ("edit".equals(action)) {
|
||||
setEntityWithEnabledSave(employee);
|
||||
setEditHandler(null);
|
||||
status.setValue(employee.getStatus());
|
||||
setFieldsEditable();
|
||||
upload.setVisible(true);
|
||||
@ -540,6 +532,7 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
salaryTotal.setValue(employee.getSalaryTotal());
|
||||
} else if ("view".equals(action) || "me".equals(action)) {
|
||||
setEntity(employee);
|
||||
setEditHandler(__ -> getUI().ifPresent(ui -> ui.navigate("/employees/" + employee.getId() + "/edit")));
|
||||
setFieldsReadOnly();
|
||||
displayProfileImage(employee);
|
||||
salaryTotal.setValue(employee.getSalaryTotal());
|
||||
@ -574,7 +567,6 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
phoneNumber.setReadOnly(true);
|
||||
personalEmail.setReadOnly(true);
|
||||
phoneNumberProfesional.setReadOnly(true);
|
||||
profesionalEmail.setReadOnly(true);
|
||||
position.setReadOnly(true);
|
||||
team.setReadOnly(true);
|
||||
emergencyCName.setReadOnly(true);
|
||||
@ -636,7 +628,6 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
phoneNumber.setReadOnly(false);
|
||||
personalEmail.setReadOnly(false);
|
||||
phoneNumberProfesional.setReadOnly(false);
|
||||
profesionalEmail.setReadOnly(false);
|
||||
position.setReadOnly(false);
|
||||
team.setReadOnly(false);
|
||||
emergencyCName.setReadOnly(false);
|
||||
@ -692,25 +683,73 @@ public class EmployeeView extends BaseEntityForm<Employee> implements HasUrlPara
|
||||
infoPer,
|
||||
infoGenr,
|
||||
imagenSub,
|
||||
upload, profileImagePreview,
|
||||
firstName, lastName,
|
||||
gender, status,
|
||||
birthday, age,
|
||||
birthCity, residenceAddress, localAddress,
|
||||
maritalStatus, ci, issuedIn, numberOfChildren,
|
||||
phoneNumber, personalEmail, phoneNumberProfesional, profesionalEmail,
|
||||
contEmerg, emergencyCName, emergencyCAddress, emergencyCPhone, emergencyCEmail,
|
||||
upload,
|
||||
profileImagePreview,
|
||||
firstName,
|
||||
lastName,
|
||||
gender,
|
||||
status,
|
||||
birthday,
|
||||
age,
|
||||
birthCity,
|
||||
residenceAddress,
|
||||
localAddress,
|
||||
maritalStatus,
|
||||
ci,
|
||||
issuedIn,
|
||||
numberOfChildren,
|
||||
phoneNumber,
|
||||
personalEmail,
|
||||
phoneNumberProfesional,
|
||||
contEmerg,
|
||||
emergencyCName,
|
||||
emergencyCAddress,
|
||||
emergencyCPhone,
|
||||
emergencyCEmail,
|
||||
infProf,
|
||||
titulos, pTitle1, pTitle2, pTitle3, pStudy1, pStudy2, pStudy3,
|
||||
certif, certification1, certification2, certification3, certification4,
|
||||
logros, recognition, achievements,
|
||||
idioma, language1, language1Level, language2, language2Level,
|
||||
titulos,
|
||||
pTitle1,
|
||||
pTitle2,
|
||||
pTitle3,
|
||||
pStudy1,
|
||||
pStudy2,
|
||||
pStudy3,
|
||||
certif,
|
||||
certification1,
|
||||
certification2,
|
||||
certification3,
|
||||
certification4,
|
||||
logros,
|
||||
recognition,
|
||||
achievements,
|
||||
idioma,
|
||||
language1,
|
||||
language1Level,
|
||||
language2,
|
||||
language2Level,
|
||||
infoAdm,
|
||||
cod, position, team, leadManager,
|
||||
infoCont, dateOfEntry, dateOfExit, seniority, contractType, customContractType,
|
||||
salaryBasic, professionalBonus, tenureBonus, salaryTotal,
|
||||
datBanc, bankName, accountNumber,
|
||||
datGest, gpss, sss, beneficiarie1, beneficiarie2,
|
||||
cod,
|
||||
position,
|
||||
team,
|
||||
leadManager,
|
||||
infoCont,
|
||||
dateOfEntry,
|
||||
dateOfExit,
|
||||
seniority,
|
||||
contractType,
|
||||
customContractType,
|
||||
salaryBasic,
|
||||
professionalBonus,
|
||||
tenureBonus,
|
||||
salaryTotal,
|
||||
datBanc,
|
||||
bankName,
|
||||
accountNumber,
|
||||
datGest,
|
||||
gpss,
|
||||
sss,
|
||||
beneficiarie1,
|
||||
beneficiarie2,
|
||||
dialog
|
||||
);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import java.util.List;
|
||||
public class EmployeesListView extends BaseView {
|
||||
|
||||
private final EmployeeService employeeService;
|
||||
private final PagingGrid<Employee> table = new PagingGrid<>(Employee.class);
|
||||
private final PagingGrid<Employee> employeePagingGrid = new PagingGrid<>(Employee.class);
|
||||
|
||||
public EmployeesListView(final AuthenticationContext authenticationContext, final EmployeeService employeeService) {
|
||||
super(authenticationContext);
|
||||
@ -52,18 +52,19 @@ public class EmployeesListView extends BaseView {
|
||||
configureTable();
|
||||
final HorizontalLayout hl = new HorizontalLayout(createAddEmployeeButton(), createExportButton());
|
||||
getCurrentPageLayout().add(hl);
|
||||
getCurrentPageLayout().add(table);
|
||||
getCurrentPageLayout().add(employeePagingGrid);
|
||||
}
|
||||
|
||||
private Button createExportButton() {
|
||||
StreamResource excelResource = new StreamResource("employees.xlsx", this::generateExcel);
|
||||
Anchor downloadLink = new Anchor(excelResource, "Export Employees");
|
||||
final StreamResource excelResource = new StreamResource("employees.xlsx", this::generateExcel);
|
||||
final Anchor downloadLink = new Anchor(excelResource, "Export Employees");
|
||||
downloadLink.getElement().setAttribute("download", true); // Forzar descarga
|
||||
|
||||
return new Button("Exportar como Excel", e -> getCurrentPageLayout().add(downloadLink));
|
||||
}
|
||||
|
||||
private ByteArrayInputStream generateExcel() {
|
||||
List<Employee> employees = employeeService.findAllEmployees();
|
||||
final List<Employee> employees = employeeService.findAllEmployees();
|
||||
try (Workbook workbook = new XSSFWorkbook(); ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
Sheet sheet = workbook.createSheet("Employees");
|
||||
Row headerRow = sheet.createRow(0);
|
||||
@ -139,17 +140,16 @@ public class EmployeesListView extends BaseView {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void configureTable() {
|
||||
table.setColumns("firstName", "lastName", "status");
|
||||
table.addComponentColumn(employee -> MenuBarUtils.menuBar(
|
||||
employeePagingGrid.setColumns("username", "firstName", "lastName", "status");
|
||||
employeePagingGrid.addComponentColumn(employee -> MenuBarUtils.menuBar(
|
||||
Pair.of("View", __ -> navigateToEmployeeView(employee)),
|
||||
Pair.of("Edit", __ -> navigateToEditView(employee))));
|
||||
setupPagingGrid();
|
||||
}
|
||||
|
||||
private Button createButton(final String label, final Runnable onClickAction, final boolean isPrimary) {
|
||||
Button button = new Button(label);
|
||||
final Button button = new Button(label);
|
||||
|
||||
if (isPrimary) {
|
||||
button.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||
@ -160,7 +160,6 @@ public class EmployeesListView extends BaseView {
|
||||
}
|
||||
|
||||
private Button createAddEmployeeButton() {
|
||||
|
||||
return createButton("Add Employee", this::navigateToAddEmployeeView, true);
|
||||
}
|
||||
|
||||
@ -173,17 +172,16 @@ public class EmployeesListView extends BaseView {
|
||||
}
|
||||
|
||||
private void navigateToAddEmployeeView() {
|
||||
|
||||
getUI().ifPresent(ui -> ui.navigate(EmployeeView.class, "new"));
|
||||
}
|
||||
|
||||
private void setupPagingGrid() {
|
||||
table.setPaginationBarMode(PagingGrid.PaginationBarMode.BOTTOM);
|
||||
table.setPageSize(Constants.PAGE_SIZE);
|
||||
employeePagingGrid.setPaginationBarMode(PagingGrid.PaginationBarMode.BOTTOM);
|
||||
employeePagingGrid.setPageSize(Constants.PAGE_SIZE);
|
||||
}
|
||||
|
||||
private void refreshGrid() {
|
||||
table.setPagingDataProvider((page, pageSize) -> fetchEmployees((int) page, pageSize));
|
||||
employeePagingGrid.setPagingDataProvider((page, pageSize) -> fetchEmployees((int) page, pageSize));
|
||||
}
|
||||
|
||||
private List<Employee> fetchEmployees(final int page, final int pageSize) {
|
||||
@ -195,18 +193,14 @@ public class EmployeesListView extends BaseView {
|
||||
}
|
||||
|
||||
private boolean hasSortOrder() {
|
||||
return !table.getSortOrder().isEmpty();
|
||||
return !employeePagingGrid.getSortOrder().isEmpty();
|
||||
}
|
||||
|
||||
private List<Employee> fetchSortedEmployees(final int start, final int pageSize) {
|
||||
GridSortOrder<Employee> sortOrder = table.getSortOrder().getFirst();
|
||||
final GridSortOrder<Employee> sortOrder = employeePagingGrid.getSortOrder().getFirst();
|
||||
|
||||
return employeeService.findEmployees(start, pageSize,
|
||||
sortOrder.getSorted().getKey(),
|
||||
sortOrder.getDirection() == SortDirection.ASCENDING);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
private interface ButtonClickHandler {
|
||||
void handle(Employee employee);
|
||||
}
|
||||
}
|
@ -105,6 +105,8 @@ public class TimeOffRequestsListView extends BaseView {
|
||||
requestsGrid.addColumn(this::getEmployeeFullName).setHeader("Empleado");
|
||||
requestsGrid.addColumn(this::getTeamName).setHeader("Equipo");
|
||||
requestsGrid.addColumn(this::getCategory).setHeader("Categoría");
|
||||
requestsGrid.addColumn(this::getDates).setHeader("Dias");
|
||||
requestsGrid.addColumn(this::getState).setHeader("Estado");
|
||||
requestsGrid.addComponentColumn((ValueProvider<TimeOffRequest, Component>) timeOffRequest -> {
|
||||
final MenuBar menuBar = new MenuBar();
|
||||
menuBar.addThemeVariants(MenuBarVariant.LUMO_TERTIARY_INLINE);
|
||||
@ -193,6 +195,14 @@ public class TimeOffRequestsListView extends BaseView {
|
||||
return String.valueOf(request.getCategory());
|
||||
}
|
||||
|
||||
private String getDates(final TimeOffRequest request) {
|
||||
return String.format("de %s a %s", request.getStartDate(), request.getEndDate());
|
||||
}
|
||||
|
||||
private String getState(final TimeOffRequest request) {
|
||||
return request.getState().name();
|
||||
}
|
||||
|
||||
private ComboBox<Employee> createEmployeeFilter() {
|
||||
employeeFilter.setClearButtonVisible(true);
|
||||
employeeFilter.setPlaceholder("Seleccionar ...");
|
||||
|
@ -24,7 +24,6 @@ import java.time.YearMonth;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SpringComponent
|
||||
@PermitAll
|
||||
@ -79,16 +78,20 @@ public class TimesheetEntryView extends BaseEntityForm<TimesheetEntry> implement
|
||||
setEntityWithEnabledSave(timesheetEntry);
|
||||
} else if ("view".equals(action) && !s.isEmpty()) {
|
||||
setEntity(timesheetEntry);
|
||||
employee.setReadOnly(true);
|
||||
team.setReadOnly(true);
|
||||
task.setReadOnly(true);
|
||||
details.setReadOnly(true);
|
||||
date.setReadOnly(true);
|
||||
hours.setReadOnly(true);
|
||||
setFormReadOnly();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setFormReadOnly() {
|
||||
employee.setReadOnly(true);
|
||||
team.setReadOnly(true);
|
||||
task.setReadOnly(true);
|
||||
details.setReadOnly(true);
|
||||
date.setReadOnly(true);
|
||||
hours.setReadOnly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Component> getFormComponents() {
|
||||
return List.of(
|
||||
@ -120,33 +123,29 @@ public class TimesheetEntryView extends BaseEntityForm<TimesheetEntry> implement
|
||||
team.setWidthFull();
|
||||
team.setItems(teamService.findAllTeams());
|
||||
team.setItemLabelGenerator(Team::getName);
|
||||
team.setValue(null);
|
||||
team.addValueChangeListener(event -> {
|
||||
Team selectedTeam = event.getValue();
|
||||
updateEmployeeField(selectedTeam);
|
||||
if (event.getOldValue() != null) {
|
||||
final Team selectedTeam = event.getValue();
|
||||
updateEmployeeField(selectedTeam);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateEmployeeField(final Team selectedTeam) {
|
||||
if (selectedTeam != null) {
|
||||
List<Employee> employeesInTeam = employeeService.findAllEmployees().stream()
|
||||
final List<Employee> employeesInTeam = employeeService.findAllEmployees().stream()
|
||||
.filter(employee -> employee.getTeam() != null && employee.getTeam().equals(selectedTeam))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
employee.setItems(employeesInTeam);
|
||||
if (!employeesInTeam.isEmpty()) {
|
||||
employee.setValue(employeesInTeam.getFirst());
|
||||
} else {
|
||||
employee.clear();
|
||||
}
|
||||
employee.setValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeEmployeeField() {
|
||||
List<Employee> employees = new ArrayList<>(employeeService.findAllEmployees());
|
||||
final List<Employee> employees = new ArrayList<>(employeeService.findAllEmployees());
|
||||
employee.setWidthFull();
|
||||
employee.setItems(employees);
|
||||
employee.setItemLabelGenerator(TimesheetEntryView::getEmployeeFullName);
|
||||
employee.setValue(null);
|
||||
employee.setRequired(true);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.primefactorsolutions.views.timesheet;
|
||||
|
||||
import com.primefactorsolutions.model.TimesheetEntry;
|
||||
import com.primefactorsolutions.model.Team;
|
||||
import com.primefactorsolutions.model.Week;
|
||||
import com.primefactorsolutions.service.TimesheetService;
|
||||
import com.primefactorsolutions.service.ReportService;
|
||||
import com.primefactorsolutions.service.TeamService;
|
||||
@ -11,81 +12,59 @@ 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.Anchor;
|
||||
import com.vaadin.flow.component.html.H2;
|
||||
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.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.router.PageTitle;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import com.vaadin.flow.server.StreamResource;
|
||||
import com.vaadin.flow.spring.security.AuthenticationContext;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.primefactorsolutions.service.EmployeeService;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.TextStyle;
|
||||
import java.time.temporal.WeekFields;
|
||||
import java.time.temporal.IsoFields;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Route(value = "/timesheet/report", layout = MainLayout.class)
|
||||
@PageTitle("Reporte de Horas Trabajadas")
|
||||
@RolesAllowed("ROLE_ADMIN")
|
||||
@Slf4j
|
||||
public class TimesheetReportView extends BaseView {
|
||||
|
||||
private final EmployeeService employeeService;
|
||||
private final TimesheetService timesheetService;
|
||||
private final ReportService reportService;
|
||||
private final TeamService teamService;
|
||||
private final ComboBox<Team> equipoComboBox = new ComboBox<>("Seleccionar Equipo");
|
||||
private final ComboBox<String> semanaComboBox = new ComboBox<>("Seleccionar Semana");
|
||||
private final ComboBox<Team> teamComboBox = new ComboBox<>("Equipo");
|
||||
private final ComboBox<Week> weekComboBox = new ComboBox<>("Semana");
|
||||
private final Grid<Map<String, Object>> grid = new Grid<>();
|
||||
private final VerticalLayout headerLayout = new VerticalLayout();
|
||||
private Anchor downloadLink;
|
||||
private final Span semanaInfoSpan = new Span();
|
||||
private final int currentYear = LocalDate.now().getYear();
|
||||
|
||||
@Autowired
|
||||
public TimesheetReportView(final AuthenticationContext authenticationContext,
|
||||
final TimesheetService timesheetService,
|
||||
final ReportService reportService,
|
||||
final TeamService teamService,
|
||||
final EmployeeService employeeService) {
|
||||
final TeamService teamService) {
|
||||
super(authenticationContext);
|
||||
this.timesheetService = timesheetService;
|
||||
this.reportService = reportService;
|
||||
this.teamService = teamService;
|
||||
this.employeeService = employeeService;
|
||||
|
||||
final H2 title = new H2("Reporte de Horas Trabajadas");
|
||||
getCurrentPageLayout().add(title);
|
||||
|
||||
final List<Team> teams = teamService.findAllTeams();
|
||||
equipoComboBox.setItems(teams);
|
||||
equipoComboBox.setItemLabelGenerator(Team::getName);
|
||||
teamComboBox.setPlaceholder("Seleccionar ...");
|
||||
teamComboBox.setItems(teams);
|
||||
teamComboBox.setItemLabelGenerator(Team::getName);
|
||||
initializeWeekComboBox();
|
||||
|
||||
semanaComboBox.addValueChangeListener(event -> {
|
||||
String selectedWeek = event.getValue();
|
||||
semanaInfoSpan.setText(selectedWeek != null ? selectedWeek : "Selecciona una semana");
|
||||
});
|
||||
|
||||
final Button reportButton = new Button("Generar Reporte de Horas Trabajadas",
|
||||
event -> generateHoursWorkedReport());
|
||||
getCurrentPageLayout().add(reportButton);
|
||||
final HorizontalLayout filtersLayout = new HorizontalLayout(equipoComboBox, semanaComboBox);
|
||||
final HorizontalLayout filtersLayout = new HorizontalLayout(teamComboBox, weekComboBox);
|
||||
getCurrentPageLayout().add(filtersLayout);
|
||||
|
||||
getCurrentPageLayout().add(headerLayout);
|
||||
updateHeaderLayout(null, null);
|
||||
|
||||
grid.addColumn(map -> map.get("Empleado")).setHeader("Empleado");
|
||||
grid.addColumn(map -> map.get("Horas Trabajadas")).setHeader("Horas Trabajadas");
|
||||
grid.addColumn(map -> map.get("Horas Pendientes")).setHeader("Horas Pendientes");
|
||||
@ -95,32 +74,13 @@ public class TimesheetReportView extends BaseView {
|
||||
}
|
||||
|
||||
private void initializeWeekComboBox() {
|
||||
int year = LocalDate.now().getYear();
|
||||
final LocalDate startOfYear = LocalDate.of(year, 1, 5);
|
||||
final List<String> weeks = startOfYear.datesUntil(LocalDate.of(year + 1, 1, 1),
|
||||
java.time.Period.ofWeeks(1))
|
||||
.map(date -> {
|
||||
final int weekNumber = date.get(
|
||||
WeekFields.of(DayOfWeek.MONDAY, 1).weekOfWeekBasedYear());
|
||||
final LocalDate endOfWeek = date.plusDays(6);
|
||||
|
||||
return String.format("Semana %d: %s - %s",
|
||||
weekNumber,
|
||||
date.getDayOfMonth() + " de " + date.getMonth()
|
||||
.getDisplayName(TextStyle.FULL, Locale.getDefault()),
|
||||
endOfWeek.getDayOfMonth() + " de " + endOfWeek.getMonth()
|
||||
.getDisplayName(TextStyle.FULL, Locale.getDefault())
|
||||
);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
semanaComboBox.setItems(weeks);
|
||||
semanaComboBox.setPlaceholder("Seleccione una semana");
|
||||
weekComboBox.setItems(Week.getLastWeeks(8));
|
||||
weekComboBox.setPlaceholder("Seleccionar ...");
|
||||
}
|
||||
|
||||
private void generateHoursWorkedReport() {
|
||||
final Team selectedTeam = equipoComboBox.getValue();
|
||||
final String selectedWeek = semanaComboBox.getValue();
|
||||
final Team selectedTeam = teamComboBox.getValue();
|
||||
final Week selectedWeek = weekComboBox.getValue();
|
||||
|
||||
if (selectedTeam == null || selectedWeek == null) {
|
||||
Notification.show("Por favor, selecciona un equipo y una semana para generar el reporte.",
|
||||
@ -128,82 +88,45 @@ public class TimesheetReportView extends BaseView {
|
||||
return;
|
||||
}
|
||||
|
||||
final int weekNumber = Integer.parseInt(selectedWeek.split(" ")[1].replace(":", ""));
|
||||
final LocalDate selectedDate = LocalDate.now().with(WeekFields.of(DayOfWeek.FRIDAY, 1)
|
||||
.weekOfWeekBasedYear(), weekNumber);
|
||||
updateHeaderLayout(selectedTeam, selectedDate);
|
||||
|
||||
final List<TimesheetEntry> timesheetEntryList = timesheetService.findAll().stream()
|
||||
.filter(hw -> hw.getEmployee().getTeam().getId().equals(selectedTeam
|
||||
.getId()) && hw.getWeekNumber() == weekNumber)
|
||||
final List<TimesheetEntry> timesheetEntryList =
|
||||
timesheetService.findListHoursWorkedEmployee(selectedWeek.from(), selectedWeek.to()).stream()
|
||||
.filter(e -> e.getEmployee().getTeam().getId().equals(selectedTeam.getId()))
|
||||
.toList();
|
||||
|
||||
if (timesheetEntryList.isEmpty()) {
|
||||
|
||||
Notification.show("No hay horas trabajadas disponibles para generar el reporte.",
|
||||
3000, Notification.Position.MIDDLE);
|
||||
return;
|
||||
}
|
||||
|
||||
List<Map<String, Object>> data = timesheetEntryList.stream()
|
||||
.map(hoursWorked -> {
|
||||
final List<Map<String, Object>> data = timesheetEntryList.stream()
|
||||
.map(e -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("ID", hoursWorked.getId().toString());
|
||||
map.put("Employee ID", hoursWorked.getEmployee().getId().toString());
|
||||
map.put("Empleado", hoursWorked.getEmployee().getFirstName() + " "
|
||||
+ hoursWorked.getEmployee().getLastName());
|
||||
map.put("Horas Trabajadas", hoursWorked.getHours());
|
||||
map.put("Horas Pendientes", 40 - hoursWorked.getHours());
|
||||
map.put("ID", e.getId().toString());
|
||||
map.put("Employee ID", e.getEmployee().getId().toString());
|
||||
map.put("Empleado", e.getEmployee().getFirstName() + " "
|
||||
+ e.getEmployee().getLastName());
|
||||
map.put("Horas Trabajadas", e.getHours());
|
||||
map.put("Horas Pendientes", 40 - e.getHours());
|
||||
map.put("Observaciones", "");
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
grid.setItems(data);
|
||||
int weekNumber = weekComboBox.getValue().from().get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
|
||||
generateExcelDownloadLink(data, weekNumber);
|
||||
}
|
||||
|
||||
private void updateHeaderLayout(final Team team, final LocalDate dateInWeek) {
|
||||
headerLayout.removeAll();
|
||||
|
||||
if (team != null && dateInWeek != null) {
|
||||
int weekNumber = getWeekOfYear(dateInWeek);
|
||||
|
||||
headerLayout.add(new Span("Informe "
|
||||
+ String.format("%03d", weekNumber) + "/" + currentYear) {{
|
||||
getStyle().set("font-size", "24px");
|
||||
getStyle().set("font-weight", "bold");
|
||||
}});
|
||||
|
||||
String teamLeadName = employeeService.getTeamLeadName(team.getId());
|
||||
headerLayout.add(
|
||||
new Span("Asunto: Informe Semanal de Horas Trabajadas") {{
|
||||
getStyle().set("font-size", "18px");
|
||||
}},
|
||||
semanaInfoSpan,
|
||||
new Span("Horas a cumplir: 40 horas") {{
|
||||
getStyle().set("font-size", "18px");
|
||||
}},
|
||||
new Span("Equipo: " + team.getName()) {{
|
||||
getStyle().set("font-size", "18px");
|
||||
}},
|
||||
new Span("Team Lead: " + teamLeadName) {{
|
||||
getStyle().set("font-size", "18px");
|
||||
}}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateExcelDownloadLink(final List<Map<String, Object>> data, final int weekNumber) {
|
||||
try {
|
||||
List<String> headers = List.of("Empleado",
|
||||
"Horas Trabajadas", "Horas Pendientes", "Observaciones");
|
||||
String selectedTeam = equipoComboBox.getValue().getName();
|
||||
byte[] excelBytes = reportService.writeAsExcel(
|
||||
final List<String> headers = List.of("Empleado", "Horas Trabajadas", "Horas Pendientes", "Observaciones");
|
||||
final String selectedTeam = teamComboBox.getValue().getName();
|
||||
final byte[] excelBytes = reportService.writeAsExcel(
|
||||
"hours_worked_report", headers, data, selectedTeam, weekNumber, currentYear);
|
||||
|
||||
StreamResource excelResource = new StreamResource("hours_worked_report.xlsx",
|
||||
final StreamResource excelResource = new StreamResource("hours_worked_report.xlsx",
|
||||
() -> new ByteArrayInputStream(excelBytes));
|
||||
|
||||
if (downloadLink == null) {
|
||||
downloadLink = new Anchor(excelResource, "Descargar Reporte en Excel");
|
||||
downloadLink.getElement().setAttribute("download", true);
|
||||
@ -214,11 +137,7 @@ public class TimesheetReportView extends BaseView {
|
||||
} catch (Exception e) {
|
||||
Notification.show("Error al generar el reporte de horas trabajadas en Excel.",
|
||||
3000, Notification.Position.MIDDLE);
|
||||
log.error("Error generating report", e);
|
||||
}
|
||||
}
|
||||
|
||||
private int getWeekOfYear(final LocalDate date) {
|
||||
return date.get(WeekFields.of(Locale.getDefault()).weekOfWeekBasedYear());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,63 +3,95 @@ insert into candidate (id, version, email) values ('23471ab3-f639-4d2b-9541-7227
|
||||
insert into question (id, version, content, title, description) values ('a7e00ff8-da41-4624-b31c-1b13c3f2e3ae', 1, 'foo bar', 'q1', 'lorem ipsum');
|
||||
insert into question (id, version, content, title, description) values ('8a4b213c-ca81-4c38-b56d-d7028c2dde88', 1, 'foo buzz', 'q2', 'lorem ipsum');
|
||||
|
||||
insert into assessment(id, version, candidate_id) values ('46b153f4-23fd-462f-8430-fbe67b83caab', 1, '23471ab3-f639-4d2b-9541-7227f4ea7ee6');
|
||||
insert into assessment (id, version, candidate_id) values ('46b153f4-23fd-462f-8430-fbe67b83caab', 1, '23471ab3-f639-4d2b-9541-7227f4ea7ee6');
|
||||
|
||||
insert into assessment_questions (assessment_id, question_id) values ('46b153f4-23fd-462f-8430-fbe67b83caab', 'a7e00ff8-da41-4624-b31c-1b13c3f2e3ae');
|
||||
insert into assessment_questions (assessment_id, question_id) values ('46b153f4-23fd-462f-8430-fbe67b83caab', '8a4b213c-ca81-4c38-b56d-d7028c2dde88');
|
||||
|
||||
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');
|
||||
INSERT INTO team (id, version, name) VALUES ('c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 1, 'DEF');
|
||||
INSERT INTO team (id, version, name) VALUES ('8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 1, 'GHI');
|
||||
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');
|
||||
insert into team (id, version, name) values ('c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 1, 'DEF');
|
||||
insert into team (id, version, name) values ('8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 1, 'GHI');
|
||||
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('123e4567-e89b-12d3-a456-426614174000', 1, 'AÑO_NUEVO', '2024-1-1', 1, 1, 'FIXED');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('223e4567-e89b-12d3-a456-426614174001', 1, 'LUNES_CARNAVAL', '2024-2-12', 1, 1, 'FIXED');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('323e4567-e89b-12d3-a456-426614174002', 1, 'MARTES_CARNAVAL', '2024-2-13', 1, 1, 'FIXED');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('423e4567-e89b-12d3-a456-426614174003', 1, 'VIERNES_SANTO', '2024-3-29', 1, 1, 'FIXED');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('523e4567-e89b-12d3-a456-426614174004', 1, 'DIA_DEL_TRABAJADOR', '2024-5-1', 1, 1, 'FIXED');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('623e4567-e89b-12d3-a456-426614174005', 1, 'DIA_DE_LA_INDEPENDENCIA', '2024-8-6', 1, 1, 'FIXED');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('723e4567-e89b-12d3-a456-426614174006', 1, 'NAVIDAD', '2024-12-25', 1, 1, 'FIXED');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('823e4567-e89b-12d3-a456-426614174007', 1, 'DIA_DEL_ESTADO_PLURINACIONAL', '2024-1-21', 1, 30, 'MOVABLE');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('923e4567-e89b-12d3-a456-426614174008', 1, 'CORPUS_CHRISTI', '2024-5-30', 1, 30, 'MOVABLE');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('a23e4567-e89b-12d3-a456-426614174009', 1, 'AÑO_NUEVO_ANDINO', '2024-6-21', 1, 30, 'MOVABLE');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('b23e4567-e89b-12d3-a456-42661417400a', 1, 'ANIVERSARIO_DEPARTAMENTAL', '2024-9-14', 1, 30, 'MOVABLE');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417400b', 1, 'DIA_DE_TODOS_LOS_DIFUNTOS', '2024-11-2', 1, 30, 'MOVABLE');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417401a', 1, 'DIA_DEL_PADRE', '2024-3-19', 0.5, 30, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417401b', 1, 'DIA_DE_LA_MADRE', '2024-5-27', 0.5, 30, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417401c', 1, 'DIA_DE_LA_MUJER_INTERNACIONAL', '2024-3-8', 0.5, 30, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, date, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417401d', 1, 'DIA_DE_LA_MUJER_NACIONAL', '2024-10-11', 0.5, 30, 'OTHER');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('123e4567-e89b-12d3-a456-426614174000', 1, 'AÑO_NUEVO', '2024-1-1', 1, 1, 'FIXED');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('223e4567-e89b-12d3-a456-426614174001', 1, 'LUNES_CARNAVAL', '2024-2-12', 1, 1, 'FIXED');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('323e4567-e89b-12d3-a456-426614174002', 1, 'MARTES_CARNAVAL', '2024-2-13', 1, 1, 'FIXED');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('423e4567-e89b-12d3-a456-426614174003', 1, 'VIERNES_SANTO', '2024-3-29', 1, 1, 'FIXED');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('523e4567-e89b-12d3-a456-426614174004', 1, 'DIA_DEL_TRABAJADOR', '2024-5-1', 1, 1, 'FIXED');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('623e4567-e89b-12d3-a456-426614174005', 1, 'DIA_DE_LA_INDEPENDENCIA', '2024-8-6', 1, 1, 'FIXED');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('723e4567-e89b-12d3-a456-426614174006', 1, 'NAVIDAD', '2024-12-25', 1, 1, 'FIXED');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('823e4567-e89b-12d3-a456-426614174007', 1, 'DIA_DEL_ESTADO_PLURINACIONAL', '2024-1-21', 1, 30, 'MOVABLE');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('923e4567-e89b-12d3-a456-426614174008', 1, 'CORPUS_CHRISTI', '2024-5-30', 1, 30, 'MOVABLE');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('a23e4567-e89b-12d3-a456-426614174009', 1, 'AÑO_NUEVO_ANDINO', '2024-6-21', 1, 30, 'MOVABLE');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('b23e4567-e89b-12d3-a456-42661417400a', 1, 'ANIVERSARIO_DEPARTAMENTAL', '2024-9-14', 1, 30, 'MOVABLE');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('c23e4567-e89b-12d3-a456-42661417400b', 1, 'DIA_DE_TODOS_LOS_DIFUNTOS', '2024-11-2', 1, 30, 'MOVABLE');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('c23e4567-e89b-12d3-a456-42661417401a', 1, 'DIA_DEL_PADRE', '2024-3-19', 0.5, 30, 'OTHER');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('c23e4567-e89b-12d3-a456-42661417401b', 1, 'DIA_DE_LA_MADRE', '2024-5-27', 0.5, 30, 'OTHER');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('c23e4567-e89b-12d3-a456-42661417401c', 1, 'DIA_DE_LA_MUJER_INTERNACIONAL', '2024-3-8', 0.5, 30, 'OTHER');
|
||||
insert into time_off (id, version, category, date, duration, expiration, type)
|
||||
values ('c23e4567-e89b-12d3-a456-42661417401d', 1, 'DIA_DE_LA_MUJER_NACIONAL', '2024-10-11', 0.5, 30, 'OTHER');
|
||||
|
||||
INSERT INTO time_off (id, version, category, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417400c', 1, 'CUMPLEAÑOS', 0.5, 0.5, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417400d', 1, 'MATERNIDAD', 90, 90, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417400e', 1, 'PATERNIDAD', 3, 3, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417400f', 1, 'MATRIMONIO', 3, 3, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, duration, expiration, type) VALUES ('550e8400-e29b-41d4-a716-446655440000', 1, 'DUELO_1ER_GRADO', 3, 3, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417400a', 1, 'DUELO_2ER_GRADO', 2, 2, 'OTHER');
|
||||
|
||||
INSERT INTO time_off (id, version, category, duration, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-42661417401e', 1, 'PERMISOS_DE_SALUD', 2, 360, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, expiration, type) VALUES ('490e5fbe-895b-42f8-b914-95437f7b39c0', 1, 'VACACION_GESTION_ACTUAL', 360, 'OTHER');
|
||||
INSERT INTO time_off (id, version, category, expiration, type) VALUES ('c23e4567-e89b-12d3-a456-4266141740ff', 1, 'VACACION_GESTION_ANTERIOR', 360, 'OTHER');
|
||||
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender, birthday, date_of_entry, lead_manager, role) values ('5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 1, 'bob', 'Bob', 'Test', 'ACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE', '2024-02-20', '2013-10-22', 'ben', 'ADMIN');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender, date_of_entry, role) values ('cba3efb7-32bc-44be-9fdc-fc5e4f211254', 1, 'ben', 'Ben', 'Test', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'MALE', '2016-10-23', 'USER');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender, date_of_entry) values ('e99b7af5-7d3a-4c0f-b8bc-e8d0388d8fc4', 1, 'jperez', 'Juan', 'Perez Condori', 'INACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MALE', '2022-10-22');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender, date_of_entry) values ('f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 1, 'agarcia', 'Ana', 'Garcia Rojas', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FEMALE', '2024-10-24');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('2e2293b1-3f9a-4f3d-abc8-32639b0a5e15', 1, 'clopez', 'Carlos', 'Lopez Mendoza', 'INACTIVE', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('4b1c6c35-4627-4b35-b6e9-dc75c68b2c31', 1, 'mfernandez', 'Maria', 'Fernandez Villca', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('afc5c741-f70a-4394-853b-39d51b118927', 1, 'lgutierrez', 'Luis', 'Gutierrez Mamani', 'ACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('b2436b82-7b9f-4f0d-9463-f2c3173a45c3', 1, 'lmartinez', 'Laura', 'Martinez Paredes', 'INACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('6e6a8a4e-9f6b-44eb-8c69-40acfdc86756', 1, 'rsantos', 'Roberto', 'Santos Escobar', 'ACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('36b0d1c6-bdc0-4d98-94bb-08b9bce3f0d5', 1, 'vmorales', 'Valeria', 'Morales Ochoa', 'INACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('5a1c6d80-58b3-43e3-a5a5-24b4a2d1d54a', 1, 'jramirez', 'Jorge', 'Ramirez Tapia', 'ACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('9d6a5b2e-6d0b-4b89-8d6a-d3f3d1bfc047', 1, 'storres', 'Sandra', 'Torres Huanca', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('f8b3e0c0-0d5a-4e5c-bf9d-207b9b5e8279', 1, 'fquispe', 'Felipe', 'Quispe Huanca', 'INACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('cd80e1d0-9a08-44a6-bd63-2c63eaa003d4', 1, 'grivas', 'Gabriela', 'Rivas Arana', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('62d3c1b7-815e-4e96-8d7e-f8c4236bca55', 1, 'oflores', 'Oscar', 'Flores Quiroga', 'INACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('f20b7c5a-5a67-44f0-9ec1-4c1b8e80de05', 1, 'mvargas', 'Marta', 'Vargas Soria', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('19b5a76e-d7b1-4b76-8b02-4d0748e85809', 1, 'aespinoza', 'Andres', 'Espinoza Chura', 'INACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender) values ('5c1a7b82-832d-4f24-8377-54b77b91b6a8', 1, 'cvillanueva', 'Carla', 'Villanueva Arce', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FEMALE');
|
||||
insert into time_off (id, version, category, duration, expiration, type) values ('c23e4567-e89b-12d3-a456-42661417400c', 1, 'CUMPLEAÑOS', 0.5, 0.5, 'OTHER');
|
||||
insert into time_off (id, version, category, duration, expiration, type) values ('c23e4567-e89b-12d3-a456-42661417400d', 1, 'MATERNIDAD', 90, 90, 'OTHER');
|
||||
insert into time_off (id, version, category, duration, expiration, type) values ('c23e4567-e89b-12d3-a456-42661417400e', 1, 'PATERNIDAD', 3, 3, 'OTHER');
|
||||
insert into time_off (id, version, category, duration, expiration, type) values ('c23e4567-e89b-12d3-a456-42661417400f', 1, 'MATRIMONIO', 3, 3, 'OTHER');
|
||||
insert into time_off (id, version, category, duration, expiration, type) values ('550e8400-e29b-41d4-a716-446655440000', 1, 'DUELO_1ER_GRADO', 3, 3, 'OTHER');
|
||||
insert into time_off (id, version, category, duration, expiration, type) values ('c23e4567-e89b-12d3-a456-42661417400a', 1, 'DUELO_2ER_GRADO', 2, 2, 'OTHER');
|
||||
insert into time_off (id, version, category, duration, expiration, type) values ('c23e4567-e89b-12d3-a456-42661417401e', 1, 'PERMISOS_DE_SALUD', 2, 360, 'OTHER');
|
||||
insert into time_off (id, version, category, expiration, type) values ('490e5fbe-895b-42f8-b914-95437f7b39c0', 1, 'VACACION_GESTION_ACTUAL', 360, 'OTHER');
|
||||
insert into time_off (id, version, category, expiration, type) values ('c23e4567-e89b-12d3-a456-4266141740ff', 1, 'VACACION_GESTION_ANTERIOR', 360, 'OTHER');
|
||||
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender, birthday, date_of_entry, lead_manager, role)
|
||||
values ('5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 1, 'bob', 'Bob', 'Test', 'ACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE', '2024-02-20', '2013-10-22', 'ben', 'ADMIN');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender, date_of_entry, role)
|
||||
values ('cba3efb7-32bc-44be-9fdc-fc5e4f211254', 1, 'ben', 'Ben', 'Test', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'MALE', '2016-10-23', 'USER');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender, date_of_entry)
|
||||
values ('e99b7af5-7d3a-4c0f-b8bc-e8d0388d8fc4', 1, 'jperez', 'Juan', 'Perez Condori', 'INACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MALE', '2022-10-22');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender, date_of_entry)
|
||||
values ('f6ab3c6d-7078-45f6-9b22-4e37637bfec6', 1, 'agarcia', 'Ana', 'Garcia Rojas', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FEMALE', '2024-10-24');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('2e2293b1-3f9a-4f3d-abc8-32639b0a5e15', 1, 'clopez', 'Carlos', 'Lopez Mendoza', 'INACTIVE', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('4b1c6c35-4627-4b35-b6e9-dc75c68b2c31', 1, 'mfernandez', 'Maria', 'Fernandez Villca', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('afc5c741-f70a-4394-853b-39d51b118927', 1, 'lgutierrez', 'Luis', 'Gutierrez Mamani', 'ACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('b2436b82-7b9f-4f0d-9463-f2c3173a45c3', 1, 'lmartinez', 'Laura', 'Martinez Paredes', 'INACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('6e6a8a4e-9f6b-44eb-8c69-40acfdc86756', 1, 'rsantos', 'Roberto', 'Santos Escobar', 'ACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('36b0d1c6-bdc0-4d98-94bb-08b9bce3f0d5', 1, 'vmorales', 'Valeria', 'Morales Ochoa', 'INACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('5a1c6d80-58b3-43e3-a5a5-24b4a2d1d54a', 1, 'jramirez', 'Jorge', 'Ramirez Tapia', 'ACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('9d6a5b2e-6d0b-4b89-8d6a-d3f3d1bfc047', 1, 'storres', 'Sandra', 'Torres Huanca', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('f8b3e0c0-0d5a-4e5c-bf9d-207b9b5e8279', 1, 'fquispe', 'Felipe', 'Quispe Huanca', 'INACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('cd80e1d0-9a08-44a6-bd63-2c63eaa003d4', 1, 'grivas', 'Gabriela', 'Rivas Arana', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('62d3c1b7-815e-4e96-8d7e-f8c4236bca55', 1, 'oflores', 'Oscar', 'Flores Quiroga', 'INACTIVE', 'c3a8a7b1-f2d9-48c0-86ea-f215c2e6b3a3', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('f20b7c5a-5a67-44f0-9ec1-4c1b8e80de05', 1, 'mvargas', 'Marta', 'Vargas Soria', 'ACTIVE', '8f6b61e7-efb2-4de7-b8ed-7438c9d8babe', 'FEMALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('19b5a76e-d7b1-4b76-8b02-4d0748e85809', 1, 'aespinoza', 'Andres', 'Espinoza Chura', 'INACTIVE','b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa', 'MALE');
|
||||
insert into employee (id, version, username, first_name, last_name, status, team_id, gender)
|
||||
values ('5c1a7b82-832d-4f24-8377-54b77b91b6a8', 1, 'cvillanueva', 'Carla', 'Villanueva Arce', 'ACTIVE', '6d63bc15-3f8b-46f7-9cf1-7e9b0b9a2b28', 'FEMALE');
|
||||
|
||||
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', 'PATERNIDAD', 'APROBADO', 3, '2024-10-03', '2024-10-01', '2024-10-03', 3, 0);
|
||||
@ -86,4 +118,4 @@ insert into time_off_request (id, version, employee_id, category, state, availab
|
||||
values ('89bc4b2a-943f-487c-a9f3-bacf78145e67', 1, 'cba3efb7-32bc-44be-9fdc-fc5e4f211254', 'LUNES_CARNAVAL', 'APROBADO', 1, '2024-02-12', '2024-02-12', '2024-02-12', 1, 0);
|
||||
|
||||
insert into timesheet_entry (id, version, task, details, date, hours, employee_id, team_id)
|
||||
values ('389389ce-7b2e-4f39-aa06-2a251a2b35ea', 0, 'coding', 'meet', '2024-11-27', 4, '5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa');
|
||||
values ('389389ce-7b2e-4f39-aa06-2a251a2b35ea', 0, 'coding', 'meet', '2024-12-30', 4, '5c6f11fe-c341-4be7-a9a6-bba0081ad7c6', 'b0e8f394-78c1-4d8a-9c57-dc6e8b36a5fa');
|
Loading…
x
Reference in New Issue
Block a user