Commit 0b89cb8931e28c796181a3d251f07727559f589e
1 parent
260cc9aed1
Exists in
master
Logica para elegirProducto cuando es una promo.
Showing
1 changed file
with
16 additions
and
2 deletions
Show diff stats
src/app/components/busqueda-productos/busqueda-productos.component.ts
| ... | ... | @@ -63,7 +63,21 @@ export class BusquedaProductosComponent implements OnInit { |
| 63 | 63 | |
| 64 | 64 | private elegirProducto(producto: Producto) { |
| 65 | 65 | |
| 66 | - this.productoService.productoAcargar = producto; | |
| 67 | - this.router.navigate(['inicio']); | |
| 66 | + if (producto.PRO) { | |
| 67 | + | |
| 68 | + this.productoService.getPromocionByCodigos(producto.CodSec, producto.CodArt) | |
| 69 | + .subscribe(res => { | |
| 70 | + | |
| 71 | + this.productoService.productoAcargar = res[0]; | |
| 72 | + this.router.navigate(['inicio']); | |
| 73 | + }, | |
| 74 | + error => { console.error(error); } | |
| 75 | + ); | |
| 76 | + }else { | |
| 77 | + | |
| 78 | + this.productoService.productoAcargar = producto; | |
| 79 | + this.router.navigate(['inicio']); | |
| 80 | + } | |
| 81 | + | |
| 68 | 82 | } |
| 69 | 83 | } |