Commit 2d5ff955b63867cb545b9d577d25c435525ea063
1 parent
83671fcf65
Exists in
master
revertido cambio de seteo de cantidad de promociones.
Showing
5 changed files
with
11 additions
and
66 deletions
Show diff stats
src/app/components/confirmacion-carrito/confirmacion-carrito.component.html
src/app/components/inicio/inicio.component.ts
| ... | ... | @@ -91,15 +91,11 @@ export class InicioComponent implements OnInit, AfterViewInit { |
| 91 | 91 | }, error => { console.error(error); }) |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - confirmarProducto(cantidad?: number) { | |
| 94 | + confirmarProducto() { | |
| 95 | 95 | |
| 96 | 96 | let producto = this.promoAcargar ? this.promoAcargar : this.productoAcargar; |
| 97 | 97 | |
| 98 | - if (cantidad) { | |
| 99 | - producto.cantidad = cantidad; | |
| 100 | - } else { | |
| 101 | - producto.cantidad = producto.cantidad ? producto.cantidad : 1; | |
| 102 | - } | |
| 98 | + producto.cantidad = producto.cantidad ? producto.cantidad : 1; | |
| 103 | 99 | |
| 104 | 100 | this.productoService.setProductos(producto); |
| 105 | 101 | this.productoService.productoAcargar = this.promoAcargar = this.productoAcargar = undefined; |
| ... | ... | @@ -152,9 +148,9 @@ export class InicioComponent implements OnInit, AfterViewInit { |
| 152 | 148 | }) |
| 153 | 149 | } |
| 154 | 150 | |
| 155 | - productosPersonalizados($event: any) { | |
| 151 | + productosPersonalizados($event: Producto[]) { | |
| 156 | 152 | |
| 157 | - let productosPersonalizados = $event.productosAenviar; | |
| 153 | + let productosPersonalizados = $event; | |
| 158 | 154 | |
| 159 | 155 | productosPersonalizados.forEach(productoElegido => { |
| 160 | 156 | |
| ... | ... | @@ -164,7 +160,8 @@ export class InicioComponent implements OnInit, AfterViewInit { |
| 164 | 160 | }); |
| 165 | 161 | |
| 166 | 162 | this.promoAcargar.productos = this.promoAcargar.productos.concat(productosPersonalizados); |
| 167 | - this.confirmarProducto($event.cantidadPromo); | |
| 163 | + | |
| 164 | + this.confirmarProducto(); | |
| 168 | 165 | } |
| 169 | 166 | |
| 170 | 167 | buscarByCodigoBarras(busqueda) { |
src/app/components/popover-sinonimos/popover-sinonimos.component.html
| ... | ... | @@ -13,32 +13,6 @@ |
| 13 | 13 | <div class="row" *ngFor="let sinonimo of popoverContent; let i = index"> |
| 14 | 14 | <div class="col p-0"> |
| 15 | 15 | |
| 16 | - <div class="row py-2"> | |
| 17 | - <div class="col-12"> | |
| 18 | - <div class="btn-group float-right my-auto" role="group"> | |
| 19 | - <button | |
| 20 | - type="button" | |
| 21 | - class="btn btn-light my-auto border shadow" | |
| 22 | - (click)="sumarCantidadPromo()"> | |
| 23 | - <i class="fa fa-plus" aria-hidden="true"></i> | |
| 24 | - </button> | |
| 25 | - <div class="bg-white border border-white px-3 py-1 my-auto text-dark h5"> | |
| 26 | - <small | |
| 27 | - class="font-weight-bold"> | |
| 28 | - {{cantidadPromo}} | |
| 29 | - </small> | |
| 30 | - </div> | |
| 31 | - <button | |
| 32 | - type="button" | |
| 33 | - class="btn btn-light my-auto border shadow" | |
| 34 | - (click)="restarCantidadPromo()" | |
| 35 | - [disabled]="cantidadRestanteSinonimos < cantidadOriginal || cantidadPromo === 1"> | |
| 36 | - <i class="fa fa-minus" aria-hidden="true"></i> | |
| 37 | - </button> | |
| 38 | - </div> | |
| 39 | - </div> | |
| 40 | - </div> | |
| 41 | - | |
| 42 | 16 | <div class="row bg-white text-dark m-0 py-1 shadow"> |
| 43 | 17 | <div class="col text-left"> |
| 44 | 18 | <p class="h5 m-0 card-title"> |
src/app/components/popover-sinonimos/popover-sinonimos.component.ts
| ... | ... | @@ -14,12 +14,8 @@ export class PopoverSinonimosComponent implements OnInit { |
| 14 | 14 | //Directiva del popover, para poder cerrarlo desde este componente |
| 15 | 15 | @Input() popover: PopoverDirective; |
| 16 | 16 | @Input() popoverContent: Sinonimo[]; |
| 17 | - @Output() productosPersonalizados = new EventEmitter<any>(); | |
| 18 | - private cantMin: number = 1; | |
| 19 | - private cantMax: number = 50; | |
| 17 | + @Output() productosPersonalizados = new EventEmitter<Producto[]>(); | |
| 20 | 18 | private cantidadRestanteSinonimos: number = 0; |
| 21 | - private cantidadOriginal: number = 0; | |
| 22 | - private cantidadPromo: number = 1; | |
| 23 | 19 | |
| 24 | 20 | constructor(private productoService: ProductoService) { } |
| 25 | 21 | |
| ... | ... | @@ -32,10 +28,8 @@ export class PopoverSinonimosComponent implements OnInit { |
| 32 | 28 | if (this.productoService.esPromoPersonalizada) { |
| 33 | 29 | producto.cantidad = producto.cantidad ? producto.cantidad : 0; |
| 34 | 30 | this.cantidadRestanteSinonimos = 0; |
| 35 | - this.cantidadOriginal = 0; | |
| 36 | 31 | } else { |
| 37 | 32 | this.cantidadRestanteSinonimos += producto.cantidad ? producto.cantidad : 0; |
| 38 | - this.cantidadOriginal += producto.cantidad ? producto.cantidad : 0; | |
| 39 | 33 | producto.cantidad = 0; |
| 40 | 34 | } |
| 41 | 35 | |
| ... | ... | @@ -55,13 +49,12 @@ export class PopoverSinonimosComponent implements OnInit { |
| 55 | 49 | |
| 56 | 50 | if (producto.cantidad > 0) { |
| 57 | 51 | producto.idSinonimo = sinonimo.ID_SIN; |
| 58 | - | |
| 59 | 52 | productosAenviar.push(producto); |
| 60 | 53 | } |
| 61 | 54 | }) |
| 62 | 55 | }) |
| 63 | 56 | |
| 64 | - this.productosPersonalizados.emit({productosAenviar: productosAenviar, cantidadPromo: this.cantidadPromo}); | |
| 57 | + this.productosPersonalizados.emit(productosAenviar); | |
| 65 | 58 | this.popover.hide(); |
| 66 | 59 | } |
| 67 | 60 | |
| ... | ... | @@ -79,21 +72,4 @@ export class PopoverSinonimosComponent implements OnInit { |
| 79 | 72 | producto.cantidad--; |
| 80 | 73 | this.cantidadRestanteSinonimos++; |
| 81 | 74 | } |
| 82 | - | |
| 83 | - sumarCantidadPromo() { | |
| 84 | - | |
| 85 | - if (this.cantidadPromo < this.cantMax) { | |
| 86 | - this.cantidadPromo++; | |
| 87 | - this.cantidadRestanteSinonimos += this.cantidadOriginal; | |
| 88 | - } | |
| 89 | - } | |
| 90 | - | |
| 91 | - restarCantidadPromo() { | |
| 92 | - | |
| 93 | - if (this.cantidadPromo > this.cantMin) { | |
| 94 | - this.cantidadPromo--; | |
| 95 | - this.cantidadRestanteSinonimos -= this.cantidadOriginal; | |
| 96 | - } | |
| 97 | - } | |
| 98 | - | |
| 99 | 75 | } |
src/app/components/sidebar/sidebar.component.html
| ... | ... | @@ -28,8 +28,7 @@ |
| 28 | 28 | <button |
| 29 | 29 | type="button" |
| 30 | 30 | class="btn btn-light btn-sm border shadow" |
| 31 | - (click)="aumentarCantidad(producto)" | |
| 32 | - [hidden]="producto.PRO"> | |
| 31 | + (click)="aumentarCantidad(producto)"> | |
| 33 | 32 | <i class="fa fa-plus" aria-hidden="true"></i> |
| 34 | 33 | </button> |
| 35 | 34 | <div class="bg-white border border-white my-auto px-2 text-dark h5 shadow"> |
| ... | ... | @@ -38,8 +37,7 @@ |
| 38 | 37 | <button |
| 39 | 38 | type="button" |
| 40 | 39 | class="btn btn-light btn-sm border shadow" |
| 41 | - (click)="restarCantidad(producto)" | |
| 42 | - [hidden]="producto.PRO"> | |
| 40 | + (click)="restarCantidad(producto)"> | |
| 43 | 41 | <i class="fa fa-minus" aria-hidden="true"></i> |
| 44 | 42 | </button> |
| 45 | 43 | </div> |