Commit 03a1244b6534151405b51d64496c0b62d273ee70

Authored by Benjamin Rodriguez
1 parent 0a9f7689a1

boton total terminado

src/app/modules/carrito/carrito.component.ts
... ... @@ -42,16 +42,19 @@ export class CarritoComponent implements OnInit {
42 42  
43 43 deleteArticulo(index: number) {
44 44 this.articuloService.carrito.splice(index, 1);
  45 + this.articuloService.calcularTotal();
45 46 }
46 47  
47 48 substractCant(articulo: IArticulo) {
48 49 if (articulo.cantidad === 1) return;
49 50 articulo.cantidad--;
  51 + this.articuloService.calcularTotal();
50 52 }
51 53  
52 54 addCant(articulo: IArticulo) {
53 55 if (articulo.cantidad >= this.maxCantidad) return;
54 56 articulo.cantidad++;
  57 + this.articuloService.calcularTotal();
55 58 }
56 59  
57 60 goBack() {
src/app/modules/opcion-pedido/opcion-pedido.component.html
... ... @@ -12,7 +12,7 @@
12 12 <div class="h-85">
13 13 <div class="row mt-5 mx-3 h-auto">
14 14 <div class="col-12 px-0 py-2 align-self-center">
15   - <p class="h6 text-truncate text-center">TÚ PEDIDO ES PARA</p>
  15 + <p class="h6 text-truncate text-center">TU PEDIDO ES PARA</p>
16 16 </div>
17 17 </div>
18 18 <div class="row mt-5 h-auto justify-content-center mx-0">
src/app/modules/pago-tarjeta/pago-tarjeta.component.html
... ... @@ -20,7 +20,7 @@
20 20 src="assets/img/icono-tarjetas.svg">
21 21 <p class="h6 m-0">AHORA</p>
22 22 <p class="h2 mb-3 text-secondary">
23   - introducí o insertá tú tarjeta
  23 + introducí o insertá tu tarjeta
24 24 </p>
25 25 <p class="h6 m-0">Y SEGUÍ LAS INSTRUCCIONES DEL LECTOR</p>
26 26 </div>
src/app/modules/seleccion-articulos/seleccion-articulos.component.html
... ... @@ -199,12 +199,12 @@
199 199 <div
200 200 class="btn-effect col-auto align-self-center px-0 bg-white"
201 201 [routerLink]="['/carrito']">
202   - <div class="row justify-content-between mx-0 bg-light">
  202 + <div class="row justify-content-between mx-0">
203 203 <div class="col-auto align-self-center text-primary">TOTAL</div>
204 204 <div class="col-auto p-0 bg-primary d-none d-sm-block total-background">
205   - <p class="text-center text-white mt-1 py-1">$---</p>
  205 + <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p>
206 206 </div>
207   - <div class="col-auto align-self-center text-primary ml-2">VER CARRITO</div>
  207 + <div class="col-auto align-self-center text-primary ml-2 bg-light">VER CARRITO</div>
208 208 <div class="col-auto p-0 bg-primary d-none d-sm-block">
209 209 <img
210 210 draggable="false"
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
... ... @@ -85,14 +85,6 @@ export class SeleccionArticulosComponent implements OnInit {
85 85 });
86 86 }
87 87  
88   - getTotal() {
89   - var subTotal = 0;
90   - this.articulos.forEach(producto => {
91   - subTotal = subTotal + (producto.PreVen * producto.cantidad);
92   - });
93   - return this.total = subTotal;
94   - }
95   -
96 88 setProductos() {
97 89 this.articulos = JSON.parse(localStorage.getItem('articulos'));
98 90 this.filterItems();
src/app/modules/splash-screen/splash-screen.component.ts
... ... @@ -11,7 +11,7 @@ export class SplashScreenComponent implements OnInit {
11 11 textWelcome = 'BIENVENIDO A SPOT!';
12 12 textComoEstas = '¿cómo estás?';
13 13 textInvitamos = 'TE INVITAMOS A HACER';
14   - textTuPedido = 'tú pedido acá';
  14 + textTuPedido = 'tu pedido acá';
15 15  
16 16 constructor() { }
17 17  
src/app/services/articulo/articulo.service.ts
... ... @@ -15,6 +15,7 @@ export class ArticuloService {
15 15 urlDeboSuite = APP_SETTINGS.apiDeboSuite;
16 16 medioPago: number;
17 17 idComanda: number;
  18 + subTotal: number = 0;
18 19  
19 20 constructor(
20 21 private http: HttpClient,
... ... @@ -33,6 +34,13 @@ export class ArticuloService {
33 34 return this.http.get(`${this.urlDeboSuite}/articulos/${page}`);
34 35 }
35 36  
  37 + calcularTotal() {
  38 + this.subTotal=0
  39 + this.carrito.forEach(articulo => {
  40 + this.subTotal += (articulo.PreVen * articulo.cantidad);
  41 + });
  42 + }
  43 +
36 44 setArticulo(articulo: IArticulo) {
37 45 for (const articuloCarrito of this.carrito) {
38 46 if (articuloCarrito.id === articulo.id) {
... ... @@ -43,6 +51,7 @@ export class ArticuloService {
43 51 }
44 52 this.setArticulosSinImagen([articulo]);
45 53 this.carrito.unshift(articulo);
  54 + this.calcularTotal();
46 55 }
47 56  
48 57 pay(dataPago: any) {