Commit fd62e365 by Nattana Chaiyamat

รอบการประเมิน

parent 48a24b75
<ng-container *ngTemplateOutlet="competency"></ng-container> <ng-container *ngTemplateOutlet="competency"></ng-container>
<ng-template #competency> <ng-template #competency>
<div class="flex flex-col gap-2"> <div class="flex flex-col">
<div class="flex flex-row gap-2 relative"> <div class="flex flex-row py-2 gap-2 sticky" style="top:0;z-index:2;background: white;">
<ng-container *ngFor="let appraisalCompentency of appraisalCompentencyList ;let i=index"> <ng-container *ngFor="let appraisalCompentency of appraisalCompentencyList ;let i=index">
<button type="button" class="flex justify-center !items-center border bg-white p-2 text-center" <button type="button" class="flex justify-center !items-center border bg-white p-2 text-center"
style="border-radius:20px;width: 100px" style="border-radius:20px;width: 100px"
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
style="padding: 1px;border-radius:5px;font-size:27px" (click)="allBiOpen(false)"></i> style="padding: 1px;border-radius:5px;font-size:27px" (click)="allBiOpen(false)"></i>
</div> </div>
</div> </div>
<div #scrollContainer class="flex flex-col gap-2 relative" style="overflow-y: auto;" [ngStyle]="{'height': canSave?'calc(100vh - 472px)':'calc(100vh - 343px)'}"> <div class="flex flex-col gap-2 relative" style="overflow-y: auto;min-height: calc(100vh - 480px);">
<ng-container *ngFor="let item2 of appraisalCompentencyFilter();let i = index;let f= first"> <ng-container *ngFor="let item2 of appraisalCompentencyFilter();let i = index;let f= first">
<button type="button" [attr.id]="'menu-' + i" class="p-4 w-full bg-secondary text-white text-left" <button type="button" [attr.id]="'menu-' + i" class="p-4 w-full bg-secondary text-white text-left"
style="border-radius:20px" style="border-radius:20px"
...@@ -133,8 +133,8 @@ ...@@ -133,8 +133,8 @@
</table> </table>
</ng-container> </ng-container>
</ng-container> </ng-container>
<button *ngIf="appraisalCompentencyFilter().length" [attr.id]="'menu-' + appraisalCompentencyFilter().length" type="button" <button *ngIf="appraisalCompentencyFilter().length" [attr.id]="'menu-' + appraisalCompentencyFilter().length"
class="p-4 w-full bg-secondary text-white text-left" style="border-radius:20px" type="button" class="p-4 w-full bg-secondary text-white text-left" style="border-radius:20px"
(click)="scrollToMenu(appraisalCompentencyFilter().length);allBiOpen(!biOpen.get('สรุป'),'สรุป')"> (click)="scrollToMenu(appraisalCompentencyFilter().length);allBiOpen(!biOpen.get('สรุป'),'สรุป')">
<span style="padding-left:50px"> <span style="padding-left:50px">
สรุป สรุป
......
...@@ -60,6 +60,9 @@ export class PmsCompetencyComponent { ...@@ -60,6 +60,9 @@ export class PmsCompetencyComponent {
inforWeight: Map<string, string> = new Map<string, string>() inforWeight: Map<string, string> = new Map<string, string>()
inforGap: Map<string, string> = new Map<string, string>() inforGap: Map<string, string> = new Map<string, string>()
@Output() scrollToMenuId: EventEmitter<any> = new EventEmitter<any>();
constructor(private appraisalService: AppraisalService, constructor(private appraisalService: AppraisalService,
private employeeService: EmployeeService, private employeeService: EmployeeService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
...@@ -76,7 +79,7 @@ export class PmsCompetencyComponent { ...@@ -76,7 +79,7 @@ export class PmsCompetencyComponent {
this.getEvaluatee() this.getEvaluatee()
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (changes['currentTap']?.currentValue||changes['appraisalCompentencyList']?.currentValue) { if (changes['currentTap']?.currentValue || changes['appraisalCompentencyList']?.currentValue) {
if (this.appraisalCompentencyList.length) { if (this.appraisalCompentencyList.length) {
this.currentPart = this.fCurrentPart == '' ? this.appraisalCompentencyList[0].comType : this.fCurrentPart this.currentPart = this.fCurrentPart == '' ? this.appraisalCompentencyList[0].comType : this.fCurrentPart
} }
...@@ -332,14 +335,7 @@ export class PmsCompetencyComponent { ...@@ -332,14 +335,7 @@ export class PmsCompetencyComponent {
} }
scrollToMenu(index: number) { scrollToMenu(index: number) {
setTimeout(() => { this.scrollToMenuId.emit('menu-' + index);
const container = this.scrollContainer?.nativeElement as HTMLElement;
const target = container.querySelector('#menu-' + index) as HTMLElement;
if (container && target) {
container.scrollTop = target.offsetTop;
}
}, 0);
} }
} }
import { ChangeDetectorRef, Component, EventEmitter, HostListener, Input, Output } from '@angular/core'; import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostListener, Input, Output, ViewChild } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { CompetencyModel } from 'src/app/shared/model/competency.model'; import { CompetencyModel } from 'src/app/shared/model/competency.model';
import { EmployeeModel, MyEmployeeModel } from 'src/app/shared/model/employee.model'; import { EmployeeModel, MyEmployeeModel } from 'src/app/shared/model/employee.model';
...@@ -62,6 +62,10 @@ export class PmsFormEmployeeComponent { ...@@ -62,6 +62,10 @@ export class PmsFormEmployeeComponent {
hasPushedState = false; hasPushedState = false;
companyId = "" companyId = ""
@ViewChild('scrollContainer') scrollContainer!: ElementRef;
constructor( constructor(
private router: Router, private router: Router,
private employeeService: EmployeeService, private employeeService: EmployeeService,
...@@ -89,6 +93,24 @@ export class PmsFormEmployeeComponent { ...@@ -89,6 +93,24 @@ export class PmsFormEmployeeComponent {
} }
return "" return ""
} }
currentStepTextShow = () => {
if (this.compentency.data) {
if (this.compentency.data.apsassessy.employeeId == this.evaluaterId) {
return "ผู้ประเมิน"
} else if (this.compentency.data.apsapprove1.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 1"
} else if (this.compentency.data.apsapprove2.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 2"
} else if (this.compentency.data.apsapprove3.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 3"
} else if (this.compentency.data.apsapprove4.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 4"
} else if (this.compentency.data.apsapprove5.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 5"
}
}
return ""
}
gradeStar = (grade: string) => { gradeStar = (grade: string) => {
if (grade == 'A') { if (grade == 'A') {
...@@ -693,4 +715,20 @@ export class PmsFormEmployeeComponent { ...@@ -693,4 +715,20 @@ export class PmsFormEmployeeComponent {
return { full, mini }; return { full, mini };
} }
scrollToMenu(id: string) {
setTimeout(() => {
const container = this.scrollContainer?.nativeElement as HTMLElement;
const target = document.getElementById(id);
if (container && target) {
const containerTop = container.getBoundingClientRect().top;
const targetTop = target.getBoundingClientRect().top;
const scrollOffset = targetTop - containerTop - 65;
container.scrollTop += scrollOffset;
}
}, 0);
}
} }
\ No newline at end of file
<ng-container *ngTemplateOutlet="idpEvaluation"></ng-container> <ng-container *ngTemplateOutlet="idpEvaluation"></ng-container>
<ng-template #idpEvaluation> <ng-template #idpEvaluation>
<ng-container *ngIf="appraisalIdp"> <ng-container *ngIf="appraisalIdp">
<div style="overflow-y: auto;" [ngStyle]="{'height': canSave?'calc(100vh - 414px)':'calc(100vh - 285px)'}"> <div style="overflow-y: auto;" style="padding-top: 1rem">
<div class="pt-1 pb-2"> <div class="pb-2">
<div class="font-size-18px font-weight-700 text-gray-500"> <div class="font-size-18px font-weight-700 text-gray-500">
ส่วนที่ 1: ข้อมูลทั่วไป ส่วนที่ 1: ข้อมูลทั่วไป
</div> </div>
......
<div class="flex flex-col gap-2" style="overflow-y: auto;" <div class="flex flex-col gap-2 pt-2" style="overflow-y: auto;min-height: calc(100vh - 422px)">
[ngStyle]="{'height': canSave?'calc(100vh - 414px)':'calc(100vh - 285px)'}">
<div class="flex"> <div class="flex">
<button type="button" class="p-4 w-full bg-secondary text-white text-left" style="border-radius:20px" <button type="button" class="p-4 w-full bg-secondary text-white text-left" style="border-radius:20px"
(click)="menuClose.set('Compentency',!menuClose.get('Compentency'))"> (click)="menuClose.set('Compentency',!menuClose.get('Compentency'))">
...@@ -38,8 +37,7 @@ ...@@ -38,8 +37,7 @@
</td> </td>
<td class="py-2 text-center" style="vertical-align: top"> <td class="py-2 text-center" style="vertical-align: top">
<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(statusType)"
[class]="statusButtonClass(statusType)"
(click)="sendCurrentTap.emit('แบบประเมินสมรรถนะ');sendCurrentPart.emit(statusType)" (click)="sendCurrentTap.emit('แบบประเมินสมรรถนะ');sendCurrentPart.emit(statusType)"
style="height: 15px; width: 45px; font-size: 12px; display: flex; align-items: center; justify-content: center;margin-left:4px;"> style="height: 15px; width: 45px; font-size: 12px; display: flex; align-items: center; justify-content: center;margin-left:4px;">
{{item.comType}} {{item.comType}}
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<ng-template #pmsEvaluation> <ng-template #pmsEvaluation>
<ng-container *ngIf="appraisalPms"> <ng-container *ngIf="appraisalPms">
<div class="flex flex-col gap-2"> <div class="flex flex-col">
<div class="flex flex-row gap-2"> <div class="flex py-2 flex-row gap-2 sticky" style="top:0;z-index:2;background: white;">
<ng-container *ngFor="let item of partShow;let i=index"> <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" <button type="button" class="flex justify-center !items-center border bg-white p-1 text-center"
(click)="scrollToMenu(currentTap == 'ประเมินผลการปฏิบัติงาน'?('menu-part-'+(i+1)):('menu-part-'+(i+8)));currentPart=item;toggleAllParts(true,item)" (click)="scrollToMenu(currentTap == 'ประเมินผลการปฏิบัติงาน'?('menu-part-'+(i+1)):('menu-part-'+(i+8)));currentPart=item;toggleAllParts(true,item)"
...@@ -34,8 +34,7 @@ ...@@ -34,8 +34,7 @@
(click)="toggleAllParts(false);currentPart=''"></i> (click)="toggleAllParts(false);currentPart=''"></i>
</div> </div>
</div> </div>
<div #scrollContainer class="flex flex-col gap-2" style="overflow-y: auto;" <div class="flex flex-col gap-2" style="min-height: calc(100vh - 479px);">
[ngStyle]="{'height': canSave?'calc(100vh - 471px)':'calc(100vh - 342px)'}">
<ng-container *ngIf="currentTap=='ประเมินผลการปฏิบัติงาน'"> <ng-container *ngIf="currentTap=='ประเมินผลการปฏิบัติงาน'">
<ng-container *ngIf="appraisalPms?.part1Detail?.length then part1 else noData"></ng-container> <ng-container *ngIf="appraisalPms?.part1Detail?.length then part1 else noData"></ng-container>
<ng-container *ngIf="appraisalPms?.part2Detail?.length then part2 else noData"></ng-container> <ng-container *ngIf="appraisalPms?.part2Detail?.length then part2 else noData"></ng-container>
...@@ -72,7 +71,7 @@ ...@@ -72,7 +71,7 @@
<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" style="width: 300px">ค่าเป้าหมาย</th>
<th scope="col">คะแนน</th> <th scope="col">คะแนน</th>
</tr> </tr>
</thead> </thead>
...@@ -170,7 +169,7 @@ ...@@ -170,7 +169,7 @@
(mouseenter)="partScore.set(item.groupAssessment1.pmsTopic.pmsTopicId,item2)" (mouseenter)="partScore.set(item.groupAssessment1.pmsTopic.pmsTopicId,item2)"
(mouseleave)="partScore.clear()" (mouseleave)="partScore.clear()"
(click)="setScore(item,item2);allFormRemain()" [ngClass]="{'!border-secondary !text-secondary':(evaluaterId==evaluateeId?item.scoreTopicExpectation>=item2:item.scoreTopicExpectationBoss>=item2)||(partScore.get(item.groupAssessment1.pmsTopic.pmsTopicId) ?? 0)>=item2, (click)="setScore(item,item2);allFormRemain()" [ngClass]="{'!border-secondary !text-secondary':(evaluaterId==evaluateeId?item.scoreTopicExpectation>=item2:item.scoreTopicExpectationBoss>=item2)||(partScore.get(item.groupAssessment1.pmsTopic.pmsTopicId) ?? 0)>=item2,
'pointer-events-none':!canEdit}"> 'pointer-events-none':!canEdit}">
{{item2}} {{item2}}
</button> </button>
</ng-container> </ng-container>
......
...@@ -94,7 +94,8 @@ export class PmsKpiComponent { ...@@ -94,7 +94,8 @@ export class PmsKpiComponent {
@Output() scorePart: EventEmitter<any> = new EventEmitter<any>(); @Output() scorePart: EventEmitter<any> = new EventEmitter<any>();
groupGrade: { loading: boolean, dataList: CompetencyGradeModel[] } = { loading: false, dataList: [] } groupGrade: { loading: boolean, dataList: CompetencyGradeModel[] } = { loading: false, dataList: [] }
@ViewChild('scrollContainer') scrollContainer!: ElementRef; @ViewChild('scrollContainer') scrollContainer!: ElementRef;
@Output() scrollToMenuId: EventEmitter<any> = new EventEmitter<any>();
constructor(private appraisalService: AppraisalService, constructor(private appraisalService: AppraisalService,
private pmsGroupGradeService: PmsGroupGradeService, private pmsGroupGradeService: PmsGroupGradeService,
private employeeService: EmployeeService, private employeeService: EmployeeService,
...@@ -542,17 +543,6 @@ export class PmsKpiComponent { ...@@ -542,17 +543,6 @@ export class PmsKpiComponent {
} }
scrollToMenu(id: string) { scrollToMenu(id: string) {
setTimeout(() => { this.scrollToMenuId.emit(id);
const container = this.scrollContainer?.nativeElement as HTMLElement;
const target = document.getElementById(id);
if (container && target) {
const containerTop = container.getBoundingClientRect().top;
const targetTop = target.getBoundingClientRect().top;
const scrollOffset = targetTop - containerTop;
container.scrollTop += scrollOffset;
}
}, 0);
} }
} }
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