Commit 9b4fec34 by Nattana Chaiyamat

compentency pms

parent a19d8b26
......@@ -129,7 +129,7 @@ export class EditGroupCompetenciesComponent {
dataListModalFilter() {
return this.dataListModal.filter(x => {
const data = x.data
if (this.dataList.some(y => y.data.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.expectation == data.competencyIndicatorsCourses0.expectation)) {
if (this.dataList.some(y => y.data.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId == data.competencyIndicatorsCourses0.competencyTopic.competencyTopicId)) {
return
}
const match = data.competencyIndicatorsCourses0.competencyTopic.competencyTopicId.toLowerCase().includes(this.searchModal.toLowerCase()) ||
......
<ng-container *ngIf="!typeTab">
<div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-between">
<div class="flex pr-2">
<div class="flex">
<div class="flex items-center">
<label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none">
{{numDataListChecked}} Selected</label>
</div>
<div class="mx-1 flex items-center">
<button (click)="dataListCheckAll()"
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" (click)="dataListCheckAll()">Select All</label>
</div>
<div class="flex">
<div class="flex items-center">
<input type="checkbox" class="ti-form-checkbox pointer-events-none" id="hs-default-checkbox"
[(ngModel)]="isDataListChecked">
<label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none">
{{numDataListChecked}} Selected</label>
</div>
<div class="mx-1 flex items-center">
<button (click)="isDataListCheckedAll = !isDataListCheckedAll;dataListCheckAll()"
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>
</div>
</div>
<div class="flex justify-end">
......@@ -156,7 +156,7 @@
data-hs-overlay="#grade-management-alert-delete-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
<a class="ti-btn ti-btn-danger" href="javascript:void(0);"
data-hs-overlay="#grade-management-alert-delete-modal"
(click)="deleteCompetencyGroupGradeList();">
ลบข้อมูล
......@@ -170,8 +170,8 @@
<ng-container *ngIf="typeTab">
<app-group-grade [dataSelect]="dataSelect" [typeTab]="typeTab"
(sendBackTab)="pathTitleChange($event)" (sendDataList)="dataList=$event"></app-group-grade>
<app-group-grade [dataSelect]="dataSelect" [typeTab]="typeTab" (sendBackTab)="pathTitleChange($event)"
(sendDataList)="dataList=$event"></app-group-grade>
</ng-container>
<!-- <ng-container *ngIf="editTab">
......
......@@ -22,8 +22,9 @@ export class GradeManagementComponent {
typeTab: "" | "add" | "edit" = "";
currentPage = 1;
page = Array.from({ length: 1 }, (_, i) => i + 1);
numDataListChecked = 0;
isDataListCheckedAll = false;
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
search = '';
dataList: DataModel[] = [];
......@@ -46,8 +47,10 @@ export class GradeManagementComponent {
this.competencyGroupGradeService.getList().subscribe({
next: response => {
this.dataList = response.map(x => ({ check: false, code: x.groupGradeId, tdesc: x.tdesc, edesc: x.edesc, competencyGrades: x.competencyGrades }))
this.dataLoading = false
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.searchChange()
this.dataLoading = false
this.cdr.detectChanges()
}, error: error => {
this.dataLoading = false
......@@ -76,33 +79,16 @@ export class GradeManagementComponent {
this.currentPage = 1;
const filteredData = this.dataListFilter();
this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
dataListFilter() {
return this.dataList.filter((x) => {
const match = x.code.toLowerCase().includes(this.search.toLowerCase()) || x.tdesc.toLowerCase().includes(this.search.toLowerCase()) || x.edesc.toLowerCase().includes(this.search.toLowerCase());
if (!match) x.check = false;
return match;
});
}
dataListCheck() {
const dataCheck = this.dataListFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every((x) => x.check) : false;
this.numDataListChecked = dataCheck.filter((x) => x.check).length;
}
dataListCheckAll() {
this.isDataListCheckedAll = !this.isDataListCheckedAll;
const selectAll = this.isDataListCheckedAll;
this.dataList = this.dataList.filter((x) => {
const match = x.code.toLowerCase().includes(this.search.toLowerCase()) || x.tdesc.toLowerCase().includes(this.search.toLowerCase()) || x.edesc.toLowerCase().includes(this.search.toLowerCase());
if (!match) x.check = false;
return match;
}).map((x) => ({ ...x, check: selectAll }));
this.dataListCheck();
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
......@@ -112,6 +98,7 @@ export class GradeManagementComponent {
deleteCompetencyGroupGradeList() {
const body = this.dataSelect.code ? new MyCompetencyGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc }) : this.dataList.filter(x => x.check).map(x => new MyCompetencyGroupGradeModel({ groupGradeId: x.code, tdesc: x.tdesc, edesc: x.edesc }))
this.dataLoading = true
this.competencyGroupGradeService.delete(body).subscribe({
next: response => {
if (response.success) {
......@@ -119,10 +106,27 @@ export class GradeManagementComponent {
this.getCompetencyGroupGradeList()
} else {
this.showAlert(response.message, 'error')
this.dataLoading = false
this.cdr.detectChanges()
}
}, error: error => {
this.showAlert(error.message, 'error')
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.dataListFilter().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.dataListFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.dataList.filter(x => x.check).length;
this.isDataListChecked = Boolean(this.numDataListChecked)
}
}
......@@ -14,8 +14,8 @@
<div class="flex justify-end">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-success h-10 m-0 shadow-md"
[ngClass]="{'ti-btn-disabled': !dataSelect.code}" data-hs-overlay="#add-group-grade-alert-add-modal"
[disabled]="!dataSelect.code">
[ngClass]="{'ti-btn-disabled': !dataSelect.code||!dataSelect.tdesc}"
data-hs-overlay="#add-group-grade-alert-add-modal" [disabled]="!dataSelect.code||!dataSelect.tdesc">
<i class="ri-save-3-line"></i>
Save
</button>
......@@ -65,8 +65,9 @@
<div class="pt-50px">
<div *ngIf="currentTab==1" id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1">
<div class="page px-rem">
<label for="input-label" class="ti-form-label">กำหนดรหัสกลุ่มเกรด</label>
<input type="text" id="input-label" class="ti-form-input w-1/4" [(ngModel)]="dataSelect.code">
<label for="input-label" class="ti-form-label">กำหนดรหัสกลุ่มเกรด*</label>
<input type="text" id="input-label" class="ti-form-input w-1/4" [readonly]="typeTab == 'edit'"
[class.bg-input-readonly]="typeTab == 'edit'" [(ngModel)]="dataSelect.code">
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)*</label>
<input type="text" id="detail_th" class="ti-form-input w-1/2" [(ngModel)]="dataSelect.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
......@@ -111,7 +112,7 @@
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#add-group-grade-alert-add-modal" (click)="postCompetencyGroupGrade()">
เพิ่มข้อมูล
บันทึกข้อมูล
</a>
</div>
</div>
......
......@@ -30,12 +30,19 @@ export class GroupGradeComponent implements OnInit {
this.dataOriginal = JSON.parse(JSON.stringify(this.dataSelect || { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }))
}
clear() {
this.dataSelect = JSON.parse(JSON.stringify(this.dataOriginal || { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }))
if (this.typeTab == 'add') {
this.dataSelect = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }
this.cdr.detectChanges()
} else if (this.typeTab == 'edit') {
this.dataSelect = { check: false, code: this.dataOriginal.code, tdesc: '', edesc: '', competencyGrades: [] }
this.cdr.detectChanges()
}
}
backTab() {
this.sendBackTab.emit();
}
postCompetencyGroupGrade() {
console.log(this.dataSelect)
this.competencyGroupGradeService.post(new MyCompetencyGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, competencyGrades: this.dataSelect.competencyGrades })).subscribe({
next: response => {
if (response.success) {
......
<div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-between">
<div class="flex pr-2">
<div class="flex">
<div class="flex items-center">
<label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none">
{{numDataListChecked}} Selected</label>
</div>
<div class="mx-1 flex items-center">
<button (click)="dataListCheckAll()"
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" (click)="dataListCheckAll()">Select All</label>
</div>
<div class="flex">
<div class="flex items-center">
<input type="checkbox" class="ti-form-checkbox pointer-events-none" id="hs-default-checkbox"
[(ngModel)]="isDataListChecked">
<label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none">
{{numDataListChecked}} Selected</label>
</div>
<div class="mx-1 flex items-center">
<button (click)="isDataListCheckedAll = !isDataListCheckedAll;dataListCheckAll()"
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>
</div>
</div>
<div class="flex justify-end">
......@@ -38,7 +38,7 @@
<div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-10 m-0 shadow-md"
data-hs-overlay="#sub-grade-registration-alert-delete-modal"
(click)="selectData();modalStatus='delete'">
(click)="selectData();modalStatus='deleteGroup'">
<i class="ri-delete-bin-6-line"></i>
Delete
</button>
......@@ -158,7 +158,7 @@
<div class="ti-modal-center">
<div class="flex justify-end" style="padding-right: 1rem;">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md" (click)="clear()">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
......@@ -220,9 +220,10 @@
<div class="w-1/2 pl-2">
<label class="ti-form-label">น้ำหนัก</label>
<div class="relative flex rounded-md">
<input type="number" id="hs-leading-button-add-on-with-icon-and-button"
<input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
oninput="this.value = this.value.replace(/\D/g, '')"
[(ngModel)]="competencyGrade.select.weight">
</div>
</div>
......@@ -231,18 +232,20 @@
<div class="w-1/2 pr-2">
<label class="ti-form-label">คะแนนต่ำสุด *</label>
<div class="relative flex rounded-md">
<input type="number" id="hs-leading-button-add-on-with-icon-and-button"
<input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
oninput="this.value = this.value.replace(/\D/g, '')"
[(ngModel)]="competencyGrade.select.gradeMinScore">
</div>
</div>
<div class="w-1/2 pl-2">
<label class="ti-form-label">คะแนนสูงสุด *</label>
<div class="relative flex rounded-md">
<input type="number" id="hs-leading-button-add-on-with-icon-and-button"
<input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
oninput="this.value = this.value.replace(/\D/g, '')"
[(ngModel)]="competencyGrade.select.gradeMaxScore">
</div>
</div>
......@@ -253,11 +256,12 @@
data-hs-overlay="#sub-grade-registration-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-grade-registration-alert-modal">
<button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#sub-grade-registration-alert-modal"
[class.ti-btn-disabled]="!competencyGrade.select.gradeId||!competencyGrade.select.tdesc||!competencyGrade.select.gradeDetail||checkNumberEmpty(competencyGrade.select.gradeMinScore)||checkNumberEmpty(competencyGrade.select.gradeMaxScore)"
[disabled]="!competencyGrade.select.gradeId||!competencyGrade.select.tdesc||!competencyGrade.select.gradeDetail||checkNumberEmpty(competencyGrade.select.gradeMinScore)||checkNumberEmpty(competencyGrade.select.gradeMaxScore)">
บันทึกข้อมูล
</a>
</button>
</div>
</div>
</div>
......@@ -325,7 +329,7 @@
data-hs-overlay="#sub-grade-registration-alert-delete-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
<a class="ti-btn ti-btn-danger" href="javascript:void(0);"
data-hs-overlay="#sub-grade-registration-alert-delete-modal"
(click)="updateCompetencyGroupGrade()">
ลบข้อมูล
......
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output, SimpleChanges } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { CompetencyGradeModel, MyCompetencyGradeModel } from 'src/app/shared/model/competency-grades.model';
import { MyCompetencyGroupGradeModel } from 'src/app/shared/model/competency-group-grade.model';
......@@ -23,10 +23,11 @@ export class SubGradeRegistrationComponent {
competencyGrade: { select: CompetencyGradeModel, dataList: { check: boolean, data: CompetencyGradeModel }[] } = { select: new MyCompetencyGradeModel({}), dataList: [] }
currentPage = 1;
page = Array.from({ length: 1 }, (_, i) => i + 1);
numDataListChecked = 0;
isDataListCheckedAll = false;
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
search = '';
modalStatus: 'add' | 'edit' | 'delete' = 'add'
modalStatus: 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add'
constructor(private toastr: ToastrService,
private competencyGroupGradeService: CompetencyGroupGradeService,
private cdr: ChangeDetectorRef
......@@ -36,10 +37,20 @@ export class SubGradeRegistrationComponent {
this.competencyGrade.dataList = this.dataSelect.competencyGrades.map(x => ({ check: false, data: x }))
this.searchChange()
}
ngOnChanges(changes: SimpleChanges): void {
if (changes) {
this.competencyGrade.dataList = changes['dataSelect'].currentValue.competencyGrades.map((x: CompetencyGradeModel) => ({ check: false, data: x }))
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.searchChange()
}
}
searchChange() {
this.currentPage = 1;
const filteredData = this.dataListFilter();
this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1);
this.dataListCheck();
}
selectData(data?: { check: boolean, data: CompetencyGradeModel }) {
......@@ -50,28 +61,22 @@ export class SubGradeRegistrationComponent {
return this.competencyGrade.dataList.filter((x) => {
const data = x.data
const match = data.gradeId.toLowerCase().includes(this.search.toLowerCase()) || data.tdesc.toLowerCase().includes(this.search.toLowerCase()) || data.edesc.toLowerCase().includes(this.search.toLowerCase());
if (!match) x.check = false;
return match;
});
}
dataListCheck() {
const dataCheck = this.dataListFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = dataCheck.filter((x) => x.check).length;
}
dataListCheckAll() {
this.isDataListCheckedAll = !this.isDataListCheckedAll;
const selectAll = this.isDataListCheckedAll;
this.competencyGrade.dataList = this.competencyGrade.dataList.filter((x) => {
const data = x.data
const match = data.gradeId.toLowerCase().includes(this.search.toLowerCase()) || data.tdesc.toLowerCase().includes(this.search.toLowerCase()) || data.edesc.toLowerCase().includes(this.search.toLowerCase());
if (!match) x.check = false;
return match;
}).map(x => ({ ...x, check: selectAll }));
this.dataListFilter().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.dataListFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.competencyGrade.dataList.filter(x => x.check).length;
this.isDataListChecked = Boolean(this.numDataListChecked)
}
updateCompetencyGroupGrade() {
switch (this.modalStatus) {
case 'add': {
......@@ -85,12 +90,17 @@ export class SubGradeRegistrationComponent {
break
}
case 'delete': {
this.competencyGrade.dataList = this.competencyGrade.select.gradeId ? this.competencyGrade.dataList.filter(x => x.data.gradeId != this.competencyGrade.select.gradeId) : this.competencyGrade.dataList.filter(x => !x.check)
this.competencyGrade.dataList = this.competencyGrade.dataList.filter(x => this.competencyGrade.select.gradeId != x.data.gradeId)
this.cdr.detectChanges()
break
}
case 'deleteGroup': {
this.competencyGrade.dataList = this.competencyGrade.dataList.filter(x => !x.check)
this.cdr.detectChanges()
break
}
}
this.sendDataSelect.emit({ ...this.dataSelect, competencyGrades: this.competencyGrade.dataList.map(x => x.data) })
this.sendDataSelect.emit({ ...this.dataSelect, competencyGrades: this.competencyGrade.dataList.map(x => ({ ...x.data, weight: +(x.data.weight || '0'), gradeMinScore: +(x.data.gradeMinScore || '0'), gradeMaxScore: +(x.data.gradeMaxScore || '0') })) })
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
......@@ -99,5 +109,24 @@ export class SubGradeRegistrationComponent {
});
}
clear() {
if (this.modalStatus == 'add') {
this.competencyGrade.select = new MyCompetencyGradeModel({})
} else if (this.modalStatus == 'edit') {
this.competencyGrade.select = new MyCompetencyGradeModel({ gradeId: this.competencyGrade.select.gradeId })
}
}
checkNumberEmpty(data: any) {
if (typeof (data) == 'number') {
if (data == 0) {
return false
}
} else {
if (data == null || data == undefined || data == "") {
return true
}
}
return false
}
}
......@@ -7,5 +7,4 @@ import { Component } from '@angular/core';
})
export class GradeRegistrationComponent {
pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนเกรด','การจัดการเกรด']
groupShow = '1'
}
......@@ -8,14 +8,13 @@
<div class="page pt-0.75rem">
<div class="border-b border-gray-200 dark:border-white/10 px-2rem">
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse">
<a class="text-base font-medium hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active"
<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 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary active"
href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1"
(click)="activeTab='underline-1';pathTitle = ['การประเมินจัดการประสิทธิภาพ','รอบประเมิน','รอบการประเมิน']">
รอบการประเมิน
</a>
<!-- <a class="text-base font-medium hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 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 = ['การประเมินจัดการประสิทธิภาพ','รอบประเมิน','กำหนดฟอร์มเอกสาร']">
......@@ -23,7 +22,7 @@
</a> -->
</nav>
</div>
<div class="px-2rem pt-50px">
<div class="px-2rem" [ngClass]="{'pt-50px': groupShow !== '2'}">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1"
*ngIf="activeTab === 'underline-1'">
<app-management-evaluation-cycle></app-management-evaluation-cycle>
......@@ -35,7 +34,6 @@
<app-edit-evaluation-form *ngIf="groupShow=='2'" [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event" (sendGroupShow)="groupShow=$event"></app-edit-evaluation-form>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { EvaluationCycleModel, MyEvaluationCycleModel } from 'src/app/shared/model/evaluation-cycle.model';
import { MyStatusCodeModel, StatusCodeModel } from 'src/app/shared/model/status-code.model';
import { EvaluationCycleService } from 'src/app/shared/services/evaluation-cycle.service';
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-management-evaluation-cycle',
templateUrl: './management-evaluation-cycle.component.html',
styleUrls: ['./management-evaluation-cycle.component.scss']
})
export class ManagementCycleComponent {
apsPeriodStart: string = '';
apsPeriodEnd: string = '';
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
numDataListChecked = 0
modalStatus = 'add'
evaluation_cyclelist: { check: boolean, data: DataModel }[] = []
evaluation_cycle: EvaluationCycleModel = new MyEvaluationCycleModel({})
dataLoading = false
dataSelect: DataModel = { evaluationRoundId: "", tdesc: "", edesc: "", apsyear: "", apsPeriodStart: "", apsPeriodEnd: "", statusCode: new MyStatusCodeModel({}) }
itemToDelete: EvaluationCycleModel | null = null;
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"
},
{
check: false,
code: "Y67P1",
period: "ช่วงเวลาที่ 1",
year: "2567",
startDate: "01-01-2567",
endDate: "30-06-2567",
status: "3"
}
]
numDataListChecked = 0
dataSelect: DataModel = {
check: false,
code: "",
period: "",
year: "",
startDate: "",
endDate: "",
status: "",
}
modalStatus: "add" | "edit" = "add"
constructor(private cdr: ChangeDetectorRef) {
}
constructor(private evaluationCycleService: EvaluationCycleService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
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.dataLoading = true
this.evaluationCycleService.getList().subscribe({
next: response => {
this.evaluation_cyclelist = response.map(x => ({
check: false,
data: {
evaluationRoundId: x.evaluationRoundId,
tdesc: x.tdesc,
edesc: x.edesc,
apsyear: x.apsyear,
apsPeriodStart: x.apsPeriodStart,
apsPeriodEnd: x.apsPeriodEnd,
statusCode: new MyStatusCodeModel(x.statusCode || {})
}
}));
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;
this.dataLoading = false
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.searchChange();
this.cdr.detectChanges();
},
error: err => {
this.dataLoading = false
this.cdr.detectChanges();
}
});
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.dataList.forEach(x => x.check = selectAll);
this.evaluation_cycleListFilter().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.evaluation_cycleListFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.evaluation_cyclelist.filter(x => x.check).length;
this.isDataListChecked = Boolean(this.numDataListChecked)
}
searchChange() {
this.currentPage = 1;
const filteredData = this.dataListFilter();
this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1);
this.dataListCheck();
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.evaluation_cycleListFilter().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
evaluation_cycleListFilter() {
return this.evaluation_cyclelist.filter(x => {
const data = x.data
const match = data.evaluationRoundId.toLowerCase().includes(this.search.toLowerCase()) || data.tdesc.toLowerCase().includes(this.search.toLowerCase()) || data.edesc.toLowerCase().includes(this.search.toLowerCase());
return match;
});
}
setData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || {
evaluationRoundId: "",
tdesc: "",
edesc: "",
apsyear: "",
apsPeriodStart: "",
apsPeriodEnd: "",
statusCode: new MyStatusCodeModel({})
}));
}
addevaluation_cycle() {
const body = new MyEvaluationCycleModel({ evaluationRoundId: this.dataSelect.evaluationRoundId, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, apsyear: this.dataSelect.apsyear, apsPeriodStart: this.dataSelect.apsPeriodStart, apsPeriodEnd: this.dataSelect.apsPeriodEnd, statusCode: this.dataSelect.statusCode })
this.dataLoading = true
this.evaluationCycleService.post(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getEvaluationCycleList()
} else {
this.dataLoading = false
this.showAlert(response.message, 'error')
this.cdr.detectChanges()
}
}, error: error => {
this.showAlert(error.message, 'error')
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
deleteevaluation_cycle() {
let body: EvaluationCycleModel | EvaluationCycleModel[] = []
if (this.dataSelect.evaluationRoundId) {
body = new MyEvaluationCycleModel({ evaluationRoundId: this.dataSelect.evaluationRoundId, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, apsyear: this.dataSelect.apsyear, apsPeriodStart: this.dataSelect.apsPeriodStart, apsPeriodEnd: this.dataSelect.apsPeriodEnd, statusCode: this.dataSelect.statusCode })
} else {
body = this.evaluation_cyclelist.filter(x => x.check).map(x => new MyEvaluationCycleModel({ evaluationRoundId: x.data.evaluationRoundId, tdesc: x.data.tdesc, edesc: x.data.edesc, apsyear: x.data.apsyear, apsPeriodStart: x.data.apsPeriodStart, apsPeriodEnd: x.data.apsPeriodEnd, statusCode: x.data.statusCode }))
}
this.dataLoading = true
this.evaluationCycleService.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getEvaluationCycleList()
} else {
this.dataLoading = false
this.showAlert(response.message, 'error')
this.dataLoading = false
this.cdr.detectChanges()
}
}, error: error => {
this.showAlert(error.message, 'error')
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
}
......@@ -62,21 +62,29 @@
</ng-container>
</tr>
</thead>
<tbody *ngIf="!dataListFilter().length">
<tbody *ngIf="data.loading">
<tr>
<td class="text-center" colspan="100%">
<div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
aria-label="loading">
<span class="sr-only">Loading...</span>
</div>
</td>
</tr>
</tbody>
<tbody *ngIf="!data.loading&&!dataListFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="dataListFilter().length">
<tbody *ngIf="!data.loading&&dataListFilter().length">
<tr
*ngFor="let item of dataListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="flex justify-center items-center">
<span>
{{item.employee }}
</span>
</td>
<td>
......@@ -133,5 +141,10 @@
</a>
</li>
</ul>
<ul class="nav-tabs mt-3">
<span>Show {{((currentPage-1) * 10)+1}} to {{dataListFilter().length<10 ?dataListFilter().length:
(currentPage==page.length ? ((currentPage * 10) - ((currentPage * 10) - dataListFilter().length) )
:(currentPage * 10) ) }} of {{dataListFilter().length}} items</span>
</ul>
</nav>
</div>
\ No newline at end of file
......@@ -20,91 +20,93 @@ export class DefineEvaluationFactorsComponent {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
dataList: DataModel[] = [
{
"employee": "01-02",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "03-04",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "S1-S2",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "S3-S4",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "M1-M2",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "M3-M4",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "E1-E2",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "E3-E4",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
}
]
data: { loading: boolean, dataList: DataModel[] } = {
loading: false, dataList: [
{
"employee": "01-02",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "03-04",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "S1-S2",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "S3-S4",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "M1-M2",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "M3-M4",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "E1-E2",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
},
{
"employee": "E3-E4",
"hoshin": "0",
"kpi": "0",
"competency": "0",
"time_attendance": "0",
"cross_functional": "0",
"special_activities": "0",
"total": "100"
}
]
}
dataListFilter() {
return this.dataList.filter(x => x.employee.includes(this.search))
return this.data.dataList.filter(x => x.employee.toLowerCase().includes(this.search.toLowerCase()))
}
searchChange() {
......
.button-clear {
position: absolute;
top: 96px;
z-index: 1;
right: 41vw;
}
.button-help {
position: absolute;
top: 0px;
z-index: 1;
right: 0vw;
margin: 4.2rem;
margin-right: 10px; /* เพิ่มใหม่ 12/16*/
}
a.custom-link {
padding: 10px 40px; /* ปรับ padding ให้เพิ่มขนาด */
}
/* สไตล์ของแถบเมนู */
.nav-tabs {
display: flex;
width: 100%;
cursor: pointer;
margin-bottom: 10px;
height: 20%;
}
.nav-item {
list-style: none;
margin-right: 10px; /* ช่องว่างระหว่างเมนู */
}
.nav-link {
text-decoration: none;
padding: 10px 20px;
display: inline-block;
font-size: large;
border-width: 2px 2px 0px 2px;
border-style: solid;
border-color: #ccc;
border-radius: 5px 5px 0px 0px;
}
.nav-link:hover {
background-color: #f0f0f0; /* เปลี่ยนสีเมื่อ hover */
}
.nav-link.active {
color: #ffffff; /* สีตัวอักษรในสถานะ active */
font-size: large;
border-bottom: 3.5px solid rgb(var(--color-primary)); /* เส้นใต้ */
background-color: rgb(var(--color-primary));
border-width: 2px 2px 0px 2px;
border-style: solid;
border-color: rgb(var(--color-primary));
border-radius: 5px 5px 0px 0px;
}
.tab-content {
margin-top: 20px;
}
.tab-pane.active {
display: block;
}
.nav-item-text {
list-style: none;
margin-right: 10px; /* ช่องว่างระหว่างเมนู */
}
.nav-link-text {
text-decoration: none;
display: inline-block;
font-size: large;
color: #569bf5;
border-bottom: 2px solid #569bf5;
line-height: 0.8;
}
.ti-pagination .page-link.active {
background-color: #569bf5;
color: white;
border-radius: 50%;
padding: 8px 12px;
}
.box-body{
padding: 0rem;
}
.page{
min-height: 0vh;
}
.ti-modal-content-alert{
width: 35%; /* ความกว้างที่คุณต้องการ */
position: absolute; /* ทำให้สามารถจัดตำแหน่งได้ */
top: 50%; /* ให้อยู่กลางในแนวตั้ง */
left: 50%; /* ให้อยู่กลางในแนวนอน */
transform: translate(-50%, -50%); /* เคลื่อนที่ modal กลับมาให้ตรงกลาง */
background-color: #ffffff;
}
.header-title-type {
width: 100%;
min-height: 50px; /* ใช้ min-height เพื่อให้มีความยืดหยุ่น */
justify-content: space-between; /* จัดเรียงองค์ประกอบภายใน */
align-items: center; /* จัดกลางแนวตั้ง */
padding-top: 50px;
padding-bottom: 1rem;
}
.body-content{
margin-bottom: 30px;
height: 100%;
width: 100%;
}
table {
width: 50%;
border-collapse: collapse;
border: 1px solid black;
}
th{
font-weight: bold;
}
th, td {
border: 1px solid black; /* เส้นขอบของเซลล์ */
padding: 15px;
text-align: center;
}
th:first-child{
width: 125px;
font-size: 18px;
}
td{
padding-top: 8px;
padding-bottom: 8px;
}
td:first-child{
font-size: 18px;
font-weight: bold;
}
td span {
display: inline-block; /*span มีลักษณะเป็นกรอบ */
padding: 5px 10px;
border: 1px solid black;
border-radius: 10px;
background-color: #f9f9f9;
width: 60px;
}
input[type="radio"]:checked {
background-color: #569BF5;
border-color: #569BF5;
}
\ No newline at end of file
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { SettingAssessmentModel, MySettingAssessmentModel } from 'src/app/shared/model/setting-assessment.model';
import { SettingAssessmentService } from 'src/app/shared/services/setting-assessment.service';
@Component({
selector: 'app-assessment-system-configuration',
templateUrl: './assessment-system-configuration.component.html',
styleUrls: ['./assessment-system-configuration.component.scss']
selector: 'app-assessment-system-configuration',
templateUrl: './assessment-system-configuration.component.html',
styleUrls: ['./assessment-system-configuration.component.scss']
})
export class AssessmentSystemConfigurationComponent {
@Input() pathTitle = ['การประเมินจัดการประสิทธิภาพ', 'การตั้งค่า', 'กำหนดค่าระบบการประเมิน'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
isChecked: boolean = false;
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินจัดการประสิทธิภาพ', 'การตั้งค่า', tab.text]);
this.activeTab = tab.id;
}
toggleCheckbox(): void {
this.isChecked = !this.isChecked;
}
// การจัดการการเปิดปิด modal
modalOptions: {
[nameModal: string]: {
isModalOpen: boolean;
modalSize: string;
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
this.currentModal = name; // ตั้งค่าค่าของ currentModal เป็น 'add' หรือ 'edit'
document.body.style.overflow = 'hidden';
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
}
isAnyModalOpen(): boolean {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
}
currentModal = ""
constructor(private toastr: ToastrService) { }
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
setting: { loading: boolean, data: SettingAssessmentModel } = { loading: false, data: new MySettingAssessmentModel() }
constructor(private settingAssessmentService: SettingAssessmentService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getSettingList()
}
getSettingList() {
this.setting.loading = true
this.settingAssessmentService.get().subscribe({
next: response => {
this.setting.data = new MySettingAssessmentModel(response)
this.setting.loading = false
this.cdr.detectChanges()
}, error: error => {
this.setting.loading = false
this.cdr.detectChanges()
}
})
}
saveSetting() {
this.setting.loading = true
// this.settingAssessmentService.post(new MySettingAssessmentModel({ ...this.setting.data, expectationLevel: +(this.setting.data.expectationLevel) })).subscribe({
// next: response => {
// if (response.success) {
// this.showAlert(response.message, 'success')
// this.getSettingList()
// } else {
// this.showAlert(response.message, 'error')
// this.setting.loading = false
// this.cdr.detectChanges()
// }
// }, error: error => {
// this.showAlert(error.message, 'error')
// this.setting.loading = false
// this.cdr.detectChanges()
// }
// })
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
})
}
}
}
\ No newline at end of file
......@@ -10,15 +10,15 @@
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse">
<a class="text-base font-medium hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active"
href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1" (click)="pathTitle = ['การประเมินจัดการประสิทธิภาพ','การตั้งค่า','กำหนดค่าระบบการประเมิน']">
aria-controls="underline-1"
(click)="pathTitle = ['การประเมินจัดการประสิทธิภาพ','การตั้งค่า','กำหนดค่าระบบการประเมิน']">
กำหนดค่าระบบการประเมิน
</a>
</nav>
</div>
<div class="mt-3 px-3rem">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-assessment-system-configuration [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event"></app-assessment-system-configuration>
<app-assessment-system-configuration></app-assessment-system-configuration>
</div>
</div>
</div>
......
......@@ -17,15 +17,15 @@ export class MyCompetencyGradeModel implements CompetencyGradeModel {
gradeMaxScore: number
gradeMinScore: number
weight: number
constructor(data: Partial<CompetencyGradeModel>) {
this.gradeId = data.gradeId || ""
this.companyId = data.companyId || ""
this.edesc = data.edesc || ""
this.tdesc = data.tdesc || ""
this.gradeDetail = data.gradeDetail || ""
this.gradeMaxScore = data.gradeMaxScore ?? 0
this.gradeMinScore = data.gradeMinScore ?? 0
this.weight = data.weight ?? 0
constructor(data?: Partial<CompetencyGradeModel>) {
this.gradeId = data?.gradeId || ""
this.companyId = data?.companyId || ""
this.edesc = data?.edesc || ""
this.tdesc = data?.tdesc || ""
this.gradeDetail = data?.gradeDetail || ""
this.gradeMaxScore = data?.gradeMaxScore ?? 0
this.gradeMinScore = data?.gradeMinScore ?? 0
this.weight = data?.weight ?? 0
}
}
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