import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {AppService} from "../../../service/appHttpService";
import {DutyApplyHandlePage} from "../duty-apply-handle/duty-apply-handle";
import {DutyChangeDetailPage} from "../duty-change-detail/duty-change-detail";

@IonicPage()
@Component({
  selector: 'page-change-apply-list',
  templateUrl: 'change-apply-list.html',
})
export class ChangeApplyListPage {

    menuList = [
        {name:'待处理'},
        {name:'已处理'},
    ];
    changeType = 1;
    noList = [];
    doneList = [];

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

  ionViewDidLoad() {
    this.getList();
  }

  getList(){
      //0 未处理  1 已处理
      const data = {
          type:0
      };
      this.appService.ObserverHttpGetOption('/wisdomgroup/changeApply/app/applyListOfType',data)
          .subscribe((res)=>{
              this.noList = res.json();
          }
          );

      const data1 = {
          type:1
      };
      this.appService.ObserverHttpGetOption('/wisdomgroup/changeApply/app/applyListOfType',data1)
          .subscribe((res)=>{
                  this.doneList = res.json();
              }
          );

  }

  change(type){
      this.changeType = type;
  }

    goApplyDetail(item){
        this.navCtrl.push('DutyApplyHandlePage',{'item':item});
    }

    goToDetail(item){
        this.navCtrl.push('DutyChangeDetailPage',{'item':item});
    }

}
