Commit 493dc671 by Nattana Chaiyamat

part4 part5

parent 5c96d334
...@@ -422,9 +422,14 @@ ...@@ -422,9 +422,14 @@
<div class="box-header"> <div class="box-header">
<div class="flex flex-row gap-2"> <div class="flex flex-row gap-2">
<ng-container <ng-container
*ngFor="let item of ['ข้อมูลการประเมิน','แบบประเมินสมรรถนะ','ประเมินผลการปฏิบัติงาน','สรุปคะแนนและข้อเสนอแนะ','แผนพัฒนาบุคลากร']"> *ngFor="let item of ['ข้อมูลการประเมิน'+
currentPart,'แบบประเมินสมรรถนะ'+
currentPart,'ประเมินผลการปฏิบัติงาน'+
currentPart,'สรุปคะแนนและข้อเสนอแนะ'+
currentPart,'แผนพัฒนาบุคลากร'+currentPart]">
<button type="button" class="flex-1 flex flex-row border bg-white p-2 justify-center" <button type="button" class="flex-1 flex flex-row border bg-white p-2 justify-center"
style="border-radius:20px" (click)="currentTap=item" style="border-radius:20px"
(click)="currentTap=item;(currentTap=='ประเมินผลการปฏิบัติงาน'||currentTap=='สรุปคะแนนและข้อเสนอแนะ'?currentPart='':null)"
[ngClass]="{'!bg-primary text-white':currentTap==item}"> [ngClass]="{'!bg-primary text-white':currentTap==item}">
<span class="overflow-hidden text-ellipsis whitespace-nowrap align-center"> <span class="overflow-hidden text-ellipsis whitespace-nowrap align-center">
{{item}} {{item}}
...@@ -477,11 +482,11 @@ ...@@ -477,11 +482,11 @@
<div class="min-height: calc(100vh - 406px);" <div class="min-height: calc(100vh - 406px);"
[class.hidden]="currentTap!='ประเมินผลการปฏิบัติงาน'&&currentTap!='สรุปคะแนนและข้อเสนอแนะ'"> [class.hidden]="currentTap!='ประเมินผลการปฏิบัติงาน'&&currentTap!='สรุปคะแนนและข้อเสนอแนะ'">
<app-pms-kpi [canSave]="canSave" [appraisalPms]="compentency.data.pms" [currentTap]="currentTap" <app-pms-kpi [canSave]="canSave" [appraisalPms]="compentency.data.pms" [currentTap]="currentTap"
[evaluaterId]="evaluaterId" [evaluateeId]="evaluateeId" [canEdit]="canEdit" [currentPart]="currentTap" [evaluaterId]="evaluaterId" [evaluateeId]="evaluateeId"
[currentStep]="compentency.data.currentStep" [dateIso]="dateIso" [canEdit]="canEdit" [currentStep]="compentency.data.currentStep" [dateIso]="dateIso"
(kpiFormRemain)="kpiFormRemain=$event" (scorePart)="kpiScorePart=$event" (kpiFormRemain)="kpiFormRemain=$event" (scorePart)="kpiScorePart=$event"
(kpiForm)="compentency.data.pms=$event" (scrollToMenuId)="scrollToMenu($event)" (kpiForm)="compentency.data.pms=$event" (scrollToMenuId)="scrollToMenu($event)"
[compentencyFormRemain]="compentencyFormRemain"></app-pms-kpi> [inforWeight]="inforWeight" [compentencyFormRemain]="compentencyFormRemain"></app-pms-kpi>
</div> </div>
<div class="min-height: calc(100vh - 406px);" [class.hidden]="currentTap!='แผนพัฒนาบุคลากร'"> <div class="min-height: calc(100vh - 406px);" [class.hidden]="currentTap!='แผนพัฒนาบุคลากร'">
<app-pms-idp [currentTap]="currentTap" [canSave]="canSave" [appraisalIdp]="compentency.data.idp" <app-pms-idp [currentTap]="currentTap" [canSave]="canSave" [appraisalIdp]="compentency.data.idp"
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
{{formatThaiDate(item.masfromEvaluationRound.apsPeriodEnd)}} {{formatThaiDate(item.masfromEvaluationRound.apsPeriodEnd)}}
</td> </td>
<td class="py-2 text-center" style="vertical-align: top"> <td class="py-2 text-center" style="vertical-align: top">
{{inforWeight.get(item.comType) !=='null'?inforWeight.get(item.comType): ''}} {{inforWeight.get(item.comType) !=='null'?inforWeight.get(item.comType): '0'}}
</td> </td>
<td class="py-2 text-center" style="vertical-align: top"> <td class="py-2 text-center" style="vertical-align: top">
{{inforGap.get(item.comType)!=='null'?inforGap.get(item.comType): ''}} {{inforGap.get(item.comType)!=='null'?inforGap.get(item.comType): ''}}
......
...@@ -632,10 +632,11 @@ ...@@ -632,10 +632,11 @@
<ng-container *ngFor="let item2 of [5,4,3,2,1];let f = first"> <ng-container *ngFor="let item2 of [5,4,3,2,1];let f = first">
<button type="button" <button type="button"
class="h-12 w-12 p-0 shadow border text-soft-secondary-no-hover bg-white pointer-events-none" class="h-12 w-12 p-0 shadow border text-soft-secondary-no-hover bg-white pointer-events-none"
style="border-radius:5px" [ngClass]="{ style="border-radius:5px"
'!border-secondary': calAverage(item.averageScore)>=item2 , [ngClass]="{
'!text-secondary': calAverage(item.averageScore)>item2, '!border-secondary': calAverage(convertToNumber(inforWeight.get(item.competencyType.shortName) !=='null'?inforWeight.get(item.competencyType.shortName): '0'))>=item2 ,
'!text-white !bg-secondary':calAverage(item.averageScore)==item2}"> '!text-secondary': calAverage(convertToNumber(inforWeight.get(item.competencyType.shortName) !=='null'?inforWeight.get(item.competencyType.shortName): '0'))>item2,
'!text-white !bg-secondary':calAverage(convertToNumber(inforWeight.get(item.competencyType.shortName) !=='null'?inforWeight.get(item.competencyType.shortName): '0'))==item2}">
{{item2}} {{item2}}
</button> </button>
</ng-container> </ng-container>
...@@ -643,13 +644,16 @@ ...@@ -643,13 +644,16 @@
<div style="height: 20px;"> <div style="height: 20px;">
<span class="text-indigo-600"> <span class="text-indigo-600">
<ng-container> <ng-container>
{{item.averageScore}} {{convertToNumber(inforWeight.get(item.competencyType.shortName)
!=='null'?inforWeight.get(item.competencyType.shortName): '0')}}
</ng-container> </ng-container>
</span> </span>
</div> </div>
</td> </td>
<td class="py-2 text-center" style="vertical-align: top"> <td class="py-2 text-center" style="vertical-align: top">
{{numberFixed2(item.competencyType.weight * calAverage(item.averageScore))}} {{numberFixed2(item.competencyType.weight *
calAverage(convertToNumber(inforWeight.get(item.competencyType.shortName)
!=='null'?inforWeight.get(item.competencyType.shortName): '0')))}}
</td> </td>
</tr> </tr>
</ng-container> </ng-container>
......
...@@ -28,6 +28,7 @@ export interface LevelStarModel { ...@@ -28,6 +28,7 @@ export interface LevelStarModel {
}) })
export class PmsKpiComponent { export class PmsKpiComponent {
@Input() canSave = false @Input() canSave = false
@Input() inforWeight: Map<string, string> = new Map<string, string>()
data8List: Part8Model[] = [{ data8List: Part8Model[] = [{
id: 1, id: 1,
evaluationFactor: "Part 1 : ประเมินผลการปฏิบัติงานตามนโยบายบริษัท (Corporate KPI)", evaluationFactor: "Part 1 : ประเมินผลการปฏิบัติงานตามนโยบายบริษัท (Corporate KPI)",
...@@ -139,6 +140,9 @@ export class PmsKpiComponent { ...@@ -139,6 +140,9 @@ export class PmsKpiComponent {
this.allFormRemain() this.allFormRemain()
this.sendScorePart() this.sendScorePart()
} }
if (changes['currentPart']?.currentValue) {
this.currentPart = ''
}
} }
getAppraisalPmsForm() { getAppraisalPmsForm() {
this.data8List.forEach((x, i) => { this.data8List.forEach((x, i) => {
...@@ -332,8 +336,10 @@ export class PmsKpiComponent { ...@@ -332,8 +336,10 @@ export class PmsKpiComponent {
return 3; return 3;
} else if (roundedScore >= 40 && roundedScore <= 59) { } else if (roundedScore >= 40 && roundedScore <= 59) {
return 2; return 2;
} else { } else if (roundedScore >= 1 && roundedScore <= 39) {
return 1; return 1;
} else {
return 0;
} }
} }
...@@ -352,13 +358,15 @@ export class PmsKpiComponent { ...@@ -352,13 +358,15 @@ export class PmsKpiComponent {
} }
calExpectationScorePart4(data?: any) { calExpectationScorePart4(data?: any) {
if (data) { if (data) {
return data.reduce((sum: number, item: any) => sum + this.calAverage(item.averageScore), 0).toFixed(2); return data.reduce((sum: number, item: any) => sum + this.calAverage(this.convertToNumber(this.inforWeight.get(item.competencyType.shortName)
!== 'null' ? this.inforWeight.get(item.competencyType.shortName) : '0')), 0).toFixed(2);
} }
return "0.00" return "0.00"
} }
calExpectationTotalScorePart4(data?: any) { calExpectationTotalScorePart4(data?: any) {
if (data) { if (data) {
return data.reduce((sum: number, item: any) => sum + (item.competencyType.weight * this.calAverage(item.averageScore)), 0).toFixed(2); return data.reduce((sum: number, item: any) => sum + (item.competencyType.weight * this.calAverage(this.convertToNumber(this.inforWeight.get(item.competencyType.shortName)
!== 'null' ? this.inforWeight.get(item.competencyType.shortName) : '0'))), 0).toFixed(2);
} }
return "0.00" return "0.00"
} }
...@@ -490,7 +498,7 @@ export class PmsKpiComponent { ...@@ -490,7 +498,7 @@ export class PmsKpiComponent {
part5Remain() { part5Remain() {
if (this.appraisalPms?.part5Detail.length) { if (this.appraisalPms?.part5Detail.length) {
const remain = this.appraisalPms.part5Detail.filter(x => const remain = this.appraisalPms.part5Detail.filter(x =>
x.pmsWorkingTimScore == null && x.pmsWorkingTimScoreBoss == null x.pmsWorkingTimScore == 0 && x.pmsWorkingTimScoreBoss == 0
).length ).length
return remain return remain
} }
...@@ -545,4 +553,23 @@ export class PmsKpiComponent { ...@@ -545,4 +553,23 @@ export class PmsKpiComponent {
scrollToMenu(id: string) { scrollToMenu(id: string) {
this.scrollToMenuId.emit(id); this.scrollToMenuId.emit(id);
} }
convertToNumber(value: any): number {
if (value === null || value === undefined) {
return 0;
}
// ถ้า value เป็น string ที่เป็นตัวเลขล้วน เช่น "123", "45.6"
if (typeof value === 'string' && !isNaN(Number(value.trim()))) {
return Number(value);
}
// ถ้าเป็น number อยู่แล้ว
if (typeof value === 'number') {
return value;
}
// ถ้าอย่างอื่นที่ไม่ใช่ตัวเลข
return 0;
}
} }
...@@ -234,7 +234,7 @@ export class NavService implements OnDestroy { ...@@ -234,7 +234,7 @@ export class NavService implements OnDestroy {
path: '', path: '',
id: 'm6', id: 'm6',
show: true, show: true,
icon: 'assets/img/icons-menu/com-self.png', icon: 'assets/img/icons-menu/Report.png',
children: [ children: [
{ id: 'm61', path: 'admin/report-com-1', title: 'รายงาน Competency 1', type: 'link', show: true }, { id: 'm61', path: 'admin/report-com-1', title: 'รายงาน Competency 1', type: 'link', show: true },
{ id: 'm62', path: 'admin/report-com-2', title: 'รายงาน Competency 2', type: 'link', show: true }, { id: 'm62', path: 'admin/report-com-2', title: 'รายงาน Competency 2', type: 'link', show: true },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment