Commit b5b898acf93aff6433c3c155936db7e063d7b7d2
1 parent
c36524ad1e
Exists in
master
Agregada logica para pantalla inactiva.
Showing
2 changed files
with
29 additions
and
6 deletions
Show diff stats
src/app/components/confirmacion-carrito/confirmacion-carrito.component.html
1 | <div class="row m-0 fade-in bg-primary-gradient disable-user-select"> | 1 | <div |
2 | class="row m-0 fade-in bg-primary-gradient disable-user-select" | ||
3 | (click)="reiniciarTimer"> | ||
2 | <div class="col-12 p-0 vh-100"> | 4 | <div class="col-12 p-0 vh-100"> |
3 | 5 | ||
4 | <!-- TOP HEADER --> | 6 | <!-- TOP HEADER --> |
5 | <app-header></app-header> | 7 | <app-header></app-header> |
6 | 8 | ||
7 | <!-- NOMBRE DE SECCION --> | 9 | <!-- NOMBRE DE SECCION --> |
8 | <div class="row m-0"> | 10 | <div class="row m-0"> |
9 | <div class="col-12 p-0"> | 11 | <div class="col-12 p-0"> |
10 | <p class="h5 py-1 bg-gray text-muted text-center m-0"> | 12 | <p class="h5 py-1 bg-gray text-muted text-center m-0"> |
11 | Pagar | 13 | Pagar |
12 | <i class="fa fa-usd"></i> | 14 | <i class="fa fa-usd"></i> |
13 | </p> | 15 | </p> |
14 | </div> | 16 | </div> |
15 | </div> | 17 | </div> |
16 | 18 | ||
17 | <div class="row m-0"> | 19 | <div class="row m-0"> |
18 | <div class="col-12"> | 20 | <div class="col-12"> |
19 | 21 | ||
20 | <!-- TEXTO DE IZQUIERDA --> | 22 | <!-- TEXTO DE IZQUIERDA --> |
21 | <div class="row mx-2 mt-4 text-white"> | 23 | <div class="row mx-2 mt-4 text-white"> |
22 | <div class="col-sm-2 my-auto"> | 24 | <div class="col-sm-2 my-auto"> |
23 | <p class="h2">Mi Compra | 25 | <p class="h2">Mi Compra |
24 | <i class="fa fa-shopping-cart "></i> | 26 | <i class="fa fa-shopping-cart "></i> |
25 | </p> | 27 | </p> |
26 | </div> | 28 | </div> |
27 | <div class="col-sm-4 my-auto"> | 29 | <div class="col-sm-4 my-auto"> |
28 | <p class="h3">¿Desea finalizar su compra?</p> | 30 | <p class="h3">¿Desea finalizar su compra?</p> |
29 | <p class="h4">Por favor, controle y confirme su compra.</p> | 31 | <p class="h4">Por favor, controle y confirme su compra.</p> |
30 | </div> | 32 | </div> |
31 | </div> | 33 | </div> |
32 | 34 | ||
33 | <div class="row"> | 35 | <div class="row"> |
34 | <!-- GRILLA DE PRODUCTOS DE MI COMPRA --> | 36 | <!-- GRILLA DE PRODUCTOS DE MI COMPRA --> |
35 | <div class="col-sm-7"> | 37 | <div class="col-sm-7"> |
36 | <div class="row ml-4 pr-3 vh-70 overflow-scroll text-dark"> | 38 | <div class="row ml-4 pr-3 vh-70 overflow-scroll text-dark"> |
37 | <div class="col-4 p-2" *ngFor="let producto of productos"> | 39 | <div class="col-4 p-2" *ngFor="let producto of productos"> |
38 | <div class="bg-white rounded-sm shadow border-0"> | 40 | <div class="bg-white rounded-sm shadow border-0"> |
39 | <img src="{{apiUrl}}/imagenes/{{producto.imagenes[0].imagen}}" class="rounded-sm w-100 m-auto"> | 41 | <img src="{{apiUrl}}/imagenes/{{producto.imagenes[0].imagen}}" class="rounded-sm w-100 m-auto"> |
40 | <div class="p-2"> | 42 | <div class="p-2"> |
41 | <p class="h6 text-left m-0">{{producto.DetArt}}</p> | 43 | <p class="h6 text-left m-0">{{producto.DetArt}}</p> |
42 | <div class="row justify-content-between m-0"> | 44 | <div class="row justify-content-between m-0"> |
43 | <div class="col-12 p-0"> | 45 | <div class="col-12 p-0"> |
44 | <div class="text-left"> | 46 | <div class="text-left"> |
45 | <p class="m-0 h6"><small>{{producto.DET_LAR}}</small></p> | 47 | <p class="m-0 h6"><small>{{producto.DET_LAR}}</small></p> |
46 | <p class="m-0 h6"><small>{{producto.CodSec}}-{{producto.CodArt}}</small></p> | 48 | <p class="m-0 h6"><small>{{producto.CodSec}}-{{producto.CodArt}}</small></p> |
47 | </div> | 49 | </div> |
48 | </div> | 50 | </div> |
49 | <div class="col-12 my-auto pt-2 pr-2 p-0"> | 51 | <div class="col-12 my-auto pt-2 pr-2 p-0"> |
50 | <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p> | 52 | <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p> |
51 | </div> | 53 | </div> |
52 | </div> | 54 | </div> |
53 | </div> | 55 | </div> |
54 | </div> | 56 | </div> |
55 | </div> | 57 | </div> |
56 | </div> | 58 | </div> |
57 | </div> | 59 | </div> |
58 | 60 | ||
59 | <div class="col-sm-5 pl-0"> | 61 | <div class="col-sm-5 pl-0"> |
60 | <div class="row ml-3"> | 62 | <div class="row ml-3"> |
61 | <!-- TICKET --> | 63 | <!-- TICKET --> |
62 | <div class="col-sm-7 p-0"> | 64 | <div class="col-sm-7 p-0"> |
63 | <div class="card rounded-sm shadow"> | 65 | <div class="card rounded-sm shadow"> |
64 | <div class="card-body"> | 66 | <div class="card-body"> |
65 | <p class="h5 card-title">Su Ticket</p> | 67 | <p class="h5 card-title">Su Ticket</p> |
66 | <div class="row mt-4 m-0"> | 68 | <div class="row mt-4 m-0"> |
67 | <div class="col-12 p-0 mb-2"> | 69 | <div class="col-12 p-0 mb-2"> |
68 | <p class="h6 m-0 card-text text-left"> | 70 | <p class="h6 m-0 card-text text-left"> |
69 | <small class="font-weight-bold">DESCRIPCIÓN</small> | 71 | <small class="font-weight-bold">DESCRIPCIÓN</small> |
70 | </p> | 72 | </p> |
71 | <p class="h6 m-0 card-text text-left"> | 73 | <p class="h6 m-0 card-text text-left"> |
72 | <small class="font-weight-bold">CANTIDAD X PRECIO UNITARIO</small> | 74 | <small class="font-weight-bold">CANTIDAD X PRECIO UNITARIO</small> |
73 | </p> | 75 | </p> |
74 | </div> | 76 | </div> |
75 | </div> | 77 | </div> |
76 | <div class="row vh-50 px-2 overflow-scroll m-0"> | 78 | <div class="row vh-50 px-2 overflow-scroll m-0"> |
77 | <div class="col-12 p-0 mb-2" *ngFor="let producto of productos"> | 79 | <div class="col-12 p-0 mb-2" *ngFor="let producto of productos"> |
78 | <p class="h6 m-0 card-text text-left"> | 80 | <p class="h6 m-0 card-text text-left"> |
79 | <small>{{producto.DetArt}}</small> | 81 | <small>{{producto.DetArt}}</small> |
80 | </p> | 82 | </p> |
81 | <div class="row d-flex justify-content-between m-0"> | 83 | <div class="row d-flex justify-content-between m-0"> |
82 | <div class="col p-0"> | 84 | <div class="col p-0"> |
83 | <p class="h6 m-0 card-text text-left"> | 85 | <p class="h6 m-0 card-text text-left"> |
84 | <small>{{producto.cantidad}} x {{producto.PreVen | currency}}</small> | 86 | <small>{{producto.cantidad}} x {{producto.PreVen | currency}}</small> |
85 | </p> | 87 | </p> |
86 | </div> | 88 | </div> |
87 | <div class="col p-0"> | 89 | <div class="col p-0"> |
88 | <p class="h6 m-0 card-text text-right"> | 90 | <p class="h6 m-0 card-text text-right"> |
89 | <small>{{(producto.PreVen) * (producto.cantidad) | currency}}</small> | 91 | <small>{{(producto.PreVen) * (producto.cantidad) | currency}}</small> |
90 | </p> | 92 | </p> |
91 | </div> | 93 | </div> |
92 | </div> | 94 | </div> |
93 | </div> | 95 | </div> |
94 | </div> | 96 | </div> |
95 | <p class="h4 font-weight-bold card-text text-right mt-3 mb-0"> | 97 | <p class="h4 font-weight-bold card-text text-right mt-3 mb-0"> |
96 | Total {{getTotal() | currency}} | 98 | Total {{getTotal() | currency}} |
97 | </p> | 99 | </p> |
98 | </div> | 100 | </div> |
99 | </div> | 101 | </div> |
100 | </div> | 102 | </div> |
101 | </div> | 103 | </div> |
102 | </div> | 104 | </div> |
103 | </div> | 105 | </div> |
104 | 106 | ||
105 | <!-- OPCIONES ABAJO DERECHA --> | 107 | <!-- OPCIONES ABAJO DERECHA --> |
106 | <div class="row m-0 fixed-bottom"> | 108 | <div class="row m-0 fixed-bottom"> |
107 | <div class="col-sm-2 offset-sm-10 p-0 mt-auto"> | 109 | <div class="col-sm-2 offset-sm-10 p-0 mt-auto"> |
108 | <div class="card m-2 rounded-top-sm mt-auto blue-gradient border-0"> | 110 | <div class="card m-2 rounded-top-sm mt-auto blue-gradient border-0"> |
109 | <div class="card-body row m-0"> | 111 | <div class="card-body row m-0"> |
110 | <div class="col-12 p-3"> | 112 | <div class="col-12 p-3"> |
111 | <button | 113 | <button |
112 | type="button" | 114 | type="button" |
113 | class="btn btn-block btn-light shadow btn-sm shadow" | 115 | class="btn btn-block btn-light shadow btn-sm shadow" |
114 | (click)="volverPreviousPage()"> | 116 | (click)="volverPreviousPage()"> |
115 | <span class="pr-2">Volver</span> | 117 | <span class="pr-2">Volver</span> |
116 | <i class="fa fa-undo text-warning"></i> | 118 | <i class="fa fa-undo text-warning"></i> |
117 | </button> | 119 | </button> |
118 | <button [routerLink]="['/pago']" type="button" class="btn btn-block btn-light btn-lg shadow mb-2 p-1"> | 120 | <button [routerLink]="['/pago']" type="button" class="btn btn-block btn-light btn-lg shadow mb-2 p-1"> |
119 | <span class="font-weight-bold pr-2">Finalizar y Pagar</span> | 121 | <span class="font-weight-bold pr-2">Finalizar y Pagar</span> |
120 | <i class="fa fa-check text-success"></i> | 122 | <i class="fa fa-check text-success"></i> |
121 | </button> | 123 | </button> |
122 | <button | 124 | <button |
123 | type="button" | 125 | type="button" |
124 | class="btn btn-block btn-light shadow btn-sm shadow" | 126 | class="btn btn-block btn-light shadow btn-sm shadow" |
125 | [routerLink]="['/cancelar-compra']"> | 127 | [routerLink]="['/cancelar-compra']"> |
126 | <span class="pr-2">Cancelar</span> | 128 | <span class="pr-2">Cancelar</span> |
127 | <i class="fa fa-times text-danger"></i> | 129 | <i class="fa fa-times text-danger"></i> |
128 | </button> | 130 | </button> |
129 | </div> | 131 | </div> |
130 | </div> | 132 | </div> |
131 | </div> | 133 | </div> |
132 | </div> | 134 | </div> |
133 | </div> | 135 | </div> |
134 | 136 | ||
135 | </div> | 137 | </div> |
136 | </div> | 138 | </div> |
137 | 139 | ||
138 | </div> | 140 | </div> |
139 | 141 | ||
140 | </div> | 142 | </div> |
141 | 143 |
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; |
2 | import { appSettings } from 'src/etc/AppSettings'; | 2 | import { appSettings } from 'src/etc/AppSettings'; |
3 | import { Location } from '@angular/common'; | 3 | import { Location } from '@angular/common'; |
4 | import { ProductoService } from 'src/app/services/producto.service'; | 4 | import { ProductoService } from 'src/app/services/producto.service'; |
5 | import { Producto } from 'src/app/wrappers/producto'; | 5 | import { Producto } from 'src/app/wrappers/producto'; |
6 | import { Router } from '@angular/router'; | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'app-confirmacion-carrito', | 9 | selector: 'app-confirmacion-carrito', |
9 | templateUrl: './confirmacion-carrito.component.html', | 10 | templateUrl: './confirmacion-carrito.component.html', |
10 | styleUrls: ['./confirmacion-carrito.component.scss'] | 11 | styleUrls: ['./confirmacion-carrito.component.scss'] |
11 | }) | 12 | }) |
12 | export class ConfirmacionCarritoComponent implements OnInit { | 13 | export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
13 | 14 | ||
14 | productos: Producto[] = []; | 15 | private productos: Producto[] = []; |
15 | total: number = 0; | 16 | private total: number = 0; |
16 | private apiUrl: string = appSettings.apiUrl; | 17 | private apiUrl: string = appSettings.apiUrl; |
18 | private timerReposo: any; | ||
17 | 19 | ||
18 | constructor( | 20 | constructor( |
19 | private location: Location, | 21 | private location: Location, |
20 | private productoService: ProductoService | 22 | private productoService: ProductoService, |
23 | private router: Router | ||
21 | ) { } | 24 | ) { } |
22 | 25 | ||
23 | ngOnInit() { | 26 | ngOnInit() { |
24 | 27 | ||
28 | this.timerReposo = setTimeout(() => { | ||
29 | |||
30 | this.router.navigate(['cancelar-compra']); | ||
31 | }, 90000) | ||
25 | this.productos = this.productoService.productos; | 32 | this.productos = this.productoService.productos; |
26 | } | 33 | } |
27 | 34 | ||
35 | ngOnDestroy() { | ||
36 | |||
37 | clearTimeout(this.timerReposo); | ||
38 | } | ||
39 | |||
28 | volverPreviousPage() { | 40 | volverPreviousPage() { |
29 | 41 | ||
30 | this.location.back(); | 42 | this.location.back(); |
31 | } | 43 | } |
32 | 44 | ||
33 | getTotal() { | 45 | getTotal() { |
34 | 46 | ||
35 | var subTotal = 0; | 47 | var subTotal = 0; |
36 | this.productos.forEach(producto => { | 48 | this.productos.forEach(producto => { |
37 | 49 | ||
38 | subTotal = subTotal + (producto.PreVen * producto.cantidad); | 50 | subTotal = subTotal + (producto.PreVen * producto.cantidad); |
39 | }); | 51 | }); |
40 | return this.total = subTotal; | 52 | return this.total = subTotal; |
41 | } | 53 | } |
42 | 54 | ||
55 | reiniciarTimer() { | ||
56 | |||
57 | clearTimeout(this.timerReposo); | ||
58 | this.timerReposo = setTimeout(() => { | ||
59 | |||
60 | this.router.navigate(['cancelar-compra']); | ||
61 | }, 90000) | ||
62 | } | ||
63 | |||
43 | } | 64 | } |
44 | 65 |