Commit 23e93f30 by Nakarin Luankla

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

parent 921acede
...@@ -7,18 +7,19 @@ import { ...@@ -7,18 +7,19 @@ import {
} from '@angular/core'; } from '@angular/core';
import { ToastrService } from 'ngx-toastr'; import { ToastrService } from 'ngx-toastr';
import { SwalService } from 'src/app/components/advanced/sweetalert/sweetalert.component'; import { SwalService } from 'src/app/components/advanced/sweetalert/sweetalert.component';
import { MyStatusCodeModel, StatusCodeModel } from 'src/app/shared/model/status-code.model';
import { EvaluationCycleService } from 'src/app/shared/services/evaluation-cycle.service';
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
export interface DataModel { export interface DataModel {
check: boolean; evaluationRoundId: string;
code: string; tdesc: string;
period: string; edesc: string;
year: string; apsyear: string;
startDate: string; apsPeriodStart: string;
endDate: string; apsPeriodEnd: string;
status: string; statusCode: StatusCodeModel;
} }
@Component({ @Component({
selector: 'app-define-document-form', selector: 'app-define-document-form',
templateUrl: './define-document-form.component.html', templateUrl: './define-document-form.component.html',
...@@ -33,92 +34,53 @@ export class DefineDocumentFormComponent { ...@@ -33,92 +34,53 @@ export class DefineDocumentFormComponent {
numDataListChecked = 0; numDataListChecked = 0;
isDataListChecked = false; isDataListChecked = false;
isDataListCheckedAll = false; isDataListCheckedAll = false;
dataList: DataModel[] = [
{
check: false,
code: 'Y67P2',
period: 'ช่วงเวลาที่ 2',
year: '2567',
startDate: '01-07-2567',
endDate: '31-12-2567',
status: '1',
},
{
check: false,
code: 'Y68P1',
period: 'ช่วงเวลาที่ 1',
year: '2568',
startDate: '01-01-2568',
endDate: '30-06-2568',
status: '2',
},
];
dataSelect: DataModel = {
check: false,
code: '',
period: '',
year: '',
startDate: '',
endDate: '',
status: '',
};
modalStatus: 'add' | 'edit' = 'add'; modalStatus: 'add' | 'edit' = 'add';
evaluation_cyclelist:DataModel[] = []
constructor( constructor(
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
private swalService: SwalService, private swalService: SwalService,
private evaluationCycleService: EvaluationCycleService,
private toastr: ToastrService private toastr: ToastrService
) {} ) {}
onEdit() { onEdit() {
this.sendGroupShow.emit('2'); this.sendGroupShow.emit('2');
} }
ngOnInit(): void {
dataListSelect(data?: DataModel) { this.getEvaluationCycleList();
this.dataSelect = data || {
check: false,
code: '',
period: '',
year: '',
startDate: '',
endDate: '',
status: '',
};
this.cdr.detectChanges();
} }
getEvaluationCycleList() {
dataListFilter() { this.evaluationCycleService.getList().subscribe({
return this.dataList.filter((x) => { next: response => {
const match = this.evaluation_cyclelist = response.filter(x => x.statusCode&&x.statusCode.code != '2').map(x => ({
x.code.includes(this.search) || x.period.includes(this.search); evaluationRoundId: x.evaluationRoundId,
if (!match) x.check = false; tdesc: x.tdesc,
return match; edesc: x.edesc,
apsyear: x.apsyear,
apsPeriodStart: x.apsPeriodStart,
apsPeriodEnd: x.apsPeriodEnd,
statusCode: new MyStatusCodeModel(x.statusCode || {})
}));
this.searchChange();
this.cdr.detectChanges();
},
error: err => {
console.error('Error fetching evaluation cycles:', err);
}
}); });
} }
searchChange() {
dataListCheck() { this.currentPage = 1
const dataCheck = this.dataListFilter(); this.page = Array.from({ length: Math.ceil(this.evaluation_cycleListFilter().length / 10) }, (_, i) => i + 1);
this.isDataListChecked = dataCheck.some((x) => x.check);
this.isDataListCheckedAll = dataCheck.length
? dataCheck.every((x) => x.check)
: false;
this.numDataListChecked = dataCheck.filter((x) => x.check).length;
} }
evaluation_cycleListFilter() {
dataListCheckAll() { return this.evaluation_cyclelist.filter(x =>
const selectAll = this.isDataListCheckedAll; x.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
this.dataList.forEach((x) => (x.check = selectAll)); x.edesc.toLowerCase().includes(this.search.toLowerCase()) ||
this.dataListCheck(); x.evaluationRoundId.toLowerCase().includes(this.search.toLowerCase())
)
} }
searchChange() {
this.currentPage = 1;
const filteredData = this.dataListFilter();
this.page = Array.from(
{ length: Math.ceil(filteredData.length / 10) },
(_, i) => i + 1
);
this.dataListCheck();
}
showSuccessDelete() { showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', { this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<td style="font-size: 12px;text-align: center;">{{item[3]}}</td> <td style="font-size: 12px;text-align: center;">{{item[3]}}</td>
<td class="flex justify-center items-center space-x-2"> <td class="flex justify-center items-center space-x-2">
<i class="ti ti-edit cursor-pointer i-gray fs-xl px-1" <i class="ti ti-edit cursor-pointer i-gray fs-xl px-1"
data-hs-overlay="#edit-define-document-form-table-modal-edit"></i> data-hs-overlay="#edit-define-document-form-table-modal-edit" (click)="openEdit()"></i>
<input type="checkbox" id="hs-small-switch" <input type="checkbox" id="hs-small-switch"
class="ti-switch checked:bg-none checked:bg-green-600 checked:hover:bg-green-600 checked:focus:bg-green-600 focus:border-green-600 dark:checked:bg-green-600 checked:before:bg-green-200 dark:checked:before:bg-green-200 shrink-0 w-11 h-6 before:w-5 before:h-5"> class="ti-switch checked:bg-none checked:bg-green-600 checked:hover:bg-green-600 checked:focus:bg-green-600 focus:border-green-600 dark:checked:bg-green-600 checked:before:bg-green-200 dark:checked:before:bg-green-200 shrink-0 w-11 h-6 before:w-5 before:h-5">
</td> </td>
...@@ -162,9 +162,8 @@ ...@@ -162,9 +162,8 @@
<div id="edit-define-document-form-table-modal-edit" class="hs-overlay hidden ti-modal"> <div #modalEdit id="edit-define-document-form-table-modal-edit" class="hs-overlay hidden ti-modal">
<div <div class="ti-modal-box ease-out lg:!max-w-4xl lg:w-full m-3 lg:mx-auto items-center ">
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 h-[calc(100%-3.5rem)] items-center">
<div class="max-h-full overflow-hidden ti-modal-content"> <div class="max-h-full overflow-hidden ti-modal-content">
<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">
......
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { ToastrService } from 'ngx-toastr'; import { ToastrService } from 'ngx-toastr';
@Component({ @Component({
...@@ -7,6 +7,7 @@ import { ToastrService } from 'ngx-toastr'; ...@@ -7,6 +7,7 @@ import { ToastrService } from 'ngx-toastr';
styleUrls: ['./edit-define-document-form.component.scss'] styleUrls: ['./edit-define-document-form.component.scss']
}) })
export class EditDefineDocumentFormComponent { export class EditDefineDocumentFormComponent {
@ViewChild('modalEdit') modalEdit!: ElementRef;
@Input() pathTitle = ['การประเมินสมรรถนะ', 'การจัดการสมรรถนะ', 'จัดกลุ่มสมรรถนะ']; @Input() pathTitle = ['การประเมินสมรรถนะ', 'การจัดการสมรรถนะ', 'จัดกลุ่มสมรรถนะ'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>(); @Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
@Output() sendGroupShow: EventEmitter<string> = new EventEmitter<string>(); @Output() sendGroupShow: EventEmitter<string> = new EventEmitter<string>();
...@@ -40,6 +41,14 @@ export class EditDefineDocumentFormComponent { ...@@ -40,6 +41,14 @@ export class EditDefineDocumentFormComponent {
} }
}; };
openEdit() {
const modalElement = this.modalEdit.nativeElement;
setTimeout(() => {
modalElement.setAttribute('aria-overlay', 'false');
}, 10);
}
openModal(name: string, size: string, closeOnBackdrop?: boolean) { openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size; this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false; this.modalOptions[name].backdropClose = closeOnBackdrop || false;
......
...@@ -14,16 +14,16 @@ ...@@ -14,16 +14,16 @@
(click)="activeTab='underline-1';pathTitle = ['การประเมินสมรรถนะ', 'การจัดการรอบการประเมิน', 'รอบการประเมิน']"> (click)="activeTab='underline-1';pathTitle = ['การประเมินสมรรถนะ', 'การจัดการรอบการประเมิน', 'รอบการประเมิน']">
รอบการประเมิน รอบการประเมิน
</a> </a>
<!-- <a class="font-size-16px font-weight-500 hs-tab-active:font-weight-700 hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary" <a class="font-size-16px font-weight-500 hs-tab-active:font-weight-700 hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary"
href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2" href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2"
aria-controls="underline-2" aria-controls="underline-2"
(click)="activeTab='underline-2';pathTitle = ['การประเมินสมรรถนะ', 'การจัดการรอบการประเมิน', 'กำหนดฟอร์มเอกสาร']"> (click)="activeTab='underline-2';pathTitle = ['การประเมินสมรรถนะ', 'การจัดการรอบการประเมิน', 'กำหนดฟอร์มเอกสาร']">
กำหนดฟอร์มเอกสาร กำหนดฟอร์มเอกสาร
</a> --> </a>
</nav> </nav>
</div> </div>
<div class="px-2rem" [ngClass]="{'pt-50px': groupShow !== '2'}"> <div class="px-2rem" [ngClass]="{'pt-50px': groupShow !== '2'}">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1"> <div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1" *ngIf="activeTab === 'underline-1'">
<app-evaluation-cycle></app-evaluation-cycle> <app-evaluation-cycle></app-evaluation-cycle>
</div> </div>
<div id="underline-2" role="tabpanel" aria-labelledby="underline-item-2" <div id="underline-2" role="tabpanel" aria-labelledby="underline-item-2"
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
{{numDataListChecked}} Selected</label> {{numDataListChecked}} Selected</label>
</div> </div>
<div class="mx-1 flex items-center"> <div class="mx-1 flex items-center">
<button (click)="isDataListCheckedAll = !isDataListCheckedAll;dataListCheckAll()" <button (click)="isDataListCheckedAll = !isDataListCheckedAll;dataListCheckAll()" id="check-boxall"
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': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i> [ngClass]="{'ri-checkbox-multiple-line text-gray-500': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i>
</button> </button>
<label class="text-sm text-gray-500 ml-2">Select All</label> <label class="text-sm text-gray-500 ml-2" for="check-boxall">Select All</label>
</div> </div>
</div> </div>
</div> </div>
...@@ -60,10 +60,10 @@ ...@@ -60,10 +60,10 @@
<thead class="height-50px"> <thead class="height-50px">
<tr class="font-size-12px"> <tr class="font-size-12px">
<ng-container <ng-container
*ngFor="let item of ['รหัส','รายละเอียด','รอบปีการประเมิน','วันที่เริ่มต้น','วันที่สิ้นสุด','สถานะ','การจัดการ']; let f = first; let l = last"> *ngFor="let item of ['','รหัส','รายละเอียด','รอบปีการประเมิน','วันที่เริ่มต้น','วันที่สิ้นสุด','สถานะ','การจัดการ']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary" [class.!text-center]="f||l"> <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary" [class.!text-center]="f||l">
<span class="font-size-12px font-weight-700">{{ item }}</span> <span class="font-size-12px font-weight-700">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l"> <div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!f&&!l">
<i class="ti ti-dots-vertical fs-l"></i> <i class="ti ti-dots-vertical fs-l"></i>
</div> </div>
</th> </th>
...@@ -93,6 +93,8 @@ ...@@ -93,6 +93,8 @@
<td class="text-center"> <td class="text-center">
<input type="checkbox" class="ti-form-checkbox cursor-pointer" <input type="checkbox" class="ti-form-checkbox cursor-pointer"
id="checkbox-{{item.data.evaluationRoundId}}" [(ngModel)]="item.check" (ngModelChange)="dataListCheck()"> id="checkbox-{{item.data.evaluationRoundId}}" [(ngModel)]="item.check" (ngModelChange)="dataListCheck()">
</td>
<td >
<label for="checkbox-{{item.data.evaluationRoundId}}">&nbsp;{{item.data.evaluationRoundId}}</label> <label for="checkbox-{{item.data.evaluationRoundId}}">&nbsp;{{item.data.evaluationRoundId}}</label>
</td> </td>
<td>{{item.data.tdesc}}</td> <td>{{item.data.tdesc}}</td>
......
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