Commit 09fee6732935ea5a68a3ee9284f4a3da9ada96f6

Authored by Marcelo Puebla
Exists in develop

Merge branch 'develop' into 'develop'

Develop

See merge request !117
src/app/modules/carrito/carrito.component.html
... ... @@ -82,7 +82,7 @@
82 82 <div class="row mx-3 mt-2 h-auto justify-content-end">
83 83 <div class="col-auto font-weight-bold align-self-center text-primary py-2 h3">TOTAL</div>
84 84 <div class="col-auto align-self-center bg-primary badge-pill">
85   - <p class="text-center font-weight-bold text-white py-2 h3 px-2">{{articuloService.subTotal | currency}}</p>
  85 + <p class="text-center font-weight-bold text-white py-2 h3 px-2">{{articuloService.total | currency}}</p>
86 86 </div>
87 87 </div>
88 88 <!-- CONTINUAR -->
src/app/modules/seleccion-articulos/seleccion-articulos.component.html
... ... @@ -167,7 +167,7 @@
167 167 <div class="row mx-0">
168 168 <div class="col-auto font-weight-bold align-self-center text-primary py-2 h3">TOTAL</div>
169 169 <div class="col-auto align-self-center bg-primary badge-pill">
170   - <p class="text-center font-weight-bold text-white py-2 h3 px-2">{{articuloService.subTotal | currency}}</p>
  170 + <p class="text-center font-weight-bold text-white py-2 h3 px-2">{{articuloService.total | currency}}</p>
171 171 </div>
172 172 </div>
173 173 </div>
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
... ... @@ -155,17 +155,11 @@ export class SeleccionArticulosComponent implements OnInit, AfterViewInit, OnDes
155 155 this.modalRef.content.onClose
156 156 .subscribe((res: any) => {
157 157 this.modalRef = null;
  158 + if (!res) return;
158 159 for (const a of articulo.productos) {
159 160 for (const aRes of res.articulos) {
160 161 if (a.idSinonimo === aRes.ID_SIN) {
161   - a.CODA = aRes.CodArt;
162   - a.CodArt = aRes.CodArt;
163   - a.SECA = aRes.CodSec;
164   - aRes.CodSec = aRes.CodSec;
165   - a.PreVen = aRes.PreVen;
166   - a.id = aRes.id;
167   - a.DET_LAR = aRes.DET_LAR;
168   - a.DetArt = aRes.DetArt;
  162 + this.articuloService.changeArticulo(a, aRes);
169 163 }
170 164 }
171 165 }
src/app/modules/splash-screen/splash-screen.component.ts
1 1 import { Component, OnInit } from '@angular/core';
  2 +import { ArticuloService } from 'src/app/services/articulo/articulo.service';
2 3  
3 4 @Component({
4 5 selector: 'app-splash-screen',
... ... @@ -13,9 +14,12 @@ export class SplashScreenComponent implements OnInit {
13 14 textInvitamos = 'TE INVITAMOS A HACER';
14 15 textTuPedido = 'tu pedido acá';
15 16  
16   - constructor() {}
  17 + constructor(
  18 + private articuloService: ArticuloService,
  19 + ) { }
17 20  
18 21 ngOnInit() {
  22 + this.articuloService.cleanShoppingCar();
19 23 localStorage.clear();
20 24 setTimeout(() => {
21 25 this.showSplashScreen = false;
src/app/services/articulo/articulo.service.ts
... ... @@ -15,7 +15,7 @@ export class ArticuloService {
15 15 urlDeboSuite = APP_SETTINGS.apiDeboSuite;
16 16 medioPago: number;
17 17 idComanda: number;
18   - subTotal = 0;
  18 + total = 0;
19 19 maxCantidad = 50;
20 20  
21 21 constructor(
... ... @@ -48,9 +48,9 @@ export class ArticuloService {
48 48 }
49 49  
50 50 calcularTotal() {
51   - this.subTotal = 0;
  51 + this.total = 0;
52 52 this.carrito.forEach(articulo => {
53   - this.subTotal += (articulo.PreVen * articulo.cantidad);
  53 + this.total += (articulo.PreVen * articulo.cantidad);
54 54 });
55 55 }
56 56  
... ... @@ -126,4 +126,16 @@ export class ArticuloService {
126 126 }
127 127 });
128 128 }
  129 +
  130 + changeArticulo(articuloToChange: IArticulo, articuloData: any) {
  131 + articuloToChange.CODA = articuloData.CodArt;
  132 + articuloToChange.CodArt = articuloData.CodArt;
  133 + articuloToChange.SECA = articuloData.CodSec;
  134 + articuloToChange.CodSec = articuloData.CodSec;
  135 + articuloToChange.PreVen = articuloData.PreVen;
  136 + articuloToChange.id = articuloData.id;
  137 + articuloToChange.DET_LAR = articuloData.DET_LAR;
  138 + articuloToChange.DetArt = articuloData.DetArt;
  139 + articuloToChange.MKT_DESC = articuloData.MKT_DESC;
  140 + }
129 141 }
src/app/shared/header-publicidad/header-publicidad.component.ts
... ... @@ -121,14 +121,7 @@ export class HeaderPublicidadComponent implements OnInit {
121 121 for (const a of articulo.productos) {
122 122 for (const aRes of res.articulos) {
123 123 if (a.idSinonimo === aRes.ID_SIN) {
124   - a.CODA = aRes.CodArt;
125   - a.CodArt = aRes.CodArt;
126   - a.SECA = aRes.CodSec;
127   - aRes.CodSec = aRes.CodSec;
128   - a.PreVen = aRes.PreVen;
129   - a.id = aRes.id;
130   - a.DET_LAR = aRes.DET_LAR;
131   - a.DetArt = aRes.DetArt;
  124 + this.articuloService.changeArticulo(a, aRes);
132 125 }
133 126 }
134 127 }
src/app/shared/promocion/promocion.component.ts
... ... @@ -85,14 +85,7 @@ export class PromocionComponent implements OnInit {
85 85 for (const a of articulo.productos) {
86 86 for (const aRes of res.articulos) {
87 87 if (a.idSinonimo === aRes.ID_SIN) {
88   - a.CODA = aRes.CodArt;
89   - a.CodArt = aRes.CodArt;
90   - a.SECA = aRes.CodSec;
91   - aRes.CodSec = aRes.CodSec;
92   - a.PreVen = aRes.PreVen;
93   - a.id = aRes.id;
94   - a.DET_LAR = aRes.DET_LAR;
95   - a.DetArt = aRes.DetArt;
  88 + this.articuloService.changeArticulo(a, aRes);
96 89 }
97 90 }
98 91 }
src/app/shared/sinonimo/sinonimo.component.ts
... ... @@ -58,19 +58,14 @@ export class SinonimoComponent implements OnInit {
58 58  
59 59 for (const articulo of this.articulosSelected) {
60 60 ID_SINS.push(articulo.ID_SIN);
61   - }
62   -
63   - for (const articulo of this.articulosSelected) {
64 61 observables.push(this.articuloService.getById(articulo.id));
65 62 }
66 63  
67 64 forkJoin(observables)
68 65 .subscribe((res: IArticulo[]) => {
69   - for (const articulo of res) {
70   - for (const ID_SIN of ID_SINS) {
71   - articulo.ID_SIN = ID_SIN;
72   - }
73   - }
  66 + res.forEach((articulo, i) => {
  67 + articulo.ID_SIN = ID_SINS[i];
  68 + });
74 69 this.modalRef.hide();
75 70 this.onClose.next({
76 71 articulos: res,