Commit ab7cb335b79127fe340271e43e583e0157cb46fe
1 parent
9d4962bfe6
Exists in
develop
Fix
Seleccion de sinonimos
Showing
2 changed files
with
13 additions
and
6 deletions
Show diff stats
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
... | ... | @@ -127,13 +127,13 @@ export class SeleccionArticulosComponent implements OnInit, AfterViewInit, OnDes |
127 | 127 | getSinonimos(articulo: IArticulo) { |
128 | 128 | this.sinonimoService.getSinonimos(articulo.CodSec, articulo.CodArt) |
129 | 129 | .subscribe((res: any[]) => { |
130 | - const sinonimos = []; | |
131 | - const gruposArticulos = _.groupBy(res[0].productos, 'ID_SIN'); | |
132 | - Object.keys(gruposArticulos).forEach(key => { | |
133 | - sinonimos.push({ productos: gruposArticulos[key] }); | |
134 | - }); | |
135 | - res = sinonimos; | |
136 | 130 | if (res.length) { |
131 | + const sinonimos = []; | |
132 | + const gruposArticulos = _.groupBy(res[0].productos, 'ID_SIN'); | |
133 | + Object.keys(gruposArticulos).forEach(key => { | |
134 | + sinonimos.push({ productos: gruposArticulos[key] }); | |
135 | + }); | |
136 | + res = sinonimos; | |
137 | 137 | this.openModalSinonimos(res, articulo); |
138 | 138 | } else { |
139 | 139 | this.articuloService.setArticulo(articulo); |
src/app/shared/promocion/promocion.component.ts
... | ... | @@ -9,6 +9,7 @@ import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive |
9 | 9 | import { SinonimoService } from 'src/app/services/sinonimo/sinonimo.service'; |
10 | 10 | import { ISinonimo } from 'src/app/interfaces/ISinonimo'; |
11 | 11 | import { SinonimoComponent } from '../sinonimo/sinonimo.component'; |
12 | +import * as _ from 'lodash'; | |
12 | 13 | |
13 | 14 | @Component({ |
14 | 15 | selector: 'app-promocion', |
... | ... | @@ -40,6 +41,12 @@ export class PromocionComponent implements OnInit { |
40 | 41 | this.sinonimoService.getSinonimos(promo.CodSec, promo.CodArt) |
41 | 42 | .subscribe((res: ISinonimo[]) => { |
42 | 43 | if (res.length) { |
44 | + const sinonimos = []; | |
45 | + const gruposArticulos = _.groupBy(res[0].productos, 'ID_SIN'); | |
46 | + Object.keys(gruposArticulos).forEach(key => { | |
47 | + sinonimos.push({ productos: gruposArticulos[key] }); | |
48 | + }); | |
49 | + res = sinonimos; | |
43 | 50 | this.openModalSinonimos(res, promo); |
44 | 51 | } else { |
45 | 52 | promo.cantidad = 1; |