Commit 9772da4939690a9919759e3775fdffb9ef84acdb
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master(mpuebla) See merge request !31
Showing
5 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 class="col-sm-2 p-1"> | |
| 17 | + <div *ngIf="verCategorias" 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> |
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | </div> |
| 31 | 31 | |
| 32 | 32 | <!-- SEARCH INPUT --> |
| 33 | - <div *ngIf="productos.length > 0" class="fade-in col-sm-10"> | |
| 33 | + <div *ngIf="productos.length > 0" class="fade-in col"> | |
| 34 | 34 | |
| 35 | 35 | <div class="form-group row search"> |
| 36 | 36 | <div class="col-sm-10"> |
src/app/components/busqueda-productos/busqueda-productos.component.ts
| ... | ... | @@ -17,6 +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 | 21 | private apiUrl: string = appSettings.apiUrl; |
| 21 | 22 | private showBtnCargarProducto: boolean = false; |
| 22 | 23 | private categorias: Categoria[] = []; |
| ... | ... | @@ -27,17 +28,20 @@ export class BusquedaProductosComponent implements OnInit { |
| 27 | 28 | |
| 28 | 29 | ngOnInit() { |
| 29 | 30 | |
| 31 | + this.verCategorias = this.productoService.verCategoriasProductos; | |
| 32 | + | |
| 30 | 33 | this.productoService.getCategorias() |
| 31 | 34 | .subscribe((categorias: Categoria[]) => { |
| 32 | 35 | this.categorias = categorias; |
| 33 | - this.categoriaActive = categorias[0].id; | |
| 36 | + this.categoriaActive = this.verCategorias ? 1 : categorias[0].id; | |
| 34 | 37 | }); |
| 35 | 38 | |
| 36 | 39 | this.productoService.productoAcargar = undefined; |
| 37 | 40 | this.productoService.getAll() |
| 38 | 41 | .subscribe((data: Producto[]) => { |
| 39 | 42 | |
| 40 | - this.auxProductos = this.productos = data; | |
| 43 | + this.productos = data; | |
| 44 | + this.filterItems(); | |
| 41 | 45 | }, (error) => { |
| 42 | 46 | this.showSpinner = false; |
| 43 | 47 | console.error(error); |
src/app/components/inicio/inicio.component.html
| ... | ... | @@ -12,7 +12,9 @@ |
| 12 | 12 | <div class="col-md-5 d-flex align-items-end flex-column"> |
| 13 | 13 | |
| 14 | 14 | <!-- PROMOCIONES --> |
| 15 | - <div class="card bg-white border-0 shadow rounded w-100 mb-auto"> | |
| 15 | + <div | |
| 16 | + (click)="irBusquedaProductos(false)" | |
| 17 | + class="card card-effect bg-white border-0 shadow rounded w-100 mb-auto"> | |
| 16 | 18 | <div class="card-body text-left px-4 py-3"> |
| 17 | 19 | <div class="row"> |
| 18 | 20 | <div class="col-7"> |
| ... | ... | @@ -176,7 +178,7 @@ |
| 176 | 178 | </div> |
| 177 | 179 | |
| 178 | 180 | <!-- BUSCAR PRODUCTOS --> |
| 179 | - <div (click)="goPage('busqueda-productos')" | |
| 181 | + <div (click)="irBusquedaProductos(true)" | |
| 180 | 182 | class="card card-effect bg-white border-0 shadow rounded w-100 mt-4"> |
| 181 | 183 | <div class="card-body text-left px-4 py-3"> |
| 182 | 184 | <div class="row"> |
src/app/components/inicio/inicio.component.ts
| ... | ... | @@ -84,9 +84,10 @@ export class InicioComponent implements OnInit { |
| 84 | 84 | }); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - private goPage(pageUrl) { | |
| 87 | + private irBusquedaProductos(verPromociones) { | |
| 88 | 88 | |
| 89 | - this.router.navigate([pageUrl]); | |
| 89 | + this.productoService.verCategoriasProductos = verPromociones; | |
| 90 | + this.router.navigate(['busqueda-productos']); | |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | 93 | deshacerCarga() { |
src/app/services/producto.service.ts