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

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

  colors = ["#009587","#01BCD5", "#663AB7","#E6A9E6", "#3F51B5", "#F8A9CA", "#6FDCDE", "#F2D2CD", "#F2CCDB", "#BFE2F5", "#D8D0F7", "#6FDCDE", "#EC8ECC"];
  theColor: any;
  @Input() sdata:any;
  otherIconsS: boolean = false;
  @Output() skillsetEditEvent = new EventEmitter();
  @Output() skillsetDeleteEvent = new EventEmitter();

  constructor() { }

  ngOnInit() {
    //console.log(JSON.stringify(this.sdata));
  }

  
  randomColor(){
    return  this.colors[Math.floor(Math.random() * (this.colors.length-1)) + 0];
  }
  
  Initials(xitem: string) {
    if (xitem) {
      return xitem.replace(/\W*(\w)\w*/g, '$1').toUpperCase();
    }
  }

  deleteSkillset(sdata){
    console.log(JSON.stringify(sdata));
    this.skillsetDeleteEvent = sdata;
  }

  editSkillset(sdata){
   // console.log(JSON.stringify(sdata));
    this.skillsetEditEvent = sdata;
  }
  showOtherIcons(sdata){
    this.otherIconsS = true;
  }
}
