From f4222918bcb44608eac38c214a9ec575419b64f5 Mon Sep 17 00:00:00 2001
From: Nattana <nattana.cha@myhr.co.th>
Date: Thu, 27 Feb 2025 16:05:55 +0700
Subject: [PATCH] การประเมินสมรรถนะ การจัดการสมรรถนะ ตัวชี้วัดและหลักสูตร

---
 src/app/components/competency-assessment/competency-management/indicators-and-curriculum/indicators-and-curriculum.component.ts | 37 ++-----------------------------------
 src/app/components/competency-assessment/competency-management/set-approvers/set-approvers.component.ts                         |  2 +-
 src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.html                              | 30 +++++++++++++-----------------
 src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.ts                                | 12 ++++++++++--
 src/app/shared/model/appraisal-subordinate .model.ts                                                                            | 31 -------------------------------
 src/app/shared/model/appraisal-subordinate.model.ts                                                                             | 31 +++++++++++++++++++++++++++++++
 src/app/shared/services/appraisal.service.ts                                                                                    |  2 +-
 7 files changed, 58 insertions(+), 87 deletions(-)
 delete mode 100644 src/app/shared/model/appraisal-subordinate .model.ts
 create mode 100644 src/app/shared/model/appraisal-subordinate.model.ts

diff --git a/src/app/components/competency-assessment/competency-management/indicators-and-curriculum/indicators-and-curriculum.component.ts b/src/app/components/competency-assessment/competency-management/indicators-and-curriculum/indicators-and-curriculum.component.ts
index 5e29f71..e23653f 100644
--- a/src/app/components/competency-assessment/competency-management/indicators-and-curriculum/indicators-and-curriculum.component.ts
+++ b/src/app/components/competency-assessment/competency-management/indicators-and-curriculum/indicators-and-curriculum.component.ts
@@ -119,7 +119,7 @@ export class IndicatorsAndCurriculumComponent {
     this.dataLoading = true
     this.competencytopicService.getList().subscribe({
       next: response => {
-        this.dataList = response.map(x => ({ code: x.competencyTopicId, name: x.tdesc, type: x.competencyType.tdesc, file: x.competencyFiles || "" }))
+        this.dataList = response.map(x => ({ code: x.competencyTopicId || "", name: x.tdesc || "", type: x.competencyType.tdesc || "", file: x.competencyFiles || "" }))
         this.indicatorsCoursesList = response
         this.dataLoading = false
         this.searchChange()
@@ -146,42 +146,9 @@ export class IndicatorsAndCurriculumComponent {
 
   dataListFilter() {
     return this.dataList.filter(x => {
-      const match = x.code.toLowerCase().includes(this.search.toLowerCase()) || x.name.toLowerCase().includes(this.search.toLowerCase());
-      return match;
+      return x.code.toLowerCase().includes(this.search.toLowerCase()) || x.name.toLowerCase().includes(this.search.toLowerCase()) || x.type.toLowerCase().includes(this.search.toLowerCase())
     });
   }
 
-
-  showSuccess() {
-    this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
-      timeOut: 3000,
-      positionClass: 'toast-top-right',
-    });
-  }
-  showSuccessEdit() {
-    this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
-      timeOut: 3000,
-      positionClass: 'toast-top-right',
-    });
-  }
-  showSuccessDelete() {
-    this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
-      timeOut: 3000,
-      positionClass: 'toast-top-right',
-    });
-  }
-  addUser() {
-    console.log('เพิ่มผู้ใช้งาน');
-  }
-
-  deleteUser() {
-    console.log('ลบผู้ใช้งาน');
-  }
-
-  editUser() {
-    console.log('แก้ไขผู้ใช้งาน');
-  }
-
-
 }
 
diff --git a/src/app/components/competency-assessment/competency-management/set-approvers/set-approvers.component.ts b/src/app/components/competency-assessment/competency-management/set-approvers/set-approvers.component.ts
index 4e8e504..d48ef65 100644
--- a/src/app/components/competency-assessment/competency-management/set-approvers/set-approvers.component.ts
+++ b/src/app/components/competency-assessment/competency-management/set-approvers/set-approvers.component.ts
@@ -157,7 +157,7 @@ export class SetApproversComponent {
   }
   searchChange() {
     this.currentPage = 1
-    this.page = Array.from({ length: Math.ceil(this.groupapprove_listFilter().length / 10) }, (_, i) => i + 1);
+    this.page = Array.from({ length: Math.ceil(this.groupapprove_listFilter().length / 10) }, (_, i) => i + 1)
   }
   groupapprove_listFilter() {
     return this.groupapprove_list.filter(x =>
diff --git a/src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.html b/src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.html
index 1f2f5e1..a1158fc 100644
--- a/src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.html
+++ b/src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.html
@@ -46,22 +46,18 @@
                     </tr>
                 </thead>
                 <tbody>
-                    <tr
-                        *ngFor="let item of[
-                          ['10001', 'ธนพัต อาชาไชย', 'HRD training Officer', '', '', '', '70', 'c', 'ประเมินเเล้ว', 'ผู้อนุมัติลำดับที่ 1'],
-                          ['10002', 'พิชญาภา มหาเมธี', 'HRD training Officer', '', '', '', '-', '-', 'ยังไม่ประเมิน', '-'],
-                          ['10003', 'นิรดา บุญเทพ', 'HRD training Officer', '', '', '', '76', '', 'ประเมินเเล้ว', 'ผู้อนุมัติลำดับที่3'],
-                          ['10004', 'รัตน์ ธนากร', 'HRD training Officer', '', '', '', '79', '', 'ประเมินเเล้ว', 'ผู้อนุมัติลำดับที่ 1'],
-                          ['10005', 'ยศกร ศิริธาดา', 'HRD training Officer', '', '', '', '', '', 'ประเมินเเล้ว', 'ผู้อนุมัติลำดับที่ 2'],
-                          ['10006', 'ธนิสรา นพรัตน์พร', 'HRD training Officer', '', '', '', '80', '', 'ประเมินเเล้ว', '-'],
-                          ['10007', 'เมริสา สุขทิพย์', 'HRD training Officer', '', '', '', '', '', 'ประเมินเเล้ว', '-']];let i = index">
-                        <td class="text-center" style="font-size: 12px; width: 150px;">{{item[0]}}</td>
-                        <td style="font-size: 12px; width: 175px;">{{item[1]}}</td>
-                        <td style="font-size: 12px;">{{item[2]}}</td>
+                    <tr *ngFor="let item of subordinateFilter();let i = index">
+                        <td class="text-center" style="font-size: 12px; width: 150px;">
+                            {{item.apsassessy.employeeId}}
+                        </td>
+                        <td style="font-size: 12px; width: 175px;">
+                            {{item.apsassessy.thFullName}}
+                        </td>
+                        <td style="font-size: 12px;">{{item.apsassessy.position.tdesc}}</td>
                         <td class="flex justify-center">
                             <button type="button" class="ti-btn rounded-sm ti-btn-success"
                                 style="height: 15px; width: 45px; font-size: 12px; display: flex; align-items: center; justify-content: center;"
-                                (click)="returnPage('c')">
+                                (click)="returnPage('evaluate')">
                                 ประเมิน
                             </button>
                         </td>
@@ -71,10 +67,10 @@
                                 IDP
                             </button>
                         </td>
-                        <td class="text-center" style="font-size: 12px;">{{item[6]}}</td>
-                        <td class="text-center" style="font-size: 12px;">{{item[7]}}</td>
-                        <td class="text-center" style="font-size: 12px;">{{item[8]}}</td>
-                        <td class="text-center" style="font-size: 12px;">{{item[9]}}</td>
+                        <td class="text-center" style="font-size: 12px;">{{item.sumScore}}</td>
+                        <td class="text-center" style="font-size: 12px;">{{item.gread}}</td>
+                        <td class="text-center" style="font-size: 12px;">{{item.masfromStatusType.tdesc}}</td>
+                        <td class="text-center" style="font-size: 12px;">{{item.apsapproveType.tdesc}}</td>
 
                     </tr>
                 </tbody>
diff --git a/src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.ts b/src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.ts
index 0e25f39..55f91a9 100644
--- a/src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.ts
+++ b/src/app/components/performance-evaluation/supervisor-evaluation/round-one/round-one.component.ts
@@ -1,5 +1,6 @@
 import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
 import { ToastrService } from 'ngx-toastr';
+import { AppraisalSubordinateModel, MyAppraisalSubordinateModel } from 'src/app/shared/model/appraisal-subordinate.model';
 import { AppraisalService } from 'src/app/shared/services/appraisal.service';
 
 @Component({
@@ -12,6 +13,9 @@ export class RoundOneComponent {
   @Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
   @Output() sendPageEvalution: EventEmitter<string> = new EventEmitter<string>();
   @Output() sendEmployeeId: EventEmitter<string> = new EventEmitter<string>();
+
+  subordinate: { loading: false, dataList: AppraisalSubordinateModel[] } = { loading: false, dataList: [] }
+  search = ""
   constructor(private appraisalService: AppraisalService,
     private cdr: ChangeDetectorRef) {
   }
@@ -21,14 +25,18 @@ export class RoundOneComponent {
   getBossList() {
     this.appraisalService.getBossList().subscribe({
       next: response => {
-        console.log(" 🐒 response:", response)
-
+        this.subordinate.dataList = response.map(x => new MyAppraisalSubordinateModel(x))
         this.cdr.detectChanges()
       }, error: error => {
         this.cdr.detectChanges()
       }
     })
   }
+  subordinateFilter() {
+    return this.subordinate.dataList.filter(x => {
+      return x.apsassessy.employeeId.toLowerCase().includes(this.search.toLowerCase()) || x.apsassessy.thFullName.toLowerCase().includes(this.search.toLowerCase())
+    })
+  }
   returnPage(text: string) {
     this.sendEmployeeId.emit()
     this.sendPageEvalution.emit(text)
diff --git a/src/app/shared/model/appraisal-subordinate .model.ts b/src/app/shared/model/appraisal-subordinate .model.ts
deleted file mode 100644
index 1586634..0000000
--- a/src/app/shared/model/appraisal-subordinate .model.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { EmployeeModel, MyEmployeeModel } from "./employee.model"
-import { MyStatusCodeModel, StatusCodeModel } from "./status-code.model"
-
-export interface AppraisalSubordinateModel {
-    companyId: string
-    active: boolean
-    masfromStatusType: StatusCodeModel
-    apsapproveType: StatusCodeModel
-    apsassessy: EmployeeModel
-    gread: string
-    sumScore: number
-}
-export class MyAppraisalSubordinateModel implements AppraisalSubordinateModel {
-    companyId: string
-    active: boolean
-    masfromStatusType: StatusCodeModel
-    apsapproveType: StatusCodeModel
-    apsassessy: EmployeeModel
-    gread: string
-    sumScore: number
-    constructor(data: Partial<AppraisalSubordinateModel>) {
-        this.companyId = data.companyId || ""
-        this.active = data.active ?? false
-        this.masfromStatusType = new MyStatusCodeModel(data.masfromStatusType)
-        this.apsapproveType = new MyStatusCodeModel(data.apsapproveType)
-        this.apsassessy = new MyEmployeeModel(data.apsassessy)
-        this.gread = data.gread || ""
-        this.sumScore = data.sumScore ?? 0
-    }
-}
-
diff --git a/src/app/shared/model/appraisal-subordinate.model.ts b/src/app/shared/model/appraisal-subordinate.model.ts
new file mode 100644
index 0000000..1586634
--- /dev/null
+++ b/src/app/shared/model/appraisal-subordinate.model.ts
@@ -0,0 +1,31 @@
+import { EmployeeModel, MyEmployeeModel } from "./employee.model"
+import { MyStatusCodeModel, StatusCodeModel } from "./status-code.model"
+
+export interface AppraisalSubordinateModel {
+    companyId: string
+    active: boolean
+    masfromStatusType: StatusCodeModel
+    apsapproveType: StatusCodeModel
+    apsassessy: EmployeeModel
+    gread: string
+    sumScore: number
+}
+export class MyAppraisalSubordinateModel implements AppraisalSubordinateModel {
+    companyId: string
+    active: boolean
+    masfromStatusType: StatusCodeModel
+    apsapproveType: StatusCodeModel
+    apsassessy: EmployeeModel
+    gread: string
+    sumScore: number
+    constructor(data: Partial<AppraisalSubordinateModel>) {
+        this.companyId = data.companyId || ""
+        this.active = data.active ?? false
+        this.masfromStatusType = new MyStatusCodeModel(data.masfromStatusType)
+        this.apsapproveType = new MyStatusCodeModel(data.apsapproveType)
+        this.apsassessy = new MyEmployeeModel(data.apsassessy)
+        this.gread = data.gread || ""
+        this.sumScore = data.sumScore ?? 0
+    }
+}
+
diff --git a/src/app/shared/services/appraisal.service.ts b/src/app/shared/services/appraisal.service.ts
index bcb247c..0df140c 100644
--- a/src/app/shared/services/appraisal.service.ts
+++ b/src/app/shared/services/appraisal.service.ts
@@ -5,7 +5,7 @@ import { environment } from 'src/environments/environment';
 import { AlertModel } from '../model/alert.model';
 import { AppraisalFormModel } from '../model/appraisal-form.model';
 import { AppraisalCompentencyModel, AppraisalCompentencyModel2 } from '../model/appraisal-competency.model';
-import { AppraisalSubordinateModel } from '../model/appraisal-subordinate .model';
+import { AppraisalSubordinateModel } from '../model/appraisal-subordinate.model';
 @Injectable({
   providedIn: 'root'
 })
--
libgit2 0.26.0