Commit a7e65d11981b2b72ffd253d0682022c4472e3888

Authored by Luis Suarez
Exists in develop

Merge branch 'develop' of http://git.focasoftware.com/angular/autoservicio-axion into develop

Traer version actual desde upstream
... ... @@ -1981,6 +1981,12 @@
1981 1981 "@types/sizzle": "*"
1982 1982 }
1983 1983 },
  1984 + "@types/lodash": {
  1985 + "version": "4.14.149",
  1986 + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.149.tgz",
  1987 + "integrity": "sha512-ijGqzZt/b7BfzcK9vTrS6MFljQRPn5BFWOx8oE0GYxribu6uV+aA9zZuXI1zc/etK9E8nrgdoF2+LgUw7+9tJQ==",
  1988 + "dev": true
  1989 + },
1984 1990 "@types/minimatch": {
1985 1991 "version": "3.0.3",
1986 1992 "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
... ... @@ -7847,8 +7853,7 @@
7847 7853 "lodash": {
7848 7854 "version": "4.17.15",
7849 7855 "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
7850   - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
7851   - "dev": true
  7856 + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
7852 7857 },
7853 7858 "lodash.clonedeep": {
7854 7859 "version": "4.5.0",
... ... @@ -30,6 +30,7 @@
30 30 "hammerjs": "^2.0.8",
31 31 "jquery": "^3.4.1",
32 32 "js-sha256": "^0.9.0",
  33 + "lodash": "^4.17.15",
33 34 "ngx-bootstrap": "^5.2.0",
34 35 "popper.js": "^1.16.0",
35 36 "rxjs": "~6.4.0",
... ... @@ -44,6 +45,7 @@
44 45 "@fortawesome/fontawesome-free": "^5.12.0",
45 46 "@types/jasmine": "~3.3.8",
46 47 "@types/jasminewd2": "~2.0.3",
  48 + "@types/lodash": "^4.14.149",
47 49 "@types/node": "~8.9.4",
48 50 "codelyzer": "^5.0.0",
49 51 "devtron": "^1.4.0",
src/app/app-routing.module.ts
... ... @@ -53,7 +53,7 @@ const routes: Routes = [
53 53 },
54 54 {
55 55 path: 'cancelar-compra',
56   - loadChildren: () => import('./modules/cancelar-compra/cancelar-compra.module').then(m => m.CancelarCompraModule)
  56 + loadChildren: () => import('./shared/cancelar-compra/cancelar-compra.module').then(m => m.CancelarCompraModule)
57 57 },
58 58 { path: '**', redirectTo: '', pathMatch: 'full' },
59 59 ];
src/app/interfaces/ISinonimo.ts
... ... @@ -6,4 +6,5 @@ export interface ISinonimo {
6 6 productos: IArticulo[];
7 7 productoPadre?: number;
8 8 cantidad?: number;
  9 + selected?: boolean;
9 10 }
src/app/modules/cancelar-compra/cancelar-compra-routing.module.ts
... ... @@ -1,14 +0,0 @@
1   -import { NgModule, Component } from '@angular/core';
2   -import { Routes, RouterModule } from '@angular/router';
3   -import { CancelarCompraComponent } from './cancelar-compra.component';
4   -
5   -
6   -const routes: Routes = [
7   - { path: '', component: CancelarCompraComponent }
8   -];
9   -
10   -@NgModule({
11   - imports: [RouterModule.forChild(routes)],
12   - exports: [RouterModule]
13   -})
14   -export class CancelarCompraRoutingModule { }
src/app/modules/cancelar-compra/cancelar-compra.component.html
... ... @@ -1,51 +0,0 @@
1   -<div class="row justify-content-center mt-2 h-15">
2   - <img class="h-100 w-auto my-auto" src="../../../assets/img/logo-spot.svg">
3   -</div>
4   -<div class="row mx-auto h-70">
5   - <div class="col-12 align-self-center">
6   - <div class="row mt-5 mx-0 justify-content-around">
7   - <div class="col-12 col-sm-8 col-md-6 col-lg-3">
8   - <div class="p-3 bg-white text-center shadow-lg rounded">
9   - <p class="mt-4 h4">NECESITA</p>
10   - <p class="font-weight-bold text-secondary my-4 h2">mรกs tiempo</p>
11   - <p class="mb-4 h4">PARA SU PEDIDO?</p>
12   - </div>
13   - </div>
14   - </div>
15   - <!-- BUTTONS -->
16   - <div class="row mx-0 mt-5 justify-content-center">
17   - <div class="col-auto px-0 align-self-start">
18   - <div
19   - class="row mx-0 py-1 btn-effect bg-primary badge-pill"
20   - (click)="volverPreviousPage()">
21   - <div class="col-auto align-self-center text-white">continuar compra</div>
22   - <div class="col-auto align-self-center p-0">
23   - <img
24   - draggable="false"
25   - ondragstart="return false;"
26   - (contextmenu)="false"
27   - class="p-1 icon-30"
28   - src="assets/img/ir.svg">
29   - </div>
30   - </div>
31   - </div>
32   - </div>
33   - <div class="row mx-0 mt-4 justify-content-center">
34   - <div class="col-auto px-0 align-self-start">
35   - <div
36   - class="row mx-0 py-1 btn-effect bg-grey badge-pill"
37   - (click)="limpiarCarritoYvolver()">
38   - <div class="col-auto align-self-center">cancelar compra</div>
39   - <div class="col-auto align-self-center p-0">
40   - <img
41   - draggable="false"
42   - ondragstart="return false;"
43   - (contextmenu)="false"
44   - class="p-1 icon-30"
45   - src="assets/img/icono-cancelar-color.svg">
46   - </div>
47   - </div>
48   - </div>
49   - </div>
50   - </div>
51   -</div>
src/app/modules/cancelar-compra/cancelar-compra.component.scss
... ... @@ -1,3 +0,0 @@
1   -.bg-grey {
2   - background-color: rgb(212, 212, 212);
3   -}
src/app/modules/cancelar-compra/cancelar-compra.component.spec.ts
... ... @@ -1,25 +0,0 @@
1   -import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2   -
3   -import { CancelarCompraComponent } from './cancelar-compra.component';
4   -
5   -describe('CancelarCompraComponent', () => {
6   - let component: CancelarCompraComponent;
7   - let fixture: ComponentFixture<CancelarCompraComponent>;
8   -
9   - beforeEach(async(() => {
10   - TestBed.configureTestingModule({
11   - declarations: [ CancelarCompraComponent ]
12   - })
13   - .compileComponents();
14   - }));
15   -
16   - beforeEach(() => {
17   - fixture = TestBed.createComponent(CancelarCompraComponent);
18   - component = fixture.componentInstance;
19   - fixture.detectChanges();
20   - });
21   -
22   - it('should create', () => {
23   - expect(component).toBeTruthy();
24   - });
25   -});
src/app/modules/cancelar-compra/cancelar-compra.component.ts
... ... @@ -1,38 +0,0 @@
1   -import { Component, OnInit, OnDestroy } from '@angular/core';
2   -import { Location } from '@angular/common';
3   -import { ArticuloService } from 'src/app/services/articulo/articulo.service';
4   -import { Router } from '@angular/router';
5   -
6   -@Component({
7   - selector: 'app-cancelar-compra',
8   - templateUrl: './cancelar-compra.component.html',
9   - styleUrls: ['./cancelar-compra.component.scss']
10   -})
11   -export class CancelarCompraComponent implements OnInit, OnDestroy {
12   - timer: any;
13   -
14   - constructor(
15   - private location: Location,
16   - private router: Router,
17   - private articuloService: ArticuloService
18   - ) { }
19   -
20   - ngOnInit() {
21   - this.timer = setTimeout(() => {
22   - this.limpiarCarritoYvolver();
23   - }, 90000);
24   - }
25   -
26   - ngOnDestroy() {
27   - clearTimeout(this.timer);
28   - }
29   -
30   - volverPreviousPage() {
31   - this.location.back();
32   - }
33   -
34   - limpiarCarritoYvolver() {
35   - this.articuloService.carrito = [];
36   - this.router.navigate(['/']);
37   - }
38   -}
src/app/modules/cancelar-compra/cancelar-compra.module.ts
... ... @@ -1,15 +0,0 @@
1   -import { NgModule } from '@angular/core';
2   -import { CommonModule } from '@angular/common';
3   -
4   -import { CancelarCompraRoutingModule } from './cancelar-compra-routing.module';
5   -import { CancelarCompraComponent } from './cancelar-compra.component';
6   -
7   -
8   -@NgModule({
9   - declarations: [CancelarCompraComponent],
10   - imports: [
11   - CommonModule,
12   - CancelarCompraRoutingModule
13   - ]
14   -})
15   -export class CancelarCompraModule { }
src/app/modules/comanda/comanda.component.html
... ... @@ -41,7 +41,7 @@
41 41 <p><i class="far fa-clock fa-spin text-info"></i></p>
42 42 </div>
43 43 <div *ngFor="let detalle of comanda.detalles">
44   - <p
  44 + <div
45 45 class="card-text border-top pt-2 mb-2"
46 46 [ngClass]="
47 47 {
... ... @@ -49,9 +49,16 @@
49 49 'border-light': comanda.estado != 1
50 50 }">
51 51 <!-- DETALLE Y CANTIDAD -->
52   - <small>{{detalle.DetLar}}</small><br>
53   - <small>CANT.{{detalle.cantidad}}</small>
54   - </p>
  52 + <p>
  53 + <small>{{detalle.DetLar}}</small><br>
  54 + <small>CANT.{{detalle.cantidad}}</small>
  55 + </p>
  56 + <div *ngFor="let componente of detalle.componentes">
  57 + <p *ngIf="componente.DetArt !== 'Producto ingrediente general'">
  58 + <small>{{componente.DetArt.toUpperCase()}}</small>
  59 + </p>
  60 + </div>
  61 + </div>
55 62 <blockquote
56 63 *ngIf="detalle.comentario">
57 64 <p class="text-muted font-italic px-4" *ngIf="comanda.estado === 1"><small>{{detalle.comentario}}</small></p>
... ... @@ -95,7 +102,7 @@
95 102 (click)="updateComanda(comanda, 1, 'Pagado')">
96 103 <div class="row justify-content-between">
97 104 <div></div>
98   - <span class="h6 ml-4"><small>Deshacer</small></span>
  105 + <span class="h6 ml-4 pt-1"><small>Deshacer</small></span>
99 106 <i class="fas fa-undo-alt text-info mr-4 my-auto"></i>
100 107 </div>
101 108 </button>
src/app/modules/info-formas-pago/info-formas-pago.component.html
... ... @@ -61,7 +61,7 @@
61 61 <ng-template #templateGoCaja>
62 62 <div class="bg-primary rounded shadow text-white">
63 63 <div class="modal-body text-center">
64   - Por favor, hace tu pedido en la caja.
  64 + Por favor, hacรฉ tu pedido en la caja.
65 65 </div>
66 66 </div>
67 67 </ng-template>
src/app/modules/opcion-pedido/opcion-pedido.component.html
... ... @@ -23,22 +23,22 @@
23 23 <div
24 24 class="btn-effect col-12 px-0 bg-white"
25 25 (click)="goTo('/seleccion-articulos'); seleccionPedido('false')">
26   - <div class="row mx-0 bg-primary badge-pill">
  26 + <div class="row mx-0 bg-primary badge-pill heigth-80">
27 27 <div class="col-2 p-0">
28 28 <img
29 29 draggable="false"
30 30 ondragstart="return false;"
31 31 (contextmenu)="false"
32   - class="p-1 icon-50"
  32 + class="pt-2 icon-60"
33 33 src="assets/img/icono-plato.svg">
34 34 </div>
35   - <div class="col-8 align-self-center text-center text-white">comer acรก</div>
  35 + <div class="col-8 align-self-center text-center text-white h3">comer acรก</div>
36 36 <div class="col-2 align-self-center p-0">
37 37 <img
38 38 draggable="false"
39 39 ondragstart="return false;"
40 40 (contextmenu)="false"
41   - class="p-1 icon-30"
  41 + class="p-1 icon-50"
42 42 src="assets/img/ir.svg">
43 43 </div>
44 44 </div>
... ... @@ -54,22 +54,22 @@
54 54 <div
55 55 class="btn-effect col-12 align-self-center px-0 bg-white"
56 56 (click)="goTo('/seleccion-articulos'); seleccionPedido('true')">
57   - <div class="row mx-0 bg-primary badge-pill">
  57 + <div class="row mx-0 bg-primary badge-pill heigth-80">
58 58 <div class="col-2 p-0">
59 59 <img
60 60 draggable="false"
61 61 ondragstart="return false;"
62 62 (contextmenu)="false"
63   - class="p-1 icon-50"
  63 + class="pt-2 icon-60"
64 64 src="assets/img/icono-take-away.svg">
65 65 </div>
66   - <div class="col-8 align-self-center text-center text-white">para llevar</div>
  66 + <div class="col-8 align-self-center text-center text-white h3">para llevar</div>
67 67 <div class="col-2 align-self-center p-0">
68 68 <img
69 69 draggable="false"
70 70 ondragstart="return false;"
71 71 (contextmenu)="false"
72   - class="p-1 icon-30"
  72 + class="p-1 icon-50"
73 73 src="assets/img/ir.svg">
74 74 </div>
75 75 </div>
src/app/modules/opcion-pedido/opcion-pedido.component.scss
... ... @@ -17,3 +17,7 @@
17 17 right: 10%;
18 18 margin-right: 0 !important;
19 19 }
  20 +
  21 +.heigth-80 {
  22 + height: 80px;
  23 +}
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
... ... @@ -12,6 +12,7 @@ import { SinonimoService } from &#39;src/app/services/sinonimo/sinonimo.service&#39;;
12 12 import { SinonimoComponent } from 'src/app/shared/sinonimo/sinonimo.component';
13 13 import { trigger, state, style, transition, animate } from '@angular/animations';
14 14 import { FiltroCategoriasComponent } from './filtro-categorias/filtro-categorias.component';
  15 +import * as _ from 'lodash';
15 16  
16 17 @Component({
17 18 selector: 'app-seleccion-articulos',
... ... @@ -125,7 +126,13 @@ export class SeleccionArticulosComponent implements OnInit, AfterViewInit, OnDes
125 126  
126 127 getSinonimos(articulo: IArticulo) {
127 128 this.sinonimoService.getSinonimos(articulo.CodSec, articulo.CodArt)
128   - .subscribe((res: ISinonimo[]) => {
  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;
129 136 if (res.length) {
130 137 this.openModalSinonimos(res, articulo);
131 138 } else {
... ... @@ -150,15 +157,17 @@ export class SeleccionArticulosComponent implements OnInit, AfterViewInit, OnDes
150 157 this.modalRef.content.onClose
151 158 .subscribe((res: any) => {
152 159 for (const a of articulo.productos) {
153   - if (a.idSinonimo === res.ID_SIN) {
154   - a.CODA = res.articulo.CodArt;
155   - a.CodArt = res.articulo.CodArt;
156   - a.SECA = res.articulo.CodSec;
157   - a.CodSec = res.articulo.CodSec;
158   - a.PreVen = res.articulo.PreVen;
159   - a.id = res.articulo.id;
160   - a.DET_LAR = res.articulo.DET_LAR;
161   - a.DetArt = res.articulo.DetArt;
  160 + for (const aRes of res.articulos) {
  161 + if (a.idSinonimo === aRes.ID_SIN) {
  162 + a.CODA = aRes.CodArt;
  163 + a.CodArt = aRes.CodArt;
  164 + a.SECA = aRes.CodSec;
  165 + aRes.CodSec = aRes.CodSec;
  166 + a.PreVen = aRes.PreVen;
  167 + a.id = aRes.id;
  168 + a.DET_LAR = aRes.DET_LAR;
  169 + a.DetArt = aRes.DetArt;
  170 + }
162 171 }
163 172 }
164 173 this.articuloService.setArticulo(articulo);
src/app/shared/cancelar-compra/cancelar-compra-routing.module.ts
... ... @@ -0,0 +1,14 @@
  1 +import { NgModule, Component } from '@angular/core';
  2 +import { Routes, RouterModule } from '@angular/router';
  3 +import { CancelarCompraComponent } from './cancelar-compra.component';
  4 +
  5 +
  6 +const routes: Routes = [
  7 + { path: '', component: CancelarCompraComponent }
  8 +];
  9 +
  10 +@NgModule({
  11 + imports: [RouterModule.forChild(routes)],
  12 + exports: [RouterModule]
  13 +})
  14 +export class CancelarCompraRoutingModule { }
src/app/shared/cancelar-compra/cancelar-compra.component.html
... ... @@ -0,0 +1,51 @@
  1 +<div class="row justify-content-center mt-2 h-15">
  2 + <img class="h-100 w-auto my-auto" src="../../../assets/img/logo-spot.svg">
  3 +</div>
  4 +<div class="row mx-auto h-70">
  5 + <div class="col-12 align-self-center">
  6 + <div class="row mt-5 mx-0 justify-content-around">
  7 + <div class="col-12 col-sm-8 col-md-6 col-lg-4">
  8 + <div class="p-3 bg-white text-center shadow-lg rounded">
  9 + <p class="mt-4 h4">NECESITA</p>
  10 + <p class="font-weight-bold text-secondary my-4 h2">mรกs tiempo</p>
  11 + <p class="mb-4 h4">PARA SU PEDIDO?</p>
  12 + </div>
  13 + </div>
  14 + </div>
  15 + <!-- BUTTONS -->
  16 + <div class="row mx-0 mt-5 justify-content-center">
  17 + <div class="col-auto px-0 align-self-start">
  18 + <div
  19 + class="row mx-0 py-1 btn-effect bg-primary badge-pill"
  20 + (click)="volverPreviousPage()">
  21 + <div class="col-auto align-self-center text-white">continuar compra</div>
  22 + <div class="col-auto align-self-center p-0">
  23 + <img
  24 + draggable="false"
  25 + ondragstart="return false;"
  26 + (contextmenu)="false"
  27 + class="p-1 icon-30"
  28 + src="assets/img/ir.svg">
  29 + </div>
  30 + </div>
  31 + </div>
  32 + </div>
  33 + <div class="row mx-0 mt-4 justify-content-center">
  34 + <div class="col-auto px-0 align-self-start">
  35 + <div
  36 + class="row mx-0 py-1 btn-effect bg-grey badge-pill"
  37 + (click)="limpiarCarritoYvolver()">
  38 + <div class="col-auto align-self-center">cancelar compra</div>
  39 + <div class="col-auto align-self-center p-0">
  40 + <img
  41 + draggable="false"
  42 + ondragstart="return false;"
  43 + (contextmenu)="false"
  44 + class="p-1 icon-30"
  45 + src="assets/img/icono-cancelar-color.svg">
  46 + </div>
  47 + </div>
  48 + </div>
  49 + </div>
  50 + </div>
  51 +</div>
src/app/shared/cancelar-compra/cancelar-compra.component.scss
... ... @@ -0,0 +1,3 @@
  1 +.bg-grey {
  2 + background-color: rgb(212, 212, 212);
  3 +}
src/app/shared/cancelar-compra/cancelar-compra.component.spec.ts
... ... @@ -0,0 +1,25 @@
  1 +import { async, ComponentFixture, TestBed } from '@angular/core/testing';
  2 +
  3 +import { CancelarCompraComponent } from './cancelar-compra.component';
  4 +
  5 +describe('CancelarCompraComponent', () => {
  6 + let component: CancelarCompraComponent;
  7 + let fixture: ComponentFixture<CancelarCompraComponent>;
  8 +
  9 + beforeEach(async(() => {
  10 + TestBed.configureTestingModule({
  11 + declarations: [ CancelarCompraComponent ]
  12 + })
  13 + .compileComponents();
  14 + }));
  15 +
  16 + beforeEach(() => {
  17 + fixture = TestBed.createComponent(CancelarCompraComponent);
  18 + component = fixture.componentInstance;
  19 + fixture.detectChanges();
  20 + });
  21 +
  22 + it('should create', () => {
  23 + expect(component).toBeTruthy();
  24 + });
  25 +});
src/app/shared/cancelar-compra/cancelar-compra.component.ts
... ... @@ -0,0 +1,38 @@
  1 +import { Component, OnInit, OnDestroy } from '@angular/core';
  2 +import { Location } from '@angular/common';
  3 +import { ArticuloService } from 'src/app/services/articulo/articulo.service';
  4 +import { Router } from '@angular/router';
  5 +
  6 +@Component({
  7 + selector: 'app-cancelar-compra',
  8 + templateUrl: './cancelar-compra.component.html',
  9 + styleUrls: ['./cancelar-compra.component.scss']
  10 +})
  11 +export class CancelarCompraComponent implements OnInit, OnDestroy {
  12 + timer: any;
  13 +
  14 + constructor(
  15 + private location: Location,
  16 + private router: Router,
  17 + private articuloService: ArticuloService
  18 + ) { }
  19 +
  20 + ngOnInit() {
  21 + this.timer = setTimeout(() => {
  22 + this.limpiarCarritoYvolver();
  23 + }, 90000);
  24 + }
  25 +
  26 + ngOnDestroy() {
  27 + clearTimeout(this.timer);
  28 + }
  29 +
  30 + volverPreviousPage() {
  31 + this.location.back();
  32 + }
  33 +
  34 + limpiarCarritoYvolver() {
  35 + this.articuloService.carrito = [];
  36 + this.router.navigate(['/']);
  37 + }
  38 +}
src/app/shared/cancelar-compra/cancelar-compra.module.ts
... ... @@ -0,0 +1,15 @@
  1 +import { NgModule } from '@angular/core';
  2 +import { CommonModule } from '@angular/common';
  3 +
  4 +import { CancelarCompraRoutingModule } from './cancelar-compra-routing.module';
  5 +import { CancelarCompraComponent } from './cancelar-compra.component';
  6 +
  7 +
  8 +@NgModule({
  9 + declarations: [CancelarCompraComponent],
  10 + imports: [
  11 + CommonModule,
  12 + CancelarCompraRoutingModule
  13 + ]
  14 +})
  15 +export class CancelarCompraModule { }
src/app/shared/promocion/promocion.component.ts
... ... @@ -59,15 +59,17 @@ export class PromocionComponent implements OnInit {
59 59 modalSinonimo.content.onClose
60 60 .subscribe((res: any) => {
61 61 for (const a of articulo.productos) {
62   - if (a.idSinonimo === res.ID_SIN) {
63   - a.CODA = res.articulo.CodArt;
64   - a.CodArt = res.articulo.CodArt;
65   - a.SECA = res.articulo.CodSec;
66   - a.CodSec = res.articulo.CodSec;
67   - a.PreVen = res.articulo.PreVen;
68   - a.id = res.articulo.id;
69   - a.DET_LAR = res.articulo.DET_LAR;
70   - a.DetArt = res.articulo.DetArt;
  62 + for (const aRes of res.articulos) {
  63 + if (a.idSinonimo === aRes.ID_SIN) {
  64 + a.CODA = aRes.CodArt;
  65 + a.CodArt = aRes.CodArt;
  66 + a.SECA = aRes.CodSec;
  67 + aRes.CodSec = aRes.CodSec;
  68 + a.PreVen = aRes.PreVen;
  69 + a.id = aRes.id;
  70 + a.DET_LAR = aRes.DET_LAR;
  71 + a.DetArt = aRes.DetArt;
  72 + }
71 73 }
72 74 }
73 75 this.articuloService.setArticulo(articulo);
src/app/shared/sinonimo/sinonimo.component.html
... ... @@ -3,17 +3,16 @@
3 3 <p class="h4">Elige una opciรณn</p>
4 4 </div>
5 5  
6   - <div class="modal-body">
7   - <div
8   - class="lista-sinonimos scroll-y-visible"
9   - *ngFor="let s of sinonimos">
  6 + <div class="modal-body lista-sinonimos scroll-y-visible my-2 mr-2">
  7 + <div *ngFor="let s of sinonimos; let i = index">
  8 + <br>
10 9 <div *ngFor="let articulo of s.productos">
11 10 <div class="custom-control custom-checkbox">
12 11 <input
13 12 type="checkbox"
14 13 class="custom-control-input"
15 14 [(ngModel)]="articulo.seleccionado"
16   - (click)="selectArticulo(articulo)"
  15 + (click)="selectSinonimo(i, articulo)"
17 16 [id]="articulo.id">
18 17 <label
19 18 class="custom-control-label"
src/app/shared/sinonimo/sinonimo.component.ts
... ... @@ -2,7 +2,7 @@ import { Component, OnInit } from &#39;@angular/core&#39;;
2 2 import { ISinonimo } from 'src/app/interfaces/ISinonimo';
3 3 import { IArticulo } from 'src/app/interfaces/IArticulo';
4 4 import { BsModalRef } from 'ngx-bootstrap/modal';
5   -import { Subject } from 'rxjs';
  5 +import { Subject, forkJoin } from 'rxjs';
6 6 import { ArticuloService } from 'src/app/services/articulo/articulo.service';
7 7  
8 8 @Component({
... ... @@ -14,49 +14,61 @@ export class SinonimoComponent implements OnInit {
14 14 sinonimos: ISinonimo[] = [];
15 15 isValid: boolean;
16 16 onClose: Subject<any>;
17   - articuloSelected: IArticulo;
  17 + articulosSelected: IArticulo[] = [];
18 18  
19 19 constructor(
20 20 private modalRef: BsModalRef,
21 21 private articuloService: ArticuloService,
22 22 ) {
23 23 this.onClose = new Subject();
  24 + this.articulosSelected.length = this.sinonimos.length;
24 25 }
25 26  
26   - ngOnInit() {
27   - }
  27 + ngOnInit() { }
28 28  
29   - selectArticulo(articulo: IArticulo) {
30   - for (const s of this.sinonimos) {
31   - for (const a of s.productos) {
32   - a.seleccionado = false;
33   - }
  29 + selectSinonimo(index: number, articulo: IArticulo) {
  30 + for (const a of this.sinonimos[index].productos) {
  31 + a.seleccionado = false;
34 32 }
35 33 articulo.seleccionado = true;
36   - this.articuloSelected = articulo;
  34 + this.articulosSelected[index] = articulo;
37 35 }
38 36  
39 37 validate() {
40   - this.isValid = false;
  38 + this.isValid = true;
41 39 for (const s of this.sinonimos) {
42   - for (const articulo of s.productos) {
43   - if (articulo.seleccionado) {
44   - this.isValid = true;
45   - }
  40 + for (const a of s.productos) {
  41 + this.isValid = (!a.seleccionado) ? false : true;
  42 + if (this.isValid) break;
46 43 }
  44 + if (!this.isValid) break;
47 45 }
48 46 return !this.isValid ? 'disabled' : 'btn-effect';
49 47 }
50 48  
51 49 continue() {
52 50 if (!this.isValid) return;
53   - const ID_SIN = this.articuloSelected.ID_SIN;
54   - this.articuloService.getById(this.articuloSelected.id)
55   - .subscribe((res: IArticulo) => {
  51 + const ID_SINS = [];
  52 + const observables = [];
  53 +
  54 + for (const articulo of this.articulosSelected) {
  55 + ID_SINS.push(articulo.ID_SIN);
  56 + }
  57 +
  58 + for (const articulo of this.articulosSelected) {
  59 + observables.push(this.articuloService.getById(articulo.id));
  60 + }
  61 +
  62 + forkJoin(observables)
  63 + .subscribe((res: IArticulo[]) => {
  64 + for (const articulo of res) {
  65 + for (const ID_SIN of ID_SINS) {
  66 + articulo.ID_SIN = ID_SIN;
  67 + }
  68 + }
56 69 this.modalRef.hide();
57 70 this.onClose.next({
58   - articulo: res,
59   - ID_SIN
  71 + articulos: res,
60 72 });
61 73 }, err => console.error(err));
62 74 }
src/scss/typography.scss
... ... @@ -3,6 +3,7 @@
3 3 @import "node_modules/bootstrap/scss/mixins";
4 4  
5 5 $font-size-base: 1rem;
  6 +$font-size-display-base: null;
6 7 $type-scales: (
7 8 minor-second: 1.067,
8 9 major-second: 1.125,