diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html index 08f79b7..0b756ab 100644 --- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html +++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html @@ -64,7 +64,7 @@

- - {{producto.cantidad}} {{p.DET_LAR}} + - {{p.cantidad * producto.cantidad}} {{p.DET_LAR}}

diff --git a/src/app/components/inicio/inicio.component.ts b/src/app/components/inicio/inicio.component.ts index fcbd0fd..510a911 100644 --- a/src/app/components/inicio/inicio.component.ts +++ b/src/app/components/inicio/inicio.component.ts @@ -91,15 +91,11 @@ export class InicioComponent implements OnInit, AfterViewInit { }, error => { console.error(error); }) } - confirmarProducto(cantidad?: number) { + confirmarProducto() { let producto = this.promoAcargar ? this.promoAcargar : this.productoAcargar; - if (cantidad) { - producto.cantidad = cantidad; - } else { - producto.cantidad = producto.cantidad ? producto.cantidad : 1; - } + producto.cantidad = producto.cantidad ? producto.cantidad : 1; this.productoService.setProductos(producto); this.productoService.productoAcargar = this.promoAcargar = this.productoAcargar = undefined; @@ -152,9 +148,9 @@ export class InicioComponent implements OnInit, AfterViewInit { }) } - productosPersonalizados($event: any) { + productosPersonalizados($event: Producto[]) { - let productosPersonalizados = $event.productosAenviar; + let productosPersonalizados = $event; productosPersonalizados.forEach(productoElegido => { @@ -164,7 +160,8 @@ export class InicioComponent implements OnInit, AfterViewInit { }); this.promoAcargar.productos = this.promoAcargar.productos.concat(productosPersonalizados); - this.confirmarProducto($event.cantidadPromo); + + this.confirmarProducto(); } buscarByCodigoBarras(busqueda) { diff --git a/src/app/components/popover-sinonimos/popover-sinonimos.component.html b/src/app/components/popover-sinonimos/popover-sinonimos.component.html index 83d7e64..6fc9605 100644 --- a/src/app/components/popover-sinonimos/popover-sinonimos.component.html +++ b/src/app/components/popover-sinonimos/popover-sinonimos.component.html @@ -13,32 +13,6 @@
-
-
-
- -
- - {{cantidadPromo}} - -
- -
-
-
-

diff --git a/src/app/components/popover-sinonimos/popover-sinonimos.component.ts b/src/app/components/popover-sinonimos/popover-sinonimos.component.ts index 0b8c6f7..9eb7356 100644 --- a/src/app/components/popover-sinonimos/popover-sinonimos.component.ts +++ b/src/app/components/popover-sinonimos/popover-sinonimos.component.ts @@ -14,12 +14,8 @@ export class PopoverSinonimosComponent implements OnInit { //Directiva del popover, para poder cerrarlo desde este componente @Input() popover: PopoverDirective; @Input() popoverContent: Sinonimo[]; - @Output() productosPersonalizados = new EventEmitter(); - private cantMin: number = 1; - private cantMax: number = 50; + @Output() productosPersonalizados = new EventEmitter(); private cantidadRestanteSinonimos: number = 0; - private cantidadOriginal: number = 0; - private cantidadPromo: number = 1; constructor(private productoService: ProductoService) { } @@ -32,10 +28,8 @@ export class PopoverSinonimosComponent implements OnInit { if (this.productoService.esPromoPersonalizada) { producto.cantidad = producto.cantidad ? producto.cantidad : 0; this.cantidadRestanteSinonimos = 0; - this.cantidadOriginal = 0; } else { this.cantidadRestanteSinonimos += producto.cantidad ? producto.cantidad : 0; - this.cantidadOriginal += producto.cantidad ? producto.cantidad : 0; producto.cantidad = 0; } @@ -55,13 +49,12 @@ export class PopoverSinonimosComponent implements OnInit { if (producto.cantidad > 0) { producto.idSinonimo = sinonimo.ID_SIN; - productosAenviar.push(producto); } }) }) - this.productosPersonalizados.emit({productosAenviar: productosAenviar, cantidadPromo: this.cantidadPromo}); + this.productosPersonalizados.emit(productosAenviar); this.popover.hide(); } @@ -79,21 +72,4 @@ export class PopoverSinonimosComponent implements OnInit { producto.cantidad--; this.cantidadRestanteSinonimos++; } - - sumarCantidadPromo() { - - if (this.cantidadPromo < this.cantMax) { - this.cantidadPromo++; - this.cantidadRestanteSinonimos += this.cantidadOriginal; - } - } - - restarCantidadPromo() { - - if (this.cantidadPromo > this.cantMin) { - this.cantidadPromo--; - this.cantidadRestanteSinonimos -= this.cantidadOriginal; - } - } - } diff --git a/src/app/components/sidebar/sidebar.component.html b/src/app/components/sidebar/sidebar.component.html index b29625f..8d33b71 100644 --- a/src/app/components/sidebar/sidebar.component.html +++ b/src/app/components/sidebar/sidebar.component.html @@ -28,8 +28,7 @@

@@ -38,8 +37,7 @@