Agregar mensaje de advertencia de tipo de documento

This commit is contained in:
jesus.pelaez 2024-11-27 00:08:26 -04:00
parent f2b24a26a4
commit 5f3e1c1f1a

View File

@ -8,6 +8,7 @@ import com.primefactorsolutions.service.EmployeeService;
import com.vaadin.flow.component.Component; import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.combobox.ComboBox; import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.notification.Notification; import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout; import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.component.textfield.TextField;
@ -42,6 +43,7 @@ public class DocumentView extends BeanValidationForm<Document> implements HasUrl
private final TextField fileName = new TextField("Nombre del documento"); private final TextField fileName = new TextField("Nombre del documento");
private final ComboBox<DocumentType> documentType = new ComboBox<>("Tipo de documento"); private final ComboBox<DocumentType> documentType = new ComboBox<>("Tipo de documento");
private final ComboBox<Employee> employeeComboBox = new ComboBox<>("Empleado"); private final ComboBox<Employee> employeeComboBox = new ComboBox<>("Empleado");
private final Span pdfOnlyMessage = new Span("Únicamente se permite la carga de archivos en formato PDF.");
private final MemoryBuffer buffer = new MemoryBuffer(); private final MemoryBuffer buffer = new MemoryBuffer();
private final Upload uploadButton = new Upload(buffer); private final Upload uploadButton = new Upload(buffer);
private final DocumentService documentService; private final DocumentService documentService;
@ -268,6 +270,6 @@ public class DocumentView extends BeanValidationForm<Document> implements HasUrl
HorizontalLayout buttonLayout = new HorizontalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.add(uploadButton, createViewDocumentButton()); buttonLayout.add(uploadButton, createViewDocumentButton());
buttonLayout.setSpacing(true); buttonLayout.setSpacing(true);
return List.of(fileName, documentType, employeeComboBox, buttonLayout, createCloseButton()); return List.of(fileName, documentType, employeeComboBox, pdfOnlyMessage, buttonLayout, createCloseButton());
} }
} }