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()"> 1 <router-outlet></router-outlet>
2 <router-outlet></router-outlet>
3 </div>
4 2
src/app/app.component.ts
1 import { Component, OnInit } from '@angular/core'; 1 import { Component } from '@angular/core';
2 import { Router, RouterModule, RoutesRecognized, RouterLink, RouterState, ActivatedRoute, RouterLinkActive } from '@angular/router';
3 2
4 @Component({ 3 @Component({
5 selector: 'app-root', 4 selector: 'app-root',
6 templateUrl: './app.component.html', 5 templateUrl: './app.component.html',
7 styleUrls: ['./app.component.scss'] 6 styleUrls: ['./app.component.scss']
8 }) 7 })
9 export class AppComponent implements OnInit { 8 export class AppComponent {
10 title = 'autoservicio-axion'; 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 }
38 11
src/app/modules/admin/admin.component.html
1 <router-outlet></router-outlet> 1 <router-outlet click="restartTimer()"></router-outlet>
2 <div class="h-8"> 2 <div class="h-8">
3 <app-footer></app-footer> 3 <app-footer></app-footer>
4 </div> 4 </div>
5 5
src/app/modules/admin/admin.component.ts
1 import { Component, OnInit } from '@angular/core'; 1 import { Component, OnInit } from '@angular/core';
2 import { Router } from '@angular/router';
2 3
3 @Component({ 4 @Component({
4 selector: 'app-admin', 5 selector: 'app-admin',
5 templateUrl: './admin.component.html', 6 templateUrl: './admin.component.html',
6 styleUrls: ['./admin.component.scss'] 7 styleUrls: ['./admin.component.scss']
7 }) 8 })
8 export class AdminComponent implements OnInit { 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 }
15 32
src/app/modules/cancelar-compra/cancelar-compra.component.html
1 <div class="row justify-content-center mt-2"> 1 <div class="row justify-content-center mt-2">
2 <img class="w-15 h-15" src="../../../assets/img/logo-spot.svg"> 2 <img class="w-15 h-15" src="../../../assets/img/logo-spot.svg">
3 </div> 3 </div>
4 <div class="row mt-3 mx-0 justify-content-around h-75"> 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 <div class="p-3 bg-white text-center shadow-lg rounded h-100"> 6 <div class="p-3 bg-white text-center shadow-lg rounded h-100">
7 <h5 class="pt-3 mt-3">NECESITA</h5> 7 <h5 class="pt-3 mt-3">NECESITA</h5>
8 <h3 class="font-weight-bold text-secondary">más tiempo</h3> 8 <h3 class="font-weight-bold text-secondary">más tiempo</h3>
9 <h5>PARA SU PEDIDO?</h5> 9 <h5>PARA SU PEDIDO?</h5>
10 </div> 10 </div>
11 </div> 11 </div>
12 </div> 12 </div>
13 <!-- BUTTONS --> 13 <!-- BUTTONS -->
14 <div class="h-25"> 14 <div class="h-25">
15 <div class="row mt-5 h-auto justify-content-center mx-0"> 15 <div class="row mt-5 h-auto justify-content-center mx-0">
16 <div class="col-auto px-0 h-auto align-self-start"> 16 <div class="col-auto px-0 h-auto align-self-start">
17 <div 17 <div
18 class="btn-effect col-auto align-self-center px-0 bg-white" 18 class="btn-effect col-auto align-self-center px-0 bg-white"
19 (click)="volverPreviousPage()"> 19 (click)="volverPreviousPage()">
20 <div class="row mx-0 bg-primary badge-pill"> 20 <div class="row mx-0 bg-primary badge-pill">
21 <div class="col-auto align-self-center text-white">continuar compra</div> 21 <div class="col-auto align-self-center text-white">continuar compra</div>
22 <div class="col-auto align-self-center p-0"> 22 <div class="col-auto align-self-center p-0">
23 <img 23 <img
24 draggable="false" 24 draggable="false"
25 ondragstart="return false;" 25 ondragstart="return false;"
26 (contextmenu)="false" 26 (contextmenu)="false"
27 class="p-1 icon-30" 27 class="p-1 icon-30"
28 src="assets/img/ir.svg"> 28 src="assets/img/ir.svg">
29 </div> 29 </div>
30 </div> 30 </div>
31 </div> 31 </div>
32 </div> 32 </div>
33 </div> 33 </div>
34 <div class="row mt-4 h-auto justify-content-center mx-0"> 34 <div class="row mt-4 h-auto justify-content-center mx-0">
35 <div class="col-auto px-0 h-auto align-self-start"> 35 <div class="col-auto px-0 h-auto align-self-start">
36 <div 36 <div
37 class="btn-effect col-auto align-self-center px-0 bg-white" 37 class="btn-effect col-auto align-self-center px-0 bg-white"
38 (click)="limpiarCarritoYvolver()"> 38 (click)="limpiarCarritoYvolver()">
39 <div class="row mx-0 cancelar-compra badge-pill"> 39 <div class="row mx-0 cancelar-compra badge-pill">
40 <div class="col-auto align-self-center">cancelar compra</div> 40 <div class="col-auto align-self-center">cancelar compra</div>
41 <div class="col-auto align-self-center p-0"> 41 <div class="col-auto align-self-center p-0">
42 <img 42 <img
43 draggable="false" 43 draggable="false"
44 ondragstart="return false;" 44 ondragstart="return false;"
45 (contextmenu)="false" 45 (contextmenu)="false"
46 class="p-1 icon-30" 46 class="p-1 icon-30"
47 src="assets/img/icono-cancelar-color.svg"> 47 src="assets/img/icono-cancelar-color.svg">
48 </div> 48 </div>
49 </div> 49 </div>
50 </div> 50 </div>
51 </div> 51 </div>
52 </div> 52 </div>
53 </div> 53 </div>
54 54