Commit c81c434e09dcd5559bae71f12fbc71d050af1d18
Exists in
develop
Merge branch 'develop' into 'develop'
Develop See merge request !75
Showing
3 changed files
Show diff stats
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.ts
src/app/shared/header-publicidad/header-publicidad.component.ts
| ... | ... | @@ -84,6 +84,12 @@ export class HeaderPublicidadComponent implements OnInit { |
| 84 | 84 | this.sinonimoService.getSinonimos(articulo.CodSec, articulo.CodArt) |
| 85 | 85 | .subscribe((res: ISinonimo[]) => { |
| 86 | 86 | if (res.length) { |
| 87 | + const sinonimos = []; | |
| 88 | + const gruposArticulos = _.groupBy(res[0].productos, 'ID_SIN'); | |
| 89 | + Object.keys(gruposArticulos).forEach(key => { | |
| 90 | + sinonimos.push({ productos: gruposArticulos[key] }); | |
| 91 | + }); | |
| 92 | + res = sinonimos; | |
| 87 | 93 | this.openModalSinonimos(res, articulo); |
| 88 | 94 | } else { |
| 89 | 95 | articulo.cantidad = 1; |
| ... | ... | @@ -102,15 +108,17 @@ export class HeaderPublicidadComponent implements OnInit { |
| 102 | 108 | modalSinonimo.content.onClose |
| 103 | 109 | .subscribe((res: any) => { |
| 104 | 110 | for (const a of articulo.productos) { |
| 105 | - if (a.idSinonimo === res.ID_SIN) { | |
| 106 | - a.CODA = res.articulo.CodArt; | |
| 107 | - a.CodArt = res.articulo.CodArt; | |
| 108 | - a.SECA = res.articulo.CodSec; | |
| 109 | - a.CodSec = res.articulo.CodSec; | |
| 110 | - a.PreVen = res.articulo.PreVen; | |
| 111 | - a.id = res.articulo.id; | |
| 112 | - a.DET_LAR = res.articulo.DET_LAR; | |
| 113 | - a.DetArt = res.articulo.DetArt; | |
| 111 | + for (const aRes of res.articulos) { | |
| 112 | + if (a.idSinonimo === aRes.ID_SIN) { | |
| 113 | + a.CODA = aRes.CodArt; | |
| 114 | + a.CodArt = aRes.CodArt; | |
| 115 | + a.SECA = aRes.CodSec; | |
| 116 | + aRes.CodSec = aRes.CodSec; | |
| 117 | + a.PreVen = aRes.PreVen; | |
| 118 | + a.id = aRes.id; | |
| 119 | + a.DET_LAR = aRes.DET_LAR; | |
| 120 | + a.DetArt = aRes.DetArt; | |
| 121 | + } | |
| 114 | 122 | } |
| 115 | 123 | } |
| 116 | 124 | this.articuloService.setArticulo(articulo); |
src/app/shared/sinonimo/sinonimo.component.ts
| ... | ... | @@ -75,8 +75,8 @@ export class SinonimoComponent implements OnInit { |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | scrollTo(index: number) { |
| 78 | - const element = document.getElementById(index.toString()); | |
| 79 | - element.scrollIntoView({ behavior: 'smooth', block: 'center' }); | |
| 78 | + const el = document.getElementById(index.toString()); | |
| 79 | + el.scrollIntoView({ behavior: 'smooth', block: 'center' }); | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | } |