Commit 88fcefad528db2d39b35ace06c48b0773fa1b0d6

Authored by Marcelo Puebla
Exists in master and in 1 other branch validar_pve

Merge branch 'master' into 'master'

Master

See merge request !43
src/app/components/confirmacion-carrito/confirmacion-carrito.component.html
... ... @@ -36,18 +36,18 @@
36 36 <div class="row ml-4 pr-3 vh-70 overflow-scroll text-dark">
37 37 <div class="col-4 p-2" *ngFor="let producto of productos">
38 38 <div class="bg-white rounded-sm shadow border-0">
39   - <img src="{{apiUrl}}/imagenes/testImg.jpg" class="rounded-sm w-100 m-auto">
  39 + <img src="{{apiUrl}}/imagenes/{{producto.imagenes[0].imagen}}" class="rounded-sm w-100 m-auto">
40 40 <div class="p-2">
41   - <p class="h6 text-left m-0">ZARAZA</p>
  41 + <p class="h6 text-left m-0">{{producto.DetArt}}</p>
42 42 <div class="row justify-content-between m-0">
43 43 <div class="col-12 p-0">
44 44 <div class="text-left">
45   - <p class="m-0 h6"><small>ZARAZA DETALLE</small></p>
46   - <p class="m-0 h6"><small>COD. 5656</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>
47 47 </div>
48 48 </div>
49 49 <div class="col-12 my-auto pt-2 pr-2 p-0">
50   - <p class="text-right m-0 h6">{{20 | currency}}</p>
  50 + <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p>
51 51 </div>
52 52 </div>
53 53 </div>
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
1 1 import { Component, OnInit } from '@angular/core';
2 2 import { appSettings } from 'src/etc/AppSettings';
3 3 import { Location } from '@angular/common';
  4 +import { ProductoService } from 'src/app/services/producto.service';
4 5  
5 6 @Component({
6 7 selector: 'app-confirmacion-carrito',
... ... @@ -9,12 +10,13 @@ import { Location } from &#39;@angular/common&#39;;
9 10 })
10 11 export class ConfirmacionCarritoComponent implements OnInit {
11 12  
12   - productos = [{}, {}, {}];
  13 + productos = [];
13 14 private apiUrl: string = appSettings.apiUrl;
14 15  
15   - constructor(private location: Location) { }
  16 + constructor(private location: Location, private productoService: ProductoService) { }
16 17  
17 18 ngOnInit() {
  19 + this.productos = this.productoService.productos;
18 20 }
19 21  
20 22 volverPreviousPage() {
src/app/components/inicio/inicio.component.ts
... ... @@ -64,11 +64,11 @@ export class InicioComponent implements OnInit {
64 64  
65 65 if (res.length === 0) {
66 66 //Si no tiene promociones la cargará al carrito despues de un tiempo
67   - setTimeout(() => {
  67 + // setTimeout(() => {
68 68 this.productoAcargar.cantidad = 1;
69 69 this.productoService.productos.push(this.productoAcargar);
70 70 this.productoAcargar = this.productoService.productoAcargar = undefined;
71   - }, 2000)
  71 + // }, 2000)
72 72 } else {
73 73  
74 74 this.promociones = res;
src/app/components/sidebar/sidebar.component.html
... ... @@ -83,7 +83,7 @@
83 83 </div>
84 84 <div class="col-12">
85 85 <button
86   - *ngIf="cantTotal > 0"
  86 + *ngIf="getCantidadProductos() > 0"
87 87 type="button"
88 88 class="btn btn-block btn-light btn-lg shadow mb-2 p-1"
89 89 routerLink="/confirmacion-carrito">
src/app/components/sidebar/sidebar.component.ts
... ... @@ -34,14 +34,13 @@ export class SidebarComponent implements OnInit {
34 34  
35 35 getCantidadProductos() {
36 36  
37   - setTimeout(() => {
38   - var cantTotalAux = 0;
39   - this.productosCarrito.forEach(producto => {
40   -
41   - cantTotalAux += producto.cantidad;
42   - }, 250);
43   - this.cantTotal = cantTotalAux;
44   - })
  37 + var cantTotalAux = 0;
  38 + this.productosCarrito.forEach(producto => {
  39 +
  40 + cantTotalAux += producto.cantidad;
  41 + });
  42 + this.cantTotal = cantTotalAux;
  43 +
45 44 return this.cantTotal;
46 45 }
47 46