Commit 375ff37aca79e49e5613ba4f38323ee43eb6cb45
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master(mpuebla) See merge request !48
Showing
2 changed files
Show diff stats
src/app/components/home/home.component.html
| ... | ... | @@ -24,17 +24,17 @@ |
| 24 | 24 | <div class="carousel-item active"> |
| 25 | 25 | <img |
| 26 | 26 | src="{{apiUrl}}/imagenes/coca1.jpg" |
| 27 | - class="d-block rounded-sm shadow w-100"> | |
| 27 | + class="d-block rounded-sm shadow w-75"> | |
| 28 | 28 | </div> |
| 29 | 29 | <div class="carousel-item"> |
| 30 | 30 | <img |
| 31 | 31 | src="{{apiUrl}}/imagenes/coca2.jpg" |
| 32 | - class="d-block rounded-sm shadow w-100"> | |
| 32 | + class="d-block rounded-sm shadow w-75"> | |
| 33 | 33 | </div> |
| 34 | 34 | <div class="carousel-item"> |
| 35 | 35 | <img |
| 36 | 36 | src="{{apiUrl}}/imagenes/coca3.jpg" |
| 37 | - class="d-block rounded-sm shadow w-100"> | |
| 37 | + class="d-block rounded-sm shadow w-75"> | |
| 38 | 38 | </div> |
| 39 | 39 | </div> |
| 40 | 40 | </div> |
src/app/components/inicio/inicio.component.ts
| ... | ... | @@ -65,9 +65,9 @@ export class InicioComponent implements OnInit { |
| 65 | 65 | if (res.length === 0) { |
| 66 | 66 | //Si no tiene promociones la cargará al carrito despues de un tiempo |
| 67 | 67 | // setTimeout(() => { |
| 68 | - this.productoAcargar.cantidad = 1; | |
| 69 | - this.productoService.productos.push(this.productoAcargar); | |
| 70 | - this.productoAcargar = this.productoService.productoAcargar = undefined; | |
| 68 | + this.productoAcargar.cantidad = 1; | |
| 69 | + this.productoService.productos.push(this.productoAcargar); | |
| 70 | + this.productoAcargar = this.productoService.productoAcargar = undefined; | |
| 71 | 71 | // }, 2000) |
| 72 | 72 | } else { |
| 73 | 73 | |
| ... | ... | @@ -77,11 +77,6 @@ export class InicioComponent implements OnInit { |
| 77 | 77 | }, error => { console.error(error); }) |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - showPopover() { | |
| 81 | - | |
| 82 | - this.popoverDirective.show(); | |
| 83 | - } | |
| 84 | - | |
| 85 | 80 | getProductos() { |
| 86 | 81 | this.productoService.getAll() |
| 87 | 82 | .subscribe((productos: Producto[]) => { |
| ... | ... | @@ -129,36 +124,41 @@ export class InicioComponent implements OnInit { |
| 129 | 124 | promoSeleccionada($event: Producto) { |
| 130 | 125 | |
| 131 | 126 | this.promoAcargar = $event; |
| 132 | - this.promoAcargar.tieneSinonimos = true; | |
| 133 | 127 | if (this.promoAcargar.tieneSinonimos) { |
| 134 | 128 | var sector = this.promoAcargar.CodSec; |
| 135 | 129 | var codigo = this.promoAcargar.CodArt; |
| 136 | - this.productoService.getPromocionSinonimos(sector, codigo) | |
| 137 | - .subscribe((res: Sinonimo[]) => { | |
| 130 | + this.getSinonimos(sector, codigo); | |
| 131 | + | |
| 132 | + } else if (this.popoverDirective) { | |
| 133 | + this.popoverDirective.hide(); | |
| 134 | + } | |
| 135 | + } | |
| 136 | + | |
| 137 | + getSinonimos(sector, codigo) { | |
| 138 | 138 | |
| 139 | - res.forEach(sinonimo => { | |
| 139 | + this.productoService.getPromocionSinonimos(sector, codigo) | |
| 140 | + .subscribe((res: Sinonimo[]) => { | |
| 140 | 141 | |
| 141 | - sinonimo.productos.forEach(productoSinonimo => { | |
| 142 | + res.forEach(sinonimo => { | |
| 142 | 143 | |
| 143 | - this.promoAcargar.productos.forEach(productoPromo => { | |
| 144 | + sinonimo.productos.forEach(productoSinonimo => { | |
| 144 | 145 | |
| 145 | - if (productoSinonimo.id === productoPromo.id) { | |
| 146 | - sinonimo.cantidad = productoPromo.cantidad; | |
| 147 | - sinonimo.productoPadre = productoPromo.id; | |
| 148 | - } | |
| 149 | - }) | |
| 146 | + this.promoAcargar.productos.forEach(productoPromo => { | |
| 147 | + | |
| 148 | + if (productoSinonimo.id === productoPromo.id) { | |
| 149 | + sinonimo.cantidad = productoPromo.cantidad; | |
| 150 | + sinonimo.productoPadre = productoPromo.id; | |
| 151 | + } | |
| 150 | 152 | }) |
| 151 | 153 | }) |
| 152 | - | |
| 153 | - this.sinonimos = res; | |
| 154 | - if (res.length > 0) | |
| 155 | - this.showPopover(); | |
| 156 | - else | |
| 157 | - this.popoverDirective.hide(); | |
| 158 | 154 | }) |
| 159 | - } else { | |
| 160 | - this.popoverDirective.hide(); | |
| 161 | - } | |
| 155 | + | |
| 156 | + this.sinonimos = res; | |
| 157 | + if (res.length > 0) | |
| 158 | + this.popoverDirective.show(); | |
| 159 | + else | |
| 160 | + this.popoverDirective.hide(); | |
| 161 | + }) | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | productosPersonalizados($event: Producto[]) { |