Commit 8f882ada0475d87808f26ab92e5bb5f9a6df5cc2
1 parent
3960d7b593
Exists in
master
and in
1 other branch
bug cambio categoría no respeta filtro activo
Showing
2 changed files
with
5 additions
and
6 deletions
Show diff stats
src/app/components/busqueda-productos/busqueda-productos.component.html
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | <button |
| 64 | 64 | class="btn btn-outline-primary badge badge-light px-2 shadow-sm" |
| 65 | 65 | [ngClass]="{'active': ordenandoByVendidos}" |
| 66 | - (click)="ordenandoByVendidos = !ordenandoByVendidos; ordenar()" | |
| 66 | + (click)="ordenandoByVendidos = !ordenandoByVendidos; filterItems()" | |
| 67 | 67 | >Más vendidos</button> |
| 68 | 68 | </div> |
| 69 | 69 | </div> |
src/app/components/busqueda-productos/busqueda-productos.component.ts
| ... | ... | @@ -46,10 +46,10 @@ export class BusquedaProductosComponent implements OnInit { |
| 46 | 46 | this.categoriaActive = 1; |
| 47 | 47 | this.title = 'Promociones'; |
| 48 | 48 | break; |
| 49 | - case 'ordenar': | |
| 49 | + case 'ordenar': | |
| 50 | 50 | this.categorias = categorias.filter((categoria: Categoria) => { |
| 51 | 51 | return categoria.ES_PEDIDO; |
| 52 | - }); | |
| 52 | + }); | |
| 53 | 53 | this.categoriaActive = 0; |
| 54 | 54 | this.title = 'Ordenar'; |
| 55 | 55 | break; |
| ... | ... | @@ -82,7 +82,6 @@ export class BusquedaProductosComponent implements OnInit { |
| 82 | 82 | this.productos = data; |
| 83 | 83 | } |
| 84 | 84 | this.filterItems(); |
| 85 | - this.ordenar(); | |
| 86 | 85 | }, (error) => { |
| 87 | 86 | this.showSpinner = false; |
| 88 | 87 | console.error(error); |
| ... | ... | @@ -101,6 +100,8 @@ export class BusquedaProductosComponent implements OnInit { |
| 101 | 100 | } |
| 102 | 101 | }); |
| 103 | 102 | |
| 103 | + this.ordenar(); | |
| 104 | + | |
| 104 | 105 | } |
| 105 | 106 | |
| 106 | 107 | agregarAlCarrito(producto: Producto) { |
| ... | ... | @@ -116,8 +117,6 @@ export class BusquedaProductosComponent implements OnInit { |
| 116 | 117 | this.auxProductos.sort((a, b) => { |
| 117 | 118 | return b.cantidadVendida - a.cantidadVendida; |
| 118 | 119 | }); |
| 119 | - } else { | |
| 120 | - this.filterItems(); | |
| 121 | 120 | } |
| 122 | 121 | |
| 123 | 122 | } |