import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,ViewController,ModalController } from 'ionic-angular';
import { dataService } from "../../providers/common.service";
import { Myservice } from "../../providers/myservice";
@IonicPage()
@Component({
  selector: 'page-ridenow',
  templateUrl: 'ridenow.html',
})
export class RidenowPage {
  details:any;
  rates:any;

  constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private data: dataService, private myservice:Myservice) {
  }

  ionViewDidEnter() {
   this.details = this.data.getbookingData()
   console.log(this.details)
    this.myservice.load_post({ time: this.details.date, type: this.details.carDetails.car_type }, 'getRate').subscribe(response=>{
      if(response.status == 'success'){
        this.rates = response.data
      }
    })
  }

  confirm() {
      let modal = this.modalCtrl.create('ConfirmridePage');
      modal.present();
    }

  dismiss()
  {
    this.viewCtrl.dismiss();
  }

  addcoupon() {
      let modal = this.modalCtrl.create('AddcouponPage');
      modal.present();
    }
	
	ratecard() {
    this.data.setrateData(this.rates)
      let modal = this.modalCtrl.create('RatecardPage',);
      modal.present();
    }

}
