Commit 3205cca4cfea99cfd4f75ccf381332d70c88de6b

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(mpuebla)

See merge request !44
src/app/components/cancelar-compra/cancelar-compra.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 { Router } from '@angular/router'; 4 import { Router } from '@angular/router';
5 import { ProductoService } from 'src/app/services/producto.service'; 5 import { ProductoService } from 'src/app/services/producto.service';
6 6
7 @Component({ 7 @Component({
8 selector: 'app-cancelar-compra', 8 selector: 'app-cancelar-compra',
9 templateUrl: './cancelar-compra.component.html', 9 templateUrl: './cancelar-compra.component.html',
10 styleUrls: ['./cancelar-compra.component.scss'] 10 styleUrls: ['./cancelar-compra.component.scss']
11 }) 11 })
12 export class CancelarCompraComponent implements OnInit { 12 export class CancelarCompraComponent implements OnInit, OnDestroy {
13 13
14 private apiUrl: string = appSettings.apiUrl; 14 private apiUrl: string = appSettings.apiUrl;
15 private timer: any;
15 16
16 constructor( 17 constructor(
17 private location: Location, 18 private location: Location,
18 private router: Router, 19 private router: Router,
19 private productoService : ProductoService 20 private productoService: ProductoService
20 ) { } 21 ) { }
21 22
22 ngOnInit() { 23 ngOnInit() {
23 24
24 setTimeout(() => { 25 this.timer = setTimeout(() => {
25 this.limpiarCarritoYvolver(); 26 this.limpiarCarritoYvolver();
26 }, 30000) 27 }, 30000)
27 } 28 }
28 29
30 ngOnDestroy() {
31
32 clearTimeout(this.timer);
33 }
34
29 volverPreviousPage() { 35 volverPreviousPage() {
30 36
31 this.location.back(); 37 this.location.back();
32 } 38 }
33 39
34 limpiarCarritoYvolver(){ 40 limpiarCarritoYvolver() {
35 41
36 this.productoService.productoAcargar = undefined; 42 this.productoService.productoAcargar = undefined;
37 this.productoService.promoAcargar = undefined; 43 this.productoService.promoAcargar = undefined;
38 this.productoService.productos = []; 44 this.productoService.productos = [];
39 this.router.navigate(['/home']); 45 this.router.navigate(['/home']);
40 } 46 }
41 47
42 } 48 }
43 49
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 class="row m-0 fade-in bg-primary-gradient disable-user-select">
2 <div class="col-12 p-0 vh-100"> 2 <div class="col-12 p-0 vh-100">
3 3
4 <!-- TOP HEADER --> 4 <!-- TOP HEADER -->
5 <app-header></app-header> 5 <app-header></app-header>
6 6
7 <!-- NOMBRE DE SECCION --> 7 <!-- NOMBRE DE SECCION -->
8 <div class="row m-0"> 8 <div class="row m-0">
9 <div class="col-12 p-0"> 9 <div class="col-12 p-0">
10 <p class="h5 py-1 bg-gray text-muted text-center m-0"> 10 <p class="h5 py-1 bg-gray text-muted text-center m-0">
11 Pagar 11 Pagar
12 <i class="fa fa-usd"></i> 12 <i class="fa fa-usd"></i>
13 </p> 13 </p>
14 </div> 14 </div>
15 </div> 15 </div>
16 16
17 <div class="row m-0"> 17 <div class="row m-0">
18 <div class="col-12"> 18 <div class="col-12">
19 19
20 <!-- TEXTO DE IZQUIERDA --> 20 <!-- TEXTO DE IZQUIERDA -->
21 <div class="row mx-2 mt-4 text-white"> 21 <div class="row mx-2 mt-4 text-white">
22 <div class="col-sm-2 my-auto"> 22 <div class="col-sm-2 my-auto">
23 <p class="h2">Mi Compra 23 <p class="h2">Mi Compra
24 <i class="fa fa-shopping-cart "></i> 24 <i class="fa fa-shopping-cart "></i>
25 </p> 25 </p>
26 </div> 26 </div>
27 <div class="col-sm-4 my-auto"> 27 <div class="col-sm-4 my-auto">
28 <p class="h3">¿Desea finalizar su compra?</p> 28 <p class="h3">¿Desea finalizar su compra?</p>
29 <p class="h4">Por favor, controle y confirme su compra.</p> 29 <p class="h4">Por favor, controle y confirme su compra.</p>
30 </div> 30 </div>
31 </div> 31 </div>
32 32
33 <div class="row"> 33 <div class="row">
34 <!-- GRILLA DE PRODUCTOS DE MI COMPRA --> 34 <!-- GRILLA DE PRODUCTOS DE MI COMPRA -->
35 <div class="col-sm-7"> 35 <div class="col-sm-7">
36 <div class="row ml-4 pr-3 vh-70 overflow-scroll text-dark"> 36 <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"> 37 <div class="col-4 p-2" *ngFor="let producto of productos">
38 <div class="bg-white rounded-sm shadow border-0"> 38 <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"> 39 <img src="{{apiUrl}}/imagenes/{{producto.imagenes[0].imagen}}" class="rounded-sm w-100 m-auto">
40 <div class="p-2"> 40 <div class="p-2">
41 <p class="h6 text-left m-0">{{producto.DetArt}}</p> 41 <p class="h6 text-left m-0">{{producto.DetArt}}</p>
42 <div class="row justify-content-between m-0"> 42 <div class="row justify-content-between m-0">
43 <div class="col-12 p-0"> 43 <div class="col-12 p-0">
44 <div class="text-left"> 44 <div class="text-left">
45 <p class="m-0 h6"><small>{{producto.DET_LAR}}</small></p> 45 <p class="m-0 h6"><small>{{producto.DET_LAR}}</small></p>
46 <p class="m-0 h6"><small>{{producto.CodSec}}-{{producto.CodArt}}</small></p> 46 <p class="m-0 h6"><small>{{producto.CodSec}}-{{producto.CodArt}}</small></p>
47 </div> 47 </div>
48 </div> 48 </div>
49 <div class="col-12 my-auto pt-2 pr-2 p-0"> 49 <div class="col-12 my-auto pt-2 pr-2 p-0">
50 <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p> 50 <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p>
51 </div> 51 </div>
52 </div> 52 </div>
53 </div> 53 </div>
54 </div> 54 </div>
55 </div> 55 </div>
56 </div> 56 </div>
57 </div> 57 </div>
58 58
59 <div class="col-sm-5"> 59 <div class="col-sm-5 pl-0">
60 <div class="row ml-3"> 60 <div class="row ml-3">
61 <!-- TICKET --> 61 <!-- TICKET -->
62 <div class="col-sm-7"> 62 <div class="col-sm-7 p-0">
63 <div class="card rounded-sm shadow"> 63 <div class="card rounded-sm shadow">
64 <div class="card-body"> 64 <div class="card-body">
65 <p class="h5 card-title">Su Ticket</p> 65 <p class="h5 card-title">Su Ticket</p>
66 <p class="h6 card-text text-left mt-4 pr-2 vh-60 overflow-scroll"> 66 <div class="row mt-4 m-0">
67 Ticket detalle. 67 <div class="col-12 p-0 mb-2">
68 </p> 68 <p class="h6 m-0 card-text text-left">
69 <p class="h4 card-text text-right mt-3 mb-0"> 69 <small class="font-weight-bold">DESCRIPCIÓN</small>
70 Total {{230 | currency}} 70 </p>
71 <p class="h6 m-0 card-text text-left">
72 <small class="font-weight-bold">CANTIDAD X PRECIO UNITARIO</small>
73 </p>
74 </div>
75 </div>
76 <div class="row vh-50 overflow-scroll m-0">
77 <div class="col-12 p-0 mb-2" *ngFor="let producto of productos">
78 <p class="h6 m-0 card-text text-left">
79 <small>{{producto.DetArt}}</small>
80 </p>
81 <div class="row d-flex justify-content-between m-0">
82 <div class="col p-0">
83 <p class="h6 m-0 card-text text-left">
84 <small>{{producto.cantidad}} x {{producto.PreVen | currency}}</small>
85 </p>
86 </div>
87 <div class="col p-0">
88 <p class="h6 m-0 card-text text-right">
89 <small>{{(producto.PreVen) * (producto.cantidad) | currency}}</small>
90 </p>
91 </div>
92 </div>
93 </div>
94 </div>
95 <p class="h4 font-weight-bold card-text text-right mt-3 mb-0">
96 Total {{getTotal() | currency}}
71 </p> 97 </p>
72 </div> 98 </div>
73 </div> 99 </div>
74 </div> 100 </div>
75 </div> 101 </div>
76 </div> 102 </div>
77 </div> 103 </div>
78 104
79 <!-- OPCIONES ABAJO DERECHA --> 105 <!-- OPCIONES ABAJO DERECHA -->
80 <div class="row m-0 fixed-bottom"> 106 <div class="row m-0 fixed-bottom">
81 <div class="col-sm-2 offset-sm-10 p-0 mt-auto"> 107 <div class="col-sm-2 offset-sm-10 p-0 mt-auto">
82 <div class="card m-2 rounded-top-sm mt-auto blue-gradient border-0"> 108 <div class="card m-2 rounded-top-sm mt-auto blue-gradient border-0">
83 <div class="card-body row m-0"> 109 <div class="card-body row m-0">
84 <div class="col-12 p-3"> 110 <div class="col-12 p-3">
85 <button 111 <button
86 type="button" 112 type="button"
87 class="btn btn-block btn-light shadow btn-sm shadow" 113 class="btn btn-block btn-light shadow btn-sm shadow"
88 (click)="volverPreviousPage()"> 114 (click)="volverPreviousPage()">
89 <span class="pr-2">Volver</span> 115 <span class="pr-2">Volver</span>
90 <i class="fa fa-undo text-warning"></i> 116 <i class="fa fa-undo text-warning"></i>
91 </button> 117 </button>
92 <button [routerLink]="['/pago']" type="button" class="btn btn-block btn-light btn-lg shadow mb-2 p-1"> 118 <button [routerLink]="['/pago']" type="button" class="btn btn-block btn-light btn-lg shadow mb-2 p-1">
93 <span class="font-weight-bold pr-2">Finalizar y Pagar</span> 119 <span class="font-weight-bold pr-2">Finalizar y Pagar</span>
94 <i class="fa fa-check text-success"></i> 120 <i class="fa fa-check text-success"></i>
95 </button> 121 </button>
96 <button 122 <button
97 type="button" 123 type="button"
98 class="btn btn-block btn-light shadow btn-sm shadow" 124 class="btn btn-block btn-light shadow btn-sm shadow"
99 [routerLink]="['/cancelar-compra']"> 125 [routerLink]="['/cancelar-compra']">
100 <span class="pr-2">Cancelar</span> 126 <span class="pr-2">Cancelar</span>
101 <i class="fa fa-times text-danger"></i> 127 <i class="fa fa-times text-danger"></i>
102 </button> 128 </button>
103 </div> 129 </div>
104 </div> 130 </div>
105 </div> 131 </div>
106 </div> 132 </div>
107 </div> 133 </div>
108 134
109 </div> 135 </div>
110 </div> 136 </div>
111 137
112 </div> 138 </div>
113 139
114 </div> 140 </div>
115 141
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
1 import { Component, OnInit } from '@angular/core'; 1 import { Component, OnInit } 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 6
6 @Component({ 7 @Component({
7 selector: 'app-confirmacion-carrito', 8 selector: 'app-confirmacion-carrito',
8 templateUrl: './confirmacion-carrito.component.html', 9 templateUrl: './confirmacion-carrito.component.html',
9 styleUrls: ['./confirmacion-carrito.component.scss'] 10 styleUrls: ['./confirmacion-carrito.component.scss']
10 }) 11 })
11 export class ConfirmacionCarritoComponent implements OnInit { 12 export class ConfirmacionCarritoComponent implements OnInit {
12 13
13 productos = []; 14 productos: Producto[] = [];
15 total: number = 0;
14 private apiUrl: string = appSettings.apiUrl; 16 private apiUrl: string = appSettings.apiUrl;
15 17
16 constructor(private location: Location, private productoService: ProductoService) { } 18 constructor(
19 private location: Location,
20 private productoService: ProductoService
21 ) { }
17 22
18 ngOnInit() { 23 ngOnInit() {
24
19 this.productos = this.productoService.productos; 25 this.productos = this.productoService.productos;
20 } 26 }
21 27
22 volverPreviousPage() { 28 volverPreviousPage() {
29
23 this.location.back(); 30 this.location.back();
24 } 31 }
25 32
33 getTotal() {
34
35 var subTotal = 0;
36 this.productos.forEach(producto => {
37
38 subTotal = subTotal + (producto.PreVen * producto.cantidad);
39 });
40 return this.total = subTotal;
41 }
42
26 } 43 }
27 44
1 @import "./assets/scss/animation.scss"; 1 @import "./assets/scss/animation.scss";
2 @import "./assets/scss/bootstrap-override.scss"; 2 @import "./assets/scss/bootstrap-override.scss";
3 @import "../node_modules/bootstrap/scss/_variables.scss"; 3 @import "../node_modules/bootstrap/scss/_variables.scss";
4 4
5 html, 5 html,
6 body { 6 body {
7 background-color: #f0f0f0; 7 background-color: #f0f0f0;
8 font-family: bahnschrift; 8 font-family: bahnschrift;
9 overflow: hidden !important; 9 overflow: hidden !important;
10 } 10 }
11 11
12 .blur { 12 .blur {
13 filter: blur(10px); 13 filter: blur(10px);
14 -webkit-filter: blur(10px); 14 -webkit-filter: blur(10px);
15 } 15 }
16 16
17 .disable-user-select { 17 .disable-user-select {
18 -webkit-user-select: none; 18 -webkit-user-select: none;
19 -moz-user-select: none; 19 -moz-user-select: none;
20 -ms-user-select: none; 20 -ms-user-select: none;
21 user-select: none; 21 user-select: none;
22 } 22 }
23 23
24 .blue-gradient { 24 .blue-gradient {
25 background: linear-gradient(0deg, #ffffff00, $white); 25 background: linear-gradient(0deg, #ffffff00, $white);
26 } 26 }
27 27
28 .rounded { 28 .rounded {
29 border-radius: 1.5rem !important; 29 border-radius: 1.5rem !important;
30 } 30 }
31 31
32 .rounded-top-sm { 32 .rounded-top-sm {
33 border-top-left-radius: 0.75rem !important; 33 border-top-left-radius: 0.75rem !important;
34 border-top-right-radius: 0.75rem !important; 34 border-top-right-radius: 0.75rem !important;
35 } 35 }
36 36
37 .rounded-sm { 37 .rounded-sm {
38 border-radius: 0.75rem !important; 38 border-radius: 0.75rem !important;
39 } 39 }
40 40
41 .card-effect { 41 .card-effect {
42 &:active { 42 &:active {
43 background-color: #c9c9c9b3 !important; 43 background-color: #c9c9c9b3 !important;
44 transition: background-color 0.5s; 44 transition: background-color 0.5s;
45 } 45 }
46 &:focus { 46 &:focus {
47 background-color: #c9c9c9b3 !important; 47 background-color: #c9c9c9b3 !important;
48 transition: background-color 0.5s; 48 transition: background-color 0.5s;
49 } 49 }
50 } 50 }
51 51
52 .overflow-scroll { 52 .overflow-scroll {
53 overflow-y: auto !important; 53 overflow-y: auto !important;
54 overflow-x: hidden !important; 54 overflow-x: hidden !important;
55 &::-webkit-scrollbar { 55 &::-webkit-scrollbar {
56 width: 1em; 56 width: 1em;
57 } 57 }
58 &::-webkit-scrollbar-track { 58 &::-webkit-scrollbar-track {
59 border-radius: 10px; 59 border-radius: 10px;
60 box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); 60 box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
61 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); 61 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
62 background-color: $white; 62 background-color: $white;
63 } 63 }
64 &::-webkit-scrollbar-thumb { 64 &::-webkit-scrollbar-thumb {
65 box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); 65 box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7);
66 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); 66 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7);
67 outline: 1px solid slategrey; 67 outline: 1px solid slategrey;
68 border-radius: 10px; 68 border-radius: 10px;
69 height: 12px; 69 height: 12px;
70 &:active { 70 &:active {
71 box-shadow: inset 0 0 8px $primary; 71 box-shadow: inset 0 0 8px $primary;
72 -webkit-box-shadow: inset 0 0 8px $primary; 72 -webkit-box-shadow: inset 0 0 8px $primary;
73 } 73 }
74 } 74 }
75 &::-webkit-scrollbar-corner { 75 &::-webkit-scrollbar-corner {
76 border-radius: 10px; 76 border-radius: 10px;
77 } 77 }
78 } 78 }
79 79
80 .bg-gray { 80 .bg-gray {
81 background-color: #e6e6e6; 81 background-color: #e6e6e6;
82 } 82 }
83 83
84 .bg-primary-gradient { 84 .bg-primary-gradient {
85 background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); 85 background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%);
86 } 86 }
87 87
88 .bg-primary-gradient-horizontal { 88 .bg-primary-gradient-horizontal {
89 background: linear-gradient(90deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); 89 background: linear-gradient(90deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%);
90 } 90 }
91 91
92 .icon-dim { 92 .icon-dim {
93 height: 40px !important; 93 height: 40px !important;
94 width: auto !important; 94 width: auto !important;
95 background-color: white !important; 95 background-color: white !important;
96 } 96 }
97 97
98 .text-purple { 98 .text-purple {
99 color: $purple; 99 color: $purple;
100 } 100 }
101 101
102 .vh-70 { 102 .vh-70 {
103 min-height: auto !important; 103 min-height: auto !important;
104 max-height: 70vh !important; 104 max-height: 70vh !important;
105 } 105 }
106 106
107 .vh-60 { 107 .vh-60 {
108 min-height: auto !important; 108 min-height: auto !important;
109 max-height: 60vh !important; 109 max-height: 60vh !important;
110 } 110 }
111 111
112 .vh-50 {
113 min-height: auto !important;
114 max-height: 50vh !important;
115 }
116
112 .spinner-lg { 117 .spinner-lg {
113 width: 3rem !important; 118 width: 3rem !important;
114 height: 3rem !important; 119 height: 3rem !important;
115 } 120 }
116 121
117 .sidebar { 122 .sidebar {
118 right: 0; 123 right: 0;
119 } 124 }
120 125
121 .background-image { 126 .background-image {
122 background-repeat: no-repeat; 127 background-repeat: no-repeat;
123 background-size: cover; 128 background-size: cover;
124 position: fixed; 129 position: fixed;
125 } 130 }
126 131
127 .rounded-bottom-right { 132 .rounded-bottom-right {
128 border-bottom-right-radius: 10rem; 133 border-bottom-right-radius: 10rem;
129 &:before { 134 &:before {
130 border-radius: 0 40px 40px 0; 135 border-radius: 0 40px 40px 0;
131 background-color: #fff; 136 background-color: #fff;
132 } 137 }
133 } 138 }
134 139
135 .rounded-top-left { 140 .rounded-top-left {
136 border-top-left-radius: 10rem; 141 border-top-left-radius: 10rem;
137 } 142 }
138 143
139 .bg-gray { 144 .bg-gray {
140 background-color: #cccccc; 145 background-color: #cccccc;
141 } 146 }
142 147