import { Component, OnInit, Input} from '@angular/core';
import { ModalController } from '@ionic/angular';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';

@Component({
  selector: 'app-digital-id',
  templateUrl: './digital-id.component.html',
  styleUrls: ['./digital-id.component.scss'],
})
export class DigitalIdComponent implements OnInit {
  @Input() userInfo: any;
  public userJobName: any;

  constructor(
    public modalCtrl: ModalController,
    public ts: TranslatorService,
  ) { }

  ngOnInit() {
    if(JSON.parse(localStorage.getItem('digitalIDUser'))){
      this.userInfo = JSON.parse(localStorage.getItem('digitalIDUser'));
    }
    console.log(this.userInfo);
    if (this.userInfo) {
      let jobTitle = this.userInfo.POSITION_NAME.split('.');
      if (jobTitle && jobTitle.length > 1) {
        this.userJobName = jobTitle[0] + " " + jobTitle[1];
      }​
    }
  }


  dismiss() {
    this.modalCtrl.dismiss({
      'dismissed': true
    });
  }

}
