Commit 7809cdfb0c1591095075d90f3a78d837b7a75a20

Authored by Marcelo Puebla
1 parent c619abbde9
Exists in master

Muestreo el sinonimo padre al prinicipio.

src/app/components/popover-sinonimos/popover-sinonimos.component.ts
... ... @@ -23,15 +23,20 @@ export class PopoverSinonimosComponent implements OnInit {
23 23  
24 24 ngOnInit() {
25 25  
26   - //Seteo en la variable a emitir el sinonimo que sea padre
27 26 this.popoverContent.forEach(sinonimo => {
28 27  
29 28 this.cantidadRestanteSinonimos.push(0);
30   - // this.sinonimo = sinonimo.productoPadre ? sinonimo : undefined;
31 29  
32   - sinonimo.productos.forEach(producto => {
  30 + sinonimo.productos.forEach((producto, index) => {
  31 +
  32 + if (producto.id === sinonimo.productoPadre) {
  33 + sinonimo.productos.splice(index, 1);
  34 + sinonimo.productos.splice(0, 0, producto);
  35 + producto.cantidad = sinonimo.cantidad;
  36 + } else {
  37 + producto.cantidad = 0;
  38 + }
33 39  
34   - producto.cantidad = (producto.id === sinonimo.productoPadre) ? sinonimo.cantidad : 0;
35 40 })
36 41 })
37 42 }