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-detalles',
  templateUrl: 'modal-detalles.html',
})
export class ModalDetallesPage {

  order: 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.getOrders(id).subscribe((data:any)=>{
        load.dismiss();
        this.load = true;
        this.order = data.data;
      })
    
  }

  dismiss() {
    this.viewCtrl.dismiss();
  }
  dateformat(fecha) {
    var fecha_mm = moment(fecha);
    return moment(fecha_mm.format(), moment.ISO_8601).format();
  }


}
