Commit a0f6eb205187d108e8b7523644c4300df08070d0

Authored by Marcelo Puebla
Exists in develop

Merge branch 'develop' into 'develop'

Develop

See merge request !120
src/app/shared/promocion/promocion.component.ts
... ... @@ -43,22 +43,26 @@ export class PromocionComponent implements OnInit {
43 43 selectPromo(promo: IArticulo) {
44 44 if (this.isPromoSelected) return;
45 45 this.isPromoSelected = true;
46   - this.sinonimoService.getSinonimos(promo.CodSec, promo.CodArt)
47   - .subscribe((res: ISinonimo[]) => {
48   - if (res.length) {
49   - const sinonimos = [];
50   - const gruposArticulos = _.groupBy(res[0].productos, 'ID_SIN');
51   - Object.keys(gruposArticulos).forEach(key => {
52   - sinonimos.push({ productos: gruposArticulos[key] });
53   - });
54   - res = sinonimos;
55   - this.openModalSinonimos(res, promo);
56   - } else {
57   - promo.cantidad = 1;
58   - this.articuloService.setArticulo(promo);
59   - this.onClose.next();
60   - this.modalPromocion.hide();
61   - }
  46 + this.articuloService.getById(promo.id)
  47 + .subscribe((resPromo: IArticulo) => {
  48 + promo = resPromo;
  49 + this.sinonimoService.getSinonimos(promo.CodSec, promo.CodArt)
  50 + .subscribe((res: ISinonimo[]) => {
  51 + if (res.length) {
  52 + const sinonimos = [];
  53 + const gruposArticulos = _.groupBy(res[0].productos, 'ID_SIN');
  54 + Object.keys(gruposArticulos).forEach(key => {
  55 + sinonimos.push({ productos: gruposArticulos[key] });
  56 + });
  57 + res = sinonimos;
  58 + this.openModalSinonimos(res, promo);
  59 + } else {
  60 + promo.cantidad = 1;
  61 + this.articuloService.setArticulo(promo);
  62 + this.onClose.next();
  63 + this.modalPromocion.hide();
  64 + }
  65 + }, err => console.error(err));
62 66 }, err => console.error(err));
63 67 this.mediaPantalla();
64 68 }