idp-evalution.component.ts 2.65 KB
Newer Older
1
import { Component, EventEmitter, Output } from '@angular/core';
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
export interface DataModel {
  code: string,
  bis: BisModel[],
  startDate: string,
  endDate: string
}
export interface BisModel {
  name: string,
  oj: boolean,
  cm: boolean,
  t: boolean,
  cdr: CdrModel
}
export interface CdrModel {
  check: boolean,
  name: string,
  code: string
}
@Component({
  selector: 'app-idp-evalution',
  templateUrl: './idp-evalution.component.html',
  styleUrls: ['./idp-evalution.component.scss']
})
export class IdpEvalutionComponent {
26
  @Output() sendPageEvalution: EventEmitter<string> = new EventEmitter<string>();
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
  pathTitle = ['การประเมินผล', 'ประเมินผล']
  hoveredCode: string | null = null;
  dataList: DataModel[] = [{
    code: "CC-01",
    bis: [{
      name: "สอนงานด้านความปลอดภัย และคุณภาพของบริษัทให้กับพนักงานในหน่วยงาน",
      oj: true,
      cm: false,
      t: true,
      cdr: {
        check: false,
        name: "จิตใต้สำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality) สำหรับระดับพนักงาน S3-S4",
        code: "CC-01-4"
      }
    }, {
      name: "ติดตามและปรับปรุงการทำงานด้านความปลอดภัยและ คุณภาพของทีมงาน",
      oj: false,
      cm: false,
      t: false,
      cdr: {
        check: false,
        name: "",
        code: ""
      }
    }],
    startDate: "01-01-2023",
    endDate: "31-12-2023"
  }, {
    code: "CC-02",
    bis: [{
      name: "สอนงาน และพัฒนาทีมงานให้เกิดการทำงานเป็นทีมโดยยึดเป้าหมายเดียวกัน (TAT Goal) และคำนึงถึงความต้องการของลูกค้าเป็นหลัก (Next Customer)",
      oj: true,
      cm: false,
      t: false,
      cdr: {
        check: false,
        name: "",
        code: ""
      }
    }],
    startDate: "01-01-2023",
    endDate: "31-12-2023"
  }, {
    code: "CC-03",
    bis: [],
    startDate: "",
    endDate: ""
  }]

  getNestedValue(obj: any, path: string) {
    return path.split('.').reduce((acc, key) => acc && acc[key], obj);
  }
  checkBg(data: any[], field: string) {
    return data.every(x => !this.getNestedValue(x, field));
  }
  dataListFilter() {
    return this.dataList
  }
85 86 87 88

  returnPage() {
    this.sendPageEvalution.emit("")
  }
89
}