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

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

    time;
    dutyDetail = {
        reason: '',
        id: ''
    };

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

    ionViewDidLoad() {
        const id = this.navParams.get('id');
        this.time = this.navParams.get('time');
        this.appService.ObserverHttpGetOption('/wisdomgroup/changeApply/app/apply', {'id': id})
            .subscribe((res) => {
                this.dutyDetail = res.json();
            })
    }

    submitOrder() {
        console.log(this.dutyDetail);
        const id = this.dutyDetail.id;
        this.appService.ObserverHttpGetOption('/wisdomgroup/changeApply/app/deleteApply', {'id': id})
            .subscribe((res) => {
                this.navCtrl.pop();
                // this.dutyDetail = res;
            })
    }

}
