Commit b68096c3 by Nattana Chaiyamat

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

parent 2af7bb7c
...@@ -5,7 +5,12 @@ import { EvaluationCycleService } from 'src/app/shared/services/evaluation-cycle ...@@ -5,7 +5,12 @@ import { EvaluationCycleService } from 'src/app/shared/services/evaluation-cycle
import { MyStatusCodeModel, StatusCodeModel } from 'src/app/shared/model/status-code.model'; import { MyStatusCodeModel, StatusCodeModel } from 'src/app/shared/model/status-code.model';
import { EvaluationAssessmentService } from 'src/app/shared/services/evaluation-assessment.service'; import { EvaluationAssessmentService } from 'src/app/shared/services/evaluation-assessment.service';
import { PLService } from 'src/app/shared/services/pl.service'; import { PLService } from 'src/app/shared/services/pl.service';
import { MyPLModel, PLModel } from 'src/app/shared/model/pl.model'; import { PLModel, MyPLModel } from 'src/app/shared/model/pl.model';
export interface DataModal {
search: string,
currentPage: number,
page: number[]
}
export interface DataModel { export interface DataModel {
evaluationRoundId: string; evaluationRoundId: string;
...@@ -16,11 +21,7 @@ export interface DataModel { ...@@ -16,11 +21,7 @@ export interface DataModel {
apsPeriodEnd: string; apsPeriodEnd: string;
statusCode: StatusCodeModel; statusCode: StatusCodeModel;
} }
export interface DataModal {
search: string,
currentPage: number,
page: number[]
}
@Component({ @Component({
selector: 'app-evaluation-cycle', selector: 'app-evaluation-cycle',
templateUrl: './evaluation-cycle.component.html', templateUrl: './evaluation-cycle.component.html',
...@@ -52,12 +53,13 @@ export class EvaluationCycleComponent { ...@@ -52,12 +53,13 @@ export class EvaluationCycleComponent {
page: Array.from({ length: 1 }, (_, i) => i + 1) page: Array.from({ length: 1 }, (_, i) => i + 1)
} }
pl: { loading: boolean, selectList: PLModel[], selectIndex: number, dataList: PLModel[] } = { loading: false, selectList: [new MyPLModel()], selectIndex: -1, dataList: [] } pl: { loading: boolean, selectList: PLModel[], selectIndex: number, dataList: PLModel[] } = { loading: false, selectList: [new MyPLModel()], selectIndex: -1, dataList: [] }
constructor(private evaluationCycleService: EvaluationCycleService, constructor(private evaluationCycleService: EvaluationCycleService,
private toastr: ToastrService, private toastr: ToastrService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
private renderer: Renderer2, private renderer: Renderer2,
private pLService: PLService private pLService: PLService
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
...@@ -250,11 +252,11 @@ export class EvaluationCycleComponent { ...@@ -250,11 +252,11 @@ export class EvaluationCycleComponent {
} }
} }
searchModalChange(dataList: any[]) { searchModalChange(dataList: any[]) {
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);
} }
} }
...@@ -9,6 +9,7 @@ export interface DataModal { ...@@ -9,6 +9,7 @@ export interface DataModal {
currentPage: number, currentPage: number,
page: number[] page: number[]
} }
@Component({ @Component({
selector: 'app-management-evaluation-cycle', selector: 'app-management-evaluation-cycle',
templateUrl: './management-evaluation-cycle.component.html', templateUrl: './management-evaluation-cycle.component.html',
...@@ -31,25 +32,38 @@ export class ManagementCycleComponent { ...@@ -31,25 +32,38 @@ export class ManagementCycleComponent {
isDataListChecked = false isDataListChecked = false
isDataListCheckedAll = false isDataListCheckedAll = false
numDataListChecked = 0 numDataListChecked = 0
evaluationRoundId = ''
private unlisten!: () => void;
modal: DataModal = { modal: DataModal = {
search: "", search: "",
currentPage: 1, currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1) page: Array.from({ length: 1 }, (_, i) => i + 1)
} }
pl: { loading: boolean, selectList: PLModel[], selectIndex: number, dataList: PLModel[] } = { loading: false, selectList: [new MyPLModel()], selectIndex: -1, dataList: [] } pl: { loading: boolean, selectList: PLModel[], selectIndex: number, dataList: PLModel[] } = { loading: false, selectList: [new MyPLModel()], selectIndex: -1, dataList: [] }
evaluationRoundId = ''
private unlisten!: () => void;
constructor(private pmsMasfromEvaluationCycleService: PmsMasfromEvaluationCycleService, constructor(private pmsMasfromEvaluationCycleService: PmsMasfromEvaluationCycleService,
private toastr: ToastrService, private toastr: ToastrService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
private pLService: PLService, private renderer: Renderer2,
private renderer: Renderer2 private pLService: PLService
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
this.getPmsMasfromEvaluationCycleList() this.getPmsMasfromEvaluationCycleList()
this.unlisten = this.renderer.listen('document', 'keydown', (event) => {
if (event.key === 'Escape') {
this.evaluationRoundId = ''
}
});
this.getPlList() this.getPlList()
} }
ngOnDestroy() {
if (this.unlisten) {
this.unlisten(); // เรียกใช้งานจริง ๆ เพื่อลบ event listener
}
}
getPlList() { getPlList() {
this.pl.loading = false this.pl.loading = false
...@@ -83,13 +97,9 @@ export class ManagementCycleComponent { ...@@ -83,13 +97,9 @@ export class ManagementCycleComponent {
if (this.pl.selectIndex === this.pl.selectList.length - 1) { if (this.pl.selectIndex === this.pl.selectList.length - 1) {
this.pl.selectList.push(new MyPLModel()); this.pl.selectList.push(new MyPLModel());
} }
this.unlisten = this.renderer.listen('document', 'keydown', (event) => {
if (event.key === 'Escape') {
this.evaluationRoundId = ''
}
});
} }
getPmsMasfromEvaluationCycleList() { getPmsMasfromEvaluationCycleList() {
this.dataLoading = true this.dataLoading = true
this.pmsMasfromEvaluationCycleService.getList().subscribe({ this.pmsMasfromEvaluationCycleService.getList().subscribe({
...@@ -201,11 +211,6 @@ export class ManagementCycleComponent { ...@@ -201,11 +211,6 @@ export class ManagementCycleComponent {
this.pl.selectList = [new MyPLModel()] this.pl.selectList = [new MyPLModel()]
} }
searchModalChange(dataList: any[]) {
this.modal.currentPage = 1
this.modal.page = Array.from({ length: Math.ceil(dataList.length / 10) }, (_, i) => i + 1);
}
openModal(id: string, evaluationRoundId: string) { openModal(id: string, evaluationRoundId: string) {
this.evaluationRoundId = '' this.evaluationRoundId = ''
if (id == 'evaluation-cycle-person-modal') { if (id == 'evaluation-cycle-person-modal') {
...@@ -218,6 +223,11 @@ export class ManagementCycleComponent { ...@@ -218,6 +223,11 @@ export class ManagementCycleComponent {
}, 10); }, 10);
} }
} }
searchModalChange(dataList: any[]) {
this.modal.currentPage = 1
this.modal.page = Array.from({ length: Math.ceil(dataList.length / 10) }, (_, i) => i + 1);
}
} }
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