Traducir modulo documentos
This commit is contained in:
parent
bf3fadbae3
commit
e72bca0d39
@ -1,36 +1,35 @@
|
||||
package com.primefactorsolutions.model;
|
||||
|
||||
public enum DocumentType {
|
||||
All,
|
||||
ID_CARD,
|
||||
PAY_STUB,
|
||||
PAY_SLIPS,
|
||||
EMPLOYMENT_CONTRACT,
|
||||
WORK_CERTIFICATES,
|
||||
TODOS,
|
||||
CARNET_DE_IDENTIDAD,
|
||||
RECIBOS_DE_PAGO,
|
||||
CONTRATO_DE_TRABAJO,
|
||||
CERTIFICADO_DE_TRABAJO,
|
||||
NDA,
|
||||
MEMORANDUMS,
|
||||
CONTRACT_APPROVAL_MTEPS,
|
||||
BACKGROUND_CHECK_CERTIFICATE,
|
||||
PRE_EMPLOYMENT_EVALUATION,
|
||||
INSURANCE_REGISTRATION_FORM,
|
||||
INSURANCE_CANCELLATION_FORM,
|
||||
PROFESSIONAL_DEGREE_1,
|
||||
PROFESSIONAL_CERTIFICATE_1,
|
||||
PROFESSIONAL_DEGREE_2,
|
||||
PROFESSIONAL_CERTIFICATE_2,
|
||||
PROFESSIONAL_DEGREE_3,
|
||||
PROFESSIONAL_CERTIFICATE_3,
|
||||
GENERAL_LABOR_REGULATIONS,
|
||||
REMOTE_WORK_GUIDELINES,
|
||||
SAFETY_REGULATIONS,
|
||||
HUMAN_RESOURCES_GUIDELINES,
|
||||
ADMINISTRATION_FUNCTIONS_MANUAL,
|
||||
ENGINEERING_FUNCTIONS_MANUAL,
|
||||
GENERAL_LABOR_LAW,
|
||||
SUPREME_DECREE,
|
||||
REGULATORY_RESOLUTION,
|
||||
COMPLEMENTARY_REGULATION,
|
||||
HEALTH_SAFETY_LAW,
|
||||
INTERNSHIP_RULES,
|
||||
OTHER
|
||||
MEMORÁNDUMS,
|
||||
APROBACIÓN_DE_CONTRATO_MTEPS,
|
||||
CERTIFICADO_DE_ANTECEDENTES,
|
||||
EVALUACIÓN_PRE_EMPLEO,
|
||||
FORMULARIO_DE_INSCRIPCIÓN_AL_SEGURO,
|
||||
FORMULARIO_DE_CANCELACIÓN_DE_SEGURO,
|
||||
TÍTULO_PROFESIONAL_1,
|
||||
CERTIFICACIÓN_PROFESIONAL_1,
|
||||
TÍTULO_PROFESIONAL_2,
|
||||
CERTIFICACIÓN_PROFECIONAL_2,
|
||||
TÍTULO_PROFESIONAL_3,
|
||||
CERTIFICACIÓN_PROFECIONAL_3,
|
||||
NORMATIVA_LABORAL_GENERAL,
|
||||
NORMAS_DE_TRABAJO_REMOTO,
|
||||
NORMAS_DE_SEGURIDAD,
|
||||
INSTRUCTIVOS_DE_RECURSOS_HUMANOS,
|
||||
MANUAL_DE_FUNCIONES_DE_ADMINISTRACIÓN,
|
||||
MANUAL_DE_FUNCIONES_DE_INGENIERÍA,
|
||||
LEY_GENERAL_DEL_TRABAJO,
|
||||
DECRETOS_SUPREMOS,
|
||||
RESOLUCIONES_O_DISPOSICIONES_REGLAMENTARIAS,
|
||||
NORMATIVA_COMPLEMENTARIA,
|
||||
LEY_GRAL_DE_HIGIENE_SALUD_SEGURIDAD_OCUPACIONAL_Y_BIENESTAR,
|
||||
NORMATIVA_REGLAMENTARIA_PARA_DESARROLLO_DE_PASANTÍAS,
|
||||
OTROS
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ import java.io.InputStream;
|
||||
@PageTitle("Document")
|
||||
@Route(value = "/documents/:documentId?/:action?", layout = MainLayout.class)
|
||||
public class DocumentView extends BeanValidationForm<Document> implements HasUrlParameter<String> {
|
||||
private final TextField fileName = new TextField("Document Name");
|
||||
private final ComboBox<DocumentType> documentType = new ComboBox<>("Document Type");
|
||||
private final ComboBox<Employee> employeeComboBox = new ComboBox<>("Employee");
|
||||
private final TextField fileName = new TextField("Nombre del documento");
|
||||
private final ComboBox<DocumentType> documentType = new ComboBox<>("Tipo de documento");
|
||||
private final ComboBox<Employee> employeeComboBox = new ComboBox<>("Empleado");
|
||||
private final MemoryBuffer buffer = new MemoryBuffer();
|
||||
private final Upload uploadButton = new Upload(buffer);
|
||||
private final DocumentService documentService;
|
||||
@ -68,19 +68,19 @@ public class DocumentView extends BeanValidationForm<Document> implements HasUrl
|
||||
}
|
||||
|
||||
protected Button createSaveButton() {
|
||||
saveButton = new Button("Save");
|
||||
saveButton = new Button("Guardar");
|
||||
saveButton.addClickListener(event -> saveDocument());
|
||||
return saveButton;
|
||||
}
|
||||
|
||||
protected Button createCloseButton() {
|
||||
Button closeButton = new Button("Close");
|
||||
Button closeButton = new Button("Salir");
|
||||
closeButton.addClickListener(event -> closeForm());
|
||||
return closeButton;
|
||||
}
|
||||
|
||||
protected Button createViewDocumentButton() {
|
||||
viewDocumentButton = new Button("View Document");
|
||||
viewDocumentButton = new Button("Ver documento");
|
||||
viewDocumentButton.setEnabled(false);
|
||||
viewDocumentButton.addClickListener(event -> viewDocument());
|
||||
return viewDocumentButton;
|
||||
@ -130,7 +130,7 @@ public class DocumentView extends BeanValidationForm<Document> implements HasUrl
|
||||
ui.getPage().open(registration.getResourceUri().toString());
|
||||
});
|
||||
} catch (IOException e) {
|
||||
Notification.show("Error reading file.");
|
||||
Notification.show("Error al leer el archivo.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,10 +148,10 @@ public class DocumentView extends BeanValidationForm<Document> implements HasUrl
|
||||
setDocumentCreator(document);
|
||||
|
||||
documentService.saveDocument(document);
|
||||
Notification.show("File saved successfully.");
|
||||
Notification.show("Archivo guardado correctamente.");
|
||||
clearForm();
|
||||
} else {
|
||||
Notification.show("Save failed: Please complete all fields and upload a file.");
|
||||
Notification.show("Error al guardar: Por favor, complete todos los campos y cargue un archivo.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ public class DocumentView extends BeanValidationForm<Document> implements HasUrl
|
||||
try {
|
||||
return buffer.getInputStream().readAllBytes();
|
||||
} catch (IOException e) {
|
||||
Notification.show("Error reading file data.");
|
||||
Notification.show("Error al leer los datos del archivo.");
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
@ -220,13 +220,13 @@ public class DocumentView extends BeanValidationForm<Document> implements HasUrl
|
||||
uploadButton.setAcceptedFileTypes(".pdf");
|
||||
uploadButton.addSucceededListener(event -> {
|
||||
fileUploaded = true;
|
||||
Notification.show("File uploaded successfully.");
|
||||
Notification.show("Archivo cargado correctamente.");
|
||||
viewDocumentButton.setEnabled(true);
|
||||
updateSaveButtonState();
|
||||
});
|
||||
uploadButton.getElement().addEventListener("file-remove", event -> {
|
||||
fileUploaded = false;
|
||||
Notification.show("File removed.");
|
||||
Notification.show("Archivo eliminado.");
|
||||
viewDocumentButton.setEnabled(false);
|
||||
updateSaveButtonState();
|
||||
});
|
||||
|
@ -47,7 +47,7 @@ public class DocumentsListView extends BaseView {
|
||||
}
|
||||
|
||||
private void initializeView() {
|
||||
getCurrentPageLayout().add(createActionButton("Add Document", this::navigateToAddDocumentView));
|
||||
getCurrentPageLayout().add(createActionButton("Añadir documento", this::navigateToAddDocumentView));
|
||||
|
||||
final HorizontalLayout hl = new HorizontalLayout();
|
||||
hl.add(createDocumentTypeFilter());
|
||||
@ -61,7 +61,10 @@ public class DocumentsListView extends BaseView {
|
||||
|
||||
private void configureDocumentGrid() {
|
||||
documentGrid.setColumns("fileName", "documentType", "creator");
|
||||
documentGrid.addComponentColumn(this::createEmployeeSpan).setHeader("Employee");
|
||||
documentGrid.getColumnByKey("fileName").setHeader("Nombre archivo");
|
||||
documentGrid.getColumnByKey("documentType").setHeader("Tipo");
|
||||
documentGrid.getColumnByKey("creator").setHeader("Creador");
|
||||
documentGrid.addComponentColumn(this::createEmployeeSpan).setHeader("Empleado");
|
||||
addActionColumns();
|
||||
configurePagination();
|
||||
}
|
||||
@ -73,9 +76,9 @@ public class DocumentsListView extends BaseView {
|
||||
}
|
||||
|
||||
private void addActionColumns() {
|
||||
addDocumentActionColumn("View", this::navigateToDocumentView);
|
||||
addDocumentActionColumn("Edit", this::navigateToEditDocumentView);
|
||||
addDocumentActionColumn("Download", this::downloadDocument);
|
||||
addDocumentActionColumn("Ver", this::navigateToDocumentView);
|
||||
addDocumentActionColumn("Editar", this::navigateToEditDocumentView);
|
||||
addDocumentActionColumn("Descargar", this::downloadDocument);
|
||||
}
|
||||
|
||||
private void addDocumentActionColumn(final String label, final DocumentActionHandler handler) {
|
||||
@ -89,7 +92,7 @@ public class DocumentsListView extends BaseView {
|
||||
}
|
||||
|
||||
private ComboBox<DocumentType> createDocumentTypeFilter() {
|
||||
documentTypeFilter = new ComboBox<>("Document Type");
|
||||
documentTypeFilter = new ComboBox<>("Tipo de documento");
|
||||
documentTypeFilter.setItems(DocumentType.values());
|
||||
documentTypeFilter.setValue(DocumentType.values()[0]);
|
||||
documentTypeFilter.addValueChangeListener(event -> {
|
||||
@ -99,7 +102,7 @@ public class DocumentsListView extends BaseView {
|
||||
}
|
||||
|
||||
private ComboBox<Employee> createEmployeeFilter() {
|
||||
employeeFilter = new ComboBox<>("Employee");
|
||||
employeeFilter = new ComboBox<>("Empleado");
|
||||
List<Employee> employees = employeeService.findAllEmployees();
|
||||
employees.addFirst(createAllEmployeesOption());
|
||||
employeeFilter.setItems(employees);
|
||||
@ -113,12 +116,12 @@ public class DocumentsListView extends BaseView {
|
||||
|
||||
private Employee createAllEmployeesOption() {
|
||||
Employee allEmployeesOption = new Employee();
|
||||
allEmployeesOption.setFirstName("All");
|
||||
allEmployeesOption.setFirstName("TODOS");
|
||||
return allEmployeesOption;
|
||||
}
|
||||
|
||||
private String getEmployeeLabel(final Employee employee) {
|
||||
return employee.getFirstName().equals("All") ? "All" : employee.getFirstName() + " " + employee.getLastName();
|
||||
return employee.getFirstName().equals("TODOS") ? "TODOS" : employee.getFirstName() + " " + employee.getLastName();
|
||||
}
|
||||
|
||||
private void navigateToEditDocumentView(final Document document) {
|
||||
|
@ -246,7 +246,8 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
|
||||
private double calculateHolidayUtilizedDays(final int year) {
|
||||
return requests.stream()
|
||||
.filter(this::verificationIsHoliday)
|
||||
.filter(req -> req.getState() == TimeOffRequestStatus.TOMADO || req.getState() == TimeOffRequestStatus.APROBADO)
|
||||
.filter(req -> req.getState() == TimeOffRequestStatus.TOMADO
|
||||
|| req.getState() == TimeOffRequestStatus.APROBADO)
|
||||
.filter(req -> getStartDateYear(req) == year)
|
||||
.mapToDouble(TimeOffRequest::getDaysToBeTake)
|
||||
.sum();
|
||||
@ -255,7 +256,8 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
|
||||
private double calculatePersonalDaysUtilized(final boolean isMale, final int year) {
|
||||
return requests.stream()
|
||||
.filter(req -> !verificationIsHoliday(req))
|
||||
.filter(req -> req.getState() == TimeOffRequestStatus.TOMADO || req.getState() == TimeOffRequestStatus.APROBADO)
|
||||
.filter(req -> req.getState() == TimeOffRequestStatus.TOMADO
|
||||
|| req.getState() == TimeOffRequestStatus.APROBADO)
|
||||
.filter(req -> !getStandardExclusions().contains(req.getCategory()))
|
||||
.filter(req -> !(isMale && getMaleSpecificExclusions().contains(req.getCategory())))
|
||||
.filter(req -> !req.getCategory().name().startsWith("VACACION"))
|
||||
|
@ -94,7 +94,8 @@ public class RequestRegisterView extends VerticalLayout {
|
||||
});
|
||||
startDatePicker.addValueChangeListener(event -> {
|
||||
LocalDate selectedDate = event.getValue();
|
||||
if (selectedDate != null && (selectedDate.getDayOfWeek().getValue() == 6 || selectedDate.getDayOfWeek().getValue() == 7)) {
|
||||
if (selectedDate != null && (selectedDate.getDayOfWeek().getValue() == 6
|
||||
|| selectedDate.getDayOfWeek().getValue() == 7)) {
|
||||
startDatePicker.setValue(selectedDate.minusDays(1));
|
||||
}
|
||||
updateDatePickerMinValues();
|
||||
@ -104,7 +105,8 @@ public class RequestRegisterView extends VerticalLayout {
|
||||
endDatePicker.setMin(startDatePicker.getValue());
|
||||
}
|
||||
LocalDate selectedDate = event.getValue();
|
||||
if (selectedDate != null && (selectedDate.getDayOfWeek().getValue() == 6 || selectedDate.getDayOfWeek().getValue() == 7)) {
|
||||
if (selectedDate != null && (selectedDate.getDayOfWeek().getValue() == 6
|
||||
|| selectedDate.getDayOfWeek().getValue() == 7)) {
|
||||
endDatePicker.setValue(selectedDate.minusDays(1));
|
||||
}
|
||||
calculateDays();
|
||||
@ -424,7 +426,7 @@ public class RequestRegisterView extends VerticalLayout {
|
||||
return startDate != null && endDate != null;
|
||||
}
|
||||
|
||||
private long countWorkDaysBetween(LocalDate startDate, LocalDate endDate) {
|
||||
private long countWorkDaysBetween(final LocalDate startDate, final LocalDate endDate) {
|
||||
return startDate.datesUntil(endDate.plusDays(1))
|
||||
.filter(date -> date.getDayOfWeek() != DayOfWeek.SATURDAY && date.getDayOfWeek() != DayOfWeek.SUNDAY)
|
||||
.count();
|
||||
@ -506,7 +508,9 @@ public class RequestRegisterView extends VerticalLayout {
|
||||
Notification.show("Solicitud guardada correctamente.");
|
||||
closeForm();
|
||||
} else {
|
||||
Notification.show("La fecha de inicio debe encontrarse dentro del rango de 15 días a 3 meses de anticipación.");
|
||||
Notification.show(
|
||||
"La fecha de inicio debe encontrarse dentro del rango de 15 días a 3 meses de anticipación."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,8 @@ public class RequestsListView extends BaseView {
|
||||
int currentYear = LocalDate.now().getYear();
|
||||
return employeeRequests.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(request -> request.getState() == TimeOffRequestStatus.APROBADO || request.getState() == TimeOffRequestStatus.TOMADO)
|
||||
.filter(request -> request.getState() == TimeOffRequestStatus.APROBADO
|
||||
|| request.getState() == TimeOffRequestStatus.TOMADO)
|
||||
.filter(request -> request.getCategory() != TimeOffRequestType.PERMISOS_DE_SALUD)
|
||||
.filter(request -> request.getCategory() != TimeOffRequestType.VACACION_GESTION_ACTUAL)
|
||||
.filter(request -> request.getCategory() != TimeOffRequestType.VACACION_GESTION_ANTERIOR)
|
||||
|
Loading…
Reference in New Issue
Block a user