import { Component } from '@angular/core';
import {IonicPage, ModalController, NavController, NavParams} from 'ionic-angular';
import {AppService} from "../../../service/appHttpService";
import {message} from "../../../app/main";
import {PersonListPage} from "../../contact/person-list/person-list";
import {QuestionDetailPage} from "../question-detail/question-detail";

@IonicPage()
@Component({
  selector: 'page-survey-result',
  templateUrl: 'survey-result.html',
})
export class SurveyResultPage {

    item;
    userId;
    survey;
    contentList;
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService: AppService,public modalCtrl: ModalController) {
  }

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

  getResult(){
      this.appService.ObserverHttpGetAdd('/wisdomgroup/modules/question/show/',this.item.id)
          .subscribe((res)=>{
              this.survey = res.json().data;
              this.contentList = res.json().data.ques.datalist;
              this.contentList.forEach(res=>{
                  res.quesDesc = JSON.parse(res.quesDesc);
              });
              console.log(this.contentList);
          })
  }

  look(item){
      let peoModal = this.modalCtrl.create(QuestionDetailPage,{item:item});
      peoModal.onDidDismiss( res=>{
          const data = {

          };

      } );
      peoModal.present();
  }

}
