import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';

export interface DataModel {
  code: string,
  name: string,
  startDate: string,
  endDate: string,
  status: string
}
export interface Data2Model {
  code: string,
  name: string,
  bi: BiModel[],
}
export interface BiModel {
  name: string,
  tools: string[],
  degree: string
}

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

  pathTitle = ['การประเมินผล', 'ประเมินตนเอง']

  dataList: DataModel[] = [
    {
      code: "CC",
      name: "การประเมินผลการปฏิบัติงาน (performance-evaluation)",
      startDate: "1 ตุลาคม 2567",
      endDate: "30 ตุลาคม 2567",
      status: "ยังไม่ประเมิน"
    },
    {
      code: "MC",
      name: "การประเมินศักยภาพ (Potential Evaluation)",
      startDate: "1 ตุลาคม 2567",
      endDate: "30 ตุลาคม 2567",
      status: "ยังไม่ประเมิน"
    },
    {
      code: "PC",
      name: "การประเมินประสิทธิภาพขององค์กร (Organizational Effectiveness Evaluation)",
      startDate: "1 ตุลาคม 2567",
      endDate: "30 ตุลาคม 2567",
      status: "ยังไม่ประเมิน"
    }
  ]
  dataList2: DataModel[] = [
    {
      code: "KPI",
      name: "Performance Management System",
      startDate: "1 ตุลาคม 2567",
      endDate: "30 ตุลาคม 2567",
      status: "ยังไม่ประเมิน"
    }
  ]
  
  hoveredCode: string | null = null;
  dataList3: Data2Model[] = [
    {
      code: "CC-01",
      name: "จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality)",
      bi: [{
        name: "สอนงานด้านความปลอดภัย และคุณภาพของบริษัทให้กับพนักงานในหน่วยงาน",
        tools: ["O"],
        degree: "4"
      }, {
        name: "ติดตามและปรับปรุงการทำงานด้านความปลอดภัยและคุณภาพของทีมงาน",
        tools: ["O", "D"],
        degree: "5"
      }],
    },
    {
      code: "CC-02",
      name: "การทำงานเป็นทีมแบบ TAT (TAT Teamwork)",
      bi: [{
        name: "คิดวิเคราะห์เพื่อแก้ปัญหาด้านความปลอดภัยและคุณภาพในหน่วยงานที่รับผิดชอบ",
        tools: ["O", "D"],
        degree: "5"
      }, {
        name: "นำเสนอและจัดทำรายงานด้านความปลอดภัยและคุณภาพทั้งภาษาไทยและภาษาอังกฤษ",
        tools: ["O"],
        degree: "2"
      },
      {
        name: "สอนงาน และพัฒนาทีมงานให้เกิดการทำงานเป็นทีม โดยยึดเป้าหมายเดียวกัน (TAT Goal) และคำนึงถึง ความต้องการของลูกค้าเป็นหลัก (Next Customer)",
        tools: ["O"],
        degree: "2"
      },
      {
        name: "สนับสนุนทีมงานให้ดำเนินการตามเป้าหมายของทีม และสิ่งที่ตนเองได้รับมอบหมาย",
        tools: ["O", "D"],
        degree: "4"
      },
      {
        name: "วิเคราะห์และแก้ไขปัญหาที่เกิดจากการทำงานเป็นทีม รวมถึงการควบคุมดูแลให้เป็นไปตามเป้าหมาย",
        tools: ["O"],
        degree: "5"
      },
      {
        name: "สื่อสารเพื่อสร้างความเข้าใจ และรับฟังความคิดเห็น ของสมาชิกในทีม ชื่นชมทีมงานแต่ละคนที่เป็น ส่วนหนึ่งในความสำเร็จของทีมร่วมกัน",
        tools: ["O", "D"],
        degree: "5"
      }],
    }
  ]
  @ViewChild('selfEvaluation1_2', { static: true }) selfEvaluation1_2!: TemplateRef<any>;
  @ViewChild('selfEvaluation1_2Edit', { static: true }) selfEvaluation1_2Edit!: TemplateRef<any>;
  currentTemplate: TemplateRef<any> = this.selfEvaluation1_2
  ngOnInit(): void {
    this.currentTemplate = this.selfEvaluation1_2
  }
  dataListFilter() {
    return this.dataList
  }
  dataList2Filter() {
    return this.dataList2
  }
  dataList3Filter() {
    return this.dataList3
  }
  showTools(data: string[]) {
    return data.join("/")
  }
}