Commit 7961588b by Natthaphat

การประเมินสมรรถนะ > การจัดการรอบการประเมิน > รอบการประเมิน

การประเมินจัดการประสิทธิภาพ > รอบการประเมิน > รอบการประเมิน
parent 52f56c3d
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
</div> </div>
<div class="grid grid-cols-2 gap-6 mb-5"> <div class="grid grid-cols-2 gap-6 mb-5">
<div class="col-span-1"> <div class="col-span-1">
<input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly" readonly [value]="evaluationRound.tdesc"> <input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly" readonly [value]="evaluationRound?.tdesc">
</div> </div>
<div class="col-span-1"> <div class="col-span-1">
<input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly" readonly [value]="evaluationRound.apsyear"> <input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly" readonly [value]="evaluationRound?.apsyear">
</div> </div>
</div> </div>
</div> </div>
...@@ -472,7 +472,7 @@ ...@@ -472,7 +472,7 @@
</ng-template> </ng-template>
<div id="form-pm-emp" class="hs-overlay hidden ti-modal" > <div id="form-pm-emp" class="hs-overlay hidden ti-modal" >
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto mt-7"> <div class="hs-overlay-open:mt-7 ti-modal-box ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto mt-7">
<div class="max-h-full overflow-hidden ti-modal-content !width-80 !box-modal" > <div class="max-h-full overflow-hidden ti-modal-content !width-80 !box-modal" >
<div class="ti-modal-header"> <div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary"> <h3 class="text-xxl font-bold text-primary">
...@@ -670,7 +670,7 @@ ...@@ -670,7 +670,7 @@
</div> </div>
<div id="form-assessment" class="hs-overlay hidden ti-modal" > <div id="form-assessment" class="hs-overlay hidden ti-modal" >
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto mt-7"> <div class="hs-overlay-open:mt-7 ti-modal-box ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto mt-7">
<div class="max-h-full overflow-hidden ti-modal-content !width-80 !box-modal" > <div class="max-h-full overflow-hidden ti-modal-content !width-80 !box-modal" >
<div class="ti-modal-header"> <div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary"> <h3 class="text-xxl font-bold text-primary">
......
...@@ -112,6 +112,10 @@ export class EditDefineDocumentFormComponent { ...@@ -112,6 +112,10 @@ export class EditDefineDocumentFormComponent {
}); });
} }
assessmentListFilter() { assessmentListFilter() {
if (!Array.isArray(this.assessmentList)) {
return []; // หรือ return null แล้วจัดการใน HTML
}
return this.assessmentList.filter(x => return this.assessmentList.filter(x =>
x.apsassessy.fname.toLowerCase().includes(this.search.toLowerCase()) || x.apsassessy.fname.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.lname.toLowerCase().includes(this.search.toLowerCase()) || x.apsassessy.lname.toLowerCase().includes(this.search.toLowerCase()) ||
...@@ -119,8 +123,9 @@ export class EditDefineDocumentFormComponent { ...@@ -119,8 +123,9 @@ export class EditDefineDocumentFormComponent {
x.apsassessy.elname.toLowerCase().includes(this.search.toLowerCase()) || x.apsassessy.elname.toLowerCase().includes(this.search.toLowerCase()) ||
x.masfromEvaluationRound.evaluationRoundId.toLowerCase().includes(this.search.toLowerCase()) || x.masfromEvaluationRound.evaluationRoundId.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.employeeId.toLowerCase().includes(this.search.toLowerCase()) x.apsassessy.employeeId.toLowerCase().includes(this.search.toLowerCase())
) );
} }
searchChange() { searchChange() {
this.currentPage = 1; this.currentPage = 1;
const filteredData = this.assessmentListFilter(); const filteredData = this.assessmentListFilter();
......
...@@ -29,8 +29,31 @@ ...@@ -29,8 +29,31 @@
<ng-template #headerTemplate let-data> <ng-template #headerTemplate let-data>
<span class="font-size-12px font-weight-700 text-primary">{{ col.headerText }}</span> <span class="font-size-12px font-weight-700 text-primary">{{ col.headerText }}</span>
</ng-template> </ng-template>
<ng-template #template let-data *ngIf="col.field == 'statusCode.tdesc'">
<div class="flex justify-center items-center w-full h-full">
<span
class="hs-tooltip ti-main-tooltip [--trigger:hover] flex items-center justify-center rounded-full h-6 w-6 text-white"
[ngClass]="{
'bg-success': data.statusCode.tdesc == 'กำลังดำเนินการประเมิน',
'bg-warning': data.statusCode.tdesc == 'รอดำเนินการ',
'bg-gray-400': data.statusCode.tdesc == 'สิ้นสุดช่วงเวลาประเมิน'
}" role="tooltip">
<ng-container [ngSwitch]="data.statusCode.tdesc">
<i *ngSwitchCase="'กำลังดำเนินการประเมิน'" class="ti ti-clock hs-tooltip-toggle ti-main-tooltip-toggle"></i>
<i *ngSwitchCase="'รอดำเนินการ'" class="ti ti-hourglass-empty hs-tooltip-toggle ti-main-tooltip-toggle"></i>
<i *ngSwitchCase="'สิ้นสุดช่วงเวลาประเมิน'" class="ti ti-check hs-tooltip-toggle ti-main-tooltip-toggle"></i>
</ng-container>
<span
class="hs-tooltip-content ti-main-tooltip-content py-1 px-2 bg-primary text-white shadow-sm dark:bg-slate-700">
{{ data.statusCode.tdesc }}
</span>
</span>
</div>
</ng-template>
</e-column> </e-column>
<e-column headerText='action' width='150' textAlign='Center' *ngIf="actionSetting"> <e-column headerText='action' width='205' textAlign='Center' *ngIf="actionSetting">
<ng-template #headerTemplate let-data *ngIf="actionSetting"> <ng-template #headerTemplate let-data *ngIf="actionSetting">
<span class="font-size-12px font-weight-700 text-primary">การจัดการ</span> <span class="font-size-12px font-weight-700 text-primary">การจัดการ</span>
</ng-template> </ng-template>
...@@ -41,6 +64,28 @@ ...@@ -41,6 +64,28 @@
<i class="ti ti-file-download cursor-pointer i-gray fs-l px-1" (click)="onFileDownload(data)" <i class="ti ti-file-download cursor-pointer i-gray fs-l px-1" (click)="onFileDownload(data)"
*ngIf="canDownload && data.competencyFiles"></i> *ngIf="canDownload && data.competencyFiles"></i>
<i class="ti ti-menu-2 cursor-pointer i-gray fs-l px-1" (click)="onNextPage(data)" *ngIf="canChild"></i> <i class="ti ti-menu-2 cursor-pointer i-gray fs-l px-1" (click)="onNextPage(data)" *ngIf="canChild"></i>
<i class="ti ti-user cursor-pointer i-gray fs-l px-1" (click)="onNextPageForm(data)" *ngIf="childForm"></i>
<ng-container *ngIf="data.statusFrom as statusFrom">
<ng-container [ngSwitch]="statusFrom.code">
<span class="badge text-white m-1 cursor-pointer"
(click)="modalStatus='createForm'; createFormEvent.emit(data)" *ngIf="statusFrom.code == '0'"
[ngClass]="{'bg-secondary': true, 'text-white': true}">
สร้างแบบฟอร์ม
</span>
<span class="badge text-white m-1" *ngIf="statusFrom.code == '1'"
[ngClass]="{'bg-primary': true, 'text-white': true}">
ปิดรอบประเมิน
</span>
<span class="badge text-white m-1" *ngIf="statusFrom.code == '2'"
[ngClass]="{'bg-gray-400': true, 'text-white': true}">
ปิดรอบประเมิน
</span>
</ng-container>
</ng-container>
</ng-template> </ng-template>
</e-column> </e-column>
</e-columns> </e-columns>
......
...@@ -108,6 +108,10 @@ export class DatagridSyncfutionComponent implements OnInit { ...@@ -108,6 +108,10 @@ export class DatagridSyncfutionComponent implements OnInit {
@Output() sendNextPageView = new EventEmitter<any>(); @Output() sendNextPageView = new EventEmitter<any>();
@Input() canDownload = false @Input() canDownload = false
@Output() sendFileDownload = new EventEmitter<any>(); @Output() sendFileDownload = new EventEmitter<any>();
@Input() childForm = false
@Output() sendNextPageForm = new EventEmitter<any>();
modalStatus = '';
@Output() createFormEvent = new EventEmitter<any>();
@Input() checkBoxSetting = true @Input() checkBoxSetting = true
@Input() actionSetting = true @Input() actionSetting = true
...@@ -376,12 +380,13 @@ export class DatagridSyncfutionComponent implements OnInit { ...@@ -376,12 +380,13 @@ export class DatagridSyncfutionComponent implements OnInit {
} }
} }
onNextPageView(data: any) { onNextPageView(data: any) {
this.sendNextPageView.emit(data); this.sendNextPageView.emit(data);
} }
onFileDownload(data: any) { onFileDownload(data: any) {
this.sendFileDownload.emit(data); this.sendFileDownload.emit(data);
} }
onNextPageForm(data: any) {
this.sendNextPageForm.emit(data);
}
} }
...@@ -108,6 +108,8 @@ export class ManagementCycleComponent { ...@@ -108,6 +108,8 @@ export class ManagementCycleComponent {
dialogRef: any dialogRef: any
@ViewChild("PLModal") PLModal: any; @ViewChild("PLModal") PLModal: any;
dialogRefPL: any dialogRefPL: any
@ViewChild("managementEvaluationCycleModalForm") managementEvaluationCycleModalForm: any;
dialogRefForm: any
modalStatusEdit = false modalStatusEdit = false
constructor(private pmsMasfromEvaluationCycleService: PmsMasfromEvaluationCycleService, constructor(private pmsMasfromEvaluationCycleService: PmsMasfromEvaluationCycleService,
...@@ -203,6 +205,7 @@ export class ManagementCycleComponent { ...@@ -203,6 +205,7 @@ export class ManagementCycleComponent {
setData(data?: PmsMasfromEvaluationModel) { setData(data?: PmsMasfromEvaluationModel) {
this.pmsMasfromEvaluation.select = new MyPmsMasfromEvaluationModel(data) this.pmsMasfromEvaluation.select = new MyPmsMasfromEvaluationModel(data)
} }
addPmsMasfromEvaluation() { addPmsMasfromEvaluation() {
Swal.fire({ Swal.fire({
icon: 'question', icon: 'question',
...@@ -257,15 +260,10 @@ export class ManagementCycleComponent { ...@@ -257,15 +260,10 @@ export class ManagementCycleComponent {
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
this.dataLoading = true; this.dataLoading = true;
let body: PmsMasfromEvaluationModel[] = [];
if (this.pmsMasfromEvaluation.select.pmsEvaluationRoundId) {
body = [new MyPmsMasfromEvaluationModel(this.pmsMasfromEvaluation.select)];
} else {
const selectedKeys = Array.from(this.selectedItems.data.keys()); const selectedKeys = Array.from(this.selectedItems.data.keys());
body = this.pmsMasfromEvaluation.dataList const body = this.pmsMasfromEvaluation.dataList.filter(x => selectedKeys.includes(x.pmsEvaluationRoundId) && this.selectedItems.data.get(x.pmsEvaluationRoundId)).map(x => new MyPmsMasfromEvaluationModel(x))
.filter(x => selectedKeys.includes(x.pmsEvaluationRoundId) && this.selectedItems.data.get(x.pmsEvaluationRoundId)) console.log(body);
.map(x => new MyPmsMasfromEvaluationModel(x));
}
this.pmsMasfromEvaluationCycleService.delete(body).subscribe({ this.pmsMasfromEvaluationCycleService.delete(body).subscribe({
next: response => { next: response => {
if (response.success) { if (response.success) {
...@@ -289,11 +287,14 @@ export class ManagementCycleComponent { ...@@ -289,11 +287,14 @@ export class ManagementCycleComponent {
} }
showAlert(text: string, type: 'success' | 'error') { showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', { Swal.fire({
timeOut: 3000, title: 'แจ้งเตือน',
positionClass: 'toast-top-right', text: text,
icon: type,
confirmButtonText: 'ตกลง',
}); });
} }
clear() { clear() {
if (this.modalStatus == 'add') { if (this.modalStatus == 'add') {
this.setData() this.setData()
...@@ -319,7 +320,19 @@ export class ManagementCycleComponent { ...@@ -319,7 +320,19 @@ export class ManagementCycleComponent {
this.modal.currentPage = 1 this.modal.currentPage = 1
this.modal.page = Array.from({ length: Math.ceil(dataList.length / 10) }, (_, i) => i + 1); this.modal.page = Array.from({ length: Math.ceil(dataList.length / 10) }, (_, i) => i + 1);
} }
createForm() { createForm(data: any) {
Swal.fire({
title: 'สร้างแบบฟอร์ม?',
text: 'คุณต้องการสร้างแบบฟอร์มการประเมินใหม่หรือไม่',
icon: 'question',
showCancelButton: true,
confirmButtonText: 'ยืนยัน',
cancelButtonText: 'ยกเลิก',
reverseButtons: true,
}).then((result) => {
if (result.isConfirmed) {
this.modalStatus = 'createForm';
this.setData(data); // เซ็ตข้อมูลก่อน
const body = new MyPmsMasfromEvaluationModel(this.pmsMasfromEvaluation.select) const body = new MyPmsMasfromEvaluationModel(this.pmsMasfromEvaluation.select)
body.active = 1 body.active = 1
this.dataLoading = true this.dataLoading = true
...@@ -353,7 +366,9 @@ export class ManagementCycleComponent { ...@@ -353,7 +366,9 @@ export class ManagementCycleComponent {
this.dataLoading = false this.dataLoading = false
this.cdr.detectChanges() this.cdr.detectChanges()
} }
}) });
}
});
} }
checkPrimary() { checkPrimary() {
...@@ -371,13 +386,21 @@ export class ManagementCycleComponent { ...@@ -371,13 +386,21 @@ export class ManagementCycleComponent {
width: '800px', width: '800px',
}) })
} }
openDialogForm() {
this.dialogRefForm = this.dialog.open(this.managementEvaluationCycleModalForm, {
width: '1200px',
disableClose: false,
});
}
closeDialog() { closeDialog() {
this.dialogRef.close() this.dialogRef.close()
} }
closePLDialog() { closePLDialog() {
this.dialogRefPL.close() this.dialogRefPL.close()
} }
closeDialogForm() {
this.dialogRefForm.close()
}
onSelectItemChange(arg: any) { onSelectItemChange(arg: any) {
this.selectedItems = arg this.selectedItems = arg
console.log(this.selectedItems) console.log(this.selectedItems)
......
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