Commit 0d3b9b8f7353517ab89467fc344021f7ecef293e
1 parent
99da490b5b
Exists in
develop
solving diff comments
Showing
3 changed files
with
4 additions
and
4 deletions
Show diff stats
src/app/modules/mensaje-final/mensaje-final.component.ts
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
4 | 4 | ||
5 | @Component({ | 5 | @Component({ |
6 | selector: 'app-mensaje-final', | 6 | selector: 'app-mensaje-final', |
7 | templateUrl: './mensaje-final.component.html', | 7 | templateUrl: './mensaje-final.component.html', |
8 | styleUrls: ['./mensaje-final.component.scss'] | 8 | styleUrls: ['./mensaje-final.component.scss'] |
9 | }) | 9 | }) |
10 | export class MensajeFinalComponent implements OnInit { | 10 | export class MensajeFinalComponent implements OnInit { |
11 | timer: any; | 11 | timer: any; |
12 | 12 | ||
13 | constructor( | 13 | constructor( |
14 | public articuloService: ArticuloService, | 14 | public articuloService: ArticuloService, |
15 | private router: Router, | 15 | private router: Router, |
16 | ) { } | 16 | ) { } |
17 | 17 | ||
18 | ngOnInit() { | 18 | ngOnInit() { |
19 | this.timer = setTimeout(() => { | 19 | this.timer = setTimeout(() => { |
20 | this.goToSplash(); | 20 | this.goToSplash(); |
21 | }, 10000000); | 21 | }, 10000); |
22 | this.mediaPantalla(); | 22 | this.mediaPantalla(); |
23 | } | 23 | } |
24 | 24 | ||
25 | OnDestroy() { | 25 | OnDestroy() { |
26 | clearTimeout(this.timer); | 26 | clearTimeout(this.timer); |
27 | } | 27 | } |
28 | 28 | ||
29 | goToSplash() { | 29 | goToSplash() { |
30 | this.articuloService.cleanShoppingCar(); | 30 | this.articuloService.cleanShoppingCar(); |
31 | this.router.navigate(['']); | 31 | this.router.navigate(['']); |
32 | } | 32 | } |
33 | 33 | ||
34 | mediaPantalla() { | 34 | mediaPantalla() { |
35 | if ($('body').hasClass('media-pantalla')) { | 35 | if ($('body').hasClass('media-pantalla')) { |
36 | $('body').removeClass('media-pantalla'); | 36 | $('body').removeClass('media-pantalla'); |
37 | } | 37 | } |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 |
src/app/modules/seleccion-articulos/seleccion-articulos.component.html
1 | <div class="h-92 bg-white fade-in-left"> | 1 | <div class="h-92 bg-white fade-in-left"> |
2 | <!-- PUBLICIDADES --> | 2 | <!-- PUBLICIDADES --> |
3 | <app-header-publicidad></app-header-publicidad> | 3 | <app-header-publicidad></app-header-publicidad> |
4 | 4 | ||
5 | <div class="row mx-0 align-items-end" | 5 | <div class="row mx-0 align-items-end" |
6 | [ngClass]="boxCarrito.classList.contains('media-pantalla') | 6 | [ngClass]="boxCarrito.classList.contains('media-pantalla') |
7 | ? 'h-68' : 'h-80'"> | 7 | ? 'h-68' : 'h-80'"> |
8 | <!-- CABECERA --> | 8 | <!-- CABECERA --> |
9 | <div class="row w-100 mx-3 h-auto border border-primary rounded-sm"> | 9 | <div class="row w-100 mx-3 h-auto border border-primary rounded-sm"> |
10 | <div class="col-12 p-2 align-self-center"> | 10 | <div class="col-12 p-2 align-self-center"> |
11 | <div class="px-3"> | 11 | <div class="px-3"> |
12 | <p class="h6 text-truncate">SELECCIONÁ TÚ COMIDA Y/O BEBIDA</p> | 12 | <p class="h6 text-truncate">SELECCIONÁ TÚ COMIDA Y/O BEBIDA</p> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | </div> | 15 | </div> |
16 | <!-- CUERPO --> | 16 | <!-- CUERPO --> |
17 | <div class="row w-100 mr-4 h-50 h-md-70" id="content"> | 17 | <div class="row w-100 mr-4 h-50 h-md-70" id="content"> |
18 | <div class="col-12 h-100 px-0 py-3"> | 18 | <div class="col-12 h-100 px-0 py-3"> |
19 | <div class="row mx-0 h-100"> | 19 | <div class="row mx-0 h-100"> |
20 | <app-filtro-categorias | 20 | <app-filtro-categorias |
21 | class="col-5 col-sm-3 col-xl-2 h-100" | 21 | class="col-5 col-sm-3 col-xl-2 h-100" |
22 | #filtroCategorias | 22 | #filtroCategorias |
23 | (getProductos)="getProductos()" | 23 | (getProductos)="getProductos()" |
24 | (setProductos)="setProductos()" | 24 | (setProductos)="setProductos()" |
25 | (filterItems)="filterItems()"> | 25 | (filterItems)="filterItems()"> |
26 | </app-filtro-categorias> | 26 | </app-filtro-categorias> |
27 | <!-- LISTA DE ARTICULOS --> | 27 | <!-- LISTA DE ARTICULOS --> |
28 | <div | 28 | <div |
29 | class="col-7 col-sm-9 col-xl-10 pb-3 h-100 align-self-center scroll-y-visible" | 29 | class="col-7 col-sm-9 col-xl-10 pb-3 h-100 align-self-center scroll-y-visible" |
30 | (scroll)="scrollEvent($event)"> | 30 | (scroll)="scrollEvent($event)"> |
31 | <div class="row row-cols-1 row-cols-sm-3 row-cols-xl-6"> | 31 | <div class="row row-cols-1 row-cols-sm-3 row-cols-xl-6"> |
32 | <!-- ARTICULO --> | 32 | <!-- ARTICULO --> |
33 | <div | 33 | <div |
34 | class="col px-2 my-1 my-md-3 h-auto" | 34 | class="col px-2 my-1 my-md-3 h-auto" |
35 | *ngFor="let articulo of auxArticulos | slice:0:showQuantity;"> | 35 | *ngFor="let articulo of auxArticulos | slice:0:showQuantity;"> |
36 | <div | 36 | <div |
37 | class="swing-in-top-fwd btn-effect card h-auto" | 37 | class="swing-in-top-fwd btn-effect card h-auto" |
38 | (click)="selectArticulo(articulo)"> | 38 | (click)="selectArticulo(articulo)"> |
39 | <img | 39 | <img |
40 | draggable="false" | 40 | draggable="false" |
41 | ondragstart="return false;" | 41 | ondragstart="return false;" |
42 | (contextmenu)="false" | 42 | (contextmenu)="false" |
43 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" | 43 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" |
44 | onerror="this.src='assets/img/imagen-no-encontrada.jpg'" | 44 | onerror="this.src='assets/img/imagen-no-encontrada.jpg'" |
45 | class="card-img-top w-100 h-auto h-md-55 rounded-sm"> | 45 | class="card-img-top w-100 h-auto h-md-55 rounded-sm"> |
46 | <div class="row mx-0 py-1 h-auto justify-content-center"> | 46 | <div class="row mx-0 py-1 h-auto justify-content-center"> |
47 | <p class="col-12 px-1 h6 h-auto text-primary text-center min-h-60"> | 47 | <p class="col-12 px-1 h6 h-auto text-primary text-center min-h-60"> |
48 | {{articulo.MKT_DESC ? articulo.MKT_DESC.toUpperCase() : articulo.DetArt.toUpperCase()}} | 48 | {{articulo.MKT_DESC ? articulo.MKT_DESC.toUpperCase() : articulo.DetArt.toUpperCase()}} |
49 | </p> | 49 | </p> |
50 | <div class="col-12 px-1 align-self-end h-auto"> | 50 | <div class="col-12 px-1 align-self-end h-auto"> |
51 | <div class="row mx-0 justify-content-between bg-primary badge-pill"> | 51 | <div class="row mx-0 justify-content-between bg-primary badge-pill"> |
52 | <div class="col px-0 align-self-center text-white text-right"> | 52 | <div class="col px-0 align-self-center text-white text-right"> |
53 | {{articulo.PreVen | currency}} | 53 | {{articulo.PreVen | currency}} |
54 | </div> | 54 | </div> |
55 | <div class="col-5 px-0"> | 55 | <div class="col-5 px-0"> |
56 | <img | 56 | <img |
57 | draggable="false" | 57 | draggable="false" |
58 | ondragstart="return false;" | 58 | ondragstart="return false;" |
59 | (contextmenu)="false" | 59 | (contextmenu)="false" |
60 | class="d-block ml-auto py-1 icon-30" | 60 | class="d-block ml-auto py-1 icon-30" |
61 | src="assets/img/ir.svg"> | 61 | src="assets/img/ir.svg"> |
62 | </div> | 62 | </div> |
63 | </div> | 63 | </div> |
64 | </div> | 64 | </div> |
65 | </div> | 65 | </div> |
66 | </div> | 66 | </div> |
67 | </div> | 67 | </div> |
68 | </div> | 68 | </div> |
69 | <!-- BOTON VER MAS --> | 69 | <!-- BOTON VER MAS --> |
70 | <div class="row mx-0"> | 70 | <div class="row mx-0"> |
71 | <div | 71 | <div |
72 | *ngIf="showQuantity <= auxArticulos.slice(0, showQuantity).length" | 72 | *ngIf="showQuantity <= auxArticulos.slice(0, showQuantity).length" |
73 | class="col-12 px-0 mb-2"> | 73 | class="col-12 px-0 mb-2"> |
74 | <button | 74 | <button |
75 | (click)="increaseShow()" | 75 | (click)="increaseShow()" |
76 | class="btn btn-block btn-outline-primary"> | 76 | class="btn btn-block btn-outline-primary"> |
77 | Ver Más | 77 | Ver Más |
78 | </button> | 78 | </button> |
79 | </div> | 79 | </div> |
80 | </div> | 80 | </div> |
81 | </div> | 81 | </div> |
82 | </div> | 82 | </div> |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
85 | <!-- FOOTER CARRITO DE COMPRAS --> | 85 | <!-- FOOTER CARRITO DE COMPRAS --> |
86 | <div class="row w-90 mx-auto h-auto justify-content-center"> | 86 | <div class="row w-90 mx-auto h-auto justify-content-center"> |
87 | <div class="h-75 px-0 border border-primary rounded" #boxCarrito | 87 | <div class="h-75 px-0 border border-primary rounded" #boxCarrito |
88 | [ngClass]="boxCarrito.classList.contains('media-pantalla') | 88 | [ngClass]="boxCarrito.classList.contains('media-pantalla') |
89 | ? 'col-8' : 'col-12'" id="boxCarrito"> | 89 | ? 'col-8' : 'col-12'" id="boxCarrito"> |
90 | <!-- CABECERA --> | 90 | <!-- CABECERA --> |
91 | <div class="row mx-0 h-15 border-bottom border-primary"> | 91 | <div class="row mx-0 h-15 border-bottom border-primary"> |
92 | <p class="col align-self-center text-truncate"><small>ARTÍCULOS EN TÚ CARRITO DE COMPRAS</small></p> | 92 | <p class="col align-self-center text-truncate"><small>ARTÍCULOS EN TÚ CARRITO DE COMPRAS</small></p> |
93 | </div> | 93 | </div> |
94 | <!-- CUERPO --> | 94 | <!-- CUERPO --> |
95 | <div class="row h-85 mx-0 justify-content-around"> | 95 | <div class="row h-85 mx-0 justify-content-around"> |
96 | <!-- BOTON SCROLL IZQUIERDA --> | 96 | <!-- BOTON SCROLL IZQUIERDA --> |
97 | <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center"> | 97 | <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center"> |
98 | <img | 98 | <img |
99 | draggable="false" | 99 | draggable="false" |
100 | ondragstart="return false;" | 100 | ondragstart="return false;" |
101 | (contextmenu)="false" | 101 | (contextmenu)="false" |
102 | class="icon-30 rotate-180-neg" | 102 | class="icon-30 rotate-180-neg" |
103 | src="assets/img/ir-fondo-color.svg" | 103 | src="assets/img/ir-fondo-color.svg" |
104 | (mousedown)="scrollX(templateCarrito, -100)" | 104 | (mousedown)="scrollX(templateCarrito, -100)" |
105 | (mouseup)="mouseup()" | 105 | (mouseup)="mouseup()" |
106 | (mouseleave)="mouseup()"> | 106 | (mouseleave)="mouseup()"> |
107 | </div> | 107 | </div> |
108 | <!-- CARRITO --> | 108 | <!-- CARRITO --> |
109 | <div class="col-6 col-sm-8 col-lg-10 h-100"> | 109 | <div class="col-6 col-sm-8 col-lg-10 h-100"> |
110 | <div | 110 | <div |
111 | #templateCarrito | 111 | #templateCarrito |
112 | class="row flex-row flex-nowrap h-100 mx-0 my-2 scroll-x" | 112 | class="row flex-row flex-nowrap h-100 mx-0 my-2 scroll-x" |
113 | (scroll)="scrollEvent($event)"> | 113 | (scroll)="scrollEvent($event)"> |
114 | <!-- ARTICULOS --> | 114 | <!-- ARTICULOS --> |
115 | <div | 115 | <div |
116 | class="col-10 col-sm-4 col-lg-2 px-2 px-xl-4 align-self-center border-right border-primary" | 116 | class="col-10 col-sm-4 col-lg-2 px-2 px-xl-4 align-self-center border-right border-primary" |
117 | *ngFor="let articulo of articuloService.carrito; let i = index;" | 117 | *ngFor="let articulo of articuloService.carrito; let i = index;" |
118 | @EnterLeaveY> | 118 | @EnterLeaveY> |
119 | <img | 119 | <img |
120 | class="btn-effect icon-20 mr-2 position-absolute right-0" | 120 | class="btn-effect icon-20 mr-2 position-absolute right-0" |
121 | src="assets/img/icono-cancelar-color.svg" | 121 | src="assets/img/icono-cancelar-color.svg" |
122 | (click)="deleteArticulo(i)"> | 122 | (click)="deleteArticulo(i)"> |
123 | <img | 123 | <img |
124 | draggable="false" | 124 | draggable="false" |
125 | ondragstart="return false;" | 125 | ondragstart="return false;" |
126 | (contextmenu)="false" | 126 | (contextmenu)="false" |
127 | class="d-block img-fluid p-2 mx-auto rounded w-100 h-auto" | 127 | class="d-block img-fluid p-2 mx-auto rounded w-100 h-auto" |
128 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" | 128 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" |
129 | onerror="this.src='assets/img/imagen-no-encontrada.jpg'"> | 129 | onerror="this.src='assets/img/imagen-no-encontrada.jpg'"> |
130 | <p class="d-block mt-auto text-center text-primary text-truncate"> | 130 | <p class="d-block mt-auto text-center text-primary text-truncate"> |
131 | <small>{{articulo.MKT_DESC ? articulo.MKT_DESC.toUpperCase() : articulo.DetArt.toUpperCase()}}</small> | 131 | <small>{{articulo.MKT_DESC ? articulo.MKT_DESC.toUpperCase() : articulo.DetArt.toUpperCase()}}</small> |
132 | </p> | 132 | </p> |
133 | <app-articulo-cantidad [articulo]="articulo"></app-articulo-cantidad> | 133 | <app-articulo-cantidad [articulo]="articulo"></app-articulo-cantidad> |
134 | </div> | 134 | </div> |
135 | <!-- MENSAJE DE ADVERTENCIA --> | 135 | <!-- MENSAJE DE ADVERTENCIA --> |
136 | <div *ngIf="!articuloService.carrito.length" class="col h-100"> | 136 | <div *ngIf="!articuloService.carrito.length" class="col h-100"> |
137 | <p class="text-center py-5">No hay articulos en el carrito</p> | 137 | <p class="text-center py-5">No hay articulos en el carrito</p> |
138 | </div> | 138 | </div> |
139 | </div> | 139 | </div> |
140 | </div> | 140 | </div> |
141 | <!-- BOTON SCROLL DERECHA --> | 141 | <!-- BOTON SCROLL DERECHA --> |
142 | <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect | 142 | <div *ngIf="articuloService.carrito.length" |
143 | h-20 align-self-center d-contents"> | 143 | class="col-auto btn-effect h-20 align-self-center d-contents"> |
144 | <img | 144 | <img |
145 | draggable="false" | 145 | draggable="false" |
146 | ondragstart="return false;" | 146 | ondragstart="return false;" |
147 | (contextmenu)="false" | 147 | (contextmenu)="false" |
148 | class="icon-30" | 148 | class="icon-30" |
149 | src="assets/img/ir-fondo-color.svg" | 149 | src="assets/img/ir-fondo-color.svg" |
150 | (mousedown)="scrollX(templateCarrito, 100)" | 150 | (mousedown)="scrollX(templateCarrito, 100)" |
151 | (mouseup)="mouseup()" | 151 | (mouseup)="mouseup()" |
152 | (mouseleave)="mouseup()"> | 152 | (mouseleave)="mouseup()"> |
153 | </div> | 153 | </div> |
154 | </div> | 154 | </div> |
155 | </div> | 155 | </div> |
156 | <!-- TOTAL--> | 156 | <!-- TOTAL--> |
157 | <div | 157 | <div |
158 | class="col-auto mt-2 ml-auto h-20"> | 158 | class="col-auto mt-2 ml-auto h-20"> |
159 | <div class="row mx-0"> | 159 | <div class="row mx-0"> |
160 | <div class="col-auto align-self-center text-primary">TOTAL</div> | 160 | <div class="col-auto align-self-center text-primary">TOTAL</div> |
161 | <div class="col-auto bg-primary badge-pill"> | 161 | <div class="col-auto bg-primary badge-pill"> |
162 | <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p> | 162 | <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p> |
163 | </div> | 163 | </div> |
164 | </div> | 164 | </div> |
165 | </div> | 165 | </div> |
166 | 166 | ||
167 | <!-- VER CARRITO --> | 167 | <!-- VER CARRITO --> |
168 | <div | 168 | <div |
169 | class="col-auto px-0 mt-2 h-20" | 169 | class="col-auto px-0 mt-2 h-20" |
170 | *ngIf="articuloService.carrito.length" | 170 | *ngIf="articuloService.carrito.length" |
171 | [ngClass]="{'ml-auto pb-3' : boxCarrito.classList.contains('media-pantalla')}"> | 171 | [ngClass]="{'ml-auto pb-3' : boxCarrito.classList.contains('media-pantalla')}"> |
172 | <div | 172 | <div |
173 | class="btn-effect col-auto px-0 align-self-center bg-white" | 173 | class="btn-effect col-auto px-0 align-self-center bg-white" |
174 | [routerLink]="['/carrito']"> | 174 | [routerLink]="['/carrito']"> |
175 | <div class="row mx-0 bg-light"> | 175 | <div class="row mx-0 bg-light"> |
176 | <div class="col-auto p-0 bg-primary"> | 176 | <div class="col-auto p-0 bg-primary"> |
177 | <img | 177 | <img |
178 | draggable="false" | 178 | draggable="false" |
179 | ondragstart="return false;" | 179 | ondragstart="return false;" |
180 | (contextmenu)="false" | 180 | (contextmenu)="false" |
181 | class="p-2 icon-40" | 181 | class="p-2 icon-40" |
182 | src="assets/img/carrito.svg"> | 182 | src="assets/img/carrito.svg"> |
183 | </div> | 183 | </div> |
184 | <div class="col-auto align-self-center text-primary d-none d-sm-block">IR AL CARRITO</div> | 184 | <div class="col-auto align-self-center text-primary d-none d-sm-block">IR AL CARRITO</div> |
185 | </div> | 185 | </div> |
186 | </div> | 186 | </div> |
187 | </div> | 187 | </div> |
188 | 188 | ||
189 | </div> | 189 | </div> |
190 | </div> | 190 | </div> |
191 | 191 | ||
192 | </div> | 192 | </div> |
193 | 193 |
src/app/shared/promocion/promocion.component.ts
1 | import { Component, OnInit, HostListener } from '@angular/core'; | 1 | import { Component, OnInit, HostListener } from '@angular/core'; |
2 | import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; | 2 | import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; |
3 | import { IArticulo } from 'src/app/interfaces/IArticulo'; | 3 | import { IArticulo } from 'src/app/interfaces/IArticulo'; |
4 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 4 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
5 | import { PromocionService } from 'src/app/services/promocion/promocion.service'; | 5 | import { PromocionService } from 'src/app/services/promocion/promocion.service'; |
6 | import { Subject } from 'rxjs'; | 6 | import { Subject } from 'rxjs'; |
7 | import { APP_SETTINGS } from 'src/etc/AppSettings'; | 7 | import { APP_SETTINGS } from 'src/etc/AppSettings'; |
8 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; | 8 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; |
9 | import { SinonimoService } from 'src/app/services/sinonimo/sinonimo.service'; | 9 | import { SinonimoService } from 'src/app/services/sinonimo/sinonimo.service'; |
10 | import { ISinonimo } from 'src/app/interfaces/ISinonimo'; | 10 | import { ISinonimo } from 'src/app/interfaces/ISinonimo'; |
11 | import { SinonimoComponent } from '../sinonimo/sinonimo.component'; | 11 | import { SinonimoComponent } from '../sinonimo/sinonimo.component'; |
12 | import * as _ from 'lodash'; | 12 | import * as _ from 'lodash'; |
13 | 13 | ||
14 | @Component({ | 14 | @Component({ |
15 | selector: 'app-promocion', | 15 | selector: 'app-promocion', |
16 | templateUrl: './promocion.component.html', | 16 | templateUrl: './promocion.component.html', |
17 | styleUrls: ['./promocion.component.scss'] | 17 | styleUrls: ['./promocion.component.scss'] |
18 | }) | 18 | }) |
19 | export class PromocionComponent implements OnInit { | 19 | export class PromocionComponent implements OnInit { |
20 | articulosPromo: IArticulo[] = []; | 20 | articulosPromo: IArticulo[] = []; |
21 | promociones: IArticulo[] = []; | 21 | promociones: IArticulo[] = []; |
22 | onClose: Subject<any>; | 22 | onClose: Subject<any>; |
23 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; | 23 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; |
24 | 24 | ||
25 | constructor( | 25 | constructor( |
26 | public modalPromocion: BsModalRef, | 26 | public modalPromocion: BsModalRef, |
27 | private modalService: BsModalService, | 27 | private modalService: BsModalService, |
28 | private articuloService: ArticuloService, | 28 | private articuloService: ArticuloService, |
29 | private promocionService: PromocionService, | 29 | private promocionService: PromocionService, |
30 | private sinonimoService: SinonimoService, | 30 | private sinonimoService: SinonimoService, |
31 | private inactiveScreen: InactiveScreenService, | 31 | private inactiveScreen: InactiveScreenService, |
32 | ) { | 32 | ) { |
33 | this.onClose = new Subject(); | 33 | this.onClose = new Subject(); |
34 | } | 34 | } |
35 | 35 | ||
36 | ngOnInit() { | 36 | ngOnInit() { |
37 | this.getPromociones(); | 37 | this.getPromociones(); |
38 | } | 38 | } |
39 | 39 | ||
40 | selectPromo(promo: IArticulo) { | 40 | selectPromo(promo: IArticulo) { |
41 | this.sinonimoService.getSinonimos(promo.CodSec, promo.CodArt) | 41 | this.sinonimoService.getSinonimos(promo.CodSec, promo.CodArt) |
42 | .subscribe((res: ISinonimo[]) => { | 42 | .subscribe((res: ISinonimo[]) => { |
43 | if (res.length) { | 43 | if (res.length) { |
44 | const sinonimos = []; | 44 | const sinonimos = []; |
45 | const gruposArticulos = _.groupBy(res[0].productos, 'ID_SIN'); | 45 | const gruposArticulos = _.groupBy(res[0].productos, 'ID_SIN'); |
46 | Object.keys(gruposArticulos).forEach(key => { | 46 | Object.keys(gruposArticulos).forEach(key => { |
47 | sinonimos.push({ productos: gruposArticulos[key] }); | 47 | sinonimos.push({ productos: gruposArticulos[key] }); |
48 | }); | 48 | }); |
49 | res = sinonimos; | 49 | res = sinonimos; |
50 | this.openModalSinonimos(res, promo); | 50 | this.openModalSinonimos(res, promo); |
51 | } else { | 51 | } else { |
52 | promo.cantidad = 1; | 52 | promo.cantidad = 1; |
53 | this.articuloService.setArticulo(promo); | 53 | this.articuloService.setArticulo(promo); |
54 | this.modalPromocion.hide(); | 54 | this.modalPromocion.hide(); |
55 | } | 55 | } |
56 | }, err => console.error(err)); | 56 | }, err => console.error(err)); |
57 | this.mediaPantalla(); | 57 | this.mediaPantalla(); |
58 | } | 58 | } |
59 | 59 | ||
60 | openModalSinonimos(sinonimosData: ISinonimo[], articulo: IArticulo) { | 60 | openModalSinonimos(sinonimosData: ISinonimo[], articulo: IArticulo) { |
61 | const modalSinonimo = this.modalService.show(SinonimoComponent, { | 61 | const modalSinonimo = this.modalService.show(SinonimoComponent, { |
62 | initialState: { sinonimos: sinonimosData }, | 62 | initialState: { sinonimos: sinonimosData }, |
63 | class: 'modal-promo modal-dialog-centered' | 63 | class: 'modal-promo modal-dialog-centered' |
64 | }); | 64 | }); |
65 | 65 | ||
66 | modalSinonimo.content.onClose | 66 | modalSinonimo.content.onClose |
67 | .subscribe((res: any) => { | 67 | .subscribe((res: any) => { |
68 | for (const a of articulo.productos) { | 68 | for (const a of articulo.productos) { |
69 | for (const aRes of res.articulos) { | 69 | for (const aRes of res.articulos) { |
70 | if (a.idSinonimo === aRes.ID_SIN) { | 70 | if (a.idSinonimo === aRes.ID_SIN) { |
71 | a.CODA = aRes.CodArt; | 71 | a.CODA = aRes.CodArt; |
72 | a.CodArt = aRes.CodArt; | 72 | a.CodArt = aRes.CodArt; |
73 | a.SECA = aRes.CodSec; | 73 | a.SECA = aRes.CodSec; |
74 | aRes.CodSec = aRes.CodSec; | 74 | aRes.CodSec = aRes.CodSec; |
75 | a.PreVen = aRes.PreVen; | 75 | a.PreVen = aRes.PreVen; |
76 | a.id = aRes.id; | 76 | a.id = aRes.id; |
77 | a.DET_LAR = aRes.DET_LAR; | 77 | a.DET_LAR = aRes.DET_LAR; |
78 | a.DetArt = aRes.DetArt; | 78 | a.DetArt = aRes.DetArt; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | } | 81 | } |
82 | this.articuloService.setArticulo(articulo); | 82 | this.articuloService.setArticulo(articulo); |
83 | this.modalPromocion.hide(); | 83 | this.modalPromocion.hide(); |
84 | }); | 84 | }); |
85 | } | 85 | } |
86 | 86 | ||
87 | getPromociones() { | 87 | getPromociones() { |
88 | const sector = this.articulosPromo[0].CodSec; | 88 | const sector = this.articulosPromo[0].CodSec; |
89 | const codigo = this.articulosPromo[0].CodArt; | 89 | const codigo = this.articulosPromo[0].CodArt; |
90 | this.promocionService.getPromociones(sector, codigo) | 90 | this.promocionService.getPromociones(sector, codigo) |
91 | .subscribe((res: IArticulo[]) => { | 91 | .subscribe((res: IArticulo[]) => { |
92 | this.promociones = res; | 92 | this.promociones = res; |
93 | }, error => { console.error(error); }); | 93 | }, error => { console.error(error); }); |
94 | } | 94 | } |
95 | 95 | ||
96 | @HostListener('document:click', ['$event']) | 96 | @HostListener('document:click', ['$event']) |
97 | eventListener(event: Event) { | 97 | eventListener(event: Event) { |
98 | clearTimeout(this.inactiveScreen.timerReposo); | 98 | clearTimeout(this.inactiveScreen.timerReposo); |
99 | this.inactiveScreen.startTimeOutInactividad(); | 99 | this.inactiveScreen.startTimeOutInactividad(); |
100 | } | 100 | } |
101 | 101 | ||
102 | @HostListener('scroll', ['$event']) | 102 | @HostListener('scroll', ['$event']) |
103 | scrollEvent(event: Event) { | 103 | scrollEvent(event: Event) { |
104 | clearTimeout(this.inactiveScreen.timerReposo); | 104 | clearTimeout(this.inactiveScreen.timerReposo); |
105 | this.inactiveScreen.startTimeOutInactividad(); | 105 | this.inactiveScreen.startTimeOutInactividad(); |
106 | } | 106 | } |
107 | 107 | ||
108 | mediaPantalla() { | 108 | mediaPantalla() { |
109 | if ($('body').hasClass('media-pantalla')) { | 109 | if ($('body').hasClass('media-pantalla')) { |
110 | $('.modal-content').addClass('media-pantalla'); | 110 | $('.modal-content').addClass('media-pantalla'); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 |