import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
// import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , MdDialogModule} from '@angular/material';
import { DialogComponent } from '../../../../../shared/dialog/dialog.component';
import { environment } from '../../../../../../environments/environment.dev';

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

  @Input() tileList: any;
  othIcons : boolean = false;

  @Output() caEditEvent = new EventEmitter();
  @Output() caDeleteEvent = new EventEmitter();
  deleteData: any;
  img_path = environment.imageUrl+'/assets/img/admin/';
  caHover: boolean = false;

  constructor() { }
// public dialog: MatDialog
  ngOnInit() {
   
  }
  Initials(xitem: string) {
    if (xitem) {
      return xitem.replace(/\W*(\w)\w*/g, '$1').toUpperCase();
    }
  }
  
  showOtherIcons(id){
    this.othIcons = true;
  }

  editAssesment(id, tileList){
    console.log(id);
    this.caEditEvent.emit(tileList);
    console.log('Edit sb details --- ' +JSON.stringify(tileList));
  }

  deleteAssesment(id, tileList){
    this.deleteData = {}
    this.deleteData.id = id;
    this.deleteData.isDelete = true;
    this.deleteData.skillTrackMstrId = tileList.pgSkillTrackMstr.skillTrackMstrId;
    this.deleteData.skillTrackName = tileList.pgSkillTrackMstr.skillTrackName;
    this.caDeleteEvent.emit(this.deleteData);
  }
}
