Commit 748026387b547e71bfcfae73b4a27e2e63b0f8bc

Authored by Marcelo Puebla
Exists in develop

Merge branch 'develop' into 'develop'

Change - Add

See merge request !42
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 h-80 align-items-end"> 5 <div class="row mx-0 h-80 align-items-end">
6 <!-- CABECERA --> 6 <!-- CABECERA -->
7 <div class="row w-100 mx-3 h-auto border border-primary rounded-sm"> 7 <div class="row w-100 mx-3 h-auto border border-primary rounded-sm">
8 <div class="col-12 p-2 align-self-center"> 8 <div class="col-12 p-2 align-self-center">
9 <div class="px-3"> 9 <div class="px-3">
10 <p class="h6 text-truncate">SELECCIONÁ TÚ COMIDA Y/O BEBIDA</p> 10 <p class="h6 text-truncate">SELECCIONÁ TÚ COMIDA Y/O BEBIDA</p>
11 </div> 11 </div>
12 </div> 12 </div>
13 </div> 13 </div>
14 <!-- CUERPO --> 14 <!-- CUERPO -->
15 <div class="row w-100 mr-4 h-50 h-md-70"> 15 <div class="row w-100 mr-4 h-50 h-md-70">
16 <div class="col-12 h-100 px-0 py-3"> 16 <div class="col-12 h-100 px-0 py-3">
17 <div class="row mx-0 h-100"> 17 <div class="row mx-0 h-100">
18 <!-- FILTRO CATEGORIAS --> 18 <!-- FILTRO CATEGORIAS -->
19 <div class="col-5 col-sm-3 col-xl-2 h-100"> 19 <div class="col-5 col-sm-3 col-xl-2 h-100">
20 <p class="h6 h-6 m-0 text-center"><small>CATEGORÍAS</small></p> 20 <p class="h6 h-6 m-0 text-center"><small>CATEGORÍAS</small></p>
21 <div class="row mx-0 h-94 justify-content-center align-items-center"> 21 <div class="row mx-0 h-94 justify-content-center align-items-center">
22 <div class="col-auto btn-effect h-5"> 22 <div class="col-auto btn-effect h-5">
23 <img 23 <img
24 draggable="false" 24 draggable="false"
25 ondragstart="return false;" 25 ondragstart="return false;"
26 (contextmenu)="false" 26 (contextmenu)="false"
27 class="h-100 d-block mx-auto rotate-90-neg" 27 class="h-100 d-block mx-auto rotate-90-neg"
28 src="assets/img/ir-color.svg" 28 src="assets/img/ir-color.svg"
29 (mousedown)="scrollY(templateCategorias, -100)" 29 (mousedown)="scrollY(templateCategorias, -100)"
30 (mouseup)="mouseup()" 30 (mouseup)="mouseup()"
31 (mouseleave)="mouseup()"> 31 (mouseleave)="mouseup()">
32 </div> 32 </div>
33 <!-- CATEGORIAS --> 33 <!-- CATEGORIAS -->
34 <div 34 <div
35 #templateCategorias 35 #templateCategorias
36 class="col-12 px-0 box-categorias border border-primary border-left-0 rounded-right scroll-y" 36 class="col-12 px-0 box-categorias border border-primary border-left-0 rounded-right scroll-y"
37 (scroll)="scrollEvent($event)"> 37 (scroll)="scrollEvent($event)">
38 <div 38 <div
39 class="row mx-4 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab" 39 class="row mx-4 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab"
40 [ngClass]="{ 'active': allActive, 'border-bottom-effect': !allActive }" 40 [ngClass]="{ 'active': allActive, 'border-bottom-effect': !allActive }"
41 (click)="selectCategoria(-1, 0)"> 41 (click)="selectCategoria(-1, 0)">
42 <img 42 <img
43 draggable="false" 43 draggable="false"
44 ondragstart="return false;" 44 ondragstart="return false;"
45 (contextmenu)="false" 45 (contextmenu)="false"
46 class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle" 46 class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle"
47 src="assets/img/logo-spot.svg"> 47 src="assets/img/logo-spot.svg">
48 <small class="col-12 px-0 my-1 h-100 h-md-25 align-self-end text-center text-truncate">Todos</small> 48 <small class="col-12 px-0 my-1 h-100 h-md-25 align-self-end text-center text-truncate">Todos</small>
49 </div> 49 </div>
50 <div 50 <div
51 class="row mx-4 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab" 51 class="row mx-4 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab"
52 [ngClass]="{ 'active': categoria.selected, 'border-bottom-effect': !categoria.selected }" 52 [ngClass]="{ 'active': categoria.selected, 'border-bottom-effect': !categoria.selected }"
53 (click)="selectCategoria(i, categoria.id)" 53 (click)="selectCategoria(i, categoria.id)"
54 *ngFor="let categoria of categorias; let i = index;"> 54 *ngFor="let categoria of categorias; let i = index;">
55 <img 55 <img
56 draggable="false" 56 draggable="false"
57 ondragstart="return false;" 57 ondragstart="return false;"
58 (contextmenu)="false" 58 (contextmenu)="false"
59 class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle" 59 class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle"
60 src="{{urlImagenes}}{{categoria.path_imagen}}" 60 src="{{urlImagenes}}{{categoria.path_imagen}}"
61 onerror="this.src='assets/img/image-not-found.jpg'"> 61 onerror="this.src='assets/img/image-not-found.jpg'">
62 <small class="col-12 px-0 my-1 h-100 h-md-25 align-self-end text-center text-truncate">{{categoria.detalle}}</small> 62 <small class="col-12 px-0 my-1 h-100 h-md-25 align-self-end text-center text-truncate">{{categoria.detalle}}</small>
63 </div> 63 </div>
64 </div> 64 </div>
65 <div class="col-auto btn-effect h-5"> 65 <div class="col-auto btn-effect h-5">
66 <img 66 <img
67 draggable="false" 67 draggable="false"
68 ondragstart="return false;" 68 ondragstart="return false;"
69 (contextmenu)="false" 69 (contextmenu)="false"
70 class="h-100 d-block mx-auto rotate-90" 70 class="h-100 d-block mx-auto rotate-90"
71 src="assets/img/ir-color.svg" 71 src="assets/img/ir-color.svg"
72 (mousedown)="scrollY(templateCategorias, 100)" 72 (mousedown)="scrollY(templateCategorias, 100)"
73 (mouseup)="mouseup()" 73 (mouseup)="mouseup()"
74 (mouseleave)="mouseup()"> 74 (mouseleave)="mouseup()">
75 </div> 75 </div>
76 </div> 76 </div>
77 </div> 77 </div>
78 <!-- LISTA DE ARTICULOS --> 78 <!-- LISTA DE ARTICULOS -->
79 <div 79 <div
80 class="col-7 col-sm-9 col-xl-10 pb-3 h-100 align-self-center scroll-y-visible" 80 class="col-7 col-sm-9 col-xl-10 pb-3 h-100 align-self-center scroll-y-visible"
81 (scroll)="scrollEvent($event)"> 81 (scroll)="scrollEvent($event)">
82 <div class="row row-cols-1 row-cols-sm-3 row-cols-xl-6"> 82 <div class="row row-cols-1 row-cols-sm-3 row-cols-xl-6">
83 <!-- ARTICULO --> 83 <!-- ARTICULO -->
84 <div 84 <div
85 class="col px-2 my-1 my-md-3 h-auto" 85 class="col px-2 my-1 my-md-3 h-auto"
86 *ngFor="let articulo of auxArticulos | slice:0:showQuantity;"> 86 *ngFor="let articulo of auxArticulos | slice:0:showQuantity;">
87 <div 87 <div
88 class="swing-in-top-fwd btn-effect card h-auto" 88 class="swing-in-top-fwd btn-effect card h-auto"
89 (click)="elegirArticulo(articulo)"> 89 (click)="elegirArticulo(articulo)">
90 <img 90 <img
91 draggable="false" 91 draggable="false"
92 ondragstart="return false;" 92 ondragstart="return false;"
93 (contextmenu)="false" 93 (contextmenu)="false"
94 src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" 94 src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}"
95 onerror="this.src='assets/img/image-not-found.jpg'" 95 onerror="this.src='assets/img/image-not-found.jpg'"
96 class="card-img-top h-30 h-md-55 rounded-sm"> 96 class="card-img-top h-30 h-md-55 rounded-sm">
97 <div class="row mx-0 py-1 h-auto justify-content-center"> 97 <div class="row mx-0 py-1 h-auto justify-content-center">
98 <p 98 <p
99 [ngClass]="{'text-primary': articulo.PRO, 'text-secondary': !articulo.PRO}" 99 [ngClass]="{'text-primary': articulo.PRO, 'text-secondary': !articulo.PRO}"
100 class="col-12 px-1 h6 h-auto text-center min-h-60"> 100 class="col-12 px-1 h6 h-auto text-center min-h-60">
101 {{articulo.DetArt}} 101 {{articulo.DetArt}}
102 </p> 102 </p>
103 <p class="col-12 px-1 h-auto text-center line-height-sm min-h-50"> 103 <p class="col-12 px-1 h-auto text-center line-height-sm min-h-50">
104 <small>{{articulo.DET_LAR}}</small> 104 <small>{{articulo.DET_LAR}}</small>
105 </p> 105 </p>
106 <div class="col-12 px-1 align-self-end h-auto"> 106 <div class="col-12 px-1 align-self-end h-auto">
107 <div 107 <div
108 [ngClass]="{'bg-primary': articulo.PRO, 'bg-secondary': !articulo.PRO}" 108 [ngClass]="{'bg-primary': articulo.PRO, 'bg-secondary': !articulo.PRO}"
109 class="row mx-0 justify-content-between badge-pill"> 109 class="row mx-0 justify-content-between badge-pill">
110 <div class="col px-0 align-self-center text-white text-right"> 110 <div class="col px-0 align-self-center text-white text-right">
111 {{articulo.PreVen | currency}} 111 {{articulo.PreVen | currency}}
112 </div> 112 </div>
113 <div class="col-5 px-0"> 113 <div class="col-5 px-0">
114 <img 114 <img
115 draggable="false" 115 draggable="false"
116 ondragstart="return false;" 116 ondragstart="return false;"
117 (contextmenu)="false" 117 (contextmenu)="false"
118 class="d-block ml-auto py-1 icon-30" 118 class="d-block ml-auto py-1 icon-30"
119 src="assets/img/ir.svg"> 119 src="assets/img/ir.svg">
120 </div> 120 </div>
121 </div> 121 </div>
122 </div> 122 </div>
123 </div> 123 </div>
124 </div> 124 </div>
125 </div> 125 </div>
126 </div> 126 </div>
127 <!-- BOTON VER MAS --> 127 <!-- BOTON VER MAS -->
128 <div class="row mx-0"> 128 <div class="row mx-0">
129 <div 129 <div
130 *ngIf="showQuantity <= auxArticulos.slice(0, showQuantity).length" 130 *ngIf="showQuantity <= auxArticulos.slice(0, showQuantity).length"
131 class="col-12 px-0 mb-2"> 131 class="col-12 px-0 mb-2">
132 <button 132 <button
133 (click)="increaseShow()" 133 (click)="increaseShow()"
134 class="btn btn-block btn-outline-primary"> 134 class="btn btn-block btn-outline-primary">
135 Ver Más 135 Ver Más
136 </button> 136 </button>
137 </div> 137 </div>
138 </div> 138 </div>
139 </div> 139 </div>
140 </div> 140 </div>
141 </div> 141 </div>
142 </div> 142 </div>
143 <!-- FOOTER CARRITO DE COMPRAS --> 143 <!-- FOOTER CARRITO DE COMPRAS -->
144 <div class="row w-90 mx-auto h-auto justify-content-center"> 144 <div class="row w-90 mx-auto h-auto justify-content-center">
145 <div class="col-12 h-75 px-0 border border-primary rounded"> 145 <div class="col-12 h-75 px-0 border border-primary rounded">
146 <!-- CABECERA --> 146 <!-- CABECERA -->
147 <div class="row mx-0 h-15 border-bottom border-primary"> 147 <div class="row mx-0 h-15 border-bottom border-primary">
148 <p class="col align-self-center text-truncate"><small>ARTÍCULOS EN TÚ CARRITO DE COMPRAS</small></p> 148 <p class="col align-self-center text-truncate"><small>ARTÍCULOS EN TÚ CARRITO DE COMPRAS</small></p>
149 </div> 149 </div>
150 <!-- CUERPO --> 150 <!-- CUERPO -->
151 <div class="row h-85 mx-0 justify-content-around"> 151 <div class="row h-85 mx-0 justify-content-around">
152 <!-- BOTON SCROLL IZQUIERDA --> 152 <!-- BOTON SCROLL IZQUIERDA -->
153 <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center"> 153 <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center">
154 <img 154 <img
155 draggable="false" 155 draggable="false"
156 ondragstart="return false;" 156 ondragstart="return false;"
157 (contextmenu)="false" 157 (contextmenu)="false"
158 class="icon-30 rotate-180-neg" 158 class="icon-30 rotate-180-neg"
159 src="assets/img/ir-fondo-color.svg" 159 src="assets/img/ir-fondo-color.svg"
160 (mousedown)="scrollX(templateCarrito, -100)" 160 (mousedown)="scrollX(templateCarrito, -100)"
161 (mouseup)="mouseup()" 161 (mouseup)="mouseup()"
162 (mouseleave)="mouseup()"> 162 (mouseleave)="mouseup()">
163 </div> 163 </div>
164 <!-- CARRITO --> 164 <!-- CARRITO -->
165 <div class="col-6 col-sm-8 col-md-9 col-lg-10 h-100"> 165 <div class="col-6 col-sm-8 col-md-9 col-lg-10 h-100">
166 <div 166 <div
167 #templateCarrito 167 #templateCarrito
168 class="row flex-row flex-nowrap h-100 mx-0 my-2 scroll-x" 168 class="row flex-row flex-nowrap h-100 mx-0 my-2 scroll-x"
169 (scroll)="scrollEvent($event)"> 169 (scroll)="scrollEvent($event)">
170 <!-- MENSAJE DE ADVERTENCIA --> 170 <!-- MENSAJE DE ADVERTENCIA -->
171 <div *ngIf="!articuloService.carrito.length" class="col h-100"> 171 <div *ngIf="!articuloService.carrito.length" class="col h-100">
172 <p class="text-center py-5">No hay articulos en el carrito</p> 172 <p class="text-center py-5">No hay articulos en el carrito</p>
173 </div> 173 </div>
174 <!-- ARTICULOS --> 174 <!-- ARTICULOS -->
175 <div 175 <div
176 class="col-10 col-sm-4 col-lg-2 px-2 px-xl-4 align-self-center border-right border-primary" 176 class="col-10 col-sm-4 col-lg-2 px-2 px-xl-4 align-self-center border-right border-primary"
177 *ngFor="let articulo of articuloService.carrito; let i = index;"> 177 *ngFor="let articulo of articuloService.carrito; let i = index;">
178 <div class="swing-in-top-fwd"> 178 <div class="swing-in-top-fwd">
179 <img 179 <img
180 class="btn-effect icon-20 position-absolute right-0"
181 src="assets/img/icono-cancelar-color.svg"
182 (click)="deleteArticulo(i)">
183 <img
180 draggable="false" 184 draggable="false"
181 ondragstart="return false;" 185 ondragstart="return false;"
182 (contextmenu)="false" 186 (contextmenu)="false"
183 class="d-block img-fluid p-2 mx-auto rounded" 187 class="d-block img-fluid p-2 mx-auto rounded"
184 src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" 188 src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}"
185 onerror="this.src='assets/img/image-not-found.jpg'"> 189 onerror="this.src='assets/img/image-not-found.jpg'">
186 <p class="d-block mt-auto text-center text-primary text-truncate"> 190 <p class="d-block mt-auto text-center text-primary text-truncate">
187 <small>{{articulo.DetArt}}</small> 191 <small>{{articulo.DetArt}}</small>
188 </p> 192 </p>
189 </div> 193 </div>
190 </div> 194 </div>
191 </div> 195 </div>
192 </div> 196 </div>
193 <!-- BOTON SCROLL DERECHA --> 197 <!-- BOTON SCROLL DERECHA -->
194 <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center"> 198 <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center">
195 <img 199 <img
196 draggable="false" 200 draggable="false"
197 ondragstart="return false;" 201 ondragstart="return false;"
198 (contextmenu)="false" 202 (contextmenu)="false"
199 class="icon-30" 203 class="icon-30"
200 src="assets/img/ir-fondo-color.svg" 204 src="assets/img/ir-fondo-color.svg"
201 (mousedown)="scrollX(templateCarrito, 100)" 205 (mousedown)="scrollX(templateCarrito, 100)"
202 (mouseup)="mouseup()" 206 (mouseup)="mouseup()"
203 (mouseleave)="mouseup()"> 207 (mouseleave)="mouseup()">
204 </div> 208 </div>
205 </div> 209 </div>
206 </div> 210 </div>
207 <!-- TOTAL--> 211 <!-- TOTAL-->
208 <div 212 <div
209 class="col-auto mt-2 ml-auto h-20"> 213 class="col-auto mt-2 ml-auto h-20">
210 <div class="row mx-0"> 214 <div class="row mx-0">
211 <div class="col-auto align-self-center text-primary">TOTAL</div> 215 <div class="col-auto align-self-center text-primary">TOTAL</div>
212 <div class="col-auto bg-primary badge-pill"> 216 <div class="col-auto bg-primary badge-pill">
213 <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p> 217 <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p>
214 </div> 218 </div>
215 </div> 219 </div>
216 </div> 220 </div>
217 221
218 <!-- VER CARRITO --> 222 <!-- VER CARRITO -->
219 <div 223 <div
220 class="col-auto px-0 mt-2 h-20" 224 class="col-auto px-0 mt-2 h-20"
221 *ngIf="articuloService.carrito.length"> 225 *ngIf="articuloService.carrito.length">
222 <div 226 <div
223 class="btn-effect col-auto px-0 align-self-center bg-white" 227 class="btn-effect col-auto px-0 align-self-center bg-white"
224 [routerLink]="['/carrito']"> 228 [routerLink]="['/carrito']">
225 <div class="row mx-0 bg-light"> 229 <div class="row mx-0 bg-light">
226 <div class="col-auto align-self-center text-primary d-none d-sm-block">VER CARRITO</div>
227 <div class="col-auto p-0 bg-primary"> 230 <div class="col-auto p-0 bg-primary">
228 <img 231 <img
229 draggable="false" 232 draggable="false"
230 ondragstart="return false;" 233 ondragstart="return false;"
231 (contextmenu)="false" 234 (contextmenu)="false"
232 class="p-2 icon-40" 235 class="p-2 icon-40"
233 src="assets/img/carrito.svg"> 236 src="assets/img/carrito.svg">
234 </div> 237 </div>
238 <div class="col-auto align-self-center text-primary d-none d-sm-block">IR AL CARRITO</div>
235 </div> 239 </div>
236 </div> 240 </div>
237 </div> 241 </div>
238 242
239 </div> 243 </div>
240 </div> 244 </div>
241 245
242 </div> 246 </div>
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
1 import { Component, OnInit, TemplateRef, OnDestroy, HostListener } from '@angular/core'; 1 import { Component, OnInit, TemplateRef, OnDestroy, HostListener } from '@angular/core';
2 import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; 2 import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
3 import { ArticuloService } from 'src/app/services/articulo/articulo.service'; 3 import { ArticuloService } from 'src/app/services/articulo/articulo.service';
4 import { IArticulo } from 'src/app/interfaces/IArticulo'; 4 import { IArticulo } from 'src/app/interfaces/IArticulo';
5 import { APP_SETTINGS } from 'src/etc/AppSettings'; 5 import { APP_SETTINGS } from 'src/etc/AppSettings';
6 import { ICategoria } from 'src/app/interfaces/ICategoria'; 6 import { ICategoria } from 'src/app/interfaces/ICategoria';
7 import { CategoriaService } from 'src/app/services/categoria/categoria.service'; 7 import { CategoriaService } from 'src/app/services/categoria/categoria.service';
8 import { PromocionService } from 'src/app/services/promocion/promocion.service'; 8 import { PromocionService } from 'src/app/services/promocion/promocion.service';
9 import { PromocionComponent } from 'src/app/shared/promocion/promocion.component'; 9 import { PromocionComponent } from 'src/app/shared/promocion/promocion.component';
10 import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; 10 import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service';
11 11
12 @Component({ 12 @Component({
13 selector: 'app-seleccion-articulos', 13 selector: 'app-seleccion-articulos',
14 templateUrl: './seleccion-articulos.component.html', 14 templateUrl: './seleccion-articulos.component.html',
15 styleUrls: ['./seleccion-articulos.component.scss'] 15 styleUrls: ['./seleccion-articulos.component.scss']
16 }) 16 })
17 export class SeleccionArticulosComponent implements OnInit, OnDestroy { 17 export class SeleccionArticulosComponent implements OnInit, OnDestroy {
18 showSpinner = true; 18 showSpinner = true;
19 timeoutHandler: any; 19 timeoutHandler: any;
20 urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; 20 urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`;
21 articulos: IArticulo[] = []; 21 articulos: IArticulo[] = [];
22 auxArticulos: IArticulo[] = []; 22 auxArticulos: IArticulo[] = [];
23 showQuantity = 100; 23 showQuantity = 100;
24 queMostrar = 'todos'; 24 queMostrar = 'todos';
25 categoriaActive = null; 25 categoriaActive = null;
26 categorias: ICategoria[] = []; 26 categorias: ICategoria[] = [];
27 searchTerm = ''; 27 searchTerm = '';
28 ordenandoByVendidos = true; 28 ordenandoByVendidos = true;
29 allActive = true; 29 allActive = true;
30 modalRef: BsModalRef; 30 modalRef: BsModalRef;
31 total = 0; 31 total = 0;
32 32
33 constructor( 33 constructor(
34 public articuloService: ArticuloService, 34 public articuloService: ArticuloService,
35 private categoriaService: CategoriaService, 35 private categoriaService: CategoriaService,
36 private modalService: BsModalService, 36 private modalService: BsModalService,
37 private inactiveScreen: InactiveScreenService, 37 private inactiveScreen: InactiveScreenService,
38 ) { } 38 ) { }
39 39
40 ngOnInit() { 40 ngOnInit() {
41 this.getCategorias(); 41 this.getCategorias();
42 } 42 }
43 43
44 ngOnDestroy() { 44 ngOnDestroy() {
45 if (this.modalRef) this.modalRef.hide(); 45 if (this.modalRef) this.modalRef.hide();
46 } 46 }
47 47
48 getCategorias() { 48 getCategorias() {
49 this.categoriaService.getAll() 49 this.categoriaService.getAll()
50 .subscribe((categorias: ICategoria[]) => { 50 .subscribe((categorias: ICategoria[]) => {
51 switch (this.queMostrar) { 51 switch (this.queMostrar) {
52 case 'todos': 52 case 'todos':
53 this.categorias = categorias; 53 this.categorias = categorias;
54 this.categoriaActive = 0; 54 this.categoriaActive = 0;
55 break; 55 break;
56 case 'promociones': 56 case 'promociones':
57 this.categorias = categorias; 57 this.categorias = categorias;
58 this.categoriaActive = 19; 58 this.categoriaActive = 19;
59 break; 59 break;
60 case 'ordenar': 60 case 'ordenar':
61 this.categorias = categorias.filter((categoria: ICategoria) => { 61 this.categorias = categorias.filter((categoria: ICategoria) => {
62 return categoria.ES_PEDIDO; 62 return categoria.ES_PEDIDO;
63 }); 63 });
64 this.categoriaActive = 4; 64 this.categoriaActive = 4;
65 break; 65 break;
66 default: 66 default:
67 this.categorias = categorias; 67 this.categorias = categorias;
68 this.categoriaActive = 0; 68 this.categoriaActive = 0;
69 break; 69 break;
70 } 70 }
71 !localStorage.getItem('articulos') ? 71 !localStorage.getItem('articulos') ?
72 this.getProductos() : 72 this.getProductos() :
73 this.setProductos(); 73 this.setProductos();
74 }); 74 });
75 } 75 }
76 76
77 getProductos() { 77 getProductos() {
78 this.articuloService.getAll() 78 this.articuloService.getAll()
79 .subscribe((result: IArticulo[]) => { 79 .subscribe((result: IArticulo[]) => {
80 this.articuloService.setArticulosSinImagen(result); 80 this.articuloService.setArticulosSinImagen(result);
81 if (this.queMostrar === 'ordenar') { 81 if (this.queMostrar === 'ordenar') {
82 this.categorias.forEach((categoria: ICategoria) => { 82 this.categorias.forEach((categoria: ICategoria) => {
83 const tempArticulos = result.filter((articulo: IArticulo) => { 83 const tempArticulos = result.filter((articulo: IArticulo) => {
84 return articulo.categoria_selfservice === categoria.id; 84 return articulo.categoria_selfservice === categoria.id;
85 }); 85 });
86 result = tempArticulos; 86 result = tempArticulos;
87 }); 87 });
88 } 88 }
89 localStorage.setItem('articulos', JSON.stringify(result)); 89 localStorage.setItem('articulos', JSON.stringify(result));
90 this.setProductos(); 90 this.setProductos();
91 }, (error) => { 91 }, (error) => {
92 this.showSpinner = false; 92 this.showSpinner = false;
93 console.error(error); 93 console.error(error);
94 }); 94 });
95 } 95 }
96 96
97 setProductos() { 97 setProductos() {
98 this.articulos = JSON.parse(localStorage.getItem('articulos')); 98 this.articulos = JSON.parse(localStorage.getItem('articulos'));
99 this.filterItems(); 99 this.filterItems();
100 } 100 }
101 101
102 filterItems() { 102 filterItems() {
103 if (this.categoriaActive === 0) { 103 if (this.categoriaActive === 0) {
104 this.auxArticulos = this.articulos; 104 this.auxArticulos = this.articulos;
105 return; 105 return;
106 } 106 }
107 this.auxArticulos = this.articulos.filter(x => { 107 this.auxArticulos = this.articulos.filter(x => {
108 return x.categoria_selfservice === this.categoriaActive; 108 return x.categoria_selfservice === this.categoriaActive;
109 }); 109 });
110 this.ordenar(); 110 this.ordenar();
111 } 111 }
112 112
113 ordenar() { 113 ordenar() {
114 if (this.ordenandoByVendidos) { 114 if (this.ordenandoByVendidos) {
115 this.auxArticulos.sort((a, b) => { 115 this.auxArticulos.sort((a, b) => {
116 return b.cantidadVendida - a.cantidadVendida; 116 return b.cantidadVendida - a.cantidadVendida;
117 }); 117 });
118 } 118 }
119 } 119 }
120 120
121 selectCategoria(index: number, idCategoria?: number) { 121 selectCategoria(index: number, idCategoria?: number) {
122 if (this.categoriaActive === idCategoria) return; 122 if (this.categoriaActive === idCategoria) return;
123 this.categoriaActive = idCategoria; 123 this.categoriaActive = idCategoria;
124 this.allActive = idCategoria === 0 ? true : false; 124 this.allActive = idCategoria === 0 ? true : false;
125 this.categorias.forEach((categoria, i) => { 125 this.categorias.forEach((categoria, i) => {
126 categoria.selected = index === i ? true : false; 126 categoria.selected = index === i ? true : false;
127 }); 127 });
128 this.filterItems(); 128 this.filterItems();
129 } 129 }
130 130
131 elegirArticulo(articulo: IArticulo) { 131 elegirArticulo(articulo: IArticulo) {
132 if (!articulo.FPP) { 132 if (!articulo.FPP) {
133 this.getByID(articulo.id); 133 this.getByID(articulo.id);
134 } else { 134 } else {
135 this.openModalPromos(articulo); 135 this.openModalPromos(articulo);
136 } 136 }
137 } 137 }
138 138
139 getByID(id: number) { 139 getByID(id: number) {
140 this.articuloService.getById(id) 140 this.articuloService.getById(id)
141 .subscribe((res: IArticulo) => { 141 .subscribe((res: IArticulo) => {
142 res.cantidad = 1; 142 res.cantidad = 1;
143 this.articuloService.setArticulo(res); 143 this.articuloService.setArticulo(res);
144 }, err => console.error(err)); 144 }, err => console.error(err));
145 } 145 }
146 146
147 openModalPromos(articulo: IArticulo) { 147 openModalPromos(articulo: IArticulo) {
148 this.modalRef = this.modalService.show(PromocionComponent, 148 this.modalRef = this.modalService.show(PromocionComponent,
149 { 149 {
150 initialState: { 150 initialState: {
151 idArticulo: articulo.id 151 idArticulo: articulo.id
152 }, 152 },
153 class: 'modal-promo modal-dialog-centered' 153 class: 'modal-promo modal-dialog-centered'
154 }); 154 });
155 } 155 }
156 156
157
158 deleteArticulo(index: number) {
159 this.articuloService.carrito.splice(index, 1);
160 this.articuloService.calcularTotal();
161 }
162
157 increaseShow() { 163 increaseShow() {
158 this.showQuantity += 100; 164 this.showQuantity += 100;
159 } 165 }
160 166
161 @HostListener('scroll', ['$event']) 167 @HostListener('scroll', ['$event'])
162 scrollEvent(event: Event) { 168 scrollEvent(event: Event) {
163 clearTimeout(this.inactiveScreen.timerReposo); 169 clearTimeout(this.inactiveScreen.timerReposo);
164 this.inactiveScreen.startTimeOutInactividad(); 170 this.inactiveScreen.startTimeOutInactividad();
165 } 171 }
166 172
167 mouseup() { 173 mouseup() {
168 if (!this.timeoutHandler) return; 174 if (!this.timeoutHandler) return;
169 clearInterval(this.timeoutHandler); 175 clearInterval(this.timeoutHandler);
170 } 176 }
171 177
172 scrollY(el: HTMLElement, value) { 178 scrollY(el: HTMLElement, value) {
173 el.scroll({ behavior: 'smooth', top: value + el.scrollTop }); 179 el.scroll({ behavior: 'smooth', top: value + el.scrollTop });
174 this.timeoutHandler = setInterval(() => { 180 this.timeoutHandler = setInterval(() => {
175 el.scroll({ behavior: 'smooth', top: value + el.scrollTop }); 181 el.scroll({ behavior: 'smooth', top: value + el.scrollTop });
176 }, 500); 182 }, 500);
177 } 183 }
178 184
179 scrollX(el: HTMLElement, value) { 185 scrollX(el: HTMLElement, value) {
180 el.scroll({ behavior: 'smooth', left: value + el.scrollLeft }); 186 el.scroll({ behavior: 'smooth', left: value + el.scrollLeft });
181 this.timeoutHandler = setInterval(() => { 187 this.timeoutHandler = setInterval(() => {
182 el.scroll({ behavior: 'smooth', left: value + el.scrollLeft }); 188 el.scroll({ behavior: 'smooth', left: value + el.scrollLeft });
183 }, 500); 189 }, 500);
184 } 190 }
185 } 191 }
186 192
1 @import "scss/styles-bootstrap.scss"; 1 @import "scss/styles-bootstrap.scss";
2 @import "scss/typography.scss"; 2 @import "scss/typography.scss";
3 @import "scss/height-width.scss"; 3 @import "scss/height-width.scss";
4 @import "scss/animations.scss"; 4 @import "scss/animations.scss";
5 @import "scss/icons.scss"; 5 @import "scss/icons.scss";
6 @import "scss/scroll.scss"; 6 @import "scss/scroll.scss";
7 @import "node_modules/bootstrap/scss/_variables.scss"; 7 @import "node_modules/bootstrap/scss/_variables.scss";
8 8
9 @font-face { 9 @font-face {
10 font-family: "Gotham"; 10 font-family: "Gotham";
11 font-style: normal; 11 font-style: normal;
12 font-weight: normal; 12 font-weight: normal;
13 src: url("assets/fonts/gotham-medium.woff") format("woff"); 13 src: url("assets/fonts/gotham-medium.woff") format("woff");
14 } 14 }
15 15
16 html, 16 html,
17 body { 17 body {
18 max-height: 100vh; 18 max-height: 100vh;
19 height: 100%; 19 height: 100%;
20 font-family: "Gotham"; 20 font-family: "Gotham";
21 overflow: hidden; 21 overflow: hidden;
22 user-select: none; 22 user-select: none;
23 } 23 }
24 24
25 .btn-effect { 25 .btn-effect {
26 transition: all 0.3s !important; 26 transition: all 0.3s !important;
27 &:hover { 27 &:hover {
28 cursor: pointer !important; 28 cursor: pointer !important;
29 opacity: 0.7 !important; 29 opacity: 0.7 !important;
30 } 30 }
31 &:active { 31 &:active {
32 transform: scale(1.02) !important; 32 transform: scale(1.02) !important;
33 } 33 }
34 } 34 }
35 35
36 .cursor-pointer { 36 .cursor-pointer {
37 cursor: pointer; 37 cursor: pointer;
38 } 38 }
39 39
40 p { 40 p {
41 margin: 0 !important; 41 margin: 0 !important;
42 } 42 }
43 43
44 .img-in-top { 44 .img-in-top {
45 position: absolute; 45 position: absolute;
46 top: -35px; 46 top: -35px;
47 left: 50%; 47 left: 50%;
48 height: 70px; 48 height: 70px;
49 -webkit-transform: translateX(-50%); 49 -webkit-transform: translateX(-50%);
50 transform: translateX(-50%); 50 transform: translateX(-50%);
51 } 51 }
52 52
53 .right-0 {
54 right: 0;
55 }
56
57 .left-0 {
58 left: 0;
59 }
60
53 .rotate-45 { 61 .rotate-45 {
54 transform: rotate(45deg); 62 transform: rotate(45deg);
55 } 63 }
56 64
57 .rotate-90 { 65 .rotate-90 {
58 transform: rotate(90deg); 66 transform: rotate(90deg);
59 } 67 }
60 68
61 .rotate-90-neg { 69 .rotate-90-neg {
62 transform: rotate(-90deg); 70 transform: rotate(-90deg);
63 } 71 }
64 72
65 .rotate-180-neg { 73 .rotate-180-neg {
66 transform: rotate(-180deg); 74 transform: rotate(-180deg);
67 } 75 }
68 76