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

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

  @Input() cardData: any;
  @Input() irCardIndex: number;
  othIcons : boolean = false;
  toDeleteData: any
  @Output() invEditEvent = new EventEmitter<any>();
  @Output() invDeleteEvent = new EventEmitter();

  
  myColor = ["#009587", "#01BCD5", "#663AB7", "#E6A9E6", "#3F51B5", "#F8A9CA", "#6FDCDE", "#F2D2CD", "#F2CCDB", "#BFE2F5", "#D8D0F7", "#6FDCDE", "#EC8ECC", "#009587", "#01BCD5", "#663AB7", "#E6A9E6", "#3F51B5", "#F8A9CA", "#6FDCDE", "#F2D2CD", "#F2CCDB", "#BFE2F5", "#D8D0F7", "#6FDCDE", "#EC8ECC"];
  
  constructor() { }
  
  ngOnInit() {
  }
  Initials(xitem: string) {
    if (xitem) {
      return xitem.replace(/\W*(\w)\w*/g, '$1').toUpperCase();
    }
  }
  showOtherIcons(id){
    this.othIcons = true;
  }

  editInnovRv(tileData){
    this.invEditEvent.emit(tileData);
  }

  deleteInnovRv(id){
    this.toDeleteData = {}
    this.toDeleteData.id = id;
    this.toDeleteData.isDelete = true;
    this.invDeleteEvent.emit(this.toDeleteData);
  }
}
