Commit c070e41e87e493a67b5244eaa05bac1eec48d8f2
1 parent
6787e86374
Exists in
master
and in
1 other branch
Agregada logica para mostrar boton cargar producto.
Showing
3 changed files
with
18 additions
and
3 deletions
Show diff stats
src/app/components/busqueda-productos/busqueda-productos.component.html
| ... | ... | @@ -95,7 +95,7 @@ |
| 95 | 95 | *ngFor="let producto of auxProductos"> |
| 96 | 96 | <div |
| 97 | 97 | class="card-effect bg-white rounded-sm shadow border-0" |
| 98 | - (click)="agregarAlCarrito(producto)"> | |
| 98 | + (click)="mostrarBotonCargar(producto)"> | |
| 99 | 99 | <img src="{{apiUrl}}/imagenes/accesoPLAYA.png" class="w-75 m-auto"> |
| 100 | 100 | <div class="p-2"> |
| 101 | 101 | <p class="h6 text-left m-0">{{producto.DetArt}}</p> |
| ... | ... | @@ -110,6 +110,11 @@ |
| 110 | 110 | <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p> |
| 111 | 111 | </div> |
| 112 | 112 | </div> |
| 113 | + <div *ngIf="producto.showCargarProducto" class="row mt-2"> | |
| 114 | + <div class="col-sm-12"> | |
| 115 | + <div class="btn btn-block btn-outline-primary shadow">Cargar Producto</div> | |
| 116 | + </div> | |
| 117 | + </div> | |
| 113 | 118 | </div> |
| 114 | 119 | </div> |
| 115 | 120 | </div> |
src/app/components/busqueda-productos/busqueda-productos.component.ts
| 1 | -import { Component, OnInit } from '@angular/core'; | |
| 1 | +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'; |
| ... | ... | @@ -16,7 +16,7 @@ export class BusquedaProductosComponent implements OnInit { |
| 16 | 16 | private showSpinner: boolean = true; |
| 17 | 17 | private categoria: Categorias = Categorias.todos; |
| 18 | 18 | private apiUrl: string = appSettings.apiUrl; |
| 19 | - | |
| 19 | + private showBtnCargarProducto: boolean = false; | |
| 20 | 20 | |
| 21 | 21 | constructor(private productoService: ProductoService) { } |
| 22 | 22 | |
| ... | ... | @@ -45,6 +45,15 @@ export class BusquedaProductosComponent implements OnInit { |
| 45 | 45 | this.productoService.productos.push(producto); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | + mostrarBotonCargar(producto: Producto) { | |
| 49 | + | |
| 50 | + for (let i = 0; i < this.auxProductos.length; i++) { | |
| 51 | + if (this.auxProductos[i].id !== producto.id) | |
| 52 | + this.auxProductos[i].showCargarProducto = false; | |
| 53 | + else if (producto.showCargarProducto) return; | |
| 54 | + } | |
| 55 | + producto.showCargarProducto = !producto.showCargarProducto | |
| 56 | + } | |
| 48 | 57 | } |
| 49 | 58 | |
| 50 | 59 | enum Categorias { |