@ -12,16 +12,12 @@ import com.vaadin.flow.component.html.Anchor;
import com.vaadin.flow.server.StreamResource ;
import mx.gob.jumapacelaya.services.ReportService ;
import org.springframework.security.core.Authentication ;
import org.springframework.cglib.core.Local ;
import org.springframework.security.core.context.SecurityContextHolder ;
import org.vaadin.lineawesome.LineAwesomeIcon ;
import com.nimbusds.jose.proc.SecurityContext ;
import com.vaadin.flow.component.button.Button ;
import com.vaadin.flow.component.combobox.ComboBox ;
import com.vaadin.flow.component.confirmdialog.ConfirmDialog ;
import com.vaadin.flow.component.dependency.CssImport ;
import com.vaadin.flow.component.dialog.Dialog ;
import com.vaadin.flow.component.grid.Grid ;
import com.vaadin.flow.component.grid.GridVariant ;
import com.vaadin.flow.component.gridpro.GridPro ;
import com.vaadin.flow.component.html.H3 ;
@ -34,8 +30,6 @@ import com.vaadin.flow.component.notification.NotificationVariant;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout ;
import com.vaadin.flow.component.orderedlayout.VerticalLayout ;
import com.vaadin.flow.component.textfield.TextField ;
import com.vaadin.flow.data.binder.Binder ;
import com.vaadin.flow.function.ValueProvider ;
import com.vaadin.flow.router.BeforeEnterEvent ;
import com.vaadin.flow.router.BeforeEnterObserver ;
import com.vaadin.flow.router.PageTitle ;
@ -51,7 +45,6 @@ import mx.gob.jumapacelaya.models.TiposMantenimiento;
import mx.gob.jumapacelaya.models.Usuario ;
import mx.gob.jumapacelaya.services.DatabaseService ;
import mx.gob.jumapacelaya.services.SecurityService ;
import oracle.net.aso.f ;
@PageTitle ( "Detalles del mantenimiento" )
@Route ( value = "detalles" , layout = MainLayout . class )
@ -70,7 +63,8 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
private TextField txtEquipo ;
private ComboBox < TiposMantenimiento > cbTipo ;
private TextField txtFecha ;
private TextField txtFechaRealizacion ;
private TextField txtFechaProgramada ;
private TextField txtSituacion ;
private ComboBox < Usuario > cbUsuario ;
private ComboBox < DepartamentosModel > cbDepartamento ;
private GridPro < HardwareDetalle > gridHardware ;
@ -144,10 +138,12 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
fechasLayout = new HorizontalLayout ( ) ;
fechasLayout . setWidthFull ( ) ;
txtFecha = new TextField ( "Fecha realización:" ) ;
txtFechaRealizacion = new TextField ( "Fecha programada:" ) ;
txtFechaProgramada = new TextField ( "Fecha programada:" ) ;
txtSituacion = new TextField ( "Situación:" ) ;
txtFecha . setReadOnly ( true ) ;
txtFechaRealizacion . setReadOnly ( true ) ;
fechasLayout . add ( txtFechaRealizacion , txtFecha ) ;
txtFechaProgramada . setReadOnly ( true ) ;
txtSituacion . setReadOnly ( true ) ;
fechasLayout . add ( txtFechaProgramada , txtFecha , txtSituacion ) ;
layout3 = new HorizontalLayout ( ) ;
layout3 . setWidthFull ( ) ;
@ -225,7 +221,6 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
txtEquipo . setReadOnly ( false ) ;
cbTipo . setReadOnly ( false ) ;
txtFecha . setReadOnly ( false ) ;
txtFechaRealizacion . setReadOnly ( false ) ;
cbUsuario . setReadOnly ( false ) ;
cbDepartamento . setReadOnly ( false ) ;
btnImprimirRepo . setVisible ( false ) ;
@ -255,7 +250,6 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
txtEquipo . setReadOnly ( true ) ;
cbTipo . setReadOnly ( true ) ;
txtFecha . setReadOnly ( true ) ;
txtFechaRealizacion . setReadOnly ( true ) ;
cbUsuario . setReadOnly ( true ) ;
cbDepartamento . setReadOnly ( true ) ;
btnImprimirRepo . setVisible ( true ) ;
@ -350,7 +344,6 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
txtEquipo . setReadOnly ( true ) ;
cbTipo . setReadOnly ( true ) ;
txtFecha . setReadOnly ( true ) ;
txtFechaRealizacion . setReadOnly ( true ) ;
cbUsuario . setReadOnly ( true ) ;
cbDepartamento . setReadOnly ( true ) ;
btnImprimirRepo . setVisible ( true ) ;
@ -392,7 +385,7 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
/ / Fechas ( corrige el campo )
DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "dd/MM/yyyy" ) ;
LocalDate fechaProg = ! txtFechaRealizacion . getValue ( ) . isEmpty ( ) ? LocalDate . parse ( txtFechaRealizacion . getValue ( ) , formatter ) : null ;
LocalDate fechaProg = ! txtFechaProgramada . getValue ( ) . isEmpty ( ) ? LocalDate . parse ( txtFechaProgramada . getValue ( ) , formatter ) : null ;
LocalDate fechaRealizado = ! txtFecha . getValue ( ) . isEmpty ( ) ? LocalDate . parse ( txtFecha . getValue ( ) , formatter ) : null ;
@ -414,7 +407,7 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
/ / ACTUALIZA PLANANUAL ( nombre del equipo y fecha programada )
if ( ! service . actualizarPlanAnual ( planAnualIdActual , txtEquipo . getValue ( ) , fechaProg ) ) {
if ( ! service . actualizarPlanAnual ( planAnualIdActual , txtEquipo . getValue ( ) ) ) {
exito = false ;
}
/ / ACTUALIZA MANTENIMIENTOS ( tipo , departamento , usuario , fecha realizado )
@ -456,7 +449,6 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
txtEquipo . setReadOnly ( true ) ;
cbTipo . setReadOnly ( true ) ;
txtFecha . setReadOnly ( true ) ;
txtFechaRealizacion . setReadOnly ( true ) ;
cbUsuario . setReadOnly ( true ) ;
cbDepartamento . setReadOnly ( true ) ;
btnImprimirRepo . setVisible ( true ) ;
@ -545,9 +537,11 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser
DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "dd/MM/yyyy" ) ;
String fechaProg = detalle . getFechaprog ( ) ! = null ? detalle . getFechaprog ( ) . format ( formatter ) : "" ;
String fechaReal = detalle . getFecha ( ) ! = null ? detalle . getFecha ( ) . format ( formatter ) : "" ;
String situacion = detalle . getSituacion ( ) ! = null ? detalle . getSituacion ( ) : "" ;
txtFechaRealizacion . setValue ( fechaProg ) ;
txtFechaProgramada . setValue ( fechaProg ) ;
txtFecha . setValue ( fechaReal ) ;
txtSituacion . setValue ( situacion ) ;
cbUsuario . setValue (
cbUsuario . getListDataView ( ) . getItems ( )
. filter ( u - > u . getNombre ( ) . equals ( detalle . getUsuario ( ) ) )