pago-con-tarjeta.component.ts 995 Bytes
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()
  }
}