import { Component, OnInit } from '@angular/core';
import { Router, NavigationExtras } from '@angular/router'
import {
  NavController,
  AlertController,
  LoadingController,
} from '@ionic/angular'

import { MermsServiceProviderService } from './../providers/merms-service-provider.service';
import { MermsSessionService } from './../merms-session.service';

@Component({
  selector: 'app-merms-settings',
  templateUrl: './merms-settings.page.html',
  styleUrls: ['./merms-settings.page.scss'],
})
export class MermsSettingsPage implements OnInit {

  doctor_profile_picture:string='../../assets/imgs/avatarM.png';

  constructor(  public navCtrl: NavController,private router: Router,
    private mermsServiceProviderService: MermsServiceProviderService,
    private mermsSessionService: MermsSessionService
    ) { 
      this.getPracticeData();
    }


  currentProviderData: {
    sessionid: string,
    member_id: number,
    card_count: number
    card_type: number
  };

  cardData: any;
  myPracticeList: any;

  getPracticeData() {
    console.log('MermsServiceProviderService::getPracticeData() ########  @@@@  ########');
    this.currentProviderData = {
      sessionid: this.mermsSessionService.session,
      member_id: this.mermsSessionService.member_id,
      card_count: 100,
      card_type: 22000
    };


    try {
      this.mermsServiceProviderService.genericGetService('provider/practicelist', this.currentProviderData).subscribe(myPracticeList => {
        console.log("card data result 22k: ", myPracticeList[0]['payload']);
        this.myPracticeList = myPracticeList[0]['payload'];

      });
    } catch (e) {
      console.log(e);
    }

    //


  }


  ngOnInit() {
  }

  goBack() {
    console.log('MERMSLoginPage::goBack()')
    this.navCtrl.pop()
  }

  goLogout(){
    // /home
    this.router.navigateByUrl('/home')
  }

  goPractice() {
    this.router.navigateByUrl('/merms-practice')
  }
}
