From f3bda474d0dad80474ff54654bd13fa00e888483 Mon Sep 17 00:00:00 2001 From: ricardo051199 Date: Tue, 24 Sep 2024 19:07:58 -0400 Subject: [PATCH] #32 Perfil de Personal Administrativo - VER Documento --- .../com/primefactorsolutions/views/DocumentView.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/primefactorsolutions/views/DocumentView.java b/src/main/java/com/primefactorsolutions/views/DocumentView.java index 4b9014f..b2b84ca 100644 --- a/src/main/java/com/primefactorsolutions/views/DocumentView.java +++ b/src/main/java/com/primefactorsolutions/views/DocumentView.java @@ -157,9 +157,21 @@ public class DocumentView extends BeanValidationForm implements HasUrl UUID documentId = UUID.fromString(s); var document = documentService.getDocument(documentId); setEntityWithEnabledSave(document); + + if ("edit".equals(action) && !s.isEmpty()) { + setFieldsReadOnly(false); + } else if ("view".equals(action) && !s.isEmpty()) { + setFieldsReadOnly(true); + } } } + private void setFieldsReadOnly(final boolean option) { + fileName.setReadOnly(option); + documentType.setReadOnly(option); + employeeComboBox.setReadOnly(option); + } + @Override protected List getFormComponents() { return List.of(title, fileName, documentType, employeeComboBox, uploadButton, createCloseButton());