Commit 0da98657 by Nattana Chaiyamat

การประเมินสมรรถนะ

ทะเบียนเกรด
การจัดการเกรด
parent fb87715a
.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*/
}
.htable{
height: 400px;
}
table.ti-custom-table thead {
height: 60px;
}
table.ti-custom-table thead th span {
font-size: 12px;
font-weight: bold;
}
.ti-custom-table td{
padding-left: 0.9rem;
padding-right: 1rem;
}
.ti-custom-table thead th:first-child {
width: 120px; /* ปรับความกว้างตามที่ต้องการ */
text-align: left; /* จัดตำแหน่งข้อความถ้าต้องการ */
padding-left: 2px;
padding-right: 2px;
}
.ti-custom-table thead th:last-child {
width: 400px; /* ปรับความกว้างตามที่ต้องการ */
}
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 {
padding: 1rem;
height: 650px;
overflow-y: auto;
}
.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;
overflow-y: auto;
}
.bg-input-readonly{
background-color: rgb(241 245 249);
}
.ciricon {
height: 12px; /* กำหนดความสูงของวงกลม */
width: 12px; /* กำหนดความกว้างของวงกลม */
background-color: #ffffff;
font-weight: bold;
display: flex; /* ใช้ Flexbox */
justify-content: center; /* จัดตำแหน่งแนวนอนให้กึ่งกลาง */
align-items: center; /* จัดตำแหน่งแนวตั้งให้กึ่งกลาง */
border-radius: 2px; /* ทำให้เป็นวงกลม */
}
.ri-close-line {
font-size: 15px; /* ขนาดไอคอน */
}
\ No newline at end of file
......@@ -42,7 +42,6 @@ export class GroupGradeComponent implements OnInit {
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) {
......
.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*/
}
.htable{
height: 400px;
}
table.ti-custom-table thead {
height: 60px;
}
table.ti-custom-table thead th span {
font-size: 12px;
font-weight: bold;
}
.ti-custom-table td{
padding-left: 0.9rem;
padding-right: 1rem;
}
.ti-custom-table thead th:first-child {
width: 120px; /* ปรับความกว้างตามที่ต้องการ */
text-align: left; /* จัดตำแหน่งข้อความถ้าต้องการ */
padding-left: 2px;
padding-right: 2px;
}
.ti-custom-table thead th:last-child {
width: 400px; /* ปรับความกว้างตามที่ต้องการ */
}
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 {
padding: 1rem;
height: 650px;
overflow-y: auto;
}
.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;
overflow-y: auto;
}
.bg-input-readonly{
background-color: rgb(241 245 249);
}
.ciricon {
height: 12px; /* กำหนดความสูงของวงกลม */
width: 12px; /* กำหนดความกว้างของวงกลม */
background-color: #ffffff;
font-weight: bold;
display: flex; /* ใช้ Flexbox */
justify-content: center; /* จัดตำแหน่งแนวนอนให้กึ่งกลาง */
align-items: center; /* จัดตำแหน่งแนวตั้งให้กึ่งกลาง */
border-radius: 2px; /* ทำให้เป็นวงกลม */
}
.ri-close-line {
font-size: 15px; /* ขนาดไอคอน */
}
\ No newline at end of file
......@@ -29,7 +29,6 @@ export class SubGradeRegistrationComponent {
search = '';
modalStatus: 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add'
constructor(private toastr: ToastrService,
private competencyGroupGradeService: CompetencyGroupGradeService,
private cdr: ChangeDetectorRef
) {
}
......
......@@ -6,5 +6,5 @@ import { Component } from '@angular/core';
styleUrls: ['./grade-registration.component.scss']
})
export class GradeRegistrationComponent {
pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนเกรด','การจัดการเกรด']
pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนเกรด', 'การจัดการเกรด']
}
......@@ -39,6 +39,7 @@ import { GradeRegistrationComponent } from '../competency-assessment/grade-regis
import { SettingPerformanceEvalutionComponent } from '../performance-management-evaluation/setting-performance-evalution/setting-performance-evalution.component';
import { SelfEvaluationComponent } from '../performance-evaluation/self-evaluation/self-evaluation.component';
import { IdpEvalutionComponent } from '../performance-evaluation/idp-evaluation/idp-evalution.component';
import { PmsGradeRegistrationComponent } from '../performance-management-evaluation/pms-grade-registration/pms-pms-grade-registration.component';
......@@ -84,7 +85,7 @@ const routes: Routes = [
{ path: "name-registration-perfomance", title: 'ทะเบียนกำหนดชื่อ', component: NameRegistrationPerfomanceComponent },
{ path: "evaluation-factors", title: 'การประเมินจัดการประสิทธิภาพ', component: EvaluationFactorsComponent },
{ path: "grade-registration", title: 'ทะเบียนเกรด', component: GradeRegistrationComponent },
{ path: "grade-registration-sub", title: 'ทะเบียนเกรด', component: GradeRegistrationComponent },
{ path: "grade-registration-sub", title: 'ทะเบียนเกรด', component: PmsGradeRegistrationComponent },
{ path: "setting-performance-evalution", title: 'การตั้งค่า', component: SettingPerformanceEvalutionComponent },
{ path: "self-evaluation", title: 'ประเมินตนเอง', component: SelfEvaluationComponent }
]
......
......@@ -144,6 +144,12 @@ import { PmsGroupAssessmentService } from 'src/app/shared/services/pms-group-ass
import { PmsGroupApproveService } from 'src/app/shared/services/pms-group-approve.service';
import { PmsEaluationFactorsService } from 'src/app/shared/services/pms-ealuation-factors.service';
import { PmsMasfromEvaluationCycleService } from 'src/app/shared/services/pms-masfrom-evaluation.service';
import { PmsGroupGradeService } from 'src/app/shared/services/pms-group-grade.service';
import { PmsSettingAssessmentService } from 'src/app/shared/services/pms-setting-assessment.service';
import { PmsGradeRegistrationComponent } from '../performance-management-evaluation/pms-grade-registration/pms-pms-grade-registration.component';
import { PmsGradeManagementComponent } from '../performance-management-evaluation/pms-grade-registration/pms-grade-management/pms-grade-management.component';
import { PmsSubGradeRegistrationComponent } from '../performance-management-evaluation/pms-grade-registration/pms-grade-management/pms-sub-grade-registration/pms-sub-grade-registration.component';
import { PmsGroupGradeComponent } from '../performance-management-evaluation/pms-grade-registration/pms-grade-management/pms-group-grade/pms-group-grade.component';
export const MY_DATE_FORMATS = {
parse: {
......@@ -263,7 +269,11 @@ export class CustomDateAdapter extends NativeDateAdapter {
CompanyRegistrationPageComponent,
PmsEvalutionComponent,
CEvaluationComponent,
ManageUserComponent
ManageUserComponent,
PmsGradeRegistrationComponent,
PmsGradeManagementComponent,
PmsGroupGradeComponent,
PmsSubGradeRegistrationComponent
],
imports: [
CommonModule,
......@@ -318,6 +328,8 @@ export class CustomDateAdapter extends NativeDateAdapter {
PmsGroupApproveService,
PmsEaluationFactorsService,
PmsMasfromEvaluationCycleService,
PmsGroupGradeService,
PmsSettingAssessmentService,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
......
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { CompetencyGradeModel } from 'src/app/shared/model/competency-grades.model';
import { MyPmsGroupGradeModel } from 'src/app/shared/model/pms-group-grade.model';
import { PmsGroupGradeService } from 'src/app/shared/services/pms-group-grade.service';
export interface DataModel {
check: boolean;
code: string;
tdesc: string;
edesc: string;
pmsGrade: CompetencyGradeModel[]
}
@Component({
selector: 'app-pms-grade-management',
templateUrl: './pms-grade-management.component.html',
styleUrls: ['./pms-grade-management.component.scss'],
})
export class PmsGradeManagementComponent {
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
typeTab: "" | "add" | "edit" = "";
currentPage = 1;
page = Array.from({ length: 1 }, (_, i) => i + 1);
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
search = '';
dataList: DataModel[] = [];
dataLoading = false
dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', pmsGrade: [] }
constructor(private toastr: ToastrService,
private pmsGroupGradeService: PmsGroupGradeService,
private cdr: ChangeDetectorRef) {
this.sendPathTitle.emit(['การประเมินจัดการประสิทธิภาพ', 'ทะเบียนเกรด', 'การจัดการเกรด'])
}
ngOnInit(): void {
this.getPmsGroupGradeList()
}
selectData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { check: false, code: '', tdesc: '', edesc: '', pmsGrade: [] }))
}
getPmsGroupGradeList() {
this.dataLoading = true
this.pmsGroupGradeService.getList().subscribe({
next: response => {
this.dataList = response.map(x => ({ check: false, code: x.groupGradeId, tdesc: x.tdesc, edesc: x.edesc, pmsGrade: x.pmsGrade }))
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.searchChange()
this.dataLoading = false
this.cdr.detectChanges()
}, error: error => {
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
pathTitleChange(tap?: 'add' | 'edit') {
this.typeTab = tap || ''
switch (this.typeTab) {
case 'add': {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'ทะเบียนเกรด', 'การจัดการเกรด', 'เพิ่มกลุ่มเกรด'])
break;
}
case 'edit': {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'ทะเบียนเกรด', 'การจัดการเกรด', 'แก้ไขกลุ่มเกรด'])
break;
}
default: {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'ทะเบียนเกรด', 'การจัดการเกรด'])
}
}
}
searchChange() {
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());
return match;
});
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
})
}
deletePmsGroupGradeList() {
const body = this.dataSelect.code ? new MyPmsGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc }) :
this.dataList.filter(x => x.check).map(x => new MyPmsGroupGradeModel({ groupGradeId: x.code, tdesc: x.tdesc, edesc: x.edesc }))
this.dataLoading = true
this.pmsGroupGradeService.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getPmsGroupGradeList()
} 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)
}
}
<div class="flex justify-between mb-10px">
<div class="flex">
<button type="button"
class="ti-btn text-primary hover:bg-blue-100 focus:ring-blue-500 dark:focus:ring-offset-white/10 h-10 m-0 shadow-md"
(click)="backTab()">
<i class="ti ti-chevron-left"></i>
ย้อนกลับ
</button>
<div class="text-2xl font-bold py-2 text-primary px-2">
{{typeTab=='add'?'เพิ่ม':'แก้ไข'}}กลุ่มเกรด
</div>
</div>
<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||!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>
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-indigo h-10 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)">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<path d="M15 49A24 24 0 0 1 32 8"></path>
<path d="M49 15a24 24 0 0 1-17 41"></path>
<polyline points="15.03 40 15.03 48.97 8 48.97"></polyline>
<polyline points="48.97 24 48.97 15.03 56 15.03"></polyline>
</g>
</svg>
Clear
</button>
</div>
<div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-10 m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div>
</div>
</div>
<div class="body-content">
<div class="page">
<nav class="flex rtl:space-x-reverse space-x-2 border-b border-gray-200">
<a (click)="currentTab=1"
class="border w-32 justify-center rounded-4px hs-tab-active:!bg-primary hs-tab-active:border-primary hs-tab-active:!text-white -mb-px py-2 px-3 inline-flex items-center gap-2 font-size-16px font-weight-500 text-center text-gray-600 hover:text-gray-900 active"
href="javascript:void(0);" id="card-type-item-1" data-hs-tab="#card-type-1" aria-controls="card-type-1">
รายละเอียด
</a>
<a (click)="currentTab=2"
class="border w-32 justify-center rounded-4px hs-tab-active:!bg-primary hs-tab-active:border-primary hs-tab-active:!text-white -mb-px py-2 px-3 inline-flex items-center gap-2 font-size-16px font-weight-500 text-center text-gray-600 hover:text-gray-900"
href="javascript:void(0);" id="card-type-item-2" data-hs-tab="#card-type-2" aria-controls="card-type-2">
ทะเบียนเกรด
</a>
</nav>
<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" [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>
<input type="text" id="detail_eng" class="ti-form-input w-1/2" [(ngModel)]="dataSelect.edesc">
</div>
</div>
<div *ngIf="currentTab==2" id="card-type-2" class="hidden" role="tabpanel"
aria-labelledby="card-type-item-2">
<app-pms-sub-grade-registration [dataSelect]="dataSelect"
(sendDataSelect)="dataSelect=$event"></app-pms-sub-grade-registration>
</div>
</div>
</div>
</div>
<div id="add-group-grade-alert-add-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center">
<div class="max-h-full overflow-hidden ti-modal-content-alert w-full">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
แจ้งเตือน
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#add-group-grade-alert-add-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#add-group-grade-alert-add-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#add-group-grade-alert-add-modal" (click)="postPmsGroupGrade()">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
import { Component, EventEmitter, Input, Output, OnInit, ChangeDetectorRef } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { CompetencyGradeModel } from 'src/app/shared/model/competency-grades.model';
import { MyPmsGroupGradeModel } from 'src/app/shared/model/pms-group-grade.model';
import { PmsGroupGradeService } from 'src/app/shared/services/pms-group-grade.service';
export interface DataModel {
check: boolean;
code: string;
tdesc: string;
edesc: string;
pmsGrade: CompetencyGradeModel[]
}
@Component({
selector: 'app-pms-group-grade',
templateUrl: './pms-group-grade.component.html',
styleUrls: ['./pms-group-grade.component.scss']
})
export class PmsGroupGradeComponent implements OnInit {
@Output() sendBackTab: EventEmitter<undefined> = new EventEmitter<undefined>();
@Input() typeTab: 'add' | 'edit' = 'add'
@Input() dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', pmsGrade: [] }
dataOriginal: DataModel = { check: false, code: '', tdesc: '', edesc: '', pmsGrade: [] }
@Output() sendDataList: EventEmitter<DataModel[]> = new EventEmitter<DataModel[]>();
currentTab = 1
constructor(private toastr: ToastrService,
private pmsGroupGradeService: PmsGroupGradeService,
private cdr: ChangeDetectorRef) { }
ngOnInit(): void {
this.dataOriginal = JSON.parse(JSON.stringify(this.dataSelect || { check: false, code: '', tdesc: '', edesc: '', pmsGrade: [] }))
}
clear() {
if (this.typeTab == 'add') {
this.dataSelect = { check: false, code: '', tdesc: '', edesc: '', pmsGrade: [] }
this.cdr.detectChanges()
} else if (this.typeTab == 'edit') {
this.dataSelect = { check: false, code: this.dataOriginal.code, tdesc: '', edesc: '', pmsGrade: [] }
this.cdr.detectChanges()
}
}
backTab() {
this.sendBackTab.emit();
}
postPmsGroupGrade() {
this.pmsGroupGradeService.post(new MyPmsGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, pmsGrade: this.dataSelect.pmsGrade })).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getPmsGroupGradeList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
getPmsGroupGradeList() {
this.pmsGroupGradeService.getList().subscribe({
next: response => {
this.sendDataList.emit(response.map(x => ({ check: false, code: x.groupGradeId, tdesc: x.tdesc, edesc: x.edesc, pmsGrade: x.pmsGrade })))
this.cdr.detectChanges()
}
})
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
}
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';
export interface DataModel {
check: boolean;
code: string;
tdesc: string;
edesc: string;
pmsGrade: CompetencyGradeModel[]
}
@Component({
selector: 'app-pms-sub-grade-registration',
templateUrl: './pms-sub-grade-registration.component.html',
styleUrls: ['./pms-sub-grade-registration.component.scss'],
})
export class PmsSubGradeRegistrationComponent {
@Input() dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', pmsGrade: [] }
@Output() sendDataSelect: EventEmitter<DataModel> = new EventEmitter<DataModel>();
pmsGrade: { select: CompetencyGradeModel, dataList: { check: boolean, data: CompetencyGradeModel }[] } = { select: new MyCompetencyGradeModel({}), dataList: [] }
currentPage = 1;
page = Array.from({ length: 1 }, (_, i) => i + 1);
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
search = '';
modalStatus: 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add'
constructor(private toastr: ToastrService,
private cdr: ChangeDetectorRef
) {
}
ngOnInit(): void {
this.pmsGrade.dataList = this.dataSelect.pmsGrade.map(x => ({ check: false, data: x }))
this.searchChange()
}
ngOnChanges(changes: SimpleChanges): void {
if (changes) {
this.pmsGrade.dataList = changes['dataSelect'].currentValue.pmsGrade.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 }) {
this.pmsGrade.select = new MyCompetencyGradeModel(data?.data || {})
}
dataListFilter() {
return this.pmsGrade.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());
return match;
});
}
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.pmsGrade.dataList.filter(x => x.check).length;
this.isDataListChecked = Boolean(this.numDataListChecked)
}
updatePmsGroupGrade() {
switch (this.modalStatus) {
case 'add': {
this.pmsGrade.dataList.push({ check: false, data: this.pmsGrade.select })
this.cdr.detectChanges()
break
}
case 'edit': {
this.pmsGrade.dataList = this.pmsGrade.dataList.map(x => x.data.gradeId == this.pmsGrade.select.gradeId ? { check: false, data: this.pmsGrade.select } : x)
this.cdr.detectChanges()
break
}
case 'delete': {
this.pmsGrade.dataList = this.pmsGrade.dataList.filter(x => this.pmsGrade.select.gradeId != x.data.gradeId)
this.cdr.detectChanges()
break
}
case 'deleteGroup': {
this.pmsGrade.dataList = this.pmsGrade.dataList.filter(x => !x.check)
this.cdr.detectChanges()
break
}
}
this.sendDataSelect.emit({ ...this.dataSelect, pmsGrade: this.pmsGrade.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, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
clear() {
if (this.modalStatus == 'add') {
this.pmsGrade.select = new MyCompetencyGradeModel({})
} else if (this.modalStatus == 'edit') {
this.pmsGrade.select = new MyCompetencyGradeModel({ gradeId: this.pmsGrade.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
}
}
<app-page-header [pathTitle]="pathTitle"></app-page-header>
<div class="bg-card-white">
</div>
<div class="block-main-content">
<div class="font-size-18px font-weight-700 pt-1.5rem text-primary px-2rem">
ทะเบียนเกรด
</div>
<div class="page pt-0.75rem">
<div class="border-b border-gray-200 dark:border-white/10 px-8">
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse">
<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)="pathTitle = ['การประเมินจัดการประสิทธิภาพ','ทะเบียนเกรด','การจัดการเกรด']">
การจัดการเกรด
</a>
</nav>
</div>
<div class="px-2rem pt-50px !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-pms-grade-management (sendPathTitle)="pathTitle=$event"></app-pms-grade-management>
</div>
</div>
</div>
</div>
\ No newline at end of file
import { Component } from '@angular/core';
@Component({
selector: 'app-pms-grade-registration',
templateUrl: './pms-grade-registration.component.html',
styleUrls: ['./pms-grade-registration.component.scss']
})
export class PmsGradeRegistrationComponent {
pathTitle = ['การประเมินจัดการประสิทธิภาพ', 'ทะเบียนเกรด', 'การจัดการเกรด']
}
......@@ -66,27 +66,27 @@
<div class="grid grid-cols-6 gap-2">
<div class="grid col-span-1 grid-cols-6 gap-2">
<div class="col-span-1">
<input type="checkbox" class="ti-form-checkbox" id="settingGroupAssessment-0"
[class.pointer-events-none]="setting.data.settingGroupAssessment=='0'" name="settingGroupAssessment"
(change)="setting.data.settingGroupAssessment='0'" [value]="'0'"
[checked]="setting.data.settingGroupAssessment=='0'">
<input type="checkbox" class="ti-form-checkbox" id="evaluationResultsStatus-0"
[class.pointer-events-none]="setting.data.evaluationResultsStatus=='0'" name="evaluationResultsStatus"
(change)="setting.data.evaluationResultsStatus='0'" [value]="'0'"
[checked]="setting.data.evaluationResultsStatus=='0'">
</div>
<div class="col-span-5">
<label for="settingGroupAssessment-0" class="text-sm text-gray-500"
[class.pointer-events-none]="setting.data.settingGroupAssessment=='0'">
<label for="evaluationResultsStatus-0" class="text-sm text-gray-500"
[class.pointer-events-none]="setting.data.evaluationResultsStatus=='0'">
เเสดงผล
</label>
</div>
</div>
<div class="grid col-span-1 grid-cols-6 gap-2">
<div class="col-span-1">
<input type="checkbox" class="ti-form-checkbox" id="settingGroupAssessment-1"
[class.pointer-events-none]="setting.data.settingGroupAssessment=='1'" name="settingGroupAssessment"
(change)="setting.data.settingGroupAssessment='1'" [checked]="setting.data.settingGroupAssessment=='1'">
<input type="checkbox" class="ti-form-checkbox" id="evaluationResultsStatus-1"
[class.pointer-events-none]="setting.data.evaluationResultsStatus=='1'" name="evaluationResultsStatus"
(change)="setting.data.evaluationResultsStatus='1'" [checked]="setting.data.evaluationResultsStatus=='1'">
</div>
<div class="col-span-5">
<label for="settingGroupAssessment-1" class="text-sm text-gray-500"
[class.pointer-events-none]="setting.data.settingGroupAssessment=='1'">
<label for="evaluationResultsStatus-1" class="text-sm text-gray-500"
[class.pointer-events-none]="setting.data.evaluationResultsStatus=='1'">
ไม่เเสดงผล
</label>
</div>
......@@ -98,27 +98,27 @@
<div class="grid grid-cols-6 gap-2">
<div class="grid col-span-1 grid-cols-6 gap-2">
<div class="col-span-1">
<input type="checkbox" class="ti-form-checkbox" id="settingGroupAssessment-0"
[class.pointer-events-none]="setting.data.settingGroupAssessment=='0'" name="settingGroupAssessment"
(change)="setting.data.settingGroupAssessment='0'" [value]="'0'"
[checked]="setting.data.settingGroupAssessment=='0'">
<input type="checkbox" class="ti-form-checkbox" id="workingTimeStatus-0"
[class.pointer-events-none]="setting.data.workingTimeStatus=='0'" name="workingTimeStatus"
(change)="setting.data.workingTimeStatus='0'" [value]="'0'"
[checked]="setting.data.workingTimeStatus=='0'">
</div>
<div class="col-span-5">
<label for="settingGroupAssessment-0" class="text-sm text-gray-500"
[class.pointer-events-none]="setting.data.settingGroupAssessment=='0'">
<label for="workingTimeStatus-0" class="text-sm text-gray-500"
[class.pointer-events-none]="setting.data.workingTimeStatus=='0'">
เเสดงผล
</label>
</div>
</div>
<div class="grid col-span-1 grid-cols-6 gap-2">
<div class="col-span-1">
<input type="checkbox" class="ti-form-checkbox" id="settingGroupAssessment-1"
[class.pointer-events-none]="setting.data.settingGroupAssessment=='1'" name="settingGroupAssessment"
(change)="setting.data.settingGroupAssessment='1'" [checked]="setting.data.settingGroupAssessment=='1'">
<input type="checkbox" class="ti-form-checkbox" id="workingTimeStatus-1"
[class.pointer-events-none]="setting.data.workingTimeStatus=='1'" name="workingTimeStatus"
(change)="setting.data.workingTimeStatus='1'" [checked]="setting.data.workingTimeStatus=='1'">
</div>
<div class="col-span-5">
<label for="settingGroupAssessment-1" class="text-sm text-gray-500"
[class.pointer-events-none]="setting.data.settingGroupAssessment=='1'">
<label for="workingTimeStatus-1" class="text-sm text-gray-500"
[class.pointer-events-none]="setting.data.workingTimeStatus=='1'">
ไม่เเสดงผล
</label>
</div>
......
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';
import { MyPmsSettingAssessmentModel, PmsSettingAssessmentModel } from 'src/app/shared/model/pms-setting-assessment.model';
import { PmsSettingAssessmentService } from 'src/app/shared/services/pms-setting-assessment.service';
@Component({
selector: 'app-assessment-system-configuration',
templateUrl: './assessment-system-configuration.component.html',
styleUrls: ['./assessment-system-configuration.component.scss']
})
export class AssessmentSystemConfigurationComponent {
setting: { loading: boolean, data: SettingAssessmentModel } = { loading: false, data: new MySettingAssessmentModel() }
constructor(private settingAssessmentService: SettingAssessmentService,
setting: { loading: boolean, data: PmsSettingAssessmentModel } = { loading: false, data: new MyPmsSettingAssessmentModel() }
constructor(private pmsSettingAssessmentService: PmsSettingAssessmentService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
......@@ -19,9 +18,9 @@ export class AssessmentSystemConfigurationComponent {
}
getSettingList() {
this.setting.loading = true
this.settingAssessmentService.get().subscribe({
this.pmsSettingAssessmentService.get().subscribe({
next: response => {
this.setting.data = new MySettingAssessmentModel(response)
this.setting.data = new MyPmsSettingAssessmentModel(response)
this.setting.loading = false
this.cdr.detectChanges()
}, error: error => {
......@@ -32,22 +31,22 @@ export class AssessmentSystemConfigurationComponent {
}
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()
// }
// })
this.pmsSettingAssessmentService.post(new MyPmsSettingAssessmentModel({ ...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') {
......
import { CompetencyGradeModel, MyCompetencyGradeModel } from "./competency-grades.model"
export interface PmsGroupGradeModel {
groupGradeId: string
companyId: string
edesc: string
tdesc: string
pmsGrade: CompetencyGradeModel[]
}
export class MyPmsGroupGradeModel implements PmsGroupGradeModel {
groupGradeId: string
companyId: string
edesc: string
tdesc: string
pmsGrade: CompetencyGradeModel[]
constructor(data: Partial<PmsGroupGradeModel>) {
this.groupGradeId = data.groupGradeId || ""
this.companyId = data.companyId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.pmsGrade = data.pmsGrade?.map(x => (new MyCompetencyGradeModel(x))) || []
}
}
export interface PmsSettingAssessmentModel {
apsyear: string
companyId: string
expectationLevel: number
settingGroupAssessment: string
evaluationResultsStatus: string
workingTimeStatus: string
settingScore5: number
settingScore4: number
settingScore3: number
settingScore2: number
settingScore1: number
}
export class MyPmsSettingAssessmentModel implements PmsSettingAssessmentModel {
apsyear: string
companyId: string
expectationLevel: number
settingGroupAssessment: string
evaluationResultsStatus: string
workingTimeStatus: string
settingScore5: number
settingScore4: number
settingScore3: number
settingScore2: number
settingScore1: number
constructor(data?: Partial<PmsSettingAssessmentModel>) {
this.apsyear = data?.apsyear || "";
this.companyId = data?.companyId || "";
this.expectationLevel = data?.expectationLevel ?? 0;
this.settingGroupAssessment = data?.settingGroupAssessment || "";
this.evaluationResultsStatus = data?.evaluationResultsStatus || "";
this.workingTimeStatus = data?.workingTimeStatus || "";
this.settingScore5 = data?.settingScore5 ?? 0;
this.settingScore4 = data?.settingScore4 ?? 0;
this.settingScore3 = data?.settingScore3 ?? 0;
this.settingScore2 = data?.settingScore2 ?? 0;
this.settingScore1 = data?.settingScore1 ?? 0;
}
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AlertModel } from '../model/alert.model';
import { PmsGroupGradeModel } from '../model/pms-group-grade.model';
@Injectable({
providedIn: 'root'
})
export class PmsGroupGradeService {
api = "/pms-group-grade"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(plId: string): Observable<PmsGroupGradeModel> {
return this.http.get<PmsGroupGradeModel>(this.urlApi + "/" + plId)
}
getList(): Observable<PmsGroupGradeModel[]> {
return this.http.get<PmsGroupGradeModel[]>(this.urlApi + "/lists")
}
post(body: PmsGroupGradeModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: PmsGroupGradeModel | PmsGroupGradeModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
\ No newline at end of file
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AlertModel } from '../model/alert.model';
import { PmsSettingAssessmentModel } from '../model/pms-setting-assessment.model';
@Injectable({
providedIn: 'root'
})
export class PmsSettingAssessmentService {
api = "/pms-setting-assessment"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
get(): Observable<PmsSettingAssessmentModel> {
return this.http.get<PmsSettingAssessmentModel>(this.urlApi)
}
post(body: PmsSettingAssessmentModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
}
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