import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { environment } from '../../../../../../environments/environment.dev';

@Component({
  selector: 'app-user-tiles',
  templateUrl: './user-tiles.component.html',
  styleUrls: ['./user-tiles.component.scss']
})
export class UserTilesComponent implements OnInit {

  @Input() usersData: any;
  otherIcons : boolean = false;
  showTheSkills: boolean;

  @Output() userEditEvent = new EventEmitter();

  usr_img_path = environment.imageUrl+'/assets/img/admin/';
  constructor() { }

  ngOnInit() {
   // console.log(JSON.stringify(this.usersData));
    if(this.usersData.pgUserInfoMstr.pgUserSkillMapping.length > 0){
      this.showTheSkills = true;
    }
    else{
      this.showTheSkills = false;
    }
  }
  Initials(xitem: string) {
    if (xitem) {
      return xitem.replace(/\W*(\w)\w*/g, '$1').toUpperCase();
    }
  }
  showOtherIcons(id){
    this.otherIcons = true;
  }

  editUserInfo(id, usersData){
    this.userEditEvent.emit(usersData);
  }
}
