Commit 0bdaea4ac2c803759d1aaa188cf665f1d3bafac9

Authored by Benjamin Rodriguez
1 parent 6937133101

cambio a hijos de adminComponent el reset de la compra

src/app/app.component.html
1   -<div click="restartTimer()">
2   - <router-outlet></router-outlet>
3   -</div>
  1 +<router-outlet></router-outlet>
src/app/app.component.ts
1   -import { Component, OnInit } from '@angular/core';
2   -import { Router, RouterModule, RoutesRecognized, RouterLink, RouterState, ActivatedRoute, RouterLinkActive } from '@angular/router';
  1 +import { Component } from '@angular/core';
3 2  
4 3 @Component({
5 4 selector: 'app-root',
6 5 templateUrl: './app.component.html',
7 6 styleUrls: ['./app.component.scss']
8 7 })
9   -export class AppComponent implements OnInit {
  8 +export class AppComponent {
10 9 title = 'autoservicio-axion';
11   - timerReposo: any;
12   -
13   - constructor(
14   - private router: Router,
15   - ) { }
16   -
17   - ngOnInit(): void {
18   - if (
19   - window.location.href !== 'http://localhost:4206/#/' &&
20   - window.location.href !== 'http://localhost:4206/#/comanda' &&
21   - window.location.href !== 'http://localhost:4206/#/pedidos-salientes'
22   - ) {
23   - this.startTimeOutInactividad();
24   - };
25   - }
26   -
27   - restartTimer() {
28   - clearTimeout(this.timerReposo);
29   - this.startTimeOutInactividad();
30   - }
31   -
32   - startTimeOutInactividad() {
33   - setTimeout(() => {
34   - this.router.navigate(['cancelar-compra']);
35   - }, 1000);
36   - }
37 10 }
src/app/modules/admin/admin.component.html
1   -<router-outlet></router-outlet>
  1 +<router-outlet click="restartTimer()"></router-outlet>
2 2 <div class="h-8">
3 3 <app-footer></app-footer>
4 4 </div>
src/app/modules/admin/admin.component.ts
1 1 import { Component, OnInit } from '@angular/core';
  2 +import { Router } from '@angular/router';
2 3  
3 4 @Component({
4 5 selector: 'app-admin',
... ... @@ -6,9 +7,25 @@ import { Component, OnInit } from &#39;@angular/core&#39;;
6 7 styleUrls: ['./admin.component.scss']
7 8 })
8 9 export class AdminComponent implements OnInit {
  10 + timerReposo: any;
9 11  
10   - constructor() { }
  12 + constructor(
  13 + private router: Router,
  14 + ) { }
11 15  
12   - ngOnInit() { }
  16 + ngOnInit() {
  17 + this.startTimeOutInactividad();
  18 + }
  19 +
  20 + restartTimer() {
  21 + clearTimeout(this.timerReposo);
  22 + this.startTimeOutInactividad();
  23 + }
  24 +
  25 + startTimeOutInactividad() {
  26 + setTimeout(() => {
  27 + this.router.navigate(['cancelar-compra']);
  28 + }, 5000);
  29 + }
13 30  
14 31 }
src/app/modules/cancelar-compra/cancelar-compra.component.html
... ... @@ -2,7 +2,7 @@
2 2 <img class="w-15 h-15" src="../../../assets/img/logo-spot.svg">
3 3 </div>
4 4 <div class="row mt-3 mx-0 justify-content-around h-75">
5   - <div class="col-5 col-md-6 col-lg-3 h-100">
  5 + <div class="col-5 col-md-6 col-lg-3 h-40">
6 6 <div class="p-3 bg-white text-center shadow-lg rounded h-100">
7 7 <h5 class="pt-3 mt-3">NECESITA</h5>
8 8 <h3 class="font-weight-bold text-secondary">más tiempo</h3>