Commit 9b4fec34 by Nattana Chaiyamat

compentency pms

parent a19d8b26
...@@ -129,7 +129,7 @@ export class EditGroupCompetenciesComponent { ...@@ -129,7 +129,7 @@ export class EditGroupCompetenciesComponent {
dataListModalFilter() { dataListModalFilter() {
return this.dataListModal.filter(x => { return this.dataListModal.filter(x => {
const data = x.data 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 return
} }
const match = data.competencyIndicatorsCourses0.competencyTopic.competencyTopicId.toLowerCase().includes(this.searchModal.toLowerCase()) || const match = data.competencyIndicatorsCourses0.competencyTopic.competencyTopicId.toLowerCase().includes(this.searchModal.toLowerCase()) ||
......
<ng-container *ngIf="!typeTab"> <ng-container *ngIf="!typeTab">
<div class="w-full min-height-50px mb-10px justify-between items-center"> <div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-between"> <div class="flex justify-between">
<div class="flex pr-2"> <div class="flex">
<div class="flex"> <div class="flex items-center">
<div class="flex items-center"> <input type="checkbox" class="ti-form-checkbox pointer-events-none" id="hs-default-checkbox"
<label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none"> [(ngModel)]="isDataListChecked">
{{numDataListChecked}} Selected</label> <label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none">
</div> {{numDataListChecked}} Selected</label>
<div class="mx-1 flex items-center"> </div>
<button (click)="dataListCheckAll()" <div class="mx-1 flex items-center">
class="focus:ring-2 focus:ring-primary rounded-sm flex item-center"> <button (click)="isDataListCheckedAll = !isDataListCheckedAll;dataListCheckAll()"
<i class="fs-l transition-all duration-200" class="focus:ring-2 focus:ring-primary rounded-sm flex item-center">
[ngClass]="{'ri-checkbox-multiple-line text-gray-500': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i> <i class="fs-l transition-all duration-200"
</button> [ngClass]="{'ri-checkbox-multiple-line text-gray-500': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i>
<label class="text-sm text-gray-500 ml-2" (click)="dataListCheckAll()">Select All</label> </button>
</div> <label class="text-sm text-gray-500 ml-2">Select All</label>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex justify-end">
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
data-hs-overlay="#grade-management-alert-delete-modal"> data-hs-overlay="#grade-management-alert-delete-modal">
ย้อนกลับ ย้อนกลับ
</button> </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" data-hs-overlay="#grade-management-alert-delete-modal"
(click)="deleteCompetencyGroupGradeList();"> (click)="deleteCompetencyGroupGradeList();">
ลบข้อมูล ลบข้อมูล
...@@ -170,8 +170,8 @@ ...@@ -170,8 +170,8 @@
<ng-container *ngIf="typeTab"> <ng-container *ngIf="typeTab">
<app-group-grade [dataSelect]="dataSelect" [typeTab]="typeTab" <app-group-grade [dataSelect]="dataSelect" [typeTab]="typeTab" (sendBackTab)="pathTitleChange($event)"
(sendBackTab)="pathTitleChange($event)" (sendDataList)="dataList=$event"></app-group-grade> (sendDataList)="dataList=$event"></app-group-grade>
</ng-container> </ng-container>
<!-- <ng-container *ngIf="editTab"> <!-- <ng-container *ngIf="editTab">
......
...@@ -22,8 +22,9 @@ export class GradeManagementComponent { ...@@ -22,8 +22,9 @@ export class GradeManagementComponent {
typeTab: "" | "add" | "edit" = ""; typeTab: "" | "add" | "edit" = "";
currentPage = 1; currentPage = 1;
page = Array.from({ length: 1 }, (_, i) => i + 1); page = Array.from({ length: 1 }, (_, i) => i + 1);
numDataListChecked = 0; numDataListChecked = 0
isDataListCheckedAll = false; isDataListChecked = false
isDataListCheckedAll = false
search = ''; search = '';
dataList: DataModel[] = []; dataList: DataModel[] = [];
...@@ -46,8 +47,10 @@ export class GradeManagementComponent { ...@@ -46,8 +47,10 @@ export class GradeManagementComponent {
this.competencyGroupGradeService.getList().subscribe({ this.competencyGroupGradeService.getList().subscribe({
next: response => { next: response => {
this.dataList = response.map(x => ({ check: false, code: x.groupGradeId, tdesc: x.tdesc, edesc: x.edesc, competencyGrades: x.competencyGrades })) 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.searchChange()
this.dataLoading = false
this.cdr.detectChanges() this.cdr.detectChanges()
}, error: error => { }, error: error => {
this.dataLoading = false this.dataLoading = false
...@@ -76,33 +79,16 @@ export class GradeManagementComponent { ...@@ -76,33 +79,16 @@ export class GradeManagementComponent {
this.currentPage = 1; this.currentPage = 1;
const filteredData = this.dataListFilter(); const filteredData = this.dataListFilter();
this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1); this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1);
this.dataListCheck()
} }
dataListFilter() { dataListFilter() {
return this.dataList.filter((x) => { 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()); 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; 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') { showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', { this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000, timeOut: 3000,
...@@ -112,6 +98,7 @@ export class GradeManagementComponent { ...@@ -112,6 +98,7 @@ export class GradeManagementComponent {
deleteCompetencyGroupGradeList() { 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 })) 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({ this.competencyGroupGradeService.delete(body).subscribe({
next: response => { next: response => {
if (response.success) { if (response.success) {
...@@ -119,10 +106,27 @@ export class GradeManagementComponent { ...@@ -119,10 +106,27 @@ export class GradeManagementComponent {
this.getCompetencyGroupGradeList() this.getCompetencyGroupGradeList()
} else { } else {
this.showAlert(response.message, 'error') this.showAlert(response.message, 'error')
this.dataLoading = false
this.cdr.detectChanges()
} }
}, error: error => { }, error: error => {
this.showAlert(error.message, '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 @@ ...@@ -14,8 +14,8 @@
<div class="flex justify-end"> <div class="flex justify-end">
<div class="px-1"> <div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-success h-10 m-0 shadow-md" <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" [ngClass]="{'ti-btn-disabled': !dataSelect.code||!dataSelect.tdesc}"
[disabled]="!dataSelect.code"> data-hs-overlay="#add-group-grade-alert-add-modal" [disabled]="!dataSelect.code||!dataSelect.tdesc">
<i class="ri-save-3-line"></i> <i class="ri-save-3-line"></i>
Save Save
</button> </button>
...@@ -65,8 +65,9 @@ ...@@ -65,8 +65,9 @@
<div class="pt-50px"> <div class="pt-50px">
<div *ngIf="currentTab==1" id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1"> <div *ngIf="currentTab==1" id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1">
<div class="page px-rem"> <div class="page px-rem">
<label for="input-label" class="ti-form-label">กำหนดรหัสกลุ่มเกรด</label> <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"> <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> <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"> <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> <label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
...@@ -111,7 +112,7 @@ ...@@ -111,7 +112,7 @@
</button> </button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);" <a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#add-group-grade-alert-add-modal" (click)="postCompetencyGroupGrade()"> data-hs-overlay="#add-group-grade-alert-add-modal" (click)="postCompetencyGroupGrade()">
เพิ่มข้อมูล บันทึกข้อมูล
</a> </a>
</div> </div>
</div> </div>
......
...@@ -30,12 +30,19 @@ export class GroupGradeComponent implements OnInit { ...@@ -30,12 +30,19 @@ export class GroupGradeComponent implements OnInit {
this.dataOriginal = JSON.parse(JSON.stringify(this.dataSelect || { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] })) this.dataOriginal = JSON.parse(JSON.stringify(this.dataSelect || { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }))
} }
clear() { 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() { backTab() {
this.sendBackTab.emit(); this.sendBackTab.emit();
} }
postCompetencyGroupGrade() { 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({ this.competencyGroupGradeService.post(new MyCompetencyGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, competencyGrades: this.dataSelect.competencyGrades })).subscribe({
next: response => { next: response => {
if (response.success) { if (response.success) {
......
<div class="w-full min-height-50px mb-10px justify-between items-center"> <div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-between"> <div class="flex justify-between">
<div class="flex pr-2"> <div class="flex">
<div class="flex"> <div class="flex items-center">
<div class="flex items-center"> <input type="checkbox" class="ti-form-checkbox pointer-events-none" id="hs-default-checkbox"
<label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none"> [(ngModel)]="isDataListChecked">
{{numDataListChecked}} Selected</label> <label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none">
</div> {{numDataListChecked}} Selected</label>
<div class="mx-1 flex items-center"> </div>
<button (click)="dataListCheckAll()" <div class="mx-1 flex items-center">
class="focus:ring-2 focus:ring-primary rounded-sm flex item-center"> <button (click)="isDataListCheckedAll = !isDataListCheckedAll;dataListCheckAll()"
<i class="fs-l transition-all duration-200" class="focus:ring-2 focus:ring-primary rounded-sm flex item-center">
[ngClass]="{'ri-checkbox-multiple-line text-gray-500': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i> <i class="fs-l transition-all duration-200"
</button> [ngClass]="{'ri-checkbox-multiple-line text-gray-500': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i>
<label class="text-sm text-gray-500 ml-2" (click)="dataListCheckAll()">Select All</label> </button>
</div> <label class="text-sm text-gray-500 ml-2">Select All</label>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex justify-end">
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<div class="px-1"> <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-10 m-0 shadow-md" <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" 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> <i class="ri-delete-bin-6-line"></i>
Delete Delete
</button> </button>
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
<div class="ti-modal-center"> <div class="ti-modal-center">
<div class="flex justify-end" style="padding-right: 1rem;"> <div class="flex justify-end" style="padding-right: 1rem;">
<div class="px-1"> <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" <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" 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)"> transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
...@@ -220,9 +220,10 @@ ...@@ -220,9 +220,10 @@
<div class="w-1/2 pl-2"> <div class="w-1/2 pl-2">
<label class="ti-form-label">น้ำหนัก</label> <label class="ti-form-label">น้ำหนัก</label>
<div class="relative flex rounded-md"> <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" 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" 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"> [(ngModel)]="competencyGrade.select.weight">
</div> </div>
</div> </div>
...@@ -231,18 +232,20 @@ ...@@ -231,18 +232,20 @@
<div class="w-1/2 pr-2"> <div class="w-1/2 pr-2">
<label class="ti-form-label">คะแนนต่ำสุด *</label> <label class="ti-form-label">คะแนนต่ำสุด *</label>
<div class="relative flex rounded-md"> <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" 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" 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"> [(ngModel)]="competencyGrade.select.gradeMinScore">
</div> </div>
</div> </div>
<div class="w-1/2 pl-2"> <div class="w-1/2 pl-2">
<label class="ti-form-label">คะแนนสูงสุด *</label> <label class="ti-form-label">คะแนนสูงสุด *</label>
<div class="relative flex rounded-md"> <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" 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" 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"> [(ngModel)]="competencyGrade.select.gradeMaxScore">
</div> </div>
</div> </div>
...@@ -253,11 +256,12 @@ ...@@ -253,11 +256,12 @@
data-hs-overlay="#sub-grade-registration-modal"> data-hs-overlay="#sub-grade-registration-modal">
ย้อนกลับ ย้อนกลับ
</button> </button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);" <button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#sub-grade-registration-alert-modal"> 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> </div>
</div> </div>
...@@ -325,7 +329,7 @@ ...@@ -325,7 +329,7 @@
data-hs-overlay="#sub-grade-registration-alert-delete-modal"> data-hs-overlay="#sub-grade-registration-alert-delete-modal">
ย้อนกลับ ย้อนกลับ
</button> </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" data-hs-overlay="#sub-grade-registration-alert-delete-modal"
(click)="updateCompetencyGroupGrade()"> (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 { ToastrService } from 'ngx-toastr';
import { CompetencyGradeModel, MyCompetencyGradeModel } from 'src/app/shared/model/competency-grades.model'; import { CompetencyGradeModel, MyCompetencyGradeModel } from 'src/app/shared/model/competency-grades.model';
import { MyCompetencyGroupGradeModel } from 'src/app/shared/model/competency-group-grade.model'; import { MyCompetencyGroupGradeModel } from 'src/app/shared/model/competency-group-grade.model';
...@@ -23,10 +23,11 @@ export class SubGradeRegistrationComponent { ...@@ -23,10 +23,11 @@ export class SubGradeRegistrationComponent {
competencyGrade: { select: CompetencyGradeModel, dataList: { check: boolean, data: CompetencyGradeModel }[] } = { select: new MyCompetencyGradeModel({}), dataList: [] } competencyGrade: { select: CompetencyGradeModel, dataList: { check: boolean, data: CompetencyGradeModel }[] } = { select: new MyCompetencyGradeModel({}), dataList: [] }
currentPage = 1; currentPage = 1;
page = Array.from({ length: 1 }, (_, i) => i + 1); page = Array.from({ length: 1 }, (_, i) => i + 1);
numDataListChecked = 0; numDataListChecked = 0
isDataListCheckedAll = false; isDataListChecked = false
isDataListCheckedAll = false
search = ''; search = '';
modalStatus: 'add' | 'edit' | 'delete' = 'add' modalStatus: 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add'
constructor(private toastr: ToastrService, constructor(private toastr: ToastrService,
private competencyGroupGradeService: CompetencyGroupGradeService, private competencyGroupGradeService: CompetencyGroupGradeService,
private cdr: ChangeDetectorRef private cdr: ChangeDetectorRef
...@@ -36,10 +37,20 @@ export class SubGradeRegistrationComponent { ...@@ -36,10 +37,20 @@ export class SubGradeRegistrationComponent {
this.competencyGrade.dataList = this.dataSelect.competencyGrades.map(x => ({ check: false, data: x })) this.competencyGrade.dataList = this.dataSelect.competencyGrades.map(x => ({ check: false, data: x }))
this.searchChange() 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() { searchChange() {
this.currentPage = 1; this.currentPage = 1;
const filteredData = this.dataListFilter(); const filteredData = this.dataListFilter();
this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1); this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1);
this.dataListCheck();
} }
selectData(data?: { check: boolean, data: CompetencyGradeModel }) { selectData(data?: { check: boolean, data: CompetencyGradeModel }) {
...@@ -50,28 +61,22 @@ export class SubGradeRegistrationComponent { ...@@ -50,28 +61,22 @@ export class SubGradeRegistrationComponent {
return this.competencyGrade.dataList.filter((x) => { return this.competencyGrade.dataList.filter((x) => {
const data = x.data 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()); 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; 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() { dataListCheckAll() {
this.isDataListCheckedAll = !this.isDataListCheckedAll;
const selectAll = this.isDataListCheckedAll; const selectAll = this.isDataListCheckedAll;
this.competencyGrade.dataList = this.competencyGrade.dataList.filter((x) => { this.dataListFilter().forEach(x => x.check = selectAll);
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.dataListCheck(); 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() { updateCompetencyGroupGrade() {
switch (this.modalStatus) { switch (this.modalStatus) {
case 'add': { case 'add': {
...@@ -85,12 +90,17 @@ export class SubGradeRegistrationComponent { ...@@ -85,12 +90,17 @@ export class SubGradeRegistrationComponent {
break break
} }
case 'delete': { 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() this.cdr.detectChanges()
break 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') { showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', { this.toastr[type](text, 'แจ้งเตือน', {
...@@ -99,5 +109,24 @@ export class SubGradeRegistrationComponent { ...@@ -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'; ...@@ -7,5 +7,4 @@ import { Component } from '@angular/core';
}) })
export class GradeRegistrationComponent { export class GradeRegistrationComponent {
pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนเกรด','การจัดการเกรด'] pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนเกรด','การจัดการเกรด']
groupShow = '1'
} }
...@@ -8,14 +8,13 @@ ...@@ -8,14 +8,13 @@
<div class="page pt-0.75rem"> <div class="page pt-0.75rem">
<div class="border-b border-gray-200 dark:border-white/10 px-2rem"> <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"> <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" href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1" aria-controls="underline-1"
(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="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"
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 = ['การประเมินจัดการประสิทธิภาพ','รอบประเมิน','กำหนดฟอร์มเอกสาร']">
...@@ -23,7 +22,7 @@ ...@@ -23,7 +22,7 @@
</a> --> </a> -->
</nav> </nav>
</div> </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" <div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1"
*ngIf="activeTab === 'underline-1'"> *ngIf="activeTab === 'underline-1'">
<app-management-evaluation-cycle></app-management-evaluation-cycle> <app-management-evaluation-cycle></app-management-evaluation-cycle>
...@@ -35,7 +34,6 @@ ...@@ -35,7 +34,6 @@
<app-edit-evaluation-form *ngIf="groupShow=='2'" [pathTitle]="pathTitle" <app-edit-evaluation-form *ngIf="groupShow=='2'" [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event" (sendGroupShow)="groupShow=$event"></app-edit-evaluation-form> (sendPathTitle)="pathTitle=$event" (sendGroupShow)="groupShow=$event"></app-edit-evaluation-form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr'; 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 { 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-management-evaluation-cycle', selector: 'app-management-evaluation-cycle',
templateUrl: './management-evaluation-cycle.component.html', templateUrl: './management-evaluation-cycle.component.html',
styleUrls: ['./management-evaluation-cycle.component.scss'] styleUrls: ['./management-evaluation-cycle.component.scss']
}) })
export class ManagementCycleComponent { export class ManagementCycleComponent {
apsPeriodStart: string = '';
apsPeriodEnd: string = '';
currentPage = 1 currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1); page = Array.from({ length: 1 }, (_, i) => i + 1);
search = "" 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 isDataListChecked = false
isDataListCheckedAll = false isDataListCheckedAll = false
dataList: DataModel[] = [ numDataListChecked = 0
{
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"
}
]
dataSelect: DataModel = { constructor(private evaluationCycleService: EvaluationCycleService,
check: false, private toastr: ToastrService,
code: "", private cdr: ChangeDetectorRef
period: "", ) { }
year: "",
startDate: "",
endDate: "",
status: "",
}
modalStatus: "add" | "edit" = "add"
constructor(private cdr: ChangeDetectorRef) {
}
dataListSelect(data?: DataModel) { ngOnInit(): void {
this.dataSelect = data || { this.getEvaluationCycleList()
check: false,
code: "",
period: "",
year: "",
startDate: "",
endDate: "",
status: "",
}
this.cdr.detectChanges()
} }
dataListFilter() { getEvaluationCycleList() {
return this.dataList.filter(x => { this.dataLoading = true
const match = x.code.includes(this.search) || x.period.includes(this.search); this.evaluationCycleService.getList().subscribe({
if (!match) x.check = false; next: response => {
return match; 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() { this.dataLoading = false
const dataCheck = this.dataListFilter(); this.isDataListCheckedAll = false
this.isDataListChecked = dataCheck.some(x => x.check); this.dataListCheckAll()
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false; this.searchChange();
this.numDataListChecked = dataCheck.filter(x => x.check).length; this.cdr.detectChanges();
},
error: err => {
this.dataLoading = false
this.cdr.detectChanges();
}
});
} }
dataListCheckAll() { dataListCheckAll() {
const selectAll = this.isDataListCheckedAll; const selectAll = this.isDataListCheckedAll;
this.dataList.forEach(x => x.check = selectAll); this.evaluation_cycleListFilter().forEach(x => x.check = selectAll);
this.dataListCheck(); 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() { searchChange() {
this.currentPage = 1; this.currentPage = 1
const filteredData = this.dataListFilter(); this.page = Array.from({ length: Math.ceil(this.evaluation_cycleListFilter().length / 10) }, (_, i) => i + 1);
this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1); this.dataListCheck()
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 @@ ...@@ -62,21 +62,29 @@
</ng-container> </ng-container>
</tr> </tr>
</thead> </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> <tr>
<td class="text-center" colspan="100%"> <td class="text-center" colspan="100%">
ไม่พบข้อมูล ไม่พบข้อมูล
</td> </td>
</tr> </tr>
</tbody> </tbody>
<tbody *ngIf="dataListFilter().length"> <tbody *ngIf="!data.loading&&dataListFilter().length">
<tr <tr
*ngFor="let item of dataListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"> *ngFor="let item of dataListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="flex justify-center items-center"> <td class="flex justify-center items-center">
<span> <span>
{{item.employee }} {{item.employee }}
</span> </span>
</td> </td>
<td> <td>
...@@ -133,5 +141,10 @@ ...@@ -133,5 +141,10 @@
</a> </a>
</li> </li>
</ul> </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> </nav>
</div> </div>
\ No newline at end of file
...@@ -20,91 +20,93 @@ export class DefineEvaluationFactorsComponent { ...@@ -20,91 +20,93 @@ export class DefineEvaluationFactorsComponent {
currentPage = 1 currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1); page = Array.from({ length: 1 }, (_, i) => i + 1);
search = "" search = ""
dataList: DataModel[] = [ data: { loading: boolean, dataList: DataModel[] } = {
{ loading: false, dataList: [
"employee": "01-02", {
"hoshin": "0", "employee": "01-02",
"kpi": "0", "hoshin": "0",
"competency": "0", "kpi": "0",
"time_attendance": "0", "competency": "0",
"cross_functional": "0", "time_attendance": "0",
"special_activities": "0", "cross_functional": "0",
"total": "100" "special_activities": "0",
}, "total": "100"
{ },
"employee": "03-04", {
"hoshin": "0", "employee": "03-04",
"kpi": "0", "hoshin": "0",
"competency": "0", "kpi": "0",
"time_attendance": "0", "competency": "0",
"cross_functional": "0", "time_attendance": "0",
"special_activities": "0", "cross_functional": "0",
"total": "100" "special_activities": "0",
}, "total": "100"
{ },
"employee": "S1-S2", {
"hoshin": "0", "employee": "S1-S2",
"kpi": "0", "hoshin": "0",
"competency": "0", "kpi": "0",
"time_attendance": "0", "competency": "0",
"cross_functional": "0", "time_attendance": "0",
"special_activities": "0", "cross_functional": "0",
"total": "100" "special_activities": "0",
}, "total": "100"
{ },
"employee": "S3-S4", {
"hoshin": "0", "employee": "S3-S4",
"kpi": "0", "hoshin": "0",
"competency": "0", "kpi": "0",
"time_attendance": "0", "competency": "0",
"cross_functional": "0", "time_attendance": "0",
"special_activities": "0", "cross_functional": "0",
"total": "100" "special_activities": "0",
}, "total": "100"
{ },
"employee": "M1-M2", {
"hoshin": "0", "employee": "M1-M2",
"kpi": "0", "hoshin": "0",
"competency": "0", "kpi": "0",
"time_attendance": "0", "competency": "0",
"cross_functional": "0", "time_attendance": "0",
"special_activities": "0", "cross_functional": "0",
"total": "100" "special_activities": "0",
}, "total": "100"
{ },
"employee": "M3-M4", {
"hoshin": "0", "employee": "M3-M4",
"kpi": "0", "hoshin": "0",
"competency": "0", "kpi": "0",
"time_attendance": "0", "competency": "0",
"cross_functional": "0", "time_attendance": "0",
"special_activities": "0", "cross_functional": "0",
"total": "100" "special_activities": "0",
}, "total": "100"
{ },
"employee": "E1-E2", {
"hoshin": "0", "employee": "E1-E2",
"kpi": "0", "hoshin": "0",
"competency": "0", "kpi": "0",
"time_attendance": "0", "competency": "0",
"cross_functional": "0", "time_attendance": "0",
"special_activities": "0", "cross_functional": "0",
"total": "100" "special_activities": "0",
}, "total": "100"
{ },
"employee": "E3-E4", {
"hoshin": "0", "employee": "E3-E4",
"kpi": "0", "hoshin": "0",
"competency": "0", "kpi": "0",
"time_attendance": "0", "competency": "0",
"cross_functional": "0", "time_attendance": "0",
"special_activities": "0", "cross_functional": "0",
"total": "100" "special_activities": "0",
} "total": "100"
] }
]
}
dataListFilter() { 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() { 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 { 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({ @Component({
selector: 'app-assessment-system-configuration', selector: 'app-assessment-system-configuration',
templateUrl: './assessment-system-configuration.component.html', templateUrl: './assessment-system-configuration.component.html',
styleUrls: ['./assessment-system-configuration.component.scss'] styleUrls: ['./assessment-system-configuration.component.scss']
}) })
export class AssessmentSystemConfigurationComponent { export class AssessmentSystemConfigurationComponent {
@Input() pathTitle = ['การประเมินจัดการประสิทธิภาพ', 'การตั้งค่า', 'กำหนดค่าระบบการประเมิน']; setting: { loading: boolean, data: SettingAssessmentModel } = { loading: false, data: new MySettingAssessmentModel() }
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>(); constructor(private settingAssessmentService: SettingAssessmentService,
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น private toastr: ToastrService,
isChecked: boolean = false; private cdr: ChangeDetectorRef
) { }
// ฟังก์ชันในการเปลี่ยนแท็บ ngOnInit(): void {
changeTab(tab: { id: string, text: string }) { this.getSettingList()
this.sendPathTitle.emit(['การประเมินจัดการประสิทธิภาพ', 'การตั้งค่า', tab.text]); }
this.activeTab = tab.id; getSettingList() {
} this.setting.loading = true
this.settingAssessmentService.get().subscribe({
toggleCheckbox(): void { next: response => {
this.isChecked = !this.isChecked; this.setting.data = new MySettingAssessmentModel(response)
} this.setting.loading = false
this.cdr.detectChanges()
// การจัดการการเปิดปิด modal }, error: error => {
modalOptions: { this.setting.loading = false
[nameModal: string]: { this.cdr.detectChanges()
isModalOpen: boolean; }
modalSize: string; })
backdropClose: boolean; }
}; saveSetting() {
} = { this.setting.loading = true
"add": { // this.settingAssessmentService.post(new MySettingAssessmentModel({ ...this.setting.data, expectationLevel: +(this.setting.data.expectationLevel) })).subscribe({
isModalOpen: false, // next: response => {
modalSize: 'm', // if (response.success) {
backdropClose: true, // this.showAlert(response.message, 'success')
}, // this.getSettingList()
"edit": { // } else {
isModalOpen: false, // this.showAlert(response.message, 'error')
modalSize: 'm', // this.setting.loading = false
backdropClose: true, // this.cdr.detectChanges()
} // }
}; // }, error: error => {
// this.showAlert(error.message, 'error')
openModal(name: string, size: string, closeOnBackdrop?: boolean) { // this.setting.loading = false
this.modalOptions[name].modalSize = size; // this.cdr.detectChanges()
this.modalOptions[name].backdropClose = closeOnBackdrop || false; // }
this.modalOptions[name].isModalOpen = true; // })
this.currentModal = name; // ตั้งค่าค่าของ currentModal เป็น 'add' หรือ 'edit' }
document.body.style.overflow = 'hidden';
} showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
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('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000, timeOut: 3000,
positionClass: 'toast-top-right', positionClass: 'toast-top-right',
}); })
} }
}
}
\ No newline at end of file
...@@ -10,15 +10,15 @@ ...@@ -10,15 +10,15 @@
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse"> <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="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" 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> </a>
</nav> </nav>
</div> </div>
<div class="mt-3 px-3rem"> <div class="mt-3 px-3rem">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1"> <div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-assessment-system-configuration [pathTitle]="pathTitle" <app-assessment-system-configuration></app-assessment-system-configuration>
(sendPathTitle)="pathTitle=$event"></app-assessment-system-configuration>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -17,15 +17,15 @@ export class MyCompetencyGradeModel implements CompetencyGradeModel { ...@@ -17,15 +17,15 @@ export class MyCompetencyGradeModel implements CompetencyGradeModel {
gradeMaxScore: number gradeMaxScore: number
gradeMinScore: number gradeMinScore: number
weight: number weight: number
constructor(data: Partial<CompetencyGradeModel>) { constructor(data?: Partial<CompetencyGradeModel>) {
this.gradeId = data.gradeId || "" this.gradeId = data?.gradeId || ""
this.companyId = data.companyId || "" this.companyId = data?.companyId || ""
this.edesc = data.edesc || "" this.edesc = data?.edesc || ""
this.tdesc = data.tdesc || "" this.tdesc = data?.tdesc || ""
this.gradeDetail = data.gradeDetail || "" this.gradeDetail = data?.gradeDetail || ""
this.gradeMaxScore = data.gradeMaxScore ?? 0 this.gradeMaxScore = data?.gradeMaxScore ?? 0
this.gradeMinScore = data.gradeMinScore ?? 0 this.gradeMinScore = data?.gradeMinScore ?? 0
this.weight = data.weight ?? 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