pago-con-tarjeta.component.ts
995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { Component, OnInit } from '@angular/core';
import { BsModalRef } from 'ngx-bootstrap';
import { TarjetasService } from 'src/app/services/tarjetas.service';
import { Tarjeta } from 'src/app/wrappers/tarjeta';
@Component({
selector: 'app-pago-con-tarjeta',
templateUrl: './pago-con-tarjeta.component.html',
styleUrls: ['./pago-con-tarjeta.component.scss'],
})
export class PagoConTarjetaComponent implements OnInit {
private tarjetas: Tarjeta[] = [];
private tarjetaSeleccionada: Tarjeta;
private showForm = false;
private importeTotal: number;
constructor(
private modalRef: BsModalRef,
private tarjetasService: TarjetasService,
) { }
ngOnInit() {
this.tarjetasService.getTarjetas()
.subscribe((res: Tarjeta[]) => {
this.tarjetas = res;
}, err => console.error(err));
}
seleccionarTarjeta(tarjeta: Tarjeta) {
this.tarjetaSeleccionada = tarjeta;
this.showForm = true;
}
close() {
this.modalRef.hide()
}
}