Commit 038a408bf4107371e875121a9b2fd86d7732f38f
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !54
Showing
6 changed files
Show diff stats
src/app/components/busqueda-productos/busqueda-productos.component.html
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | <div class="row m-3 disable-user-select"> |
| 15 | 15 | |
| 16 | 16 | <!-- FILTROS --> |
| 17 | - <div *ngIf="verCategorias" class="col-sm-2 p-1"> | |
| 17 | + <div *ngIf="queMostrar != 'promociones'" class="col-sm-2 p-1"> | |
| 18 | 18 | <div class="text-center"> |
| 19 | 19 | <p class="font-weight-bold text-muted border-bottom pb-2">Buscar por Categoría</p> |
| 20 | 20 | </div> |
src/app/components/busqueda-productos/busqueda-productos.component.ts
| ... | ... | @@ -17,7 +17,7 @@ export class BusquedaProductosComponent implements OnInit { |
| 17 | 17 | private searchTerm: string = ''; |
| 18 | 18 | private categoriaActive: number = null; |
| 19 | 19 | private showSpinner: boolean = true; |
| 20 | - private verCategorias: boolean = true; | |
| 20 | + private queMostrar: string = 'todo'; | |
| 21 | 21 | private apiUrl: string = appSettings.apiUrl; |
| 22 | 22 | private categorias: Categoria[] = []; |
| 23 | 23 | private blurFocus = new EventEmitter(); |
| ... | ... | @@ -28,12 +28,32 @@ export class BusquedaProductosComponent implements OnInit { |
| 28 | 28 | |
| 29 | 29 | ngOnInit() { |
| 30 | 30 | |
| 31 | - this.verCategorias = this.productoService.verCategoriasProductos; | |
| 31 | + this.queMostrar = this.productoService.mostrar; | |
| 32 | 32 | |
| 33 | 33 | this.productoService.getCategorias() |
| 34 | 34 | .subscribe((categorias: Categoria[]) => { |
| 35 | 35 | this.categorias = categorias; |
| 36 | - this.categoriaActive = this.verCategorias ? 0 : categorias[0].id; | |
| 36 | + | |
| 37 | + switch (this.queMostrar) { | |
| 38 | + case 'todos': | |
| 39 | + this.categoriaActive = 1; | |
| 40 | + break; | |
| 41 | + case 'promociones': | |
| 42 | + this.categoriaActive = 1; | |
| 43 | + break; | |
| 44 | + case 'ordenar': | |
| 45 | + | |
| 46 | + this.categorias = this.categorias.filter((categoria: Categoria) => { | |
| 47 | + return categoria.ES_PEDIDO; | |
| 48 | + }); | |
| 49 | + | |
| 50 | + this.categoriaActive = this.categorias[0].id; | |
| 51 | + | |
| 52 | + break; | |
| 53 | + default: | |
| 54 | + break; | |
| 55 | + } | |
| 56 | + | |
| 37 | 57 | }); |
| 38 | 58 | |
| 39 | 59 | this.productoService.productoAcargar = undefined; |
src/app/components/inicio/inicio.component.html
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | |
| 14 | 14 | <!-- PROMOCIONES --> |
| 15 | 15 | <div |
| 16 | - (click)="irBusquedaProductos(false)" | |
| 16 | + (click)="irBusquedaProductos('promociones')" | |
| 17 | 17 | class="card card-effect bg-white border-0 shadow rounded w-100 mb-auto"> |
| 18 | 18 | <div class="card-body text-left px-4 py-3"> |
| 19 | 19 | <div class="row"> |
| ... | ... | @@ -45,7 +45,8 @@ |
| 45 | 45 | </div> |
| 46 | 46 | |
| 47 | 47 | <!-- ORDENAR --> |
| 48 | - <div class="card card-effect bg-white border-0 shadow rounded w-100 mt-4"> | |
| 48 | + <div (click)="irBusquedaProductos('ordenar')" | |
| 49 | + class="card card-effect bg-white border-0 shadow rounded w-100 mt-4"> | |
| 49 | 50 | <div class="card-body text-left px-4 py-3"> |
| 50 | 51 | <div class="row"> |
| 51 | 52 | <div class="col-auto"> |
| ... | ... | @@ -176,7 +177,7 @@ |
| 176 | 177 | </div> |
| 177 | 178 | |
| 178 | 179 | <!-- BUSCAR PRODUCTOS --> |
| 179 | - <div (click)="irBusquedaProductos(true)" | |
| 180 | + <div (click)="irBusquedaProductos('todos')" | |
| 180 | 181 | class="card card-effect bg-white border-0 shadow rounded w-100 mt-4"> |
| 181 | 182 | <div class="card-body text-left px-4 py-3"> |
| 182 | 183 | <div class="row"> |
src/app/components/inicio/inicio.component.ts
| ... | ... | @@ -85,9 +85,9 @@ export class InicioComponent implements OnInit { |
| 85 | 85 | }); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - irBusquedaProductos(verPromociones) { | |
| 88 | + irBusquedaProductos(value) { | |
| 89 | 89 | |
| 90 | - this.productoService.verCategoriasProductos = verPromociones; | |
| 90 | + this.productoService.mostrar = value; | |
| 91 | 91 | this.router.navigate(['busqueda-productos']); |
| 92 | 92 | } |
| 93 | 93 |
src/app/services/producto.service.ts
src/app/wrappers/categoria.ts