import { Component, OnInit } from '@angular/core';
import { Router, NavigationExtras } from '@angular/router'
import { MermsServiceProviderService } from './../providers/merms-service-provider.service';
import { MermsSessionService } from './../merms-session.service';


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

  currentDateFormated: string = '10/10/2020';
  welcomeName: string = '';

  dashData: any;

  constructor(
    private router: Router,
    private mermsServiceProviderService: MermsServiceProviderService,
    private mermsSessionService : MermsSessionService 
  ) {
    this.welcomeName = "Dr. Something"
  }

  ngOnInit() {
    this.getDashData();
  }

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

  cardData: any;

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

    try {
      this.mermsServiceProviderService.genericGetService('provider/recentencounter', this.currentProviderData).subscribe(cardData => {
        console.log("card data result 22k: ", this.cardData);
        if (cardData.hasOwnProperty('result_list') && Array.isArray(cardData['result_list'])) {
 

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

  }

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

  goPatient() {
    this.router.navigateByUrl('/merms-patient')
  }
  goHome() {

  }
}
