@ -9,6 +9,7 @@ import com.vaadin.flow.component.datepicker.DatePicker;
import com.vaadin.flow.component.dependency.CssImport ;
import com.vaadin.flow.component.dependency.CssImport ;
import com.vaadin.flow.component.html.H1 ;
import com.vaadin.flow.component.html.H1 ;
import com.vaadin.flow.component.html.H2 ;
import com.vaadin.flow.component.html.H2 ;
import com.vaadin.flow.component.html.Image ;
import com.vaadin.flow.component.html.Span ;
import com.vaadin.flow.component.html.Span ;
import com.vaadin.flow.component.icon.Icon ;
import com.vaadin.flow.component.icon.Icon ;
import com.vaadin.flow.component.icon.VaadinIcon ;
import com.vaadin.flow.component.icon.VaadinIcon ;
@ -72,7 +73,7 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse
private RadioButtonGroup < String > masActualizacionesGroup ;
private RadioButtonGroup < String > masActualizacionesGroup ;
private SignaturePad userSignPad ;
private SignaturePad userSignPad ;
private SignaturePad smtSignPad ;
private SignaturePad smtSignPad ;
private SignaturePad gciatiSignPad ;
/ / private SignaturePad gciatiSignPad ;
Span userSignSpan = new Span ( "Nombre Usuario" ) ;
Span userSignSpan = new Span ( "Nombre Usuario" ) ;
@ -459,17 +460,15 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse
smtSignLayout . add ( smtSignPad , smtSignSpan , tituloSMT ) ;
smtSignLayout . add ( smtSignPad , smtSignSpan , tituloSMT ) ;
VerticalLayout gcialSignLayout = new VerticalLayout ( ) ;
VerticalLayout gcialSignLayout = new VerticalLayout ( ) ;
gciatiSignPad = new SignaturePad ( ) ;
gciatiSignPad . setBackgroundColor ( "#FFFFFF" ) ;
gciatiSignPad . setHeight ( "200px" ) ;
gciatiSignPad . setPenColor ( "#000000" ) ;
gciatiSignPad . getElement ( ) . getStyle ( ) . set ( "border" , "1px solid black" ) ;
Span gciatiSignSpan = new Span ( "L.I. David Olivares Ramos" ) ;
Span tituloGerente = new Span ( "Encargado de Despacho Gcia. T.I" ) ;
Image firmaGcia = new Image ( "images/firmaGcia.png" , "Firma Gerente de Sistemas" ) ;
firmaGcia . setHeight ( "200px" ) ;
firmaGcia . setWidthFull ( ) ;
Span gciatiSignSpan = new Span ( "Lic. Juan Pablo Torres Alvárez" ) ;
Span tituloGerente = new Span ( "Gerente de T.I" ) ;
gcialSignLayout . setSizeFull ( ) ;
gcialSignLayout . setSizeFull ( ) ;
gcialSignLayout . setSpacing ( false ) ;
gcialSignLayout . setSpacing ( false ) ;
gcialSignLayout . setAlignItems ( Alignment . CENTER ) ;
gcialSignLayout . setAlignItems ( Alignment . CENTER ) ;
gcialSignLayout . add ( gciatiSignPad , gciatiSignSpan , tituloGerente ) ;
gcialSignLayout . add ( firmaGcia , gciatiSignSpan , tituloGerente ) ;
@ -526,15 +525,15 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse
byte [ ] userSignatureBytes = userSignPad . getImageBase64 ( ) ;
byte [ ] userSignatureBytes = userSignPad . getImageBase64 ( ) ;
byte [ ] smtSignatureBytes = smtSignPad . getImageBase64 ( ) ;
byte [ ] smtSignatureBytes = smtSignPad . getImageBase64 ( ) ;
byte [ ] gciaSignatureBytes = gciatiSignPad . getImageBase64 ( ) ;
/ / byte [ ] gciaSignatureBytes = gciatiSignPad . getImageBase64 ( ) ;
String userSignatureBase64 = Base64 . getEncoder ( ) . encodeToString ( userSignatureBytes ) ;
String userSignatureBase64 = Base64 . getEncoder ( ) . encodeToString ( userSignatureBytes ) ;
String smtSignatureBase64 = Base64 . getEncoder ( ) . encodeToString ( smtSignatureBytes ) ;
String smtSignatureBase64 = Base64 . getEncoder ( ) . encodeToString ( smtSignatureBytes ) ;
String gciaSignatureBase64 = Base64 . getEncoder ( ) . encodeToString ( gciaSignatureBytes ) ;
/ / String gciaSignatureBase64 = Base64 . getEncoder ( ) . encodeToString ( gciaSignatureBytes ) ;
if ( esFirmaVacia ( userSignatureBase64 ) ) userSignatureBase64 = null ;
if ( esFirmaVacia ( userSignatureBase64 ) ) userSignatureBase64 = null ;
if ( esFirmaVacia ( smtSignatureBase64 ) ) smtSignatureBase64 = null ;
if ( esFirmaVacia ( smtSignatureBase64 ) ) smtSignatureBase64 = null ;
if ( esFirmaVacia ( gciaSignatureBase64 ) ) gciaSignatureBase64 = null ;
/ / if ( esFirmaVacia ( gciaSignatureBase64 ) ) gciaSignatureBase64 = null ;
/ / Validación de campos de hardware
/ / Validación de campos de hardware
@ -585,7 +584,7 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse
/ / Una vez que validamos todos los campos del formulario , procedemos a insertar en BD
/ / Una vez que validamos todos los campos del formulario , procedemos a insertar en BD
try {
try {
int isInserted = databaseService . insertarMantenimiento ( fechaSeleccionada , tipoMantId , departamentoId , empleadoId , formaMantt , equipoId , userSignatureBase64 , smtSignatureBase64 , gciaSignatureBase64 , planAnualValue ) ;
int isInserted = databaseService . insertarMantenimiento ( fechaSeleccionada , tipoMantId , departamentoId , empleadoId , formaMantt , equipoId , userSignatureBase64 , smtSignatureBase64 , planAnualValue ) ;
if ( isInserted < = 0 ) {
if ( isInserted < = 0 ) {
Notification . show ( "Error al guardar el mantenimiento" , 4000 , Notification . Position . MIDDLE )
Notification . show ( "Error al guardar el mantenimiento" , 4000 , Notification . Position . MIDDLE )
@ -654,7 +653,7 @@ public class MantenimientoView extends VerticalLayout implements BeforeEnterObse
txtCuales . clear ( ) ;
txtCuales . clear ( ) ;
userSignPad . clear ( ) ;
userSignPad . clear ( ) ;
smtSignPad . clear ( ) ;
smtSignPad . clear ( ) ;
gciatiSignPad . clear ( ) ;
/ / gciatiSignPad . clear ( ) ;
for ( HorizontalLayout layout : hardwareLayouts ) {
for ( HorizontalLayout layout : hardwareLayouts ) {
( ( ComboBox < ? > ) layout . getComponentAt ( 0 ) ) . clear ( ) ;
( ( ComboBox < ? > ) layout . getComponentAt ( 0 ) ) . clear ( ) ;