From 64c4843a81d4592a8aa1828b3541a692e4849ef4 Mon Sep 17 00:00:00 2001 From: mpuebla Date: Thu, 22 Aug 2019 16:24:33 -0300 Subject: [PATCH] Agregada logica de pantalla inactiva en pago. --- src/app/components/pago/pago.component.html | 3 ++- src/app/components/pago/pago.component.ts | 28 ++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/app/components/pago/pago.component.html b/src/app/components/pago/pago.component.html index fd25909..3f78156 100644 --- a/src/app/components/pago/pago.component.html +++ b/src/app/components/pago/pago.component.html @@ -1,6 +1,7 @@
+ class="row m-0 fade-in bg-primary-gradient disable-user-select" + (click)="reiniciarTimer()">
diff --git a/src/app/components/pago/pago.component.ts b/src/app/components/pago/pago.component.ts index ba4a1d8..62492e4 100644 --- a/src/app/components/pago/pago.component.ts +++ b/src/app/components/pago/pago.component.ts @@ -1,8 +1,8 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; import { appSettings } from 'src/etc/AppSettings'; import { Location } from '@angular/common'; import { ProductoService } from 'src/app/services/producto.service'; -import { RouterLink, Router } from '@angular/router'; +import { Router } from '@angular/router'; import { Producto } from 'src/app/wrappers/producto'; @Component({ @@ -10,7 +10,7 @@ import { Producto } from 'src/app/wrappers/producto'; templateUrl: './pago.component.html', styleUrls: ['./pago.component.scss'] }) -export class PagoComponent implements OnInit { +export class PagoComponent implements OnInit, OnDestroy { private apiUrl: string = appSettings.apiUrl; private verQR: boolean = false; @@ -19,6 +19,7 @@ export class PagoComponent implements OnInit { private compraConQRfinalizada: boolean = false; private compraConEfectivofinalizada: boolean = false; + private timerReposo: any; constructor( private productoService: ProductoService, @@ -28,12 +29,22 @@ export class PagoComponent implements OnInit { ngOnInit() { + this.timerReposo = setTimeout(() => { + + this.router.navigate(['cancelar-compra']); + }, 90000) this.productos = this.productoService.productos; } + ngOnDestroy() { + + clearTimeout(this.timerReposo); + } + pagoEfectivo() { this.compraConEfectivofinalizada = true; + clearTimeout(this.timerReposo); setTimeout(() => { this.router.navigate(['mensaje-final']); @@ -47,7 +58,7 @@ export class PagoComponent implements OnInit { this.productoService.pagar() .subscribe(() => { - // alert('Compra finalizada'); + clearTimeout(this.timerReposo); this.compraConQRfinalizada = true; setTimeout(() => { @@ -78,4 +89,13 @@ export class PagoComponent implements OnInit { return this.total = subTotal; } + reiniciarTimer() { + + clearTimeout(this.timerReposo); + this.timerReposo = setTimeout(() => { + + this.router.navigate(['cancelar-compra']); + }, 90000) + } + } -- 1.9.1