Commit 085f5b9c by Nattana Chaiyamat

การประเมินสมรรถนะ

ทะเบียนกำหนดชื่อ
ประเภทสมรรถนะ
parent 7fd7a2f9
...@@ -218,6 +218,11 @@ ...@@ -218,6 +218,11 @@
<label for="detail_eng" class="ti-form-label mt-1rem">ระดับความคาดหวัง *</label> <label for="detail_eng" class="ti-form-label mt-1rem">ระดับความคาดหวัง *</label>
<input type="text" id="detail_eng" class="ti-form-input" style="width: 200px;" <input type="text" id="detail_eng" class="ti-form-input" style="width: 200px;"
oninput="this.value = this.value.replace(/\D/g, '')" [(ngModel)]="dataSelect.level"> oninput="this.value = this.value.replace(/\D/g, '')" [(ngModel)]="dataSelect.level">
<label for="detail_eng" class="ti-form-label mt-1rem">น้ำหนัก</label>
<input type="text" id="detail_eng" class="ti-form-input" style="width: 200px;"
oninput="this.value = this.value.replace(/[^\d.]/g, '').replace(/(\..*?)\..*/g, '$1').replace(/(\..*?)(\d{2})./g, '$1$2');"
onchange="this.value = this.value.replace('', '0');this.value = parseFloat(this.value).toFixed(2)"
[(ngModel)]="dataSelect.weight">
<div class="flex justify-end mt-2rem mb-1rem"> <div class="flex justify-end mt-2rem mb-1rem">
<button type="button" <button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10" class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
......
...@@ -10,6 +10,7 @@ export interface DataModel { ...@@ -10,6 +10,7 @@ export interface DataModel {
name: string name: string
code: string code: string
level: string level: string
weight: number
checked: boolean checked: boolean
} }
@Component({ @Component({
...@@ -29,7 +30,7 @@ export class TypeRegistration { ...@@ -29,7 +30,7 @@ export class TypeRegistration {
dataSelectList: DataModel[] = []; dataSelectList: DataModel[] = [];
dataLoading = false dataLoading = false
dataSelect: DataModel = { id: "", companyId: "", edesc: "", name: "", code: "", level: "", checked: false } dataSelect: DataModel = { id: "", companyId: "", edesc: "", name: "", code: "", level: "", weight: 0.00, checked: false }
competoncy_typeList: { check: boolean; data: DataModel & { checked?: boolean } }[] = [] competoncy_typeList: { check: boolean; data: DataModel & { checked?: boolean } }[] = []
competoncy_type: CompetencytypeModel = new MyCompetencytypeModel({}) competoncy_type: CompetencytypeModel = new MyCompetencytypeModel({})
modalStatus: 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add' modalStatus: 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add'
...@@ -101,7 +102,7 @@ export class TypeRegistration { ...@@ -101,7 +102,7 @@ export class TypeRegistration {
this.dataLoading = true this.dataLoading = true
this.competencytypeService.getList().subscribe({ this.competencytypeService.getList().subscribe({
next: response => { next: response => {
this.competoncy_typeList = response.map(x => ({ check: false, data: { id: x.competencyTypeId, companyId: x.companyId, edesc: x.edesc, name: x.tdesc, code: x.shortName, level: x.expectationLevel, checked: false } })) this.competoncy_typeList = response.map(x => ({ check: false, data: { id: x.competencyTypeId, companyId: x.companyId, edesc: x.edesc, name: x.tdesc, code: x.shortName, weight: x.weight, level: x.expectationLevel, checked: false } }))
this.dataLoading = false this.dataLoading = false
this.isDataListCheckedAll = false this.isDataListCheckedAll = false
this.dataListCheckAll() this.dataListCheckAll()
...@@ -153,7 +154,7 @@ export class TypeRegistration { ...@@ -153,7 +154,7 @@ export class TypeRegistration {
let body: CompetencytypeModel | CompetencytypeModel[] = []; let body: CompetencytypeModel | CompetencytypeModel[] = [];
if (this.dataSelect.id) { if (this.dataSelect.id) {
body = new MyCompetencytypeModel({ competencyTypeId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, shortName: this.dataSelect.code, expectationLevel: this.dataSelect.level }); body = new MyCompetencytypeModel({ competencyTypeId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, shortName: this.dataSelect.code, weight: +(this.dataSelect.weight), expectationLevel: this.dataSelect.level });
} else { } else {
body = this.competoncy_typeList.filter(x => x.check).map(x => new MyCompetencytypeModel({ competencyTypeId: x.data.id, tdesc: x.data.name, edesc: x.data.edesc, shortName: x.data.code, expectationLevel: x.data.level })); body = this.competoncy_typeList.filter(x => x.check).map(x => new MyCompetencytypeModel({ competencyTypeId: x.data.id, tdesc: x.data.name, edesc: x.data.edesc, shortName: x.data.code, expectationLevel: x.data.level }));
} }
...@@ -205,7 +206,7 @@ export class TypeRegistration { ...@@ -205,7 +206,7 @@ export class TypeRegistration {
if (modalStatus == 'add') { if (modalStatus == 'add') {
this.setData() this.setData()
} else if (modalStatus == 'edit') { } else if (modalStatus == 'edit') {
this.setData({ id: this.dataSelect.id, companyId: "", name: "", edesc: "", code: "", level: "", checked: this.dataSelect.checked }) this.setData({ id: this.dataSelect.id, companyId: "", name: "", edesc: "", code: "", level: "", weight: 0.00, checked: this.dataSelect.checked })
} }
} }
} }
......
...@@ -103,19 +103,10 @@ ...@@ -103,19 +103,10 @@
<td class="text-center"> <td class="text-center">
<div class="flex"> <div class="flex">
<button type="button" class="ti-btn rounded-sm ti-btn-soft-success" <button type="button" class="ti-btn rounded-sm ti-btn-soft-success"
*ngFor="let type of item.typeList"
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;"
(click)="selectSubordinate(item);pageEvalution='evaluation'"> (click)="selectSubordinate(item,type.shortName,type.shortName);pageEvalution='evaluation'">
PC {{type.shortName}}
</button>
<button type="button" class="ti-btn rounded-sm ti-btn-soft-secondary"
style="height: 15px; width: 45px; font-size: 12px; display: flex; align-items: center; justify-content: center;margin-left:4px;"
(click)="selectSubordinate(item);pageEvalution='evaluation'">
MC
</button>
<button type="button" class="ti-btn rounded-sm ti-btn-soft-danger"
style="height: 15px; width: 45px; font-size: 12px; display: flex; align-items: center; justify-content: center;margin-left:4px;"
(click)="selectSubordinate(item);pageEvalution='evaluation'">
CC
</button> </button>
</div> </div>
</td> </td>
...@@ -127,8 +118,7 @@ ...@@ -127,8 +118,7 @@
</td> </td>
<td class="text-center"> <td class="text-center">
<button type="button" class="ti-btn rounded-sm ti-btn-soft-success" <button type="button" class="ti-btn rounded-sm ti-btn-soft-success"
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;">
(click)="selectSubordinate(item);pageEvalution='evaluation'">
ประเมิน ประเมิน
</button> </button>
</td> </td>
...@@ -196,8 +186,7 @@ ...@@ -196,8 +186,7 @@
<ng-container *ngIf="pageEvalution=='pms'"> <ng-container *ngIf="pageEvalution=='pms'">
<app-pms-evalution (sendPageEvalution)="pageEvalution=$event"></app-pms-evalution> <app-pms-evalution (sendPageEvalution)="pageEvalution=$event"></app-pms-evalution>
</ng-container> </ng-container>
<ng-container *ngIf="pageEvalution=='evaluation'&&subordinate.select.apsassessy.employeeId"> <ng-container *ngIf="pageEvalution=='evaluation'">
<app-self-evaluation [byBoss]="true" [pathTitle]="pathTitle" (sendPageEvalution)="pageEvalution=$event" <app-evaluation [evaluationRoundId]="evaluationRoundId" [evaluaterId]="evaluaterId" [evaluateeId]="evaluateeId"
(sendPathTitle)="pathTitle=$event" [competencyTypeId]="competencyTypeId"></app-evaluation>
[employeeId]="subordinate.select.apsassessy.employeeId"></app-self-evaluation>
</ng-container> </ng-container>
\ No newline at end of file
...@@ -14,11 +14,17 @@ export class SupervisorEvaluationComponent { ...@@ -14,11 +14,17 @@ export class SupervisorEvaluationComponent {
subordinate: { loading: false, select: AppraisalSubordinateModel, dataList: AppraisalSubordinateModel[], dataListRound: AppraisalSubordinateModel[][] } = { loading: false, select: new MyAppraisalSubordinateModel(), dataListRound: [], dataList: [] } subordinate: { loading: false, select: AppraisalSubordinateModel, dataList: AppraisalSubordinateModel[], dataListRound: AppraisalSubordinateModel[][] } = { loading: false, select: new MyAppraisalSubordinateModel(), dataListRound: [], dataList: [] }
search = "" search = ""
currentPage = 1 currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1); page = Array.from({ length: 1 }, (_, i) => i + 1)
evaluateeId = ""
evaluaterId = ""
competencyTypeId = ""
evaluationRoundId = ""
constructor(private appraisalService: AppraisalService, constructor(private appraisalService: AppraisalService,
private cdr: ChangeDetectorRef) { private cdr: ChangeDetectorRef) {
} }
ngOnInit(): void { ngOnInit(): void {
this.evaluaterId = this.decodeJWT(sessionStorage.getItem("accessToken") || '').employeeid
this.getBossList() this.getBossList()
} }
getBossList() { getBossList() {
...@@ -42,8 +48,12 @@ export class SupervisorEvaluationComponent { ...@@ -42,8 +48,12 @@ export class SupervisorEvaluationComponent {
this.currentPage = 1 this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.subordinateFilter().length / 10) }, (_, i) => i + 1); this.page = Array.from({ length: Math.ceil(this.subordinateFilter().length / 10) }, (_, i) => i + 1);
} }
selectSubordinate(data: AppraisalSubordinateModel) { selectSubordinate(data: AppraisalSubordinateModel, competencyTypeId: string, evaluationRoundId: string) {
this.subordinate.select = new MyAppraisalSubordinateModel(data) this.subordinate.select = new MyAppraisalSubordinateModel(data)
this.evaluateeId = this.subordinate.select.apsassessy.employeeId
this.competencyTypeId = competencyTypeId
this.evaluationRoundId = evaluationRoundId
this.cdr.detectChanges() this.cdr.detectChanges()
} }
selectDataListRound(data: AppraisalSubordinateModel[]) { selectDataListRound(data: AppraisalSubordinateModel[]) {
...@@ -51,4 +61,13 @@ export class SupervisorEvaluationComponent { ...@@ -51,4 +61,13 @@ export class SupervisorEvaluationComponent {
this.searchChange() this.searchChange()
this.cdr.detectChanges() this.cdr.detectChanges()
} }
decodeJWT(token: string) {
let base64Url = token.split('.')[1]; // ดึงส่วนที่เป็น Payload
let base64 = base64Url.replace('-', '+').replace('_', '/'); // แก้ไข base64 ให้ถูกต้อง
let jsonPayload = decodeURIComponent(atob(base64).split('').map(function (c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
return JSON.parse(jsonPayload);
}
} }
...@@ -9,6 +9,10 @@ export interface AppraisalSubordinateModel { ...@@ -9,6 +9,10 @@ export interface AppraisalSubordinateModel {
apsassessy: EmployeeModel apsassessy: EmployeeModel
gread: string gread: string
sumScore: number sumScore: number
typeList: {
competencyTypeId: string,
shortName: string
}[]
} }
export class MyAppraisalSubordinateModel implements AppraisalSubordinateModel { export class MyAppraisalSubordinateModel implements AppraisalSubordinateModel {
companyId: string companyId: string
...@@ -18,6 +22,10 @@ export class MyAppraisalSubordinateModel implements AppraisalSubordinateModel { ...@@ -18,6 +22,10 @@ export class MyAppraisalSubordinateModel implements AppraisalSubordinateModel {
apsassessy: EmployeeModel apsassessy: EmployeeModel
gread: string gread: string
sumScore: number sumScore: number
typeList: {
competencyTypeId: string,
shortName: string
}[]
constructor(data?: Partial<AppraisalSubordinateModel>) { constructor(data?: Partial<AppraisalSubordinateModel>) {
this.companyId = data?.companyId || "" this.companyId = data?.companyId || ""
this.active = data?.active ?? false this.active = data?.active ?? false
...@@ -26,6 +34,9 @@ export class MyAppraisalSubordinateModel implements AppraisalSubordinateModel { ...@@ -26,6 +34,9 @@ export class MyAppraisalSubordinateModel implements AppraisalSubordinateModel {
this.apsassessy = new MyEmployeeModel(data?.apsassessy) this.apsassessy = new MyEmployeeModel(data?.apsassessy)
this.gread = data?.gread || "" this.gread = data?.gread || ""
this.sumScore = data?.sumScore ?? 0 this.sumScore = data?.sumScore ?? 0
this.typeList = data?.typeList?.map(x => ({
competencyTypeId: x.competencyTypeId || "",
shortName: x.shortName || ""
})) || []
} }
} }
...@@ -5,6 +5,7 @@ export interface CompetencytypeModel { ...@@ -5,6 +5,7 @@ export interface CompetencytypeModel {
tdesc: string tdesc: string
shortName: string shortName: string
expectationLevel: string expectationLevel: string
weight: number
} }
...@@ -15,6 +16,7 @@ export class MyCompetencytypeModel implements CompetencytypeModel { ...@@ -15,6 +16,7 @@ export class MyCompetencytypeModel implements CompetencytypeModel {
tdesc: string tdesc: string
shortName: string shortName: string
expectationLevel: string expectationLevel: string
weight: number
constructor(data?: Partial<CompetencytypeModel>) { constructor(data?: Partial<CompetencytypeModel>) {
this.competencyTypeId = data?.competencyTypeId || "" this.competencyTypeId = data?.competencyTypeId || ""
this.companyId = data?.companyId || "" this.companyId = data?.companyId || ""
...@@ -22,6 +24,7 @@ export class MyCompetencytypeModel implements CompetencytypeModel { ...@@ -22,6 +24,7 @@ export class MyCompetencytypeModel implements CompetencytypeModel {
this.tdesc = data?.tdesc || "" this.tdesc = data?.tdesc || ""
this.shortName = data?.shortName || "" this.shortName = data?.shortName || ""
this.expectationLevel = data?.expectationLevel || "" this.expectationLevel = data?.expectationLevel || ""
this.weight = data?.weight ?? 0
} }
} }
...@@ -24922,3 +24922,7 @@ div:where(.swal2-container) div:where(.swal2-validation-message) { ...@@ -24922,3 +24922,7 @@ div:where(.swal2-container) div:where(.swal2-validation-message) {
.masked-input { .masked-input {
-webkit-text-security: disc; /* Safari, Chrome */ -webkit-text-security: disc; /* Safari, Chrome */
} }
.cursor-not-allowed{
cursor: not-allowed
}
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