import { Component, OnInit, OnChanges, Input, Output, EventEmitter } from '@angular/core';
import { Router } from '@angular/router';
import { LocalStorageService } from 'angular-2-local-storage';
import { EmployeeReview } from '../../../models/employee.model';
import { environment } from '../../../../environments/environment.dev';
@Component({
  selector: 'app-employee-review-feedback',
  templateUrl: './employee-review-feedback.component.html',
  styleUrls: ['./employee-review-feedback.component.scss']
})
export class EmployeeReviewFeedbackComponent implements OnInit, OnChanges {

  @Input() reviewData: EmployeeReview | null;
  @Output() valueChange = new EventEmitter();
  imagelink: string;
  userInfoMstrId: string;
  eventDetailsId: string;
  useCaseId: string;

  constructor(
    private localStorageService: LocalStorageService,
    private router: Router
  ) {
    const empData = this.localStorageService.get('userInfo');
    if (empData['userInfoMstrId']) {
      this.userInfoMstrId = empData['userInfoMstrId'];
    }
   }

  ngOnInit() {
    this.imagelink = environment.imageUrl+'/assets/img/employee/newdashboard/';
  }

  ngOnChanges() {
    this.eventDetailsId = String(this.reviewData.eventDetailsId);
    this.useCaseId = String(this.reviewData.usecaseId);
    console.log('use Case Id ' +  this.useCaseId);
  }

  updateEmployeeReviewStatus(status) {
      if (status === 'Done') {
        this.valueChange.emit('Done');
      } else if(status === 'To Do') {
        this.valueChange.emit('To Do');
      }
  }


}
