import { Component } from '@angular/core';
import { IonicPage, NavController, LoadingController, ViewController, ModalController, NavParams } from 'ionic-angular';
import { DoctorService } from '../../services/doctor.service';
import { Pata } from '../../pata';
import * as moment from 'moment';

@Component({
  selector: 'page-modal-pago-ok',
  templateUrl: 'modal-pago-ok.html',
})
export class ModalPagoOkPage {

  data: any = null;
  load: boolean = false;
  id: string = '';
  
  constructor(public navCtrl: NavController,
    public viewCtrl: ViewController,
    private docService: DoctorService,
    public service: Pata,
    public loadingCtrl: LoadingController,
    public modalCtrl: ModalController,
    public navParams: NavParams) {
      
      let id = this.navParams.get('id');
      let load = this.loadingCtrl.create({content: 'cargando...'});
      load.present();
      
      this.docService.getTbkOrder(id).subscribe((data:any)=>{
        load.dismiss();
        this.load = true;
        this.data = data.data;
      })
    
  }

  dismiss() {
    this.viewCtrl.dismiss();
  }
  df(fecha:string) {
    if (!fecha) {
      return new Date();
    }
    fecha = fecha.replace(' ','T');
    return fecha;
  }
  dateformat(fecha) {
    var fecha_mm = moment(fecha);
    return moment(fecha_mm.format(), moment.ISO_8601).format();
  }


}
