Commit 1abd6a9f974396ee4203aa7e7ab00d3eb71be765
1 parent
2bfe01da15
Exists in
master
and in
1 other branch
Agregado enum para filtro por categoria.
Showing
2 changed files
with
34 additions
and
8 deletions
Show diff stats
src/app/components/busqueda-productos/busqueda-productos.component.html
| ... | ... | @@ -16,36 +16,51 @@ |
| 16 | 16 | <div class="row m-4 disable-user-select"> |
| 17 | 17 | |
| 18 | 18 | <!-- FILTROS --> |
| 19 | - <div class="col-sm-2"> | |
| 19 | + <div class="col-sm-2 p-1"> | |
| 20 | 20 | <div class="text-center"> |
| 21 | 21 | <p class="font-weight-bold text-muted border-bottom pb-2">Buscar por Categoría</p> |
| 22 | 22 | </div> |
| 23 | 23 | <ul class="list-group"> |
| 24 | - <li class="list-group-item list-group-item-action my-1 py-2 h6"> | |
| 24 | + <li | |
| 25 | + [ngClass]="{active: categoria == 1}" | |
| 26 | + (click)="categoria = 1" | |
| 27 | + class="list-group-item list-group-item-action text-center my-1 p-2 h6"> | |
| 25 | 28 | Combos y Promociones |
| 26 | 29 | </li> |
| 27 | 30 | <li |
| 28 | - class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm font-weight-bold"> | |
| 31 | + [ngClass]="{active: categoria == 2}" | |
| 32 | + (click)="categoria = 2" | |
| 33 | + class="list-group-item list-group-item-action text-center my-1 p-2 h6 shadow-sm"> | |
| 29 | 34 | Todos |
| 30 | 35 | </li> |
| 31 | 36 | <li |
| 32 | - class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> | |
| 37 | + [ngClass]="{active: categoria == 3}" | |
| 38 | + (click)="categoria = 3" | |
| 39 | + class="list-group-item list-group-item-action text-center my-1 p-2 h6 shadow-sm"> | |
| 33 | 40 | Bebidas |
| 34 | 41 | </li> |
| 35 | 42 | <li |
| 36 | - class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> | |
| 43 | + [ngClass]="{active: categoria == 4}" | |
| 44 | + (click)="categoria = 4" | |
| 45 | + class="list-group-item list-group-item-action text-center my-1 p-2 h6 shadow-sm"> | |
| 37 | 46 | Sandwichería |
| 38 | 47 | </li> |
| 39 | 48 | <li |
| 40 | - class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> | |
| 49 | + [ngClass]="{active: categoria == 5}" | |
| 50 | + (click)="categoria = 5" | |
| 51 | + class="list-group-item list-group-item-action text-center my-1 p-2 h6 shadow-sm"> | |
| 41 | 52 | Panaderia |
| 42 | 53 | </li> |
| 43 | 54 | <li |
| 44 | - class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> | |
| 55 | + [ngClass]="{active: categoria == 6}" | |
| 56 | + (click)="categoria = 6" | |
| 57 | + class="list-group-item list-group-item-action text-center my-1 p-2 h6 shadow-sm"> | |
| 45 | 58 | Golosinas |
| 46 | 59 | </li> |
| 47 | 60 | <li |
| 48 | - class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> | |
| 61 | + [ngClass]="{active: categoria == 7}" | |
| 62 | + (click)="categoria = 7" | |
| 63 | + class="list-group-item list-group-item-action text-center my-1 p-2 h6 shadow-sm"> | |
| 49 | 64 | Tabaqueria |
| 50 | 65 | </li> |
| 51 | 66 | </ul> |
src/app/components/busqueda-productos/busqueda-productos.component.ts
| ... | ... | @@ -13,6 +13,7 @@ export class BusquedaProductosComponent implements OnInit { |
| 13 | 13 | auxProductos: Producto[] = []; |
| 14 | 14 | searchTerm: string = ''; |
| 15 | 15 | showSpinner: boolean = true; |
| 16 | + categoria: Categorias = Categorias.todos; | |
| 16 | 17 | |
| 17 | 18 | constructor(private productoService: ProductoService) { } |
| 18 | 19 | |
| ... | ... | @@ -34,3 +35,13 @@ export class BusquedaProductosComponent implements OnInit { |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | } |
| 38 | + | |
| 39 | +enum Categorias { | |
| 40 | + promosCombos = 1, | |
| 41 | + todos = 2, | |
| 42 | + bebidas = 3, | |
| 43 | + sandwicheria = 4, | |
| 44 | + panaderia = 5, | |
| 45 | + golosinas = 6, | |
| 46 | + tabaqueria = 7, | |
| 47 | +} |