Commit 67f80d2cf5b3af9c6e91cb90a69988da1c78b10d
1 parent
b9c5ea1261
Exists in
master
Arreglo de imagen y agregada logica para cargar producto.
Showing
2 changed files
with
19 additions
and
5 deletions
Show diff stats
src/app/components/busqueda-productos/busqueda-productos.component.html
| ... | ... | @@ -89,14 +89,14 @@ |
| 89 | 89 | </div> |
| 90 | 90 | </div> |
| 91 | 91 | <!-- LISTA DE PRODUCTOS --> |
| 92 | - <div class="row align-items-start vh-70 overflow-scroll disable-user-select"> | |
| 92 | + <div class="row align-items-start vh-60 overflow-scroll disable-user-select"> | |
| 93 | 93 | <div |
| 94 | 94 | class="col-4 p-2" |
| 95 | 95 | *ngFor="let producto of auxProductos"> |
| 96 | 96 | <div |
| 97 | 97 | class="card-effect bg-white rounded-sm shadow border-0" |
| 98 | 98 | (click)="mostrarBotonCargar(producto)"> |
| 99 | - <img src="{{apiUrl}}/imagenes/accesoPLAYA.png" class="w-75 m-auto"> | |
| 99 | + <img src="{{apiUrl}}/imagenes/cafe.jpg" class="rounded-sm w-100 m-auto"> | |
| 100 | 100 | <div class="p-2"> |
| 101 | 101 | <p class="h6 text-left m-0">{{producto.DetArt}}</p> |
| 102 | 102 | <div class="row justify-content-between m-0"> |
| ... | ... | @@ -112,7 +112,12 @@ |
| 112 | 112 | </div> |
| 113 | 113 | <div *ngIf="producto.showCargarProducto" class="row mt-2"> |
| 114 | 114 | <div class="col-sm-12"> |
| 115 | - <div class="btn btn-block btn-outline-primary shadow">Cargar Producto</div> | |
| 115 | + <button | |
| 116 | + type="button" | |
| 117 | + class="btn btn-block btn-outline-primary shadow" | |
| 118 | + (click)="elegirProducto(producto)"> | |
| 119 | + Cargar Producto | |
| 120 | + </button> | |
| 116 | 121 | </div> |
| 117 | 122 | </div> |
| 118 | 123 | </div> |
src/app/components/busqueda-productos/busqueda-productos.component.ts
| ... | ... | @@ -2,6 +2,7 @@ import { Component, OnInit, APP_BOOTSTRAP_LISTENER } from '@angular/core'; |
| 2 | 2 | import { ProductoService } from 'src/app/services/producto.service'; |
| 3 | 3 | import { Producto } from 'src/app/wrappers/producto'; |
| 4 | 4 | import { appSettings } from 'src/etc/AppSettings'; |
| 5 | +import { Router } from '@angular/router'; | |
| 5 | 6 | |
| 6 | 7 | @Component({ |
| 7 | 8 | selector: 'app-busqueda-productos', |
| ... | ... | @@ -18,7 +19,9 @@ export class BusquedaProductosComponent implements OnInit { |
| 18 | 19 | private apiUrl: string = appSettings.apiUrl; |
| 19 | 20 | private showBtnCargarProducto: boolean = false; |
| 20 | 21 | |
| 21 | - constructor(private productoService: ProductoService) { } | |
| 22 | + constructor( | |
| 23 | + private productoService: ProductoService, | |
| 24 | + private router: Router) { } | |
| 22 | 25 | |
| 23 | 26 | ngOnInit() { |
| 24 | 27 | |
| ... | ... | @@ -45,7 +48,7 @@ export class BusquedaProductosComponent implements OnInit { |
| 45 | 48 | this.productoService.productos.push(producto); |
| 46 | 49 | } |
| 47 | 50 | |
| 48 | - mostrarBotonCargar(producto: Producto) { | |
| 51 | + private mostrarBotonCargar(producto: Producto) { | |
| 49 | 52 | |
| 50 | 53 | for (let i = 0; i < this.auxProductos.length; i++) { |
| 51 | 54 | if (this.auxProductos[i].id !== producto.id) |
| ... | ... | @@ -54,6 +57,12 @@ export class BusquedaProductosComponent implements OnInit { |
| 54 | 57 | } |
| 55 | 58 | producto.showCargarProducto = !producto.showCargarProducto |
| 56 | 59 | } |
| 60 | + | |
| 61 | + private elegirProducto(producto: Producto) { | |
| 62 | + | |
| 63 | + this.productoService.productoAcargar = producto; | |
| 64 | + this.router.navigate(['inicio']); | |
| 65 | + } | |
| 57 | 66 | } |
| 58 | 67 | |
| 59 | 68 | enum Categorias { |