Commit 0dadc073 by Nattana Chaiyamat

ใส่ filter ตาราง ในหน้า ประเมินโดยหัวหน้า

เพิ่ม part8
parent 1d055b48
...@@ -253,6 +253,7 @@ export class DatagridSyncfutionComponent implements OnInit { ...@@ -253,6 +253,7 @@ export class DatagridSyncfutionComponent implements OnInit {
} }
} }
} }
filterData(text: string, fields: string[]): any[] { filterData(text: string, fields: string[]): any[] {
return this.dataSource.filter(item => { return this.dataSource.filter(item => {
return fields.some(field => { return fields.some(field => {
......
...@@ -1319,7 +1319,10 @@ ...@@ -1319,7 +1319,10 @@
<th scope="col">การประเมินผล</th> <th scope="col">การประเมินผล</th>
<th scope="col">คะแนนดิบคิดเป็นร้อยละ</th> <th scope="col">คะแนนดิบคิดเป็นร้อยละ</th>
<th scope="col">ร้อยละของปัจจัย</th> <th scope="col">ร้อยละของปัจจัย</th>
<th scope="col">คะแนนที่ได้คิดเป็นร้อยละ</th> <th scope="col" *ngIf="evaluaterId!=evaluateeId||currentStep != '0'">
คะแนนลูกน้องคิดเป็นร้อยละ</th>
<th scope="col">คะแนนคิดเป็นร้อยละ</th>
<th scope="col" *ngIf="evaluaterId!=evaluateeId||currentStep != '0'">คะแนนสุทธิลูกน้อง</th>
<th scope="col">คะแนนสุทธิ</th> <th scope="col">คะแนนสุทธิ</th>
</tr> </tr>
</thead> </thead>
...@@ -1337,27 +1340,41 @@ ...@@ -1337,27 +1340,41 @@
<td class="py-2 text-center" style="vertical-align: top"> <td class="py-2 text-center" style="vertical-align: top">
{{item.factors}} {{item.factors}}
</td> </td>
<td *ngIf="evaluaterId!=evaluateeId||currentStep != '0'" class="py-2 text-center"
style="vertical-align: top">
{{numberFixed2(item.scoreObtainedEmp)}}
</td>
<td class="py-2 text-center" style="vertical-align: top"> <td class="py-2 text-center" style="vertical-align: top">
{{numberFixed2(item.scoreObtained)}} {{numberFixed2(item.scoreObtained)}}
</td> </td>
<td *ngIf="evaluaterId!=evaluateeId||currentStep != '0'" class="py-2 text-center"
style="vertical-align: top">
{{numberFixed2(item.netScoreEmp)}}
</td>
<td class="py-2 text-center" style="vertical-align: top"> <td class="py-2 text-center" style="vertical-align: top">
{{numberFixed2(item.netScore)}} {{numberFixed2(item.netScore)}}
</td> </td>
</tr> </tr>
</ng-container> </ng-container>
<tr class="bg-table-soft-gray" style="height:35px"> <tr class="bg-table-soft-gray" style="height:35px">
<td class="align-start text-center font-semibold"> <td class="py-2 align-start text-center font-semibold">
รวม รวม
</td> </td>
<td class="align-start text-center"> <td class="py-2 align-start text-center">
</td> </td>
<td class="align-start text-center font-semibold text-indigo-600"> <td class="py-2 align-start text-center font-semibold text-indigo-600">
{{calFactors()}} {{calFactors()}}
</td> </td>
<td class="align-start text-center font-semibold text-indigo-600"> <td *ngIf="evaluaterId!=evaluateeId||currentStep != '0'" class="py-2 align-start text-center font-semibold text-indigo-600">
{{calScoreObtainedEmp()}}
</td>
<td class="py-2 align-start text-center font-semibold text-indigo-600">
{{calScoreObtained()}} {{calScoreObtained()}}
</td> </td>
<td class="align-start text-center font-semibold text-indigo-600"> <td *ngIf="evaluaterId!=evaluateeId||currentStep != '0'" class="py-2 align-start text-center font-semibold text-indigo-600">
{{calNetScoreEmp()}}
</td>
<td class="py-2 align-start text-center font-semibold text-indigo-600">
{{calNetScore()}} {{calNetScore()}}
</td> </td>
</tr> </tr>
......
...@@ -12,7 +12,9 @@ export interface Part8Model { ...@@ -12,7 +12,9 @@ export interface Part8Model {
rawScore: number, rawScore: number,
factors: number factors: number
scoreObtained: number scoreObtained: number
scoreObtainedEmp: number
netScore: number netScore: number
netScoreEmp: number
} }
export interface LevelStarModel { export interface LevelStarModel {
evaluationFactor: string, evaluationFactor: string,
...@@ -36,6 +38,8 @@ export class PmsKpiComponent { ...@@ -36,6 +38,8 @@ export class PmsKpiComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 2, id: 2,
evaluationFactor: "Part 2 : ประเมินผลการปฏิบัติงานประจำ (Department KPI)", evaluationFactor: "Part 2 : ประเมินผลการปฏิบัติงานประจำ (Department KPI)",
...@@ -43,6 +47,8 @@ export class PmsKpiComponent { ...@@ -43,6 +47,8 @@ export class PmsKpiComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 3, id: 3,
evaluationFactor: "Part 3 : ประเมินผลการปฏิบัติงานประจำ (Individual KPI)", evaluationFactor: "Part 3 : ประเมินผลการปฏิบัติงานประจำ (Individual KPI)",
...@@ -50,6 +56,8 @@ export class PmsKpiComponent { ...@@ -50,6 +56,8 @@ export class PmsKpiComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 4, id: 4,
evaluationFactor: "Part 4 : ประเมินผลสมรรถนะที่สนับสนุนการปฏิบัติงาน (Competency)", evaluationFactor: "Part 4 : ประเมินผลสมรรถนะที่สนับสนุนการปฏิบัติงาน (Competency)",
...@@ -57,6 +65,8 @@ export class PmsKpiComponent { ...@@ -57,6 +65,8 @@ export class PmsKpiComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 5, id: 5,
evaluationFactor: "Part 5 : อัตราการเข้างาน (Time Attendance)", evaluationFactor: "Part 5 : อัตราการเข้างาน (Time Attendance)",
...@@ -64,6 +74,8 @@ export class PmsKpiComponent { ...@@ -64,6 +74,8 @@ export class PmsKpiComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 6, id: 6,
evaluationFactor: "Part 6 : งานที่ได้รับมอบหมายเพิ่มเติม (Cross Functional Project Assignment)", evaluationFactor: "Part 6 : งานที่ได้รับมอบหมายเพิ่มเติม (Cross Functional Project Assignment)",
...@@ -71,6 +83,8 @@ export class PmsKpiComponent { ...@@ -71,6 +83,8 @@ export class PmsKpiComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 7, id: 7,
evaluationFactor: "Part 7 : กิจกรรมพิเศษ (Special Activities)", evaluationFactor: "Part 7 : กิจกรรมพิเศษ (Special Activities)",
...@@ -78,6 +92,8 @@ export class PmsKpiComponent { ...@@ -78,6 +92,8 @@ export class PmsKpiComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}] }]
partShow: string[] = [] partShow: string[] = []
partOpen: Map<string, boolean> = new Map<string, boolean>() partOpen: Map<string, boolean> = new Map<string, boolean>()
...@@ -271,41 +287,56 @@ export class PmsKpiComponent { ...@@ -271,41 +287,56 @@ export class PmsKpiComponent {
changePercentage() { changePercentage() {
this.data8List.forEach(x => { this.data8List.forEach(x => {
if (x.id == 1 && this.appraisalPms?.part1Detail) { if (x.id == 1 && this.appraisalPms?.part1Detail) {
x.scoreObtainedEmp = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part1Detail), this.calRawScore(this.appraisalPms?.part1Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part1Detail), this.calRawScore(this.appraisalPms?.part1Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part1Detail), this.calRawScore(this.appraisalPms?.part1Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part1SumScoreEmp = x.scoreObtainedEmp
this.appraisalPms.part1SumScore = x.scoreObtained this.appraisalPms.part1SumScore = x.scoreObtained
} }
} else if (x.id == 2 && this.appraisalPms?.part2Detail) { } else if (x.id == 2 && this.appraisalPms?.part2Detail) {
x.scoreObtainedEmp = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part2Detail), this.calRawScore(this.appraisalPms?.part2Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part2Detail), this.calRawScore(this.appraisalPms?.part2Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part2Detail), this.calRawScore(this.appraisalPms?.part2Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part2SumScoreEmp = x.scoreObtainedEmp
this.appraisalPms.part2SumScore = x.scoreObtained this.appraisalPms.part2SumScore = x.scoreObtained
} }
} else if (x.id == 3 && this.appraisalPms?.part3Detail) { } else if (x.id == 3 && this.appraisalPms?.part3Detail) {
x.scoreObtainedEmp = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part3Detail), this.calRawScore(this.appraisalPms?.part3Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part3Detail), this.calRawScore(this.appraisalPms?.part3Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part3Detail), this.calRawScore(this.appraisalPms?.part3Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part3SumScoreEmp = x.scoreObtainedEmp
this.appraisalPms.part3SumScore = x.scoreObtained this.appraisalPms.part3SumScore = x.scoreObtained
} }
} else if (x.id == 4 && this.appraisalPms?.part4Detail) { } else if (x.id == 4 && this.appraisalPms?.part4Detail) {
x.scoreObtainedEmp = +this.calPercentage(this.calExpectationTotalScoreBossPart4(this.appraisalPms?.part4Detail), this.calRawScorePart4(this.appraisalPms?.part4Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBossPart4(this.appraisalPms?.part4Detail), this.calRawScorePart4(this.appraisalPms?.part4Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBossPart4(this.appraisalPms?.part4Detail), this.calRawScorePart4(this.appraisalPms?.part4Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part4SumScoreEmp = x.scoreObtainedEmp
this.appraisalPms.part4SumScore = x.scoreObtained this.appraisalPms.part4SumScore = x.scoreObtained
} }
} else if (x.id == 5 && this.appraisalPms?.part5Detail) { } else if (x.id == 5 && this.appraisalPms?.part5Detail) {
x.scoreObtainedEmp = +this.calPercentage(this.calExpectationTotalScorePart5(this.appraisalPms?.part5Detail), this.calRawScorePart5(this.appraisalPms?.part5Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBossPart5(this.appraisalPms?.part5Detail), this.calRawScorePart5(this.appraisalPms?.part5Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBossPart5(this.appraisalPms?.part5Detail), this.calRawScorePart5(this.appraisalPms?.part5Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part5SumScoreEmp = x.scoreObtainedEmp
this.appraisalPms.part5SumScore = x.scoreObtained this.appraisalPms.part5SumScore = x.scoreObtained
} }
} else if (x.id == 6 && this.appraisalPms?.part6Detail) { } else if (x.id == 6 && this.appraisalPms?.part6Detail) {
x.scoreObtainedEmp = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part6Detail), this.calRawScore(this.appraisalPms?.part6Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part6Detail), this.calRawScore(this.appraisalPms?.part6Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part6Detail), this.calRawScore(this.appraisalPms?.part6Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part6SumScoreEmp = x.scoreObtainedEmp
this.appraisalPms.part6SumScore = x.scoreObtained this.appraisalPms.part6SumScore = x.scoreObtained
} }
} else if (x.id == 7 && this.appraisalPms?.part7Detail) { } else if (x.id == 7 && this.appraisalPms?.part7Detail) {
x.scoreObtainedEmp = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part7Detail), this.calRawScore(this.appraisalPms?.part7Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part7Detail), this.calRawScore(this.appraisalPms?.part7Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part7Detail), this.calRawScore(this.appraisalPms?.part7Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part7SumScoreEmp = x.scoreObtainedEmp
this.appraisalPms.part7SumScore = x.scoreObtained this.appraisalPms.part7SumScore = x.scoreObtained
} }
} }
x.netScoreEmp = x.factors / 100 * x.scoreObtainedEmp
x.netScore = x.factors / 100 * x.scoreObtained x.netScore = x.factors / 100 * x.scoreObtained
}) })
this.setGradeScore() this.setGradeScore()
...@@ -320,6 +351,16 @@ export class PmsKpiComponent { ...@@ -320,6 +351,16 @@ export class PmsKpiComponent {
calFactors() { calFactors() {
return this.data8List.reduce((sum: number, item: any) => sum + item.factors, 0).toFixed(2); return this.data8List.reduce((sum: number, item: any) => sum + item.factors, 0).toFixed(2);
} }
calScoreObtainedEmp() {
return this.data8List.reduce((sum: number, item: any) => sum + item.scoreObtainedEmp, 0).toFixed(2);
}
calNetScoreEmp() {
if (this.appraisalPms) {
this.appraisalPms.netScoreEmp = +(this.data8List.reduce((sum: number, item: any) => sum + item.netScoreEmp, 0).toFixed(2));
return this.appraisalPms.netScoreEmp
}
return "0.00"
}
calScoreObtained() { calScoreObtained() {
return this.data8List.reduce((sum: number, item: any) => sum + item.scoreObtained, 0).toFixed(2); return this.data8List.reduce((sum: number, item: any) => sum + item.scoreObtained, 0).toFixed(2);
} }
......
...@@ -12,7 +12,9 @@ export interface Part8Model { ...@@ -12,7 +12,9 @@ export interface Part8Model {
rawScore: number, rawScore: number,
factors: number factors: number
scoreObtained: number scoreObtained: number
scoreObtainedEmp: number
netScore: number netScore: number
netScoreEmp: number
} }
export interface LevelStarModel { export interface LevelStarModel {
evaluationFactor: string, evaluationFactor: string,
...@@ -41,7 +43,9 @@ export class PmsSummaryComponent { ...@@ -41,7 +43,9 @@ export class PmsSummaryComponent {
rawScore: 100, rawScore: 100,
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
scoreObtainedEmp: 0,
netScore: 0, netScore: 0,
netScoreEmp: 0,
}, { }, {
id: 2, id: 2,
evaluationFactor: "Part 2 : ประเมินผลการปฏิบัติงานประจำ (Department KPI)", evaluationFactor: "Part 2 : ประเมินผลการปฏิบัติงานประจำ (Department KPI)",
...@@ -49,6 +53,8 @@ export class PmsSummaryComponent { ...@@ -49,6 +53,8 @@ export class PmsSummaryComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 3, id: 3,
evaluationFactor: "Part 3 : ประเมินผลการปฏิบัติงานประจำ (Individual KPI)", evaluationFactor: "Part 3 : ประเมินผลการปฏิบัติงานประจำ (Individual KPI)",
...@@ -56,6 +62,8 @@ export class PmsSummaryComponent { ...@@ -56,6 +62,8 @@ export class PmsSummaryComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 4, id: 4,
evaluationFactor: "Part 4 : ประเมินผลสมรรถนะที่สนับสนุนการปฏิบัติงาน (Competency)", evaluationFactor: "Part 4 : ประเมินผลสมรรถนะที่สนับสนุนการปฏิบัติงาน (Competency)",
...@@ -63,6 +71,8 @@ export class PmsSummaryComponent { ...@@ -63,6 +71,8 @@ export class PmsSummaryComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 5, id: 5,
evaluationFactor: "Part 5 : อัตราการเข้างาน (Time Attendance)", evaluationFactor: "Part 5 : อัตราการเข้างาน (Time Attendance)",
...@@ -70,6 +80,8 @@ export class PmsSummaryComponent { ...@@ -70,6 +80,8 @@ export class PmsSummaryComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 6, id: 6,
evaluationFactor: "Part 6 : งานที่ได้รับมอบหมายเพิ่มเติม (Cross Functional Project Assignment)", evaluationFactor: "Part 6 : งานที่ได้รับมอบหมายเพิ่มเติม (Cross Functional Project Assignment)",
...@@ -77,6 +89,8 @@ export class PmsSummaryComponent { ...@@ -77,6 +89,8 @@ export class PmsSummaryComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}, { }, {
id: 7, id: 7,
evaluationFactor: "Part 7 : กิจกรรมพิเศษ (Special Activities)", evaluationFactor: "Part 7 : กิจกรรมพิเศษ (Special Activities)",
...@@ -84,6 +98,8 @@ export class PmsSummaryComponent { ...@@ -84,6 +98,8 @@ export class PmsSummaryComponent {
factors: 0, factors: 0,
scoreObtained: 0, scoreObtained: 0,
netScore: 0, netScore: 0,
scoreObtainedEmp: 0,
netScoreEmp: 0,
}] }]
part9show = true part9show = true
part10show = true part10show = true
...@@ -229,6 +245,12 @@ export class PmsSummaryComponent { ...@@ -229,6 +245,12 @@ export class PmsSummaryComponent {
} }
return "0.00" return "0.00"
} }
calExpectationTotalScoreEmp(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + (item.scoreTopicExpectation * item.weight), 0).toFixed(2);
}
return "0.00"
}
calPercentage(A: number, B: number) { calPercentage(A: number, B: number) {
if (B > 0) { if (B > 0) {
return ((A / B) * 100).toFixed(2); return ((A / B) * 100).toFixed(2);
...@@ -239,41 +261,56 @@ export class PmsSummaryComponent { ...@@ -239,41 +261,56 @@ export class PmsSummaryComponent {
this.data8List.forEach(x => { this.data8List.forEach(x => {
if (x.id == 1 && this.appraisalPms?.part1Detail) { if (x.id == 1 && this.appraisalPms?.part1Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part1Detail), this.calRawScore(this.appraisalPms?.part1Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part1Detail), this.calRawScore(this.appraisalPms?.part1Detail))
x.scoreObtainedEmp = +this.calPercentage(this.calExpectationTotalScoreEmp(this.appraisalPms?.part1Detail), this.calRawScore(this.appraisalPms?.part1Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part1SumScore = x.scoreObtained this.appraisalPms.part1SumScore = x.scoreObtained
this.appraisalPms.part1SumScoreEmp = x.scoreObtainedEmp
} }
} else if (x.id == 2 && this.appraisalPms?.part2Detail) { } else if (x.id == 2 && this.appraisalPms?.part2Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part2Detail), this.calRawScore(this.appraisalPms?.part2Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part2Detail), this.calRawScore(this.appraisalPms?.part2Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part2Detail), this.calRawScore(this.appraisalPms?.part2Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part2SumScore = x.scoreObtained this.appraisalPms.part2SumScore = x.scoreObtained
this.appraisalPms.part2SumScoreEmp = x.scoreObtainedEmp
} }
} else if (x.id == 3 && this.appraisalPms?.part3Detail) { } else if (x.id == 3 && this.appraisalPms?.part3Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part3Detail), this.calRawScore(this.appraisalPms?.part3Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part3Detail), this.calRawScore(this.appraisalPms?.part3Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part3Detail), this.calRawScore(this.appraisalPms?.part3Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part3SumScore = x.scoreObtained this.appraisalPms.part3SumScore = x.scoreObtained
this.appraisalPms.part3SumScoreEmp = x.scoreObtainedEmp
} }
} else if (x.id == 4 && this.appraisalPms?.part4Detail) { } else if (x.id == 4 && this.appraisalPms?.part4Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart4(this.appraisalPms?.part4Detail), this.calRawScorePart4(this.appraisalPms?.part4Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart4(this.appraisalPms?.part4Detail), this.calRawScorePart4(this.appraisalPms?.part4Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart4(this.appraisalPms?.part4Detail), this.calRawScorePart4(this.appraisalPms?.part4Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part4SumScore = x.scoreObtained this.appraisalPms.part4SumScore = x.scoreObtained
this.appraisalPms.part4SumScoreEmp = x.scoreObtainedEmp
} }
} else if (x.id == 5 && this.appraisalPms?.part5Detail) { } else if (x.id == 5 && this.appraisalPms?.part5Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart5(this.appraisalPms?.part5Detail), this.calRawScorePart5(this.appraisalPms?.part5Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart5(this.appraisalPms?.part5Detail), this.calRawScorePart5(this.appraisalPms?.part5Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart5(this.appraisalPms?.part5Detail), this.calRawScorePart5(this.appraisalPms?.part5Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part5SumScore = x.scoreObtained this.appraisalPms.part5SumScore = x.scoreObtained
this.appraisalPms.part5SumScoreEmp = x.scoreObtainedEmp
} }
} else if (x.id == 6 && this.appraisalPms?.part6Detail) { } else if (x.id == 6 && this.appraisalPms?.part6Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part6Detail), this.calRawScore(this.appraisalPms?.part6Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part6Detail), this.calRawScore(this.appraisalPms?.part6Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part6Detail), this.calRawScore(this.appraisalPms?.part6Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part6SumScore = x.scoreObtained this.appraisalPms.part6SumScore = x.scoreObtained
this.appraisalPms.part6SumScoreEmp = x.scoreObtainedEmp
} }
} else if (x.id == 7 && this.appraisalPms?.part7Detail) { } else if (x.id == 7 && this.appraisalPms?.part7Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part7Detail), this.calRawScore(this.appraisalPms?.part7Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part7Detail), this.calRawScore(this.appraisalPms?.part7Detail))
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part7Detail), this.calRawScore(this.appraisalPms?.part7Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part7SumScore = x.scoreObtained this.appraisalPms.part7SumScore = x.scoreObtained
this.appraisalPms.part7SumScoreEmp = x.scoreObtainedEmp
} }
} }
x.netScore = x.factors / 100 * x.scoreObtained x.netScore = x.factors / 100 * x.scoreObtained
x.netScoreEmp = x.factors / 100 * x.scoreObtainedEmp
}) })
this.setGradeScore() this.setGradeScore()
} }
......
...@@ -149,13 +149,13 @@ ...@@ -149,13 +149,13 @@
{{selectEmp.size-1 < 0 ? 0 : selectEmp.size-1}} Selected</label> {{selectEmp.size-1 < 0 ? 0 : selectEmp.size-1}} Selected</label>
</div> </div>
<div class="mx-1 flex items-center"> <div class="mx-1 flex items-center">
<button id='check-boxall' (click)="toggleSelectAll()" <button (click)="toggleSelectAll()"
class="focus:ring-2 focus:ring-primary rounded-sm flex item-center"> class="focus:ring-2 focus:ring-primary rounded-sm flex item-center">
<i class="fs-l transition-all duration-200" <i class="fs-l transition-all duration-200"
[ngClass]="{'ri-checkbox-multiple-line text-gray-500': !selectEmp.get('selectAll'), 'ri-checkbox-multiple-fill text-primary': selectEmp.get('selectAll')}"></i> [ngClass]="{'ri-checkbox-multiple-line text-gray-500': !selectEmp.get('selectAll'), 'ri-checkbox-multiple-fill text-primary': selectEmp.get('selectAll')}"></i>
</button> </button>
<label class="text-sm text-gray-500 ml-2 cursor-pointer" for="check-boxall" <label (click)="toggleSelectAll()"
(click)="toggleSelectAll()">Select All</label> class="text-sm text-gray-500 ml-2 cursor-pointer">Select All</label>
</div> </div>
</div> </div>
</div> </div>
...@@ -170,7 +170,8 @@ ...@@ -170,7 +170,8 @@
<div class="px-1"> <div class="px-1">
<div class="relative shadow-md"> <div class="relative shadow-md">
<input type="text" class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " <input type="text" class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder="Search by No. or Name" [(ngModel)]="search"> placeholder="Search by No. or Name" [(ngModel)]="search"
(ngModelChange)="searchDataGrid(search)">
<div <div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"> class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i> <i class="ri-search-line text-gray"></i>
...@@ -179,164 +180,131 @@ ...@@ -179,164 +180,131 @@
</div> </div>
</div> </div>
</div> </div>
<div class="flex flex-col w-100"> <ng-container *ngIf="syncfution.columns.length && syncfution.dataList.length">
<div class="overflow-auto rounded-t-md"> <div class="mb-4">
<div id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1"> <ng-container *ngTemplateOutlet="Datagrid"></ng-container>
<div class="overflow-auto shadow-md"> </div>
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
<thead>
<tr>
<ng-container
*ngFor="let item of subordinate.select?.showPms?['รหัสพนักงาน','ชื่อพนักงาน','ตำเเหน่งงาน','ประเมิน','ผลประเมิน','เกรด' ,'สถานะผู้ประเมิน']:
['รหัสพนักงาน','ชื่อพนักงาน','ตำเเหน่งงาน','ประเมิน','เเผนพัฒนา','สถานะผู้ประเมิน']; let f = first; let l = last; let i = index">
<th scope="col"
class="relative px-10px py-10px bg-soft-secondary text-primary !text-center"
[ngClass]="{'!p-0':f, '!pl-0':i==1}" [colSpan]="f?2:1">
<span class="text-sm">{{ item }}</span>
<div *ngIf="!l"
class="absolute top-1/2 transform -translate-y-1/2 right-0">
<svg class="head-table-icon"
xmlns="http://www.w3.org/2000/svg" width="50"
height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
</path>
</svg>
</div>
</th>
</ng-container> </ng-container>
</tr> </div>
</thead> </div>
<tbody *ngIf="subordinate.loading">
<tr> </div>
<td class="text-center" colspan="100%"> </div>
<div *ngFor="let item of [1,2,3]" </div>
class="ti-spinner w-8 h-8 text-secondary mx-1" role="status" <ng-container *ngIf="pageEvalution!=''">
aria-label="loading"> <app-pms-form-employee [evaluationForm]="'sup'" [currentTap]="'ข้อมูลการประเมิน'"
<span class="sr-only">Loading...</span> (sendReturnPath)="pageEvalution='';getBossList() ; pathTitle = ['การประเมินผล', 'ประเมินโดยหัวหน้า']"
</div> [evaluaterId]="formEvaluation.evaluaterId" [evaluateeId]="formEvaluation.evaluateeId"></app-pms-form-employee>
</td> </ng-container>
</tr>
</tbody>
<tbody *ngIf="!subordinate.loading&&!subordinateFilter().length">
<tr> <ng-template #Datagrid>
<td class="text-center" colspan="100%"> <ejs-grid #grid id='Grid' [dataSource]="dataSourceSearch" [allowFiltering]="true" [filterSettings]="filterSettings"
ไม่พบข้อมูล [selectionSettings]="selectionOptions" [searchSettings]="syncfution.searchSettings"
</td> [groupSettings]="groupSettings" [toolbar]="toolbarOptions" [editSettings]="editSettings"
</tr> [loadingIndicator]='loadingIndicator' [query]="query" [columnMenuItems]="columnMenuItems"
</tbody> [pageSettings]="initialPage" [allowMultiSorting]="true" [allowPaging]="true" [allowGrouping]="true"
<tbody *ngIf="!subordinate.loading&&subordinateFilter().length"> [allowSorting]="true" [showColumnMenu]="true" [allowPdfExport]="true" [allowExcelExport]="true"
<tr *ngFor="let item of subordinateFilter();let i = index"> [allowReordering]="true" width="auto" rowHeight="60" allowEditing="false"
<td class="text-center !pr-0" (actionComplete)="actionComplete($event)" (columnMenuClick)="onColumnMenuClick($event)"
style="font-size: 12px;width: 90px;;min-width: 90px;max-width: 90px;"> (toolbarClick)='toolbarClick($event)'>
<e-columns>
<ng-container *ngFor="let col of syncfution.columns">
<ng-container *ngIf="col.headerText">
<e-column [field]="col.field" [headerText]="col.headerText" [width]="col.width"
[format]="col.format" [isPrimaryKey]="col.isPrimaryKey" [validationRules]="col.validationRules"
[visible]="col.visible" [editType]="false" [allowEditing]="false" [allowFiltering]="true"
[allowSorting]="true" [type]="col.type" textAlign="center">
<ng-template #headerTemplate let-data>
<span class="font-size-12px font-weight-700 text-primary">{{ col.headerText }}</span>
</ng-template>
<ng-template #template let-data *ngIf="col.headerText=='รหัสพนักงาน'">
<div class="flex-col gap-2"> <div class="flex-col gap-2">
<input <input
[disabled]="!(item.apsapproveType.code!='Apsapprove1'&&(item.masfromStatusType.code=='evaluating'||item.masfromStatusType.code=='pending'))" [disabled]="!(data.apsapproveType.code!='Apsapprove1'&&(data.masfromStatusType.code=='evaluating'||data.masfromStatusType.code=='pending'))"
[class.cursor-not-allowed]="!(item.apsapproveType.code!='Apsapprove1'&&(item.masfromStatusType.code=='evaluating'||item.masfromStatusType.code=='pending'))" [class.cursor-not-allowed]="!(data.apsapproveType.code!='Apsapprove1'&&(data.masfromStatusType.code=='evaluating'||data.masfromStatusType.code=='pending'))"
[class.accent-gray-400]="!(item.apsapproveType.code!='Apsapprove1'&&(item.masfromStatusType.code=='evaluating'||item.masfromStatusType.code=='pending'))" [class.accent-gray-400]="!(data.apsapproveType.code!='Apsapprove1'&&(data.masfromStatusType.code=='evaluating'||data.masfromStatusType.code=='pending'))"
[class.opacity-50]="!(item.apsapproveType.code!='Apsapprove1'&&(item.masfromStatusType.code=='evaluating'||item.masfromStatusType.code=='pending'))" [class.opacity-50]="!(data.apsapproveType.code!='Apsapprove1'&&(data.masfromStatusType.code=='evaluating'||data.masfromStatusType.code=='pending'))"
type="checkbox" class="ti-form-checkbox cursor-pointer" type="checkbox" class="ti-form-checkbox cursor-pointer"
[checked]="selectEmp.get(item.apsassessy.employeeId)" [checked]="selectEmp.get(data.apsassessy.employeeId)"
(click)="!selectEmp.get(item.apsassessy.employeeId)?selectEmp.set(item.apsassessy.employeeId , true):selectEmp.delete(item.apsassessy.employeeId);checkSelectAll()"> (click)="!selectEmp.get(data.apsassessy.employeeId)?selectEmp.set(data.apsassessy.employeeId , true):selectEmp.delete(data.apsassessy.employeeId);checkSelectAll()">
&nbsp; &nbsp;
<ng-container <ng-container
*ngIf="item.apsapproveType.code!='Apsapprove1'&&(item.masfromStatusType.code=='evaluating'||item.masfromStatusType.code=='pending')"> *ngIf="data.apsapproveType.code!='Apsapprove1'&&(data.masfromStatusType.code=='evaluating'||data.masfromStatusType.code=='pending')">
<img (click)="!selectEmp.get(item.apsassessy.employeeId)?selectEmp.set(item.apsassessy.employeeId , true):selectEmp.delete(item.apsassessy.employeeId);checkSelectAll()" <img (click)="!selectEmp.get(data.apsassessy.employeeId)?selectEmp.set(data.apsassessy.employeeId , true):selectEmp.delete(data.apsassessy.employeeId);checkSelectAll()"
class="cursor-pointer avatar shadow-none rounded-full !ring-transparent object-cover h-12 w-12" class="cursor-pointer avatar shadow-none rounded-full !ring-transparent object-cover h-12 w-12"
[src]="item.apsassessy.picture?getImg(item.apsassessy.picture):'./assets/img/users/defaultperson.jpg'" [src]="data.apsassessy.picture?getImg(data.apsassessy.picture):'./assets/img/users/defaultperson.jpg'"
(error)="onImageError($event)"> (error)="onImageError($event)">
<span class="cursor-pointer"
(click)="!selectEmp.get(data.apsassessy.employeeId)?selectEmp.set(data.apsassessy.employeeId , true):selectEmp.delete(data.apsassessy.employeeId);checkSelectAll()">
{{data.apsassessy.employeeId}}
</span>
</ng-container> </ng-container>
<ng-container <ng-container
*ngIf="!(item.apsapproveType.code!='Apsapprove1'&&(item.masfromStatusType.code=='evaluating'||item.masfromStatusType.code=='pending'))"> *ngIf="!(data.apsapproveType.code!='Apsapprove1'&&(data.masfromStatusType.code=='evaluating'||data.masfromStatusType.code=='pending'))">
<img class="cursor-pointer avatar shadow-none rounded-full !ring-transparent object-cover h-12 w-12" <img class=" avatar shadow-none rounded-full !ring-transparent object-cover h-12 w-12"
[src]="item.apsassessy.picture?getImg(item.apsassessy.picture):'./assets/img/users/defaultperson.jpg'" [src]="data.apsassessy.picture?getImg(data.apsassessy.picture):'./assets/img/users/defaultperson.jpg'"
(error)="onImageError($event)"> (error)="onImageError($event)">
{{data.apsassessy.employeeId}}
</ng-container> </ng-container>
</div> </div>
</td> </ng-template>
<td class="text-left" <ng-template #template let-data *ngIf="col.headerText=='ประเมิน'">
style="font-size: 12px;width: 90px;min-width: 90px;max-width: 90px;padding-left: 10px;">
{{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="text-center">
<div class="flex justify-center"> <div class="flex justify-center">
<button type="button" class="ti-btn rounded-sm " <button type="button" class="ti-btn rounded-sm "
[class]="statusButtonClass(item.statusIdp.statusType)" [class]="statusButtonClass(data.statusIdp.statusType)"
style="height: 30px; width: auto; font-size: 12px; display: flex; align-items: center; justify-content: center;margin-left:4px;" style="height: 30px; width: auto; font-size: 12px; display: flex; align-items: center; justify-content: center;margin-left:4px;"
(click)="selectSubordinate(item,'',subordinate.select?.evaluationRoundId,item.statusIdp.statusType);pageEvalution='open'"> (click)="selectSubordinate(data,'',subordinate.select?.evaluationRoundId,data.statusIdp.statusType);pageEvalution='open'">
{{statusCompetencyText(item.statusIdp.statusType)}} {{statusCompetencyText(data.statusIdp.statusType)}}
</button> </button>
</div> </div>
</td> </ng-template>
<td class="text-center" style="font-size: 12px;" </e-column>
*ngIf="subordinate.select?.showPms">
{{item.sumScore}}</td>
<td class=" text-center" style="font-size: 12px;"
*ngIf="subordinate.select?.showPms">
{{item.grade}}</td>
<td class=" text-center" style="font-size: 12px;">
{{item.apsapproveType.tdesc}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<nav class="pagination-style-3 my-5" *ngIf="page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="currentPage = (currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of page;let f = first;let l = last">
<ng-container *ngIf="item==3&&currentPage!=1&&currentPage!=2&&currentPage!=3">
<a aria-label="anchor" class="page-link" href="javascript:void(0);"><i
class="ri-more-line"></i>
</a>
</ng-container>
<ng-container
*ngIf="(f||l)||(item==currentPage-1||item==currentPage||item==currentPage+1)">
<a class="page-link" href="javascript:void(0);"
[class.active]="item==currentPage" (click)="currentPage=item">{{item}}
</a>
</ng-container> </ng-container>
<ng-container
*ngIf="item==page.length-2&&currentPage!=page.length&&currentPage!=page.length-1&&currentPage!=page.length-2">
<a aria-label="anchor" class="page-link" href="javascript:void(0);"><i
class="ri-more-line"></i>
</a>
</ng-container> </ng-container>
</li> </e-columns>
<li> <e-aggregates>
<a aria-label="anchor" class="page-link" href="javascript:void(0);" <e-aggregate>
(click)="currentPage = (currentPage > page.length-1 ? currentPage: currentPage+1 )"> <e-columns>
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i> <e-column *ngFor="let col of aggregatesSum" [field]="col.field" [type]="'Sum'"
</a> [footerTemplate]="'Sum: ${Sum}'" [groupFooterTemplate]="'Sum: ${Sum}'"
</li> [groupCaptionTemplate]="col.groupCaptionTemplate" [format]="col.format">
</ul> </e-column>
<ul class="nav-tabs mt-3"> </e-columns>
<span>Show {{((currentPage-1) * 10)+1}} to {{subordinateFilter().length<10 </e-aggregate>
?subordinateFilter().length: (currentPage==page.length ? ((currentPage * 10) - <e-aggregate>
((currentPage * 10) - subordinateFilter().length) ) :(currentPage * 10) ) }} of <e-columns>
{{subordinateFilter().length}} items</span> <e-column *ngFor="let col of aggregatesCount" [field]="col.field" [type]="'Count'"
</ul> [footerTemplate]="'Count: ${Count}'" [groupFooterTemplate]="'Count: ${Count}'"
</nav> [groupCaptionTemplate]="col.groupCaptionTemplate" [format]="col.format">
</div> </e-column>
</div> </e-columns>
</div> </e-aggregate>
<e-aggregate>
</div> <e-columns>
</div> <e-column *ngFor="let col of aggregatesAvg" [field]="col.field" [type]="'Average'"
</div> [footerTemplate]="'Average: ${Average}'" [groupFooterTemplate]="'Average: ${Average}'"
<ng-container *ngIf="pageEvalution!=''"> [groupCaptionTemplate]="col.groupCaptionTemplate" [format]="col.format">
<app-pms-form-employee [evaluationForm]="'sup'" [currentTap]="'ข้อมูลการประเมิน'" </e-column>
(sendReturnPath)="getBossList();pageEvalution='' ; pathTitle = ['การประเมินผล', 'ประเมินโดยหัวหน้า']" </e-columns>
[evaluaterId]="formEvaluation.evaluaterId" [evaluateeId]="formEvaluation.evaluateeId"></app-pms-form-employee> </e-aggregate>
</ng-container> <e-aggregate>
\ No newline at end of file <e-columns>
<e-column *ngFor="let col of aggregatesMin" [field]="col.field" [type]="'Min'"
[footerTemplate]="'Min: ${Min}'" [groupFooterTemplate]="'Min: ${Min}'"
[groupCaptionTemplate]="col.groupCaptionTemplate" [format]="col.format">
</e-column>
</e-columns>
</e-aggregate>
<e-aggregate>
<e-columns>
<e-column *ngFor="let col of aggregatesMax" [field]="col.field" [type]="'Max'"
[footerTemplate]="'Max: ${Max}'" [groupFooterTemplate]="'Max: ${Max}'"
[groupCaptionTemplate]="col.groupCaptionTemplate" [format]="col.format">
</e-column>
</e-columns>
</e-aggregate>
</e-aggregates>
</ejs-grid>
</ng-template>
\ No newline at end of file
// th{
// position: relative; // เทียบเท่า class "relative"
// padding: 10px; // เทียบเท่า class "px-10px py-10px" (อาจเปลี่ยนตามต้องการ)
// background-color: rgb(96 165 250 / 0.1); // ตัวอย่างแทน "bg-soft-secondary"
// color: #2b2b2b; // ตัวอย่างแทน "text-primary"
// text-align: center !important; // เทียบเท่า "!text-center"
// // หากต้องการดีไซน์อื่น ๆ เพิ่มเติมก็ใส่ในนี้ได้เลย เช่น:
// font-weight: 600;
// border-bottom: 1px solid #eee;
// }
.e-headercell,
.e-detailheadercell {
background-color: rgb(96 165 250 / 0.1) !important;
}
.e-pager .e-currentitem, .e-pager .e-currentitem:hover {
background: rgb(96 165 250) !important;
color: #fff;
opacity: 1 !important;
}
.e-checkbox-wrapper .e-frame.e-check, .e-css.e-checkbox-wrapper .e-frame.e-check {
background-color: rgb(96 165 250) !important;
border-color: transparent;
color: #fff;
}
.e-checkbox-wrapper .e-frame, .e-css.e-checkbox-wrapper .e-frame {
border: 1px solid !important;
border-radius: 2px;
box-sizing: border-box;
cursor: pointer;
display: inline-block;
font-family: "e-icons";
height: 18px;
line-height: 10px;
padding: 2px 0;
text-align: center;
vertical-align: middle;
width: 1rem !important;
border-color: #64748b !important;
}
.e-grid td.e-selectionbackground {
background-color: #aec2ec !important;
}
import { ChangeDetectorRef, Component } from '@angular/core';
import { EChartsOption } from 'echarts'; import { EChartsOption } from 'echarts';
import { AppraisalSubordinateModel, Masfromevaluationassessment, TypeList } from 'src/app/shared/model/appraisal-subordinate.model'; import { AppraisalSubordinateModel, Masfromevaluationassessment, TypeList } from 'src/app/shared/model/appraisal-subordinate.model';
import { AppraisalService } from 'src/app/shared/services/appraisal.service'; import { AppraisalService } from 'src/app/shared/services/appraisal.service';
import { FileService } from 'src/app/shared/services/file.service'; import { FileService } from 'src/app/shared/services/file.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
import {
Component,
Input,
Output,
EventEmitter,
ViewEncapsulation,
OnInit,
ViewChild,
SimpleChanges,
ChangeDetectorRef
} from '@angular/core';
import {
EditService,
SearchService,
ReorderService,
SortService,
GroupService,
ColumnMenuService,
PageService,
FilterService,
SelectionSettingsModel,
ToolbarItems,
ToolbarService,
GridComponent,
PdfExportService,
ExcelExportService,
DetailRowService,
DetailDataBoundEventArgs,
Grid,
AggregateService,
PdfExportProperties,
LoadingIndicatorModel,
ExcelExportProperties,
Column,
ColumnMenuClickEventArgs
} from '@syncfusion/ej2-angular-grids';
import { GroupSettingsModel, FilterSettingsModel, ColumnModel } from '@syncfusion/ej2-angular-grids';
import { DataManager, Query } from '@syncfusion/ej2-data';
import { L10n, setCulture } from '@syncfusion/ej2-base';
setCulture('th-TH');
L10n.load({
'en-US': {
'pager': {
'currentPageInfo': '',
'totalItemsInfo': '{1} to {2} of {0}',
}
},
'th-TH': {
'grid': {
'EmptyRecord': 'ไม่มีข้อมูลที่จะแสดง',
'Item': '1 รายการ',
'Items': '{0} รายการ'
},
'pager': {
'All': 'ทั้งหมด',
'pagerAllDropDown': 'รายการ',
'currentPageInfo': '',
'totalItemsInfo': '{0} รายการ',
'totalItemInfo': '{0} รายการ',
'totalRecordsInfo': '{0} รายการ',
'firstPageTooltip': 'หน้าแรก',
'lastPageTooltip': 'หน้าสุดท้าย',
'nextPageTooltip': 'ถัดไป',
'previousPageTooltip': 'ก่อนหน้า',
'nextPagerTooltip': 'ถัดไป',
'previousPagerTooltip': 'ก่อนหน้า',
'pageInput': '{0}',
'page': 'หน้า',
'pagerDropDown': 'รายการ',
'pagerAll': 'ทั้งหมด',
'pageSize': 'รายการต่อหน้า',
'pageSizeAll': 'ทั้งหมด',
'pageCount': 'จำนวนหน้า',
'pageCountAll': 'ทั้งหมด'
}
}
});
@Component({ @Component({
selector: 'app-supervisor-evaluation', selector: 'app-supervisor-evaluation',
templateUrl: './supervisor-evaluation.component.html', templateUrl: './supervisor-evaluation.component.html',
styleUrls: ['./supervisor-evaluation.component.scss'] styleUrls: ['./supervisor-evaluation.component.scss'],
providers: [AggregateService, SortService, GroupService, ColumnMenuService, PageService, FilterService, ToolbarService, PdfExportService, ExcelExportService, DetailRowService, ReorderService, EditService, SearchService],
encapsulation: ViewEncapsulation.None
}) })
export class SupervisorEvaluationComponent { export class SupervisorEvaluationComponent {
pathTitle = ['การประเมินผล', 'ประเมินโดยหัวหน้า'] pathTitle = ['การประเมินผล', 'ประเมินโดยหัวหน้า']
...@@ -64,6 +142,58 @@ export class SupervisorEvaluationComponent { ...@@ -64,6 +142,58 @@ export class SupervisorEvaluationComponent {
myApproveOption!: EChartsOption; myApproveOption!: EChartsOption;
myApprovePer: number = 0 myApprovePer: number = 0
pmsOption!: EChartsOption; pmsOption!: EChartsOption;
syncfution: {
dataList: any[],
searchSettings: {
fields: string[],
operator: 'contains',
ignoreCase: false
},
columns: ColumnModel[]
} = {
dataList: [],
searchSettings: {
fields: [
'employeeId',
'thFullName',
'position',
'statusIdp',
'sumScore',
'grade',
'apsapproveType'],
operator: 'contains',
ignoreCase: false
},
columns: []
}
@ViewChild('grid') public grid?: GridComponent;
dataSourceSearch: any[] = [];
filterSettings: FilterSettingsModel = { type: 'Excel' };
selectionOptions: SelectionSettingsModel = { checkboxOnly: true };
groupSettings: GroupSettingsModel = { allowReordering: true, showGroupedColumn: true, showDropArea: false };
toolbarOptions: ToolbarItems[] = ['Print', 'ExcelExport', 'CsvExport'];
editSettings? = { allowEditing: true, mode: 'Batch' };
loadingIndicator: LoadingIndicatorModel = { indicatorType: 'Shimmer' };
query: Query = new Query().addParams('dataCount', '1000');
columnMenuItems: any[] = [
'AutoFit', 'AutoFitAll', 'SortAscending', 'SortDescending',
'Group', 'Ungroup', 'ColumnChooser', 'Filter',
{ text: 'Sum', id: 'aggregate_sum' },
{ text: 'Count', id: 'aggregate_count' },
{ text: 'Average', id: 'aggregate_average' },
{ text: 'Min', id: 'aggregate_min' },
{ text: 'Max', id: 'aggregate_max' }
];
initialPage? = { pageSizes: true, pageSize: 10 };
dataSourceFilter: any[] = [];
aggregatesSum: any[] = [];
aggregatesCount: any[] = [];
aggregatesAvg: any[] = [];
aggregatesMin: any[] = [];
aggregatesMax: any[] = [];
constructor(private appraisalService: AppraisalService, constructor(private appraisalService: AppraisalService,
private fileService: FileService, private fileService: FileService,
private cdr: ChangeDetectorRef) { private cdr: ChangeDetectorRef) {
...@@ -73,16 +203,90 @@ export class SupervisorEvaluationComponent { ...@@ -73,16 +203,90 @@ export class SupervisorEvaluationComponent {
this.getBossList() this.getBossList()
} }
getBossList() { getBossList() {
this.syncfution = {
dataList: [],
searchSettings: {
fields: [
'employeeId',
'thFullName',
'position',
'statusIdp',
'sumScore',
'grade',
'apsapproveType'],
operator: 'contains',
ignoreCase: false
},
columns: []
}
this.dataSourceSearch = []
this.dataSourceFilter = [];
this.aggregatesSum = [];
this.aggregatesCount = [];
this.aggregatesAvg = [];
this.aggregatesMin = [];
this.aggregatesMax = [];
this.appraisalService.getBossList().subscribe({ this.appraisalService.getBossList().subscribe({
next: response => { next: response => {
this.subordinate.dataList = JSON.parse(JSON.stringify(response)) this.subordinate.dataList = JSON.parse(JSON.stringify(response))
this.cdr.detectChanges() this.cdr.detectChanges()
if (this.subordinate.dataList.length) { if (this.subordinate.dataList.length) {
this.subordinate.select = JSON.parse(JSON.stringify(this.subordinate.dataList[0])) this.subordinate.select = JSON.parse(JSON.stringify(this.subordinate.dataList[0]))
if (this.subordinate.select?.showPms) {
this.syncfution.dataList = this.subordinate.select.masfromevaluationassessment.map(e => ({
employeeId: e.apsassessy.employeeId,
thFullName: e.apsassessy.thFullName,
position: e.apsassessy.position.tdesc,
statusType: this.statusCompetencyText(e.statusIdp.statusType),
statusIdp: e.statusIdp,
sumScore: e.sumScore,
grade: e.grade,
apsapproveType: e.apsapproveType.tdesc,
apsassessy: e.apsassessy,
masfromStatusType: e.masfromStatusType
}))
this.syncfution.columns =
[{
field: "employeeId",
headerText: "รหัสพนักงาน",
type: "string",
isPrimaryKey: true,
},
{
field: "thFullName",
headerText: "ชื่อพนักงาน",
type: "string"
},
{
field: "position",
headerText: "ตำเเหน่งงาน",
type: "string"
},
{
field: "statusType",
headerText: "ประเมิน",
type: "string"
},
{
field: "sumScore",
headerText: "ผลประเมิน",
type: "string"
},
{
field: "grade",
headerText: "เกรด",
type: "string"
},
{
field: "apsapproveType",
headerText: "สถานะผู้ประเมิน",
type: "string"
}]
}
this.setEcharts() this.setEcharts()
this.cdr.detectChanges() this.cdr.detectChanges()
} }
this.searchChange() this.searchDataGrid(this.search)
}, error: error => { }, error: error => {
this.cdr.detectChanges() this.cdr.detectChanges()
} }
...@@ -93,7 +297,7 @@ export class SupervisorEvaluationComponent { ...@@ -93,7 +297,7 @@ export class SupervisorEvaluationComponent {
this.subordinate.select = JSON.parse(JSON.stringify(data)) this.subordinate.select = JSON.parse(JSON.stringify(data))
this.setEcharts() this.setEcharts()
this.cdr.detectChanges() this.cdr.detectChanges()
this.searchChange() this.searchDataGrid(this.search)
} }
subordinateAll() { subordinateAll() {
...@@ -233,25 +437,9 @@ export class SupervisorEvaluationComponent { ...@@ -233,25 +437,9 @@ export class SupervisorEvaluationComponent {
] ]
}; };
} }
subordinateFilter() {
if (this.subordinate.select) {
return this.subordinate.select.masfromevaluationassessment.filter(x => {
return x.apsassessy.employeeId.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.thFullName.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.position.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
this.statusCompetencyText(x.apsassessy.position.tdesc).toLowerCase().includes(this.search.toLowerCase()) ||
x.grade.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsapproveType.tdesc.toLowerCase().includes(this.search.toLowerCase())
})
}
return []
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.subordinateFilter().length / 10) }, (_, i) => i + 1);
}
selectSubordinate(data: Masfromevaluationassessment, competencyTypeId: string, evaluationRoundId?: string, masfromStatusType?: string) { selectSubordinate(data: Masfromevaluationassessment, competencyTypeId: string, evaluationRoundId?: string, masfromStatusType?: string) {
if (data && evaluationRoundId) { if (data && evaluationRoundId) {
this.formEvaluation.evaluateeId = data.apsassessy.employeeId this.formEvaluation.evaluateeId = data.apsassessy.employeeId
...@@ -273,10 +461,10 @@ export class SupervisorEvaluationComponent { ...@@ -273,10 +461,10 @@ export class SupervisorEvaluationComponent {
} }
toggleSelectAll() { toggleSelectAll() {
if (this.subordinateFilter().filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length > 0) { if (this.dataSourceSearch.filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length > 0) {
if (!this.selectEmp.get('selectAll')) { if (!this.selectEmp.get('selectAll')) {
this.selectEmp.set('selectAll', true) this.selectEmp.set('selectAll', true)
this.subordinateFilter().filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).forEach(e => { this.dataSourceSearch.filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).forEach(e => {
this.selectEmp.set(e.apsassessy.employeeId, true) this.selectEmp.set(e.apsassessy.employeeId, true)
}) })
} else { } else {
...@@ -287,7 +475,10 @@ export class SupervisorEvaluationComponent { ...@@ -287,7 +475,10 @@ export class SupervisorEvaluationComponent {
} }
checkSelectAll() { checkSelectAll() {
this.selectEmp.set('selectAll', (this.subordinateFilter().filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length > 0 && this.subordinateFilter().filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length == this.selectEmp.size - 1)) this.selectEmp.set('selectAll', (this.dataSourceSearch.filter(e => e.apsapproveType.code != 'Apsapprove1' &&
(e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length > 0 &&
this.dataSourceSearch.filter(e => e.apsapproveType.code != 'Apsapprove1' &&
(e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length == this.selectEmp.size - 1))
} }
postBossApproveAll() { postBossApproveAll() {
if (this.subordinate.select) { if (this.subordinate.select) {
...@@ -373,4 +564,113 @@ export class SupervisorEvaluationComponent { ...@@ -373,4 +564,113 @@ export class SupervisorEvaluationComponent {
const imgElement = event.target as HTMLImageElement; const imgElement = event.target as HTMLImageElement;
imgElement.src = './assets/img/users/defaultperson.jpg'; imgElement.src = './assets/img/users/defaultperson.jpg';
} }
searchDataGrid(text: string) {
if (this.grid) {
if (this.syncfution.searchSettings.fields.length) {
this.dataSourceSearch = JSON.parse(JSON.stringify(this.filterData(text, this.syncfution.searchSettings.fields)));
this.dataSourceFilter = JSON.parse(JSON.stringify(this.filterData(text, this.syncfution.searchSettings.fields)));
} else {
(this.grid as GridComponent).search(text);
}
}
this.checkSelectAll()
}
filterData(text: string, fields: string[]): any[] {
return this.syncfution.dataList.filter(item => {
return fields.some(field => {
const value = field.split('.').reduce((obj, key) => obj?.[key], item);
return value?.toString().toLowerCase().includes(text.toLowerCase());
}
);
});
}
actionComplete(args: any) {
if (args.requestType === 'filtering') {
if (this.grid) {
this.dataSourceFilter = ((this.grid as GridComponent).getFilteredRecords() as any).length ? ((this.grid as GridComponent).getFilteredRecords() as any) : JSON.parse(JSON.stringify(this.dataSourceSearch || []));
console.log("🥷🏿 ~ this.dataSourceFilter:", this.dataSourceFilter)
}
}
}
onColumnMenuClick(args: ColumnMenuClickEventArgs): void {
if (!args.item.id) { return; }
if (args.item.id.startsWith('aggregate_')) {
const colField = (args.column as any)?.field;
if (!colField) { return; }
const selectedAgg = args.item.id.split('_')[1];
if (selectedAgg === 'sum') {
if (this.aggregatesSum.find(a => a.field === colField)) {
this.aggregatesSum = this.aggregatesSum.filter(a => a.field !== colField);
} else {
this.aggregatesSum.push({
field: colField,
type: 'Sum',
footerTemplate: 'Sum: ${Sum}'
});
}
this.cdr.detectChanges()
}
else if (selectedAgg === 'count') {
this.aggregatesCount.push({
field: colField,
type: 'Count',
footerTemplate: 'Count: ${Count}'
});
} else if (selectedAgg === 'average') {
this.aggregatesAvg.push({
field: colField,
type: 'Average',
footerTemplate: 'Avg: ${Average}'
});
}
else if (selectedAgg === 'min') {
this.aggregatesMin.push({
field: colField,
type: 'Min',
footerTemplate: 'Min: ${Min}'
});
}
else if (selectedAgg === 'max') {
this.aggregatesMax.push({
field: colField,
type: 'Max',
footerTemplate: 'Max: ${Max}'
});
}
setTimeout(() => {
this.grid?.refresh();
}, 500);
}
}
toolbarClick(args: any): void {
if (args.item.id === 'Grid_excelexport') {
let exportProperties: ExcelExportProperties = {
columns: this.syncfution.columns.map(col => ({
field: col.field,
headerText: col.headerText
})) as Column[]
};
this.grid?.excelExport(exportProperties);
} else if (args.item.id === 'Grid_csvexport') {
let exportColumns = this.syncfution.columns.map(col => ({
field: col.field || '',
headerText: col.headerText || ''
}));
this.grid?.csvExport({ columns: exportColumns as Column[] });
} else if (args.item.id === 'Grid_print') {
this.cdr.detectChanges()
setTimeout(() => {
this.cdr.detectChanges()
}, 1000)
}
}
checkSubordinate(employeeId: string) {
return this.subordinate.select?.masfromevaluationassessment.find(x => x.apsassessy.employeeId == employeeId)
}
} }
...@@ -2770,27 +2770,35 @@ export interface Pms { ...@@ -2770,27 +2770,35 @@ export interface Pms {
learningTopicsForWeaknesses: string learningTopicsForWeaknesses: string
masfromStatusType: MasfromStatusType4 masfromStatusType: MasfromStatusType4
netScore: number netScore: number
netScoreEmp: number
part1Detail: Part1Detail[] part1Detail: Part1Detail[]
part1Percentage: number part1Percentage: number
part1SumScore: number part1SumScore: number
part1SumScoreEmp: number
part2Detail: Part2Detail[] part2Detail: Part2Detail[]
part2Percentage: number part2Percentage: number
part2SumScore: number part2SumScore: number
part2SumScoreEmp: number
part3Detail: Part3Detail[] part3Detail: Part3Detail[]
part3Percentage: number part3Percentage: number
part3SumScore: number part3SumScore: number
part3SumScoreEmp: number
part4Detail: Part4Detail[] part4Detail: Part4Detail[]
part4Percentage: number part4Percentage: number
part4SumScore: number part4SumScore: number
part4SumScoreEmp: number
part5Detail: Part5Detail[] part5Detail: Part5Detail[]
part5Percentage: number part5Percentage: number
part5SumScore: number part5SumScore: number
part5SumScoreEmp: number
part6Detail: Part6Detail[] part6Detail: Part6Detail[]
part6Percentage: number part6Percentage: number
part6SumScore: number part6SumScore: number
part6SumScoreEmp: number
part7Detail: Part7Detail[] part7Detail: Part7Detail[]
part7Percentage: number part7Percentage: number
part7SumScore: number part7SumScore: number
part7SumScoreEmp: number
performanceWeaknesses: string performanceWeaknesses: string
personalLevel: PersonalLevel11 personalLevel: PersonalLevel11
pmsMasfromEvaluationRoundModel: PmsMasfromEvaluationRoundModel pmsMasfromEvaluationRoundModel: PmsMasfromEvaluationRoundModel
......
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