diff --git a/package-lock.json b/package-lock.json index 392fdbe..b55c854 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,8 @@ "proj4": "2.11.0", "react": "18.3.1", "react-dom": "18.3.1", - "react-router-dom": "6.23.1" + "react-router-dom": "6.23.1", + "signature_pad": "4.1.5" }, "devDependencies": { "@babel/preset-react": "7.24.7", @@ -7945,6 +7946,11 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/signature_pad": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/signature_pad/-/signature_pad-4.1.5.tgz", + "integrity": "sha512-VOE846UbQMeLBbcR08KwjwE1wNLgp3gqC7yr/AELkgSMs/BdRpxIZna6K5XyZJpA7IWq9GiInw1C8PLm57VO6Q==" + }, "node_modules/smob": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", @@ -15275,6 +15281,11 @@ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true }, + "signature_pad": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/signature_pad/-/signature_pad-4.1.5.tgz", + "integrity": "sha512-VOE846UbQMeLBbcR08KwjwE1wNLgp3gqC7yr/AELkgSMs/BdRpxIZna6K5XyZJpA7IWq9GiInw1C8PLm57VO6Q==" + }, "smob": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", diff --git a/package.json b/package.json index aa5047d..c145ba8 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "proj4": "2.11.0", "react": "18.3.1", "react-dom": "18.3.1", - "react-router-dom": "6.23.1" + "react-router-dom": "6.23.1", + "signature_pad": "4.1.5" }, "devDependencies": { "@babel/preset-react": "7.24.7", @@ -63,7 +64,8 @@ "proj4": "2.11.0", "react": "18.3.1", "react-dom": "18.3.1", - "react-router-dom": "6.23.1" + "react-router-dom": "6.23.1", + "signature_pad": "4.1.5" }, "devDependencies": { "@babel/preset-react": "7.24.7", @@ -85,7 +87,7 @@ "workbox-core": "7.1.0", "workbox-precaching": "7.1.0" }, - "hash": "f06d8005ffcc9d94c8e92e1b762dd0aac0e0103be3ed4f2479d1479a7d1846ec" + "hash": "cecfde44fdf74f05a518ad5c890570bd04aa35ca261dade379aac8545a81171b" }, "overrides": { "@vaadin/bundles": "$@vaadin/bundles", @@ -106,6 +108,7 @@ "proj4": "$proj4", "@vaadin/vaadin-themable-mixin": "$@vaadin/vaadin-themable-mixin", "@vaadin/vaadin-lumo-styles": "$@vaadin/vaadin-lumo-styles", - "@vaadin/vaadin-material-styles": "$@vaadin/vaadin-material-styles" + "@vaadin/vaadin-material-styles": "$@vaadin/vaadin-material-styles", + "signature_pad": "$signature_pad" } } diff --git a/pom.xml b/pom.xml index c7f2db9..cee55ff 100644 --- a/pom.xml +++ b/pom.xml @@ -123,6 +123,11 @@ vaadin-testbench-junit5 test + + de.f0rce.signaturepad + signature-widget + 3.1.0 + diff --git a/src/main/bundles/dev.bundle b/src/main/bundles/dev.bundle index 813660c..2207835 100644 Binary files a/src/main/bundles/dev.bundle and b/src/main/bundles/dev.bundle differ diff --git a/src/main/java/mx/gob/jumapacelaya/ui/MantenimientoView.java b/src/main/java/mx/gob/jumapacelaya/ui/MantenimientoView.java index e66d780..ec2fbed 100644 --- a/src/main/java/mx/gob/jumapacelaya/ui/MantenimientoView.java +++ b/src/main/java/mx/gob/jumapacelaya/ui/MantenimientoView.java @@ -1,17 +1,23 @@ package mx.gob.jumapacelaya.ui; +import com.vaadin.flow.component.Component; +import com.vaadin.flow.component.UI; import com.vaadin.flow.component.button.ButtonVariant; import com.vaadin.flow.component.checkbox.CheckboxGroup; import com.vaadin.flow.component.combobox.ComboBox; import com.vaadin.flow.component.datepicker.DatePicker; import com.vaadin.flow.component.dependency.CssImport; +import com.vaadin.flow.component.html.H1; +import com.vaadin.flow.component.html.H2; import com.vaadin.flow.component.html.Span; import com.vaadin.flow.component.icon.Icon; import com.vaadin.flow.component.icon.VaadinIcon; import com.vaadin.flow.component.notification.Notification; +import com.vaadin.flow.component.orderedlayout.FlexComponent; import com.vaadin.flow.component.orderedlayout.HorizontalLayout; import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.component.radiobutton.RadioButtonGroup; +import com.vaadin.flow.component.textfield.NumberField; import com.vaadin.flow.component.textfield.TextArea; import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.component.button.Button; @@ -19,6 +25,7 @@ import com.vaadin.flow.router.BeforeEnterEvent; import com.vaadin.flow.router.BeforeEnterObserver; import com.vaadin.flow.router.PageTitle; import com.vaadin.flow.router.Route; +import de.f0rce.signaturepad.SignaturePad; import jakarta.annotation.security.PermitAll; import mx.gob.jumapacelaya.services.DatabaseService; @@ -36,14 +43,16 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse private final DatabaseService databaseService; private final VerticalLayout actualizacionesLayout; private final VerticalLayout etiquetaLayout; - private DatePicker fecha; - private ComboBox tipoMantt; + private final HorizontalLayout firmasLayout; + private final DatePicker fecha; + private final ComboBox tipoMantt; public MantenimientoView() { this.databaseService = new DatabaseService(); this.controlsLayout = new VerticalLayout(); this.actualizacionesLayout = new VerticalLayout(); this.etiquetaLayout = new VerticalLayout(); + this.firmasLayout = new HorizontalLayout(); HorizontalLayout fechaLayout = new HorizontalLayout(); //Componentes de texto @@ -107,10 +116,11 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse createHardwareSection(databaseService); addActualizacionesSection(); - correctivo(); + correctivoLayout(); + signLayout(); - add(fechaLayout, departamentoLayout, controlsLayout, actualizacionesLayout, etiquetaLayout); + add(fechaLayout, departamentoLayout, controlsLayout, actualizacionesLayout, etiquetaLayout, firmasLayout); } @@ -135,6 +145,7 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse addNuevoTipo(); } + //Metodo para agregar un nuevo ComboBox de tipo de hardware y campos de texto private void addNuevoTipo() { ComboBox tipoHardware = new ComboBox<>(); @@ -143,7 +154,7 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse tipoHardware.setPlaceholder("Tipo de hardware"); tipoHardware.setSizeFull(); - TextField noSerie = new TextField(); + NumberField noSerie = new NumberField(); noSerie.setEnabled(false); noSerie.setRequired(true); noSerie.setPlaceholder("No. Serie"); @@ -155,7 +166,7 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse modelo.setPlaceholder("Modelo"); modelo.setSizeFull(); - TextField placa = new TextField(); + NumberField placa = new NumberField(); placa.setEnabled(false); placa.setRequired(true); placa.setPlaceholder("Placa"); @@ -234,6 +245,7 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse } else { txtCuales.setEnabled(false); txtCuales.setRequired(false); + txtCuales.clear(); } }); @@ -251,7 +263,8 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse actualizacionesLayout.setSpacing(false); } - private void correctivo(){ + + private void correctivoLayout(){ Span Titulo = new Span("Reparación Realizada al Equipo: "); @@ -259,8 +272,8 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse txtModelo.setPlaceholder("Modelo"); txtModelo.setWidth("240px"); - TextField txtSerie = new TextField(); - txtSerie.setPlaceholder("Serie"); + NumberField txtSerie = new NumberField(); + txtSerie.setPlaceholder("No. Serie"); txtSerie.setWidth("240px"); TextField txtSoft = new TextField(); @@ -287,15 +300,58 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse hard.setSizeFull(); - - etiquetaLayout.setVisible(false); + etiquetaLayout.add(Titulo, model, hard); + } - etiquetaLayout.add(Titulo, model, hard); + private void signLayout() { + VerticalLayout userSignLayout = new VerticalLayout(); + SignaturePad userSignPad = new SignaturePad(); + userSignPad.setBackgroundColor(0, 0, 0, 0); + userSignPad.setHeight("200px"); + userSignPad.setPenColor("#000000"); + userSignPad.getElement().getStyle().set("border", "1px solid black"); + Span userSignSpan = new Span("Nombre Usuario"); + userSignLayout.setSizeFull(); + userSignLayout.setSpacing(true); + userSignLayout.setAlignItems(Alignment.CENTER); + userSignLayout.add(userSignPad, userSignSpan); + + VerticalLayout smtSignLayout = new VerticalLayout(); + SignaturePad smtSignPad = new SignaturePad(); + smtSignPad.setHeight("200px"); + smtSignPad.setBackgroundColor(0, 0, 0, 0); + smtSignPad.setPenColor("#000000"); + smtSignPad.getElement().getStyle().set("border", "1px solid black"); + Span smtSignSpan = new Span("S.M.T. Nombre"); + smtSignLayout.setSizeFull(); + smtSignLayout.setSpacing(true); + smtSignLayout.setAlignItems(Alignment.CENTER); + smtSignLayout.add(smtSignPad, smtSignSpan); + + VerticalLayout gcialSignLayout = new VerticalLayout(); + SignaturePad gciatiSignPad = new SignaturePad(); + gciatiSignPad.setBackgroundColor(0, 0, 0, 0); + gciatiSignPad.setHeight("200px"); + gciatiSignPad.setPenColor("#000000"); + gciatiSignPad.getElement().getStyle().set("border", "1px solid black"); + Span gciatiSignSpan = new Span("L.I. Sandra E. Rodriguez Ramirez"); + Span tituloGerente = new Span("Gerencia de Tecnologias de la Información"); + gcialSignLayout.setSizeFull(); + gcialSignLayout.setSpacing(false); + gcialSignLayout.setAlignItems(Alignment.CENTER); + gcialSignLayout.add(gciatiSignPad, gciatiSignSpan, tituloGerente); + + + + firmasLayout.add(userSignLayout, smtSignLayout, gcialSignLayout); + firmasLayout.setSizeFull(); + firmasLayout.setSpacing(false); } + @Override public void beforeEnter(BeforeEnterEvent beforeEnterEvent) { String fechaParam = beforeEnterEvent.getLocation().getQueryParameters().getParameters().get("fecha") != null diff --git a/src/main/java/mx/gob/jumapacelaya/ui/PlanAnualView.java b/src/main/java/mx/gob/jumapacelaya/ui/PlanAnualView.java index 1213c6b..1443d26 100644 --- a/src/main/java/mx/gob/jumapacelaya/ui/PlanAnualView.java +++ b/src/main/java/mx/gob/jumapacelaya/ui/PlanAnualView.java @@ -65,7 +65,7 @@ public class PlanAnualView extends VerticalLayout { planAnualGrid.addComponentColumn(plan -> getIcon(plan.getLaptop())).setHeader("Laptop").setAutoWidth(true); planAnualGrid.addComponentColumn(plan -> getIcon(plan.getEscaner())).setHeader("Escáner").setAutoWidth(true); planAnualGrid.addColumn(PlanAnual::getFecha).setHeader("Fecha Programada").setAutoWidth(true); - planAnualGrid.addColumn(PlanAnual::getSmt).setHeader("Smt").setAutoWidth(true); + planAnualGrid.addColumn(PlanAnual::getSmt).setHeader("S.M.T").setAutoWidth(true); planAnualGrid.addColumn(PlanAnual::getEstado).setHeader("Estado").setAutoWidth(true); planAnualGrid.addColumn(PlanAnual::getFechaRealizado).setHeader("Fecha Realizado").setAutoWidth(true); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 82f2fe2..ecfd8e5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -5,7 +5,7 @@ logging.level.org.atmosphere = warn vaadin.launch-browser=true # To improve the performance during development. # For more information https://vaadin.com/docs/latest/integrations/spring/configuration#special-configuration-parameters -vaadin.allowed-packages = com.vaadin,org.vaadin,mx.gob.jumapacelaya +vaadin.allowed-packages = com.vaadin,org.vaadin,mx.gob.jumapacelaya, de.f0rce.signaturepad spring.jpa.defer-datasource-initialization = true @@ -32,3 +32,4 @@ redmine.api_key=ce4dc8b6b531c818017e6831a5732ccc15b8faf6 #spring.datasource.username=root #spring.datasource.password=mantenimientos #spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +