Commit 264eccfb by Nattana Chaiyamat

หน้าประเมินตนเอง : การแสดงผลแจ้งเตือนผิดและทำการส่งต่อไม่ได้

parent 0ce3b3b9
......@@ -264,7 +264,7 @@
</div>
</div>
<div class="w-full"
*ngIf="(currentTap=='ประเมินผลการปฏิบัติงาน'||currentTap=='สรุปคะแนนและข้อเสนอแนะ')&&(evaluaterId!=evaluateeId||complete)">
*ngIf="findMenu('ประเมินผลการปฏิบัติงาน')&&(currentTap=='ประเมินผลการปฏิบัติงาน'||currentTap=='สรุปคะแนนและข้อเสนอแนะ')&&(evaluaterId!=evaluateeId||complete)">
<div class="box shadow-md hover:shadow-xl transition m-0" style="border-radius:20px">
<div class="box-header" [class.border-none]="menuClose.get('สรุปผลประเมิน')">
<div class="flex justify-between">
......@@ -333,7 +333,8 @@
</div>
</div>
</div>
<div class="w-full" *ngIf="(currentTap=='ประเมินผลการปฏิบัติงาน'||currentTap=='สรุปคะแนนและข้อเสนอแนะ')">
<div class="w-full"
*ngIf="findMenu('ประเมินผลการปฏิบัติงาน')&&(currentTap=='ประเมินผลการปฏิบัติงาน'||currentTap=='สรุปคะแนนและข้อเสนอแนะ')">
<div class="box shadow-md hover:shadow-xl transition m-0" style="border-radius:20px">
<div class="box-header" [class.border-none]="menuClose.get('สรุปผลประเมินตนเอง')">
<div class="flex justify-between">
......@@ -541,8 +542,7 @@
<div class="box shadow-md hover:shadow-xl transition m-0" style="border-radius:20px;">
<div class="box-header">
<div class="flex flex-row gap-2">
<ng-container
*ngFor="let item of ['ข้อมูลการประเมิน','แบบประเมินสมรรถนะ','ประเมินผลการปฏิบัติงาน','สรุปคะแนนและข้อเสนอแนะ','แผนพัฒนาบุคลากร']">
<ng-container *ngFor="let item of menuList">
<button type="button" class="flex-1 flex flex-row border bg-white p-2 justify-center"
style="border-radius:20px"
(click)="currentTap=item;(currentTap=='ประเมินผลการปฏิบัติงาน'||currentTap=='สรุปคะแนนและข้อเสนอแนะ'?currentPart='':null)"
......
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostListener, Input, Output, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { CompetencyModel } from 'src/app/shared/model/competency.model';
import { CompetencyModel, Pms } from 'src/app/shared/model/competency.model';
import { EmployeeModel, MyEmployeeModel } from 'src/app/shared/model/employee.model';
import { AppraisalService } from 'src/app/shared/services/appraisal.service';
import { EmployeeService } from 'src/app/shared/services/employee.service';
......@@ -75,6 +75,8 @@ export class PmsFormEmployeeComponent {
complete = false
@ViewChild('scrollContainer') scrollContainer!: ElementRef;
menuList: string[] = ['ข้อมูลการประเมิน', 'แบบประเมินสมรรถนะ', 'ประเมินผลการปฏิบัติงาน', 'สรุปคะแนนและข้อเสนอแนะ', 'แผนพัฒนาบุคลากร']
constructor(
private router: Router,
private employeeService: EmployeeService,
......@@ -86,6 +88,10 @@ export class PmsFormEmployeeComponent {
) {
}
findMenu(text: string) {
return this.menuList.find(e => e == text)
}
currentStepText = () => {
if (this.compentency.data) {
if (this.compentency.data.apsassessy.employeeId == this.evaluaterId) {
......@@ -322,6 +328,11 @@ export class PmsFormEmployeeComponent {
selectDataList(data: CompetencyModel) {
this.compentency.originalData = this.deepClone(data)
this.compentency.data = this.deepClone(data)
const checkMenu = Array.from({ length: 7 }, (_, i) => i + 1)
.filter(i => (this.compentency.data?.pms?.[`part${i}Detail` as keyof Pms] as any)?.length).length
if (!checkMenu) {
this.menuList.splice(2, 1)
}
this.complete = this.compentency.data?.statusType == 'complete'
this.cdr.detectChanges()
if (this.compentency.data) {
......
......@@ -29,7 +29,7 @@
<ng-container *ngFor="let item of partShow;let i=index">
<button type="button"
class="flex justify-center !items-center border bg-white p-1 text-center font-semibold"
(click)="scrollToMenu('menu-part-'+(i+8));currentPart=item;toggleAllParts(true,item)"
(click)="scrollToMenu('menu-part-'+(i+(data8List.length?8:9)));currentPart=item;toggleAllParts(true,item)"
style="border-radius:20px;width: 100px"
[ngClass]="{'!bg-primary text-white':currentPart==item}">
<span class="leading-none">{{ item }}</span>
......@@ -57,7 +57,9 @@
<ng-container *ngIf="appraisalPms?.part7Detail?.length then part7 else noData"></ng-container>
</ng-container>
<ng-container *ngIf="currentTap=='สรุปคะแนนและข้อเสนอแนะ'">
<ng-container *ngTemplateOutlet="part8"></ng-container>
<ng-container *ngIf="data8List.length">
<ng-container *ngTemplateOutlet="part8"></ng-container>
</ng-container>
<ng-container *ngTemplateOutlet="part9"></ng-container>
<ng-container *ngTemplateOutlet="part10"></ng-container>
</ng-container>
......
......@@ -138,31 +138,18 @@ export class PmsKpiComponent {
}
ngOnInit(): void {
this.partOpen.clear()
const menuList = Array.from({ length: 7 }, (_, i) => i + 1)
.filter(i => (this.appraisalPms?.[`part${i}Detail` as keyof Pms] as any)?.length)
.map(i => `PART ${i}`)
this.data8List = this.data8List.filter(e => menuList.some(e2 => e.id == +e2.replace('PART ', '')))
if (this.currentTap == 'ประเมินผลการปฏิบัติงาน') {
this.partShow = []
if (this.appraisalPms?.part1Detail?.length) {
this.partShow.push('PART 1')
}
if (this.appraisalPms?.part2Detail?.length) {
this.partShow.push('PART 2')
}
if (this.appraisalPms?.part3Detail?.length) {
this.partShow.push('PART 3')
}
if (this.appraisalPms?.part4Detail?.length) {
this.partShow.push('PART 4')
}
if (this.appraisalPms?.part5Detail?.length) {
this.partShow.push('PART 5')
}
if (this.appraisalPms?.part6Detail?.length) {
this.partShow.push('PART 6')
}
if (this.appraisalPms?.part7Detail?.length) {
this.partShow.push('PART 7')
}
this.partShow = menuList
} else {
this.partShow = ['PART 8', 'PART 9', 'PART 10']
if (this.data8List.length) {
this.partShow = ['PART 8', 'PART 9', 'PART 10']
} else {
this.partShow = ['PART 9', 'PART 10']
}
}
this.partShow.forEach(x => {
this.partOpen.set(x, false)
......@@ -175,31 +162,18 @@ export class PmsKpiComponent {
ngOnChanges(changes: SimpleChanges): void {
if (changes['currentTap']?.currentValue || changes['appraisalPms']?.currentValue) {
this.partOpen.clear()
const menuList = Array.from({ length: 7 }, (_, i) => i + 1)
.filter(i => (this.appraisalPms?.[`part${i}Detail` as keyof Pms] as any)?.length)
.map(i => `PART ${i}`)
this.data8List = this.data8List.filter(e => menuList.some(e2 => e.id == +e2.replace('PART ', '')))
if (this.currentTap == 'ประเมินผลการปฏิบัติงาน') {
this.partShow = []
if (this.appraisalPms?.part1Detail?.length) {
this.partShow.push('PART 1')
}
if (this.appraisalPms?.part2Detail?.length) {
this.partShow.push('PART 2')
}
if (this.appraisalPms?.part3Detail?.length) {
this.partShow.push('PART 3')
}
if (this.appraisalPms?.part4Detail?.length) {
this.partShow.push('PART 4')
}
if (this.appraisalPms?.part5Detail?.length) {
this.partShow.push('PART 5')
}
if (this.appraisalPms?.part6Detail?.length) {
this.partShow.push('PART 6')
}
if (this.appraisalPms?.part7Detail?.length) {
this.partShow.push('PART 7')
}
this.partShow = menuList
} else {
this.partShow = ['PART 8', 'PART 9', 'PART 10']
if (this.data8List.length) {
this.partShow = ['PART 8', 'PART 9', 'PART 10']
} else {
this.partShow = ['PART 9', 'PART 10']
}
}
this.partShow.forEach(x => {
this.partOpen.set(x, false)
......@@ -230,25 +204,25 @@ export class PmsKpiComponent {
x.factors = this.appraisalPms.part7Percentage
}
})
if (!this.appraisalPms?.part1Detail.length) {
if (!this.appraisalPms?.part1Detail) {
this.data8List = this.data8List.filter(item => item.id !== 1)
}
if (!this.appraisalPms?.part2Detail.length) {
if (!this.appraisalPms?.part2Detail) {
this.data8List = this.data8List.filter(item => item.id !== 2)
}
if (!this.appraisalPms?.part3Detail.length) {
if (!this.appraisalPms?.part3Detail) {
this.data8List = this.data8List.filter(item => item.id !== 3)
}
if (!this.appraisalPms?.part4Detail.length) {
if (!this.appraisalPms?.part4Detail) {
this.data8List = this.data8List.filter(item => item.id !== 4)
}
if (!this.appraisalPms?.part5Detail.length) {
if (!this.appraisalPms?.part5Detail) {
this.data8List = this.data8List.filter(item => item.id !== 5)
}
if (!this.appraisalPms?.part6Detail.length) {
if (!this.appraisalPms?.part6Detail) {
this.data8List = this.data8List.filter(item => item.id !== 6)
}
if (!this.appraisalPms?.part7Detail.length) {
if (!this.appraisalPms?.part7Detail) {
this.data8List = this.data8List.filter(item => item.id !== 7)
}
this.changePercentage()
......@@ -571,7 +545,7 @@ export class PmsKpiComponent {
}
part1Remain() {
if (this.appraisalPms?.part1Detail.length) {
if (this.appraisalPms?.part1Detail) {
const remain = this.appraisalPms.part1Detail.filter(x =>
x.scoreTopicExpectation == null && x.scoreTopicExpectationBoss == null
).length
......@@ -581,7 +555,7 @@ export class PmsKpiComponent {
}
part2Remain() {
if (this.appraisalPms?.part2Detail.length) {
if (this.appraisalPms?.part2Detail) {
const remain = this.appraisalPms.part2Detail.filter(x =>
x.scoreTopicExpectation == null && x.scoreTopicExpectationBoss == null
).length
......@@ -591,7 +565,7 @@ export class PmsKpiComponent {
}
part3Remain() {
if (this.appraisalPms?.part3Detail.length) {
if (this.appraisalPms?.part3Detail) {
const remain = this.appraisalPms.part3Detail.filter(x =>
x.scoreTopicExpectation == null && x.scoreTopicExpectationBoss == null
).length
......@@ -601,7 +575,7 @@ export class PmsKpiComponent {
}
part5Remain() {
if (this.appraisalPms?.part5Detail.length) {
if (this.appraisalPms?.part5Detail) {
const remain = this.appraisalPms.part5Detail.filter(x =>
x.pmsWorkingTimeScore == 0 && x.pmsWorkingTimeScoreBoss == 0
).length
......@@ -611,7 +585,7 @@ export class PmsKpiComponent {
}
part6Remain() {
if (this.appraisalPms?.part6Detail.length) {
if (this.appraisalPms?.part6Detail) {
const remain = this.appraisalPms.part6Detail.filter(x =>
x.scoreTopicExpectation == null && x.scoreTopicExpectationBoss == null
).length
......@@ -621,7 +595,7 @@ export class PmsKpiComponent {
}
part7Remain() {
if (this.appraisalPms?.part7Detail.length) {
if (this.appraisalPms?.part7Detail) {
const remain = this.appraisalPms.part7Detail.filter(x =>
x.scoreTopicExpectation == null && x.scoreTopicExpectationBoss == null
).length
......@@ -630,28 +604,42 @@ export class PmsKpiComponent {
return 0
}
allFormRemain() {
const remain = [this.part1Remain(), this.part2Remain(), this.part3Remain(), this.compentencyFormRemain, this.part5Remain(), this.part6Remain(), this.part7Remain()].filter(data => data != 0).length
const parts = [
{ detail: this.appraisalPms?.part1Detail, fn: () => this.part1Remain() },
{ detail: this.appraisalPms?.part2Detail, fn: () => this.part2Remain() },
{ detail: this.appraisalPms?.part3Detail, fn: () => this.part3Remain() },
{ detail: this.appraisalPms?.part4Detail, fn: () => this.compentencyFormRemain },
{ detail: this.appraisalPms?.part5Detail, fn: () => this.part5Remain() },
{ detail: this.appraisalPms?.part6Detail, fn: () => this.part6Remain() },
{ detail: this.appraisalPms?.part7Detail, fn: () => this.part7Remain() },
]
const remainList = parts.filter(p => p.detail?.length).map(p => p.fn())
const remain = remainList.filter(data => data != 0).length
this.kpiForm.emit(this.appraisalPms)
this.kpiFormRemain.emit(remain)
}
remainList() {
return [
this.part1Remain(),
this.part2Remain(),
this.part3Remain(),
this.compentencyFormRemain,
this.part5Remain(),
this.part6Remain(),
this.part7Remain()
];
const remainMap: Record<string, () => number> = {
'PART 1': () => this.part1Remain(),
'PART 2': () => this.part2Remain(),
'PART 3': () => this.part3Remain(),
'PART 4': () => this.compentencyFormRemain,
'PART 5': () => this.part5Remain(),
'PART 6': () => this.part6Remain(),
'PART 7': () => this.part7Remain(),
}
const remain = this.partShow.map(part => remainMap[part]?.() ?? 0)
return remain
}
sendScorePart() {
if (this.appraisalPms) {
const gradeScore = this.groupGrade.dataList.find(item => Math.ceil(+this.calNetScoreBoss()) >= item.gradeMinScore && Math.ceil(+this.calNetScoreBoss()) <= item.gradeMaxScore);
const scoreBoss = this.data8List.map((x, i) => ({ text: this.partShow[i], score: this.numberFixed2(x.netScoreBoss) })).concat([{ text: "สุทธิ", score: this.calNetScoreBoss() + '' }, { text: "Grade", score: gradeScore?.gradeDetail || '' }])
const score = this.data8List.map((x, i) => ({ text: this.partShow[i], score: this.numberFixed2(x.netScore) })).concat([{ text: "สุทธิ", score: this.calNetScore() + '' }, { text: "Grade", score: gradeScore?.gradeDetail || '' }])
const scoreBoss = this.data8List.map((x, i) => ({ text: x.evaluationFactor.match(/Part\s*\d+/)?.[0].toUpperCase(), score: this.numberFixed2(x.netScoreBoss) }))
.concat([{ text: "สุทธิ", score: this.calNetScoreBoss() + '' }, { text: "Grade", score: gradeScore?.gradeDetail || '' }])
const score = this.data8List.map((x, i) => ({ text: x.evaluationFactor.match(/Part\s*\d+/)?.[0].toUpperCase(), score: this.numberFixed2(x.netScore) }))
.concat([{ text: "สุทธิ", score: this.calNetScore() + '' }, { text: "Grade", score: gradeScore?.gradeDetail || '' }])
this.scorePartBoss.emit(scoreBoss)
this.scorePart.emit(score)
}
......
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