Commit 64c4843a81d4592a8aa1828b3541a692e4849ef4

Authored by Marcelo Puebla
1 parent cec29272c2
Exists in master

Agregada logica de pantalla inactiva en pago.

src/app/components/pago/pago.component.html
1 1 <div
2 2 *ngIf="!compraConEfectivofinalizada && !compraConQRfinalizada"
3   - class="row m-0 fade-in bg-primary-gradient disable-user-select">
  3 + class="row m-0 fade-in bg-primary-gradient disable-user-select"
  4 + (click)="reiniciarTimer()">
4 5  
5 6 <div class="col-12 p-0 vh-100">
6 7  
src/app/components/pago/pago.component.ts
1   -import { Component, OnInit } from '@angular/core';
  1 +import { Component, OnInit, OnDestroy } from '@angular/core';
2 2 import { appSettings } from 'src/etc/AppSettings';
3 3 import { Location } from '@angular/common';
4 4 import { ProductoService } from 'src/app/services/producto.service';
5   -import { RouterLink, Router } from '@angular/router';
  5 +import { Router } from '@angular/router';
6 6 import { Producto } from 'src/app/wrappers/producto';
7 7  
8 8 @Component({
... ... @@ -10,7 +10,7 @@ import { Producto } from &#39;src/app/wrappers/producto&#39;;
10 10 templateUrl: './pago.component.html',
11 11 styleUrls: ['./pago.component.scss']
12 12 })
13   -export class PagoComponent implements OnInit {
  13 +export class PagoComponent implements OnInit, OnDestroy {
14 14  
15 15 private apiUrl: string = appSettings.apiUrl;
16 16 private verQR: boolean = false;
... ... @@ -19,6 +19,7 @@ export class PagoComponent implements OnInit {
19 19  
20 20 private compraConQRfinalizada: boolean = false;
21 21 private compraConEfectivofinalizada: boolean = false;
  22 + private timerReposo: any;
22 23  
23 24 constructor(
24 25 private productoService: ProductoService,
... ... @@ -28,12 +29,22 @@ export class PagoComponent implements OnInit {
28 29  
29 30 ngOnInit() {
30 31  
  32 + this.timerReposo = setTimeout(() => {
  33 +
  34 + this.router.navigate(['cancelar-compra']);
  35 + }, 90000)
31 36 this.productos = this.productoService.productos;
32 37 }
33 38  
  39 + ngOnDestroy() {
  40 +
  41 + clearTimeout(this.timerReposo);
  42 + }
  43 +
34 44 pagoEfectivo() {
35 45  
36 46 this.compraConEfectivofinalizada = true;
  47 + clearTimeout(this.timerReposo);
37 48 setTimeout(() => {
38 49  
39 50 this.router.navigate(['mensaje-final']);
... ... @@ -47,7 +58,7 @@ export class PagoComponent implements OnInit {
47 58 this.productoService.pagar()
48 59 .subscribe(() => {
49 60  
50   - // alert('Compra finalizada');
  61 + clearTimeout(this.timerReposo);
51 62 this.compraConQRfinalizada = true;
52 63 setTimeout(() => {
53 64  
... ... @@ -78,4 +89,13 @@ export class PagoComponent implements OnInit {
78 89 return this.total = subTotal;
79 90 }
80 91  
  92 + reiniciarTimer() {
  93 +
  94 + clearTimeout(this.timerReposo);
  95 + this.timerReposo = setTimeout(() => {
  96 +
  97 + this.router.navigate(['cancelar-compra']);
  98 + }, 90000)
  99 + }
  100 +
81 101 }