Commit 23e93f30 by Nakarin Luankla

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

parent 921acede
......@@ -7,18 +7,19 @@ import {
} from '@angular/core';
import { ToastrService } from 'ngx-toastr';
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';
export interface DataModel {
check: boolean;
code: string;
period: string;
year: string;
startDate: string;
endDate: string;
status: string;
evaluationRoundId: string;
tdesc: string;
edesc: string;
apsyear: string;
apsPeriodStart: string;
apsPeriodEnd: string;
statusCode: StatusCodeModel;
}
@Component({
selector: 'app-define-document-form',
templateUrl: './define-document-form.component.html',
......@@ -33,92 +34,53 @@ export class DefineDocumentFormComponent {
numDataListChecked = 0;
isDataListChecked = 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';
evaluation_cyclelist:DataModel[] = []
constructor(
private cdr: ChangeDetectorRef,
private swalService: SwalService,
private evaluationCycleService: EvaluationCycleService,
private toastr: ToastrService
) {}
onEdit() {
this.sendGroupShow.emit('2');
}
dataListSelect(data?: DataModel) {
this.dataSelect = data || {
check: false,
code: '',
period: '',
year: '',
startDate: '',
endDate: '',
status: '',
};
this.cdr.detectChanges();
ngOnInit(): void {
this.getEvaluationCycleList();
}
dataListFilter() {
return this.dataList.filter((x) => {
const match =
x.code.includes(this.search) || x.period.includes(this.search);
if (!match) x.check = false;
return match;
getEvaluationCycleList() {
this.evaluationCycleService.getList().subscribe({
next: response => {
this.evaluation_cyclelist = response.filter(x => x.statusCode&&x.statusCode.code != '2').map(x => ({
evaluationRoundId: x.evaluationRoundId,
tdesc: x.tdesc,
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);
}
});
}
dataListCheck() {
const dataCheck = this.dataListFilter();
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;
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.evaluation_cycleListFilter().length / 10) }, (_, i) => i + 1);
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.dataList.forEach((x) => (x.check = selectAll));
this.dataListCheck();
evaluation_cycleListFilter() {
return this.evaluation_cyclelist.filter(x =>
x.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.search.toLowerCase()) ||
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() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
......
......@@ -115,7 +115,7 @@
<td style="font-size: 12px;text-align: center;">{{item[3]}}</td>
<td class="flex justify-center items-center space-x-2">
<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"
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>
......@@ -162,9 +162,8 @@
<div id="edit-define-document-form-table-modal-edit" 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 h-[calc(100%-3.5rem)] items-center">
<div #modalEdit id="edit-define-document-form-table-modal-edit" class="hs-overlay hidden ti-modal">
<div class="ti-modal-box ease-out lg:!max-w-4xl lg:w-full m-3 lg:mx-auto items-center ">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<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';
@Component({
......@@ -7,6 +7,7 @@ import { ToastrService } from 'ngx-toastr';
styleUrls: ['./edit-define-document-form.component.scss']
})
export class EditDefineDocumentFormComponent {
@ViewChild('modalEdit') modalEdit!: ElementRef;
@Input() pathTitle = ['การประเมินสมรรถนะ', 'การจัดการสมรรถนะ', 'จัดกลุ่มสมรรถนะ'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
@Output() sendGroupShow: EventEmitter<string> = new EventEmitter<string>();
......@@ -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) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
......
......@@ -14,16 +14,16 @@
(click)="activeTab='underline-1';pathTitle = ['การประเมินสมรรถนะ', 'การจัดการรอบการประเมิน', 'รอบการประเมิน']">
รอบการประเมิน
</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"
aria-controls="underline-2"
(click)="activeTab='underline-2';pathTitle = ['การประเมินสมรรถนะ', 'การจัดการรอบการประเมิน', 'กำหนดฟอร์มเอกสาร']">
กำหนดฟอร์มเอกสาร
</a> -->
</a>
</nav>
</div>
<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>
</div>
<div id="underline-2" role="tabpanel" aria-labelledby="underline-item-2"
......
......@@ -9,12 +9,12 @@
{{numDataListChecked}} Selected</label>
</div>
<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">
<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>
</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>
......@@ -60,10 +60,10 @@
<thead class="height-50px">
<tr class="font-size-12px">
<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">
<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>
</div>
</th>
......@@ -93,6 +93,8 @@
<td class="text-center">
<input type="checkbox" class="ti-form-checkbox cursor-pointer"
id="checkbox-{{item.data.evaluationRoundId}}" [(ngModel)]="item.check" (ngModelChange)="dataListCheck()">
</td>
<td >
<label for="checkbox-{{item.data.evaluationRoundId}}">&nbsp;{{item.data.evaluationRoundId}}</label>
</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