import { Component } from '@angular/core';
import {IonicPage, ModalController, NavController, NavParams} from 'ionic-angular';
import {AppService} from "../../../service/appHttpService";
import {ContactModalPage} from "../contact-modal/contact-modal";
import {PersonListPage} from "../person-list/person-list";


@IonicPage()
@Component({
  selector: 'page-block-list',
  templateUrl: 'block-list.html',
})
export class BlockListPage {

    orgid;
    orgName;
    contactPersons;
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService:AppService,public modalCtrl: ModalController) {
  }

  ionViewDidLoad() {
      this.orgid = this.navParams.get("orgid");
      this.orgName = this.navParams.get("orgName");
      this.initList();
      console.log(this.orgid);
  }

  initList(){
      const data = {
          'groupId': this.orgid
      }
      this.appService.ObserverHttpGetOption('/wisdomgroup/modules/telpBookPerson',data)
          .subscribe((res)=>{
              if(res.json().data){
                  this.contactPersons = res.json().data.list;
              }
          })
  }

    showPersonModal(){
        let peoModal = this.modalCtrl.create(PersonListPage);
        peoModal.present();
    }

}
