Commit dd6738d0d6f4fbe66a731be0b5bb8e45781390e9

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

Asignando el precio total a una variable.

src/app/components/popover-promos/popover-promos.component.html
... ... @@ -24,7 +24,7 @@
24 24 </div>
25 25 <div class="col-12 text-right mt-2">
26 26 <p class="h4 font-weight-bold mb-0">
27   - {{calcularPrecioDePromo(promo.productos) | currency}}
  27 + {{calcularPrecioDePromo(promo) | currency}}
28 28 </p>
29 29 </div>
30 30 </div>
src/app/components/popover-promos/popover-promos.component.ts
... ... @@ -28,14 +28,13 @@ export class PopoverPromosComponent implements OnInit {
28 28 this.promoSeleccionada.emit(promo);
29 29 }
30 30  
31   - calcularPrecioDePromo(productos: Producto[]) {
  31 + calcularPrecioDePromo(promo: Promocion) {
32 32  
33   - var precio = 0;
34   - productos.forEach(producto => {
35   - precio += producto.PreVen;
  33 + promo.precioTotal = 0;
  34 + promo.productos.forEach(producto => {
  35 + promo.precioTotal += producto.PreVen;
36 36 })
37   -
38   - return precio;
  37 + return promo.precioTotal;
39 38 }
40 39  
41 40 }