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

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

  @Input() coTilesData: any;
  @Input() coTilesIndex: number;
  @Output() coEditEvent = new EventEmitter<any>();
  @Output() coDeleteEvent = new EventEmitter();
  @Input() colgStatus: boolean;

  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"];

  othIcons : boolean = false;
  toDeleteData: any
  constructor() { }

  ngOnInit() {
    if(this.coTilesData){
      // console.log(this.coTilesData);
    }
    console.log("College Invalid Status",this.colgStatus);
  }
  Initials(xitem: string) {
    if (xitem) {
      return xitem.replace(/\W*(\w)\w*/g, '$1').toUpperCase();
    }
  }

  showOtherIcons(){
    this.othIcons = true;
  }

  editCollegeData(coTilesData){
    this.coEditEvent.emit(coTilesData);
  }

  deleteCollegeData(coTilesData){
    this.toDeleteData = {}
    this.toDeleteData.id = coTilesData.id;
    this.toDeleteData.isDelete = true;
    this.coDeleteEvent.emit(this.toDeleteData);
  }
}
