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

/**
 * Generated class for the SelectChangePersonPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-select-change-person',
  templateUrl: 'select-change-person.html',
})
export class SelectChangePersonPage {

    nowId;
    list = [];
    changeType = 0;
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService: AppService) {
  }

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

  getMonth(){
    const data = {
      date:'2018/10/01',
        type:this.changeType
    };
      this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/getScheduleByMonthAndType',data)
          .subscribe((res)=>{
            this.list = res.json();
            console.log(res.json())
      })
  }

  //换班
  select(item){
    this.navCtrl.push('ChangeApplySurePage',{
      'changeId':item.id,
        'nowId':this.nowId
    })
  }

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

}
