Commit 6690b26783371ce02f06634d5d3b9f49ba4ccd99
1 parent
cf95fd9dd5
Exists in
master
and in
1 other branch
Cambio en metodo pagar, agregado input para ingresar el nombre de quien realiza la compra.
Showing
2 changed files
with
27 additions
and
14 deletions
Show diff stats
src/app/components/confirmacion-carrito/confirmacion-carrito.component.html
... | ... | @@ -27,6 +27,19 @@ |
27 | 27 | <div class="col-sm-9 my-auto"> |
28 | 28 | <p class="h4">Por favor, controle y confirme su compra.</p> |
29 | 29 | </div> |
30 | + <label for="customLabel" class="col-auto font-weight-bold h4 m-0"> | |
31 | + Pedido a nombre de: | |
32 | + </label> | |
33 | + <div class="col-12 col-sm-6 col-md-5 col-lg-5"> | |
34 | + <input | |
35 | + type="text" | |
36 | + class="form-control text-center" | |
37 | + id="customLabel" | |
38 | + maxlength="24" | |
39 | + [(ngModel)]="pedidoAnombreDe" | |
40 | + autofocus | |
41 | + > | |
42 | + </div> | |
30 | 43 | </div> |
31 | 44 | |
32 | 45 | <div [ngClass]="{'mt-5': verQR}" class="row m-0"> |
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
... | ... | @@ -15,14 +15,15 @@ import { PagoConTarjetaComponent } from '../pago-con-tarjeta/pago-con-tarjeta.co |
15 | 15 | }) |
16 | 16 | export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
17 | 17 | |
18 | - private productos: Producto[] = []; | |
19 | - private total: number = 0; | |
20 | 18 | private apiImagenes: string = appSettings.apiImagenes; |
21 | - private timerReposo: any; | |
22 | 19 | private compraConEfectivofinalizada: boolean = false; |
23 | 20 | private compraConQRfinalizada: boolean = false; |
21 | + private productos: Producto[] = []; | |
22 | + private total: number = 0; | |
23 | + private timerReposo: any; | |
24 | 24 | private verQR: boolean = false; |
25 | 25 | private subscribePago: Subscription; |
26 | + private pedidoAnombreDe: string = ''; | |
26 | 27 | |
27 | 28 | constructor( |
28 | 29 | private location: Location, |
... | ... | @@ -84,21 +85,19 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
84 | 85 | //#region METODOS PARA LA FORMA DE PAGO |
85 | 86 | pagar(medioPago: number) { |
86 | 87 | |
87 | - if (medioPago === 9) { | |
88 | - | |
89 | - this.verQR = true; | |
88 | + this.verQR = medioPago === 9 ? true : false; | |
89 | + let dataPago = { | |
90 | + medioPago: medioPago, | |
91 | + pedidoAnombreDe: this.pedidoAnombreDe | |
90 | 92 | } |
91 | - | |
92 | - this.subscribePago = this.productoService.pagar(medioPago) | |
93 | - .subscribe(() => { | |
93 | + this.subscribePago = this.productoService.pagar(dataPago) | |
94 | + .subscribe((res: any) => { | |
94 | 95 | |
95 | 96 | clearTimeout(this.timerReposo); |
96 | - | |
97 | + | |
97 | 98 | if (medioPago === 1) { |
98 | - | |
99 | 99 | this.compraConEfectivofinalizada = true; |
100 | 100 | } else if (medioPago === 9) { |
101 | - | |
102 | 101 | this.compraConQRfinalizada = true; |
103 | 102 | } |
104 | 103 | |
... | ... | @@ -107,8 +106,9 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
107 | 106 | this.router.navigate(['mensaje-final']); |
108 | 107 | }, 10000); |
109 | 108 | }, err => { |
110 | - console.log(err); | |
111 | - alert('algo salió mal'); | |
109 | + | |
110 | + console.error(err); | |
111 | + alert('Algo salió mal'); | |
112 | 112 | }) |
113 | 113 | } |
114 | 114 | //#endregion |