@ -16,6 +16,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 mx.gob.jumapacelaya.Services.GuardarSolicitudService ;
import mx.gob.jumapacelaya.Services.PredioService ;
import mx.gob.jumapacelaya.models.Predio ;
import mx.gob.jumapacelaya.views.tiposSolicitud.InfraccionesView ;
@ -33,12 +34,15 @@ import java.util.List;
public class SolicitudDescView extends VerticalLayout implements BeforeEnterObserver {
private H3 label ;
private String usuarioId ;
private final PredioService predioService ;
private final GuardarSolicitudService guardarSolicitudService ;
@Autowired
public SolicitudDescView ( PredioService predioService ) {
public SolicitudDescView ( PredioService predioService , GuardarSolicitudService guardarSolicitudService ) {
this . setSizeFull ( ) ;
this . predioService = predioService ;
this . guardarSolicitudService = guardarSolicitudService ;
cabezera ( ) ;
titulo ( ) ;
@ -139,48 +143,43 @@ public class SolicitudDescView extends VerticalLayout implements BeforeEnterObse
Predio resultado = predios . get ( 0 ) ;
UI . getCurrent ( ) . getSession ( ) . setAttribute ( "predio" , resultado ) ;
UI . getCurrent ( ) . getSession ( ) . setAttribute ( "tipoSolicitud" , tipoSolicitud ) ;
UI . getCurrent ( ) . getSession ( ) . setAttribute ( "nombreSolicitante" , nombreSolicitante ) ;
UI . getCurrent ( ) . getSession ( ) . setAttribute ( "txtParentesco" , txtParentesco . getValue ( ) ) ;
UI . getCurrent ( ) . getSession ( ) . setAttribute ( "cmbTipoIdentificacion" , cmbTipoIdentificacion . getValue ( ) ) ;
UI . getCurrent ( ) . getSession ( ) . setAttribute ( "numIdentificacion" , numIdentificacion . getValue ( ) ) ;
UI . getCurrent ( ) . getSession ( ) . setAttribute ( "usuarioId" , usuarioId ) ;
System . out . println ( resultado . getPredioid ( ) ) ;
System . out . println ( resultado . getNomcliente ( ) ) ;
System . out . println ( resultado . getDireccorta ( ) ) ;
System . out . println ( resultado . getTelefono ( ) ) ;
System . out . println ( resultado . getUso ( ) ) ;
System . out . println ( resultado . getActividad ( ) ) ;
System . out . println ( resultado . getContrato ( ) ) ;
} else {
Notification . show ( "No se encontro informacion del predio" , 3000 , Notification . Position . MIDDLE ) ;
}
} else {
Notification . show ( "Ingresa un numero de predio" , 3000 , Notification . Position . MIDDLE ) ;
}
if ( tipoSolicitud ! = null & & nombreSolicitante ! = null ) {
String url = "" ;
/ / Luego de guardar la solicitud , redirigir a la página correspondiente
String url = "" ;
switch ( tipoSolicitud ) {
case "Recargos" :
url = "recargos?solicitante=" + nombreSolicitante ;
break ;
switch ( tipoSolicitud ) {
case "Recargos" :
url = "recargos?solicitante=" + nombreSolicitante ;
break ;
case "Infracciones" :
url = "infracciones?solicitante=" + nombreSolicitante ;
url = "infracciones?solicitante=" + nombreSolicitante ;
break ;
case "Ajuste de Facturas" :
url = "ajustefacturas?solicitante=" + nombreSolicitante ;
break ;
case "Descuento Especial Pago Anual" :
url = "descesp?solicitante=" + nombreSolicitante ;
break ;
default :
Notification . show ( "Selecciona un tipo de solicitud" , 3000 , Notification . Position . MIDDLE ) ;
}
if ( ! url . isEmpty ( ) ) {
UI . getCurrent ( ) . navigate ( url ) ;
case "Ajuste de Facturas" :
url = "ajustefacturas?solicitante=" + nombreSolicitante ;
break ;
case "Descuento Especial Pago Anual" :
url = "descesp?solicitante=" + nombreSolicitante ;
break ;
default :
Notification . show ( "Selecciona un tipo de solicitud" , 3000 , Notification . Position . MIDDLE ) ;
return ; / / No continuar si no se seleccionó un tipo válido
}
if ( ! url . isEmpty ( ) ) {
UI . getCurrent ( ) . navigate ( url ) ;
}
} else {
Notification . show ( "No se encontró información del predio" , 3000 , Notification . Position . MIDDLE ) ;
}
} else {
Notification . show ( "Selecciona una opcion" , 3000 , Notification . Position . MIDDLE ) ;
Notification . show ( "Ingresa un número de predio " , 3000 , Notification . Position . MIDDLE ) ;
}
} ) ;
@ -196,13 +195,13 @@ public class SolicitudDescView extends VerticalLayout implements BeforeEnterObse
@Override
public void beforeEnter ( BeforeEnterEvent event ) {
String usuario = event . getLocation ( ) . getQueryParameters ( ) . getParameters ( ) . get ( "usuarioid" ) ! = null
usuarioId = event . getLocation ( ) . getQueryParameters ( ) . getParameters ( ) . get ( "usuarioid" ) ! = null
? event . getLocation ( ) . getQueryParameters ( ) . getParameters ( ) . get ( "usuarioid" ) . stream ( ) . findFirst ( ) . orElse ( null )
: null ;
if ( usuario ! = null ) {
label . setText ( "Solicitud de Descuento en adeudo [" + usuario + "]" ) ;
if ( usuarioId ! = null ) {
label . setText ( "Solicitud de Descuento en adeudo [" + usuarioId + "]" ) ;
} else {
label . setText ( "Usuario Desconocido" ) ;
UI . getCurrent ( ) . navigate ( "/" ) ;