import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AppService } from "../../../service/appHttpService";

@IonicPage()
@Component({
  selector: 'page-duty-apply',
  templateUrl: 'duty-apply.html',
})
export class DutyApplyPage {

  date;
    reason;
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService: AppService) {
  }

  ionViewDidLoad() {
    this.date = this.navParams.get('date');
  }

  submit(){
    const data = {
        date:new Date(this.date).toLocaleDateString(),
        reason:this.reason
    };
    this.appService.ObserverHttpPost('/wisdomgroup/changeApply/app/apply',data)
        .subscribe((res )=>{
           this.navCtrl.pop();
        })
  }

}
