Commit e59735fa by Nattana Chaiyamat

เปลี่ยนการจัดกลุ่มหัวข้อประเมิน จาก JL เป็น JD

parent 66a890c0
......@@ -12,7 +12,7 @@
</div>
</div>
</div>
<div *ngIf="pl" class="py-2 border-b-2 border-collapse ">
<div *ngIf="jobCode" class="py-2 border-b-2 border-collapse ">
<div class="grid grid-cols-3 gap-6">
<div class="col-span-1">
<label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">รหัส</label>
......@@ -22,7 +22,7 @@
<div class="col-span-1">
<input type="text" id="input-label"
class="py-2 px-3 ltr:pr-11 rtl:pl-11 ti-form-input w-2/3 rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 bg-input-readonly"
readonly [(ngModel)]="pl.plId">
readonly [(ngModel)]="jobCode.jobCodeId">
</div>
</div>
<div class="grid grid-cols-3 gap-6 mt-5">
......@@ -37,12 +37,12 @@
<div class="col-span-1">
<input type="text" id="input-label"
class="py-2 px-3 ltr:pr-11 rtl:pl-11 ti-form-input w-2/3 rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 bg-input-readonly"
readonly [(ngModel)]="pl.tdesc">
readonly [(ngModel)]="jobCode.tdesc">
</div>
<div class="col-span-1">
<input type="text" id="input-label"
class="py-2 px-3 ltr:pr-11 rtl:pl-11 ti-form-input w-2/3 rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 bg-input-readonly"
readonly [(ngModel)]="pl.edesc">
readonly [(ngModel)]="jobCode.edesc">
</div>
</div>
</div>
......@@ -467,11 +467,11 @@
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
<ng-container *ngIf="numDataListChecked">
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
<ng-container *ngIf="!numDataListChecked">
เลือกข้อมูลที่ต้องการลบ
</ng-container>!
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
<ng-container *ngIf="!numDataListChecked">
เลือกข้อมูลที่ต้องการลบ
</ng-container>!
</p>
<div class="flex justify-end mt-2rem mb-1rem">
......@@ -481,7 +481,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#edit-group-competencies-alert-delete-modal" *ngIf="numDataListChecked"
data-hs-overlay="#edit-group-competencies-alert-delete-modal" *ngIf="numDataListChecked"
(click)="deleteGroupAssessmentById()">
ลบข้อมูล
</a>
......
......@@ -2,7 +2,7 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angu
import { ToastrService } from 'ngx-toastr';
import { GroupAssessmentModel, MyGroupAssessmentModel } from 'src/app/shared/model/group-assessment.model';
import { GroupAssessment1ListModel, MyGroupAssessment1ListModel } from 'src/app/shared/model/group-assessment1-list.model';
import { MyPLModel, PLModel } from 'src/app/shared/model/pl.model';
import { MyJobcodeModel, JobcodeModel } from 'src/app/shared/model/jobcode.model';
import { GroupAssessmentService } from 'src/app/shared/services/group-assessment.service';
import { IndicatorsCoursesService } from 'src/app/shared/services/indicators-courses.service';
import { CompetencyIndicatorsCourses1MiniModel, MyCompetencyIndicatorsCourses1MiniModel } from 'src/app/shared/model/competency-indicators-courses1-mini.model';
......@@ -13,7 +13,7 @@ import { CompetencyIndicatorsCourses1MiniModel, MyCompetencyIndicatorsCourses1Mi
styleUrls: ['./edit-group-competencies.component.scss']
})
export class EditGroupCompetenciesComponent {
@Input() pl: PLModel = new MyPLModel()
@Input() jobCode: JobcodeModel = new MyJobcodeModel()
@Output() sendEdit: EventEmitter<boolean> = new EventEmitter<boolean>();
groupCompetencies: GroupAssessmentModel = new MyGroupAssessmentModel()
dataSelectList: GroupAssessment1ListModel[] = [];
......@@ -53,9 +53,9 @@ export class EditGroupCompetenciesComponent {
getGroupAssessmentById() {
this.dataLoading = true;
this.groupAssessmentService.getById(this.pl.plId).subscribe({
next: response => {
this.groupCompetencies = new MyGroupAssessmentModel({ ...response, personalLevel: new MyPLModel(this.pl) })
this.groupAssessmentService.getById(this.jobCode.jobCodeId).subscribe({
next: response => {[[]]
this.groupCompetencies = new MyGroupAssessmentModel({ ...response, jd: new MyJobcodeModel(this.jobCode) })
this.dataList = new MyGroupAssessmentModel(response).groupAssessment1List.map(x => ({ check: false, data: new MyGroupAssessment1ListModel(x) }))
this.dataList.sort((a, b) => {
const topicA = a.data.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId.toLowerCase();
......
......@@ -33,7 +33,7 @@
</ng-container>
<ng-container *ngIf="editTab">
<app-edit-group-competencies [pl]="groupCompetencies"
<app-edit-group-competencies [jobCode]="groupCompetencies"
(sendEdit)="editTab=$event;pathTitleChange()"></app-edit-group-competencies>
</ng-container>
......
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ColumnModel } from '@syncfusion/ej2-grids';
import { ToastrService } from 'ngx-toastr';
import { MyPLModel, PLModel } from 'src/app/shared/model/pl.model';
import { JobcodeModel, MyJobcodeModel } from 'src/app/shared/model/jobcode.model';
import { FileService } from 'src/app/shared/services/file.service';
import { PLService } from 'src/app/shared/services/pl.service';
import { JobcodeService } from 'src/app/shared/services/jobcode.service';
@Component({
selector: 'app-group-competencies',
......@@ -16,15 +16,15 @@ export class GroupCompetenciesComponent {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
groupCompetenciesList: PLModel[] = []
groupCompetencies: PLModel = new MyPLModel({})
groupCompetenciesList: JobcodeModel[] = []
groupCompetencies: JobcodeModel = new MyJobcodeModel({})
dataLoading = false
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
columns: ColumnModel[] = [{
field: "plId",
field: "jobCodeId",
headerText: "รหัส",
type: "string",
isPrimaryKey: true,
......@@ -45,7 +45,7 @@ export class GroupCompetenciesComponent {
constructor(private toastr: ToastrService,
private cdr: ChangeDetectorRef,
private fileService: FileService,
private pLService: PLService,
private jobcodeService: JobcodeService,
) {
this.pathTitleChange()
}
......@@ -106,11 +106,11 @@ export class GroupCompetenciesComponent {
getGroupCompetenciesList() {
this.dataLoading = true
this.selectedItems.data.clear()
this.pLService.getList().subscribe({
this.jobcodeService.getGroupAssessmentList().subscribe({
next: response => {
this.groupCompetenciesList = response.map(x => {
this.selectedItems.data.set(x.plId, false)
return new MyPLModel(x)
this.selectedItems.data.set(x.jobCodeId, false)
return new MyJobcodeModel(x)
})
this.groupCompetenciesList = response
this.dataLoading = false
......@@ -122,9 +122,9 @@ export class GroupCompetenciesComponent {
})
}
selectGroupCompetencies(data: PLModel) {
const groupCompetencies = this.groupCompetenciesList.find(x => x.plId == data.plId)
this.groupCompetencies = new MyPLModel(groupCompetencies)
selectGroupCompetencies(data: JobcodeModel) {
const groupCompetencies = this.groupCompetenciesList.find(x => x.jobCodeId == data.jobCodeId)
this.groupCompetencies = new MyJobcodeModel(groupCompetencies)
}
pathTitleChange() {
......@@ -140,7 +140,7 @@ export class GroupCompetenciesComponent {
}
checkPrimary() {
return this.groupCompetenciesList.find(x => x.plId == this.groupCompetencies.plId)
return this.groupCompetenciesList.find(x => x.jobCodeId == this.groupCompetencies.jobCodeId)
}
}
......@@ -47,7 +47,7 @@
<thead>
<tr>
<ng-container
*ngFor="let item of ['รหัสแบบฟอร์ม','ชื่อพนักงาน','ตำแหน่ง','ระดับพนักงาน','การจัดการ']; let f = first; let l = last; let i = index">
*ngFor="let item of ['รหัสแบบฟอร์ม','ชื่อพนักงาน','ตำแหน่ง','ลักษณะงาน','การจัดการ']; let f = first; let l = last; let i = index">
<th scope="col"
class="relative px-10px py-10px bg-soft-secondary text-primary !text-center">
<span class="font-size-12px font-weight-700">{{ item }}</span>
......@@ -82,7 +82,7 @@
{{item.masfromEvaluationRound.evaluationRoundId}}</td>
<td>{{item.apsassessy.fname}} {{item.apsassessy.lname}}</td>
<td class="text-center">{{item.apsassessy.position.tdesc}}</td>
<td class="text-center">{{item.personalLevel.tdesc}}</td>
<td class="text-center">{{item.jd.tdesc}}</td>
<td class="flex justify-center items-center space-x-2">
<i class="ti ti-edit cursor-pointer i-gray fs-xl px-1" *ngIf="item.active" (click)="openAddRoundModel(item.masfromEvaluationRound.evaluationRoundId,item.apsassessy.employeeId,item,'form-pm-emp')" ></i>
<input type="checkbox" id="hs-small-switch{{i+1}}" [(ngModel)]="item.active" (ngModelChange)="saveAssessmentOne(item)"
......
......@@ -102,14 +102,14 @@
<input type="date" id="input-label" class="ti-form-input w-1/2" [(ngModel)]="evaluation_cycle.apsPeriodEnd"
[ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [readonly]="modalStatus == 'edit'">
<label for="input-label" class="ti-form-label mt-2rem">ระดับพนักงาน (JL)</label>
<div *ngFor="let item of evaluation_cycle.personalLevel;let i = index;let f=first;let l = last"
<label for="input-label" class="ti-form-label mt-2rem">ลักษณะงาน (JD)</label>
<div *ngFor="let item of evaluation_cycle.jd;let i = index;let f=first;let l = last"
class="grid grid-cols-2">
<div class="col-span-1">
<div class="flex relative">
<input type="text" class="ti-form-input pointer-events-none" readonly
[ngClass]="{'input-list-f1': f&&!l, 'input-list-c1': !f&&!l, 'input-list-l1': !f&&l, 'input-list-fl1': f&&l,'!bg-input-readonly':modalStatus == 'edit'}"
[(ngModel)]="item.plId">
[(ngModel)]="item.jobCodeId">
<div
[ngClass]="{'input-list-line-f': f&&!l, 'input-list-line-c': !f&&!l, 'input-list-line-l': !f&&l, 'input-list-line-fl': f&&l}">
<div class="input-list-line"></div>
......@@ -118,7 +118,7 @@
[ngClass]="{'input-list-f2': f&&!l, 'input-list-c2': !f&&!l, 'input-list-l2': !f&&l, 'input-list-fl2': f&&l,'!bg-input-readonly':modalStatus == 'edit'}"
[(ngModel)]="item.tdesc">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button *ngIf="item.plId && modalStatus !== 'edit'" type="button" class="flex items-center text-red-500"
<button *ngIf="item.jobCodeId && modalStatus !== 'edit'" type="button" class="flex items-center text-red-500"
(click)="pl.selectIndex=i;selectPl()">
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
......@@ -129,7 +129,7 @@
<ng-component *ngTemplateOutlet="plSearchButton"></ng-component>
</div>
</div>
<div class="grid grid-cols-2" *ngIf="!evaluation_cycle.personalLevel.length">
<div class="grid grid-cols-2" *ngIf="!evaluation_cycle.jd.length">
<div class="col-span-1">
<div class="flex relative">
<input type="text" class="ti-form-input input-list-fl1 pointer-events-none" readonly>
......@@ -150,7 +150,7 @@
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</ng-template>
<span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JL ระบบจะทำการเลือกทั้งหมด</span>
<span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JD ระบบจะทำการเลือกทั้งหมด</span>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button type="button" mat-button [mat-dialog-close]
......@@ -186,7 +186,7 @@
<ng-template #PLModal let-modal>
<h3 mat-dialog-title>
ข้อมูลระดับพนักงาน (JL)
ข้อมูลลักษณะงาน (JD)
</h3>
<mat-dialog-content>
<div class="flex justify-end pb-1rem">
......@@ -207,7 +207,7 @@
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสระดับพนักงาน (JL)','รายละเอียดฝ่าย (ไทย)','รายละเอียดฝ่าย (อังกฤษ)']; let f = first; let l = last">
*ngFor="let item of ['ลำดับ','รหัสลักษณะงาน (JD)','รายละเอียดฝ่าย (ไทย)','รายละเอียดฝ่าย (อังกฤษ)']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary" [class.!text-center]="f">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
......@@ -231,7 +231,7 @@
<td class="flex justify-center">
{{((PLsearchmodal.currentPage-1) * PLsearchmodal.pageSize)+(i+1)}}
</td>
<td>{{item.plId}}</td>
<td>{{item.jobCodeId}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
</tr>
......@@ -481,7 +481,7 @@
<input type="date" id="input-label" class="ti-form-input w-1/2" [(ngModel)]="evaluation_cycle.apsPeriodEnd"
[ngClass]="{'bg-input-readonly':!modalStatusEdit}" [readonly]="!modalStatusEdit">
<label for="input-label" class="ti-form-label mt-2rem">ระดับพนักงาน (JL)</label>
<label for="input-label" class="ti-form-label mt-2rem">ลักษณะงาน (JD)</label>
<div *ngFor="let item of evaluation_cycle.personalLevel;let i = index;let f=first;let l = last"
class="grid grid-cols-2">
<div class="col-span-1">
......@@ -531,7 +531,7 @@
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</ng-template>
<span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JL ระบบจะทำการเลือกทั้งหมด</span>
<span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JD ระบบจะทำการเลือกทั้งหมด</span>
<div class="flex justify-end mt-2rem mb-1rem">
<button type="button"
......@@ -663,7 +663,7 @@
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
ข้อมูลระดับพนักงาน (JL)
ข้อมูลลักษณะงาน (JD)
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
......@@ -692,7 +692,7 @@
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสระดับพนักงาน (JL)','รายละเอียด(ไทย)','รายละเอียด(อังกฤษ)']; let f = first; let l = last">
*ngFor="let item of ['ลำดับ','รหัสลักษณะงาน (JD)','รายละเอียด(ไทย)','รายละเอียด(อังกฤษ)']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f">
<span class="text-sm">{{ item }}</span>
......
......@@ -2,11 +2,12 @@ import { ChangeDetectorRef, Component, EventEmitter, Output, Renderer2, ViewChil
import { ToastrService } from 'ngx-toastr';
import { EvaluationCycleModel, MyEvaluationCycleModel } from 'src/app/shared/model/evaluation-cycle.model';
import { EvaluationCycleService } from 'src/app/shared/services/evaluation-cycle.service';
import { PLService } from 'src/app/shared/services/pl.service';
import { PLModel, MyPLModel } from 'src/app/shared/model/pl.model';
import { MatDialog } from '@angular/material/dialog';
import { ColumnModel } from '@syncfusion/ej2-grids';
import Swal from 'sweetalert2';
import { JobcodeService } from 'src/app/shared/services/jobcode.service';
import { JobcodeModel, MyJobcodeModel } from 'src/app/shared/model/jobcode.model';
export interface DataModal {
search: string,
currentPage: number,
......@@ -34,7 +35,7 @@ export class EvaluationCycleComponent {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
modalStatus : 'createForm' | 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add'
modalStatus: 'createForm' | 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add'
evaluation_cyclelist: EvaluationCycleModel[] = []
evaluation_cycle: EvaluationCycleModel = new MyEvaluationCycleModel({})
dataLoading = false
......@@ -57,7 +58,7 @@ export class EvaluationCycleComponent {
search: "",
pageSize: 10
}
pl: { loading: boolean, selectIndex: number, dataList: PLModel[] } = { loading: false, selectIndex: -1, dataList: [] }
pl: { loading: boolean, selectIndex: number, dataList: JobcodeModel[] } = { loading: false, selectIndex: -1, dataList: [] }
currentDate = new Date()
yearList = [
(this.currentDate.getFullYear() - 1) + "",
......@@ -110,7 +111,7 @@ export class EvaluationCycleComponent {
private toastr: ToastrService,
private cdr: ChangeDetectorRef,
private renderer: Renderer2,
private pLService: PLService,
private jobcodeService: JobcodeService,
private dialog: MatDialog
) { }
......@@ -132,9 +133,9 @@ export class EvaluationCycleComponent {
getPlList() {
this.pl.loading = false
this.pLService.getList().subscribe({
this.jobcodeService.getGroupAssessmentList().subscribe({
next: response => {
this.pl.dataList = response.map((x: any) => new MyPLModel(x))
this.pl.dataList = response.map((x: any) => new MyJobcodeModel(x))
this.pl.loading = false
this.searchChange()
this.cdr.detectChanges()
......@@ -146,22 +147,22 @@ export class EvaluationCycleComponent {
}
plListFilter() {
return this.pl.dataList.filter(x =>
(x.plId.toLowerCase().includes(this.PLsearchmodal.search.toLowerCase()) ||
(x.jobCodeId.toLowerCase().includes(this.PLsearchmodal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.PLsearchmodal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.PLsearchmodal.search.toLowerCase())) &&
!this.evaluation_cycle.personalLevel.some(y => y.plId == x.plId)
!this.evaluation_cycle.jd.some(y => y.jobCodeId == x.jobCodeId)
);
}
onPLModalSearchChange() {
this.PLsearchmodal.currentPage = 1
this.PLsearchmodal.page = Array.from({ length: Math.ceil(this.plListFilter().length / 10) }, (_, i) => i + 1);
}
selectPl(data?: PLModel) {
selectPl(data?: JobcodeModel) {
if (!data) {
this.evaluation_cycle.personalLevel.splice(this.pl.selectIndex, 1);
this.evaluation_cycle.jd.splice(this.pl.selectIndex, 1);
return;
}
this.evaluation_cycle.personalLevel.push(new MyPLModel(data))
this.evaluation_cycle.jd.push(new MyJobcodeModel(data))
}
getEvaluationCycleList() {
......@@ -220,9 +221,6 @@ export class EvaluationCycleComponent {
} else if (this.modalStatus == 'add') {
this.evaluation_cycle = new MyEvaluationCycleModel();
this.evaluationRoundId = '';
} else if (this.modalStatus == 'edit') {
this.evaluation_cycle = new MyEvaluationCycleModel({ evaluationRoundId: this.evaluation_cycle.evaluationRoundId });
this.evaluationRoundId = this.evaluation_cycle.evaluationRoundId;
}
}
......@@ -399,60 +397,60 @@ export class EvaluationCycleComponent {
}
createForm(data: any) {
Swal.fire({
title: 'สร้างแบบฟอร์ม?',
text: 'คุณต้องการสร้างแบบฟอร์มการประเมินใหม่หรือไม่',
icon: 'question',
showCancelButton: true,
confirmButtonText: 'ยืนยัน',
cancelButtonText: 'ยกเลิก',
reverseButtons: true,
}).then((result) => {
if (result.isConfirmed) {
this.modalStatus = 'createForm';
this.setData(data); // เซ็ตข้อมูลก่อน
const body = new MyEvaluationCycleModel(this.evaluation_cycle);
body.active = 1;
this.dataLoading = true;
this.evaluationCycleService.post(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success');
} else {
Swal.fire({
title: 'สร้างแบบฟอร์ม?',
text: 'คุณต้องการสร้างแบบฟอร์มการประเมินใหม่หรือไม่',
icon: 'question',
showCancelButton: true,
confirmButtonText: 'ยืนยัน',
cancelButtonText: 'ยกเลิก',
reverseButtons: true,
}).then((result) => {
if (result.isConfirmed) {
this.modalStatus = 'createForm';
this.setData(data); // เซ็ตข้อมูลก่อน
const body = new MyEvaluationCycleModel(this.evaluation_cycle);
body.active = 1;
this.dataLoading = true;
this.evaluationCycleService.post(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success');
} else {
this.dataLoading = false;
this.showAlert(response.message, 'error');
this.cdr.detectChanges();
}
},
error: error => {
this.showAlert(error.message, 'error');
this.dataLoading = false;
this.showAlert(response.message, 'error');
this.cdr.detectChanges();
}
},
error: error => {
this.showAlert(error.message, 'error');
this.dataLoading = false;
this.cdr.detectChanges();
}
});
this.evaluationCycleService.postCreateForm(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success');
this.getEvaluationCycleList();
} else {
});
this.evaluationCycleService.postCreateForm(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.showAlert(response.message, 'error');
this.cdr.detectChanges();
}
},
error: error => {
this.showAlert(error.message, 'error');
this.dataLoading = false;
this.cdr.detectChanges();
}
});
}
});
}
});
}
});
}
checkPrimary() {
......
......@@ -109,7 +109,6 @@ import { SettingPerformanceEvalutionComponent } from '../performance-management-
import { AssessmentSystemConfigurationComponent } from '../performance-management-evaluation/setting-performance-evalution/assessment-system-configuration/assessment-system-configuration.component';
import { SelfEvaluationComponent } from '../performance-evaluation/self-evaluation/self-evaluation.component';
import { CompanyRegistrationPageComponent } from '../company-components/company-registration/company-registration-page/company-registration-page.component';
import { PmsEvalutionComponent } from '../performance-evaluation/pms-evaluation/pms-evalution.component';
import { CompanyService } from 'src/app/shared/services/company.service';
import { CompetencytypeService } from 'src/app/shared/services/competencytype.service';
import { CompetencytopicService } from 'src/app/shared/services/competencytopic.service';
......@@ -324,7 +323,6 @@ export class CustomDateAdapter extends NativeDateAdapter {
AssessmentSystemConfigurationComponent,
SelfEvaluationComponent,
CompanyRegistrationPageComponent,
PmsEvalutionComponent,
ManageUserComponent,
PmsGradeRegistrationComponent,
PmsGradeManagementComponent,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import { ChangeDetectorRef, Component, EventEmitter, Input, Output, SimpleChanges } from '@angular/core';
import { AppraisalPmsFormModel } from 'src/app/shared/model/appraisal-pms-form.model';
import { CompetencyGradeModel, MyCompetencyGradeModel } from 'src/app/shared/model/competency-grades.model';
import { AppraisalService } from 'src/app/shared/services/appraisal.service';
import { EmployeeService } from 'src/app/shared/services/employee.service';
import { PmsGroupGradeService } from 'src/app/shared/services/pms-group-grade.service';
import { SettingAssessmentService } from 'src/app/shared/services/setting-assessment.service';
import Swal from 'sweetalert2';
export interface Part8Model {
id: number
evaluationFactor: string,
rawScore: number,
factors: number
scoreObtained: number
netScore: number
}
export interface LevelStarModel {
evaluationFactor: string,
rawScore: number,
factors: number
scoreObtained: number
netScore: number
}
@Component({
selector: 'app-pms-evalution',
templateUrl: './pms-evalution.component.html',
styleUrls: ['./pms-evalution.component.scss']
})
export class PmsEvalutionComponent {
part1show = true
part2show = true
part3show = true
part4show = true
part5show = true
part6show = true
part7show = true
part8show = true
data8List: Part8Model[] = [{
id: 1,
evaluationFactor: "Part 1 : ประเมินผลการปฏิบัติงานตามนโยบายบริษัท (Corporate KPI)",
rawScore: 100,
factors: 0,
scoreObtained: 0,
netScore: 0,
}, {
id: 2,
evaluationFactor: "Part 2 : ประเมินผลการปฏิบัติงานประจำ (Department KPI)",
rawScore: 100,
factors: 0,
scoreObtained: 0,
netScore: 0,
}, {
id: 3,
evaluationFactor: "Part 3 : ประเมินผลการปฏิบัติงานประจำ (Individual KPI)",
rawScore: 100,
factors: 0,
scoreObtained: 0,
netScore: 0,
}, {
id: 4,
evaluationFactor: "Part 4 : ประเมินผลสมรรถนะที่สนับสนุนการปฏิบัติงาน (Competency)",
rawScore: 100,
factors: 0,
scoreObtained: 0,
netScore: 0,
}, {
id: 5,
evaluationFactor: "Part 5 : อัตราการเข้างาน (Time Attendance)",
rawScore: 100,
factors: 0,
scoreObtained: 0,
netScore: 0,
}, {
id: 6,
evaluationFactor: "Part 6 : งานที่ได้รับมอบหมายเพิ่มเติม (Cross Functional Project Assignment)",
rawScore: 100,
factors: 0,
scoreObtained: 0,
netScore: 0,
}, {
id: 7,
evaluationFactor: "Part 7 : กิจกรรมพิเศษ (Special Activities)",
rawScore: 100,
factors: 0,
scoreObtained: 0,
netScore: 0,
}]
part9show = true
part10show = true
canEdit = false
canSave = false
currentDate = new Date()
@Input() pathTitle: string[] = []
@Input() evaluationRoundId = ""
@Input() evaluateeId = ""
@Input() evaluaterId = ""
@Input() competencyTypeId = ""
@Output() sendReturnPath: EventEmitter<any> = new EventEmitter<any>();
appraisalPms: { loading: boolean, data?: AppraisalPmsFormModel } = { loading: false, data: undefined }
groupGrade: { loading: boolean, dataList: CompetencyGradeModel[] } = { loading: false, dataList: [] }
constructor(private appraisalService: AppraisalService,
private pmsGroupGradeService: PmsGroupGradeService,
private employeeService: EmployeeService,
private cdr: ChangeDetectorRef,
private settingAssessmentService: SettingAssessmentService
) {
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['evaluateeId'].currentValue || changes['evaluaterId'].currentValue) {
this.toggleAllParts(this.evaluateeId == this.evaluaterId)
}
}
ngOnInit(): void {
this.getPmsGroupGradeList()
this.getAppraisalPmsForm()
}
getPmsGroupGradeList() {
this.groupGrade.loading = true
this.pmsGroupGradeService.getGradeList().subscribe({
next: response => {
this.groupGrade.dataList = response.map(x => new MyCompetencyGradeModel(x))
this.groupGrade.loading = false
this.cdr.detectChanges()
}, error: error => {
this.groupGrade.loading = false
this.cdr.detectChanges()
}
})
}
getAppraisalPmsForm() {
this.appraisalPms.loading = true
this.appraisalService.getFormPmsById(this.evaluationRoundId, this.evaluateeId).subscribe({
next: response => {
this.appraisalPms.data = JSON.parse(JSON.stringify(response))
this.data8List.forEach((x, i) => {
if (x.id == 1 && this.appraisalPms.data?.part1Percentage) {
x.factors = this.appraisalPms.data.part1Percentage
} else if (x.id == 2 && this.appraisalPms.data?.part2Percentage) {
x.factors = this.appraisalPms.data.part2Percentage
} else if (x.id == 3 && this.appraisalPms.data?.part3Percentage) {
x.factors = this.appraisalPms.data.part3Percentage
} else if (x.id == 4 && this.appraisalPms.data?.part4Percentage) {
x.factors = this.appraisalPms.data.part4Percentage
} else if (x.id == 5 && this.appraisalPms.data?.part5Percentage) {
x.factors = this.appraisalPms.data.part5Percentage
} else if (x.id == 6 && this.appraisalPms.data?.part6Percentage) {
x.factors = this.appraisalPms.data.part6Percentage
} else if (x.id == 7 && this.appraisalPms.data?.part7Percentage) {
x.factors = this.appraisalPms.data.part7Percentage
}
})
if (!this.appraisalPms.data?.part1Detail.length) {
this.data8List = this.data8List.filter(item => item.id !== 1)
}
if (!this.appraisalPms.data?.part2Detail.length) {
this.data8List = this.data8List.filter(item => item.id !== 2)
}
if (!this.appraisalPms.data?.part3Detail.length) {
this.data8List = this.data8List.filter(item => item.id !== 3)
}
if (!this.appraisalPms.data?.part4Detail.length) {
this.data8List = this.data8List.filter(item => item.id !== 4)
}
if (!this.appraisalPms.data?.part5Detail.length) {
this.data8List = this.data8List.filter(item => item.id !== 5)
}
if (!this.appraisalPms.data?.part6Detail.length) {
this.data8List = this.data8List.filter(item => item.id !== 6)
}
if (!this.appraisalPms.data?.part7Detail.length) {
this.data8List = this.data8List.filter(item => item.id !== 7)
}
this.changePercentage()
if (this.appraisalPms.data) {
this.canSave = (this.appraisalPms.data.currentStep == this.appraisalPms.data.checkStep) && this.appraisalPms.data.masfromStatusType.code != 'Boss_finish' && this.appraisalPms.data.masfromStatusType.code != 'Not_evaluating_yet'
this.canEdit = (this.appraisalPms.data.currentStep == this.appraisalPms.data.checkStep) && (+(this.appraisalPms.data.checkStep) <= 1) && this.appraisalPms.data.masfromStatusType.code != 'Boss_finish' && this.appraisalPms.data.masfromStatusType.code != 'Not_evaluating_yet'
switch (this.appraisalPms.data?.currentStep) {
case ("0"): {
if (this.canSave) {
this.appraisalPms.data.apsassessyDate = this.currentDate.toISOString().split('T')[0];
}
break
}
case ("1"): {
if (this.canSave) {
this.appraisalPms.data.apsapprove1Date = this.currentDate.toISOString().split('T')[0];
}
break
}
case ("2"): {
if (this.canSave) {
this.appraisalPms.data.apsapprove2Date = this.currentDate.toISOString().split('T')[0];
}
break
}
case ("3"): {
if (this.canSave) {
this.appraisalPms.data.apsapprove3Date = this.currentDate.toISOString().split('T')[0];
}
break
}
case ("4"): {
if (this.canSave) {
this.appraisalPms.data.apsapprove4Date = this.currentDate.toISOString().split('T')[0];
}
break
}
case ("5"): {
if (this.canSave) {
this.appraisalPms.data.apsapprove5Date = this.currentDate.toISOString().split('T')[0];
}
break
}
default: { return }
}
}
this.appraisalPms.loading = false
this.cdr.detectChanges()
}, error: error => {
this.appraisalPms.loading = false
this.cdr.detectChanges()
}
})
}
returnPath() {
this.sendReturnPath.emit()
}
calRawScore(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + item.weight * 5, 0).toFixed(2);
}
return "0.00"
}
calWeigth(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + item.weight, 0).toFixed(2);
}
return "0.00"
}
calExpectationScore(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + item.scoreTopicExpectationBoss, 0).toFixed(2);
}
return "0.00"
}
calExpectationTotalScore(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + (item.scoreTopicExpectationBoss * item.weight), 0).toFixed(2);
}
return "0.00"
}
calPercentage(A: number, B: number) {
if (B > 0) {
return ((A / B) * 100).toFixed(2);
}
return "0.00"
}
changePercentage() {
this.data8List.forEach(x => {
if (x.id == 1 && this.appraisalPms.data?.part1Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms.data?.part1Detail), this.calRawScore(this.appraisalPms.data?.part1Detail))
if (this.appraisalPms.data) {
this.appraisalPms.data.part1SumScore = x.scoreObtained
}
} else if (x.id == 2 && this.appraisalPms.data?.part2Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms.data?.part2Detail), this.calRawScore(this.appraisalPms.data?.part2Detail))
if (this.appraisalPms.data) {
this.appraisalPms.data.part2SumScore = x.scoreObtained
}
} else if (x.id == 3 && this.appraisalPms.data?.part3Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms.data?.part3Detail), this.calRawScore(this.appraisalPms.data?.part3Detail))
if (this.appraisalPms.data) {
this.appraisalPms.data.part3SumScore = x.scoreObtained
}
} else if (x.id == 4 && this.appraisalPms.data?.part4Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart4(this.appraisalPms.data?.part4Detail), this.calRawScorePart4(this.appraisalPms.data?.part4Detail))
if (this.appraisalPms.data) {
this.appraisalPms.data.part4SumScore = x.scoreObtained
}
} else if (x.id == 5 && this.appraisalPms.data?.part5Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart5(this.appraisalPms.data?.part5Detail), this.calRawScorePart5(this.appraisalPms.data?.part5Detail))
if (this.appraisalPms.data) {
this.appraisalPms.data.part5SumScore = x.scoreObtained
}
} else if (x.id == 6 && this.appraisalPms.data?.part6Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms.data?.part6Detail), this.calRawScore(this.appraisalPms.data?.part6Detail))
if (this.appraisalPms.data) {
this.appraisalPms.data.part6SumScore = x.scoreObtained
}
} else if (x.id == 7 && this.appraisalPms.data?.part7Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms.data?.part7Detail), this.calRawScore(this.appraisalPms.data?.part7Detail))
if (this.appraisalPms.data) {
this.appraisalPms.data.part7SumScore = x.scoreObtained
}
}
x.netScore = x.factors / 100 * x.scoreObtained
})
this.setGradeScore()
}
setGradeScore() {
const gradeScore = this.groupGrade.dataList.find(item => Math.ceil(+this.calNetScore()) >= item.gradeMinScore && Math.ceil(+this.calNetScore()) <= item.gradeMaxScore);
if (this.appraisalPms.data && gradeScore) {
this.appraisalPms.data.gradeScore = gradeScore.gradeDetail
}
}
calFactors() {
return this.data8List.reduce((sum: number, item: any) => sum + item.factors, 0).toFixed(2);
}
calScoreObtained() {
return this.data8List.reduce((sum: number, item: any) => sum + item.scoreObtained, 0).toFixed(2);
}
calNetScore() {
if (this.appraisalPms.data) {
this.appraisalPms.data.netScore = +(this.data8List.reduce((sum: number, item: any) => sum + item.netScore, 0).toFixed(2));
return this.appraisalPms.data.netScore
}
return "0.00"
}
calAverage(score: number) {
const roundedScore = score % 1 <= 0.5 ? Math.floor(score) : Math.round(score);
if (roundedScore >= 90 && roundedScore <= 100) {
return 5;
} else if (roundedScore >= 80 && roundedScore <= 89) {
return 4;
} else if (roundedScore >= 60 && roundedScore <= 79) {
return 3;
} else if (roundedScore >= 40 && roundedScore <= 59) {
return 2;
} else {
return 1;
}
}
calRawScorePart4(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + item.competencyType.weight * 5, 0).toFixed(2);
}
return "0.00"
}
calWeigthPart4(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + item.competencyType.weight, 0).toFixed(2);
}
return "0.00"
}
calExpectationScorePart4(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + this.calAverage(item.averageScore), 0).toFixed(2);
}
return "0.00"
}
calExpectationTotalScorePart4(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + (item.competencyType.weight * this.calAverage(item.averageScore)), 0).toFixed(2);
}
return "0.00"
}
calRawScorePart5(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + item.weight * 5, 0).toFixed(2);
}
return "0.00"
}
calWeigthPart5(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + item.weight, 0).toFixed(2);
}
return "0.00"
}
calExpectationScorePart5(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + item.pmsWorkingTimScoreBoss, 0).toFixed(2);
}
return "0.00"
}
calExpectationTotalScorePart5(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + (item.pmsWorkingTimScoreBoss * item.weight), 0).toFixed(2);
}
return "0.00"
}
setScorePart5(item: any, score: number) {
if (this.canEdit) {
if (this.evaluaterId == this.evaluateeId) {
item.pmsWorkingTimScore = score
item.pmsWorkingTimScoreBoss = score
} else {
item.pmsWorkingTimScoreBoss = score
}
this.changePercentage()
}
}
numberFixed2(data?: number) {
if (data) {
return data.toFixed(2)
}
return "0.00"
}
setScore(item: any, score: number) {
if (this.canEdit) {
if (this.evaluaterId == this.evaluateeId) {
item.scoreTopicExpectation = score
item.scoreTopicExpectationBoss = score
} else {
item.scoreTopicExpectationBoss = score
}
this.changePercentage()
}
}
convertDate(dateInput?: string | Date): string {
let date = new Date()
if (dateInput) {
if (typeof dateInput === 'string') {
const [year, month, day] = dateInput.split('-').map(Number);
date = new Date(year, month - 1, day);
} else {
date = dateInput
}
} else {
return ''
}
return date?.toLocaleDateString('th-TH', { day: 'numeric', month: 'long', year: 'numeric' }) || ''
}
save(status: 'approve' | 'noApprove' | 'draft') {
let title = ''
let text = ''
let confirmButtonText = ''
let approveStatus = '0'
if (status == 'draft') {
title = 'บันทึกแบบร่าง'
text = 'คุณต้องการบันทึกแบบร่างของการประเมินนี้ใช่หรือไม่'
confirmButtonText = 'ยืนยันการบันทึก'
approveStatus = '1'
} else if (status == 'approve') {
approveStatus = '2'
if (this.appraisalPms?.data?.checkStep == '0') {
title = 'ยืนยันข้อมูล'
text = 'คุณต้องการยืนยันข้อมูลการประเมินนี้ใช่หรือไม่'
confirmButtonText = 'ยืนยันการบันทึก'
} else {
title == 'อนุมัติ'
text = 'คุณต้องการอนุมัติข้อมูลการประเมินนี้ใช่หรือไม่'
confirmButtonText = 'ยืนยันการอนุมัติ'
}
} else if (status == 'noApprove') {
approveStatus = '0'
title == 'ไม่อนุมัติ'
text = 'คุณต้องการไม่อนุมัติข้อมูลการประเมินนี้ใช่หรือไม่'
confirmButtonText = 'ยืนยันการไม่อนุมัติ'
}
Swal.fire({
iconHtml: `
<div class="flex items-center justify-center rounded-full !h-80px !w-80px" style="background-color: #E8F8EE;">
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="39" height="39" fill="#D2D2D2"/>
<g id="Component">
<g id="alert cart">
<g id="mdi:file-export">
<circle cx="22.5" cy="19.5" r="33.5" fill="#E8F8EE"/>
<path d="M9.75 3.25C8.88805 3.25 8.0614 3.59241 7.4519 4.2019C6.84241 4.8114 6.5 5.63805 6.5 6.5V32.5C6.5 33.362 6.84241 34.1886 7.4519 34.7981C8.0614 35.4076 8.88805 35.75 9.75 35.75H29.25C30.112 35.75 30.9386 35.4076 31.5481 34.7981C32.1576 34.1886 32.5 33.362 32.5 32.5V13L22.75 3.25M21.125 5.6875L30.0625 14.625H21.125M14.5113 19.8575H26V31.3463L22.555 27.9013L17.9563 32.5L13.3575 27.9013L17.9563 23.3188"
fill="#1DBE5A"/>
</g>
</g>
</g>
</svg>
</div>
`,
title: title,
text: text,
showCancelButton: true,
confirmButtonText: confirmButtonText,
cancelButtonText: 'ย้อนกลับ',
customClass: {
title: '!swal2-title-mt-20px',
actions: '!swal2-actions-mt-20px',
icon: '!swal2-icon-no-border',
confirmButton: '!swal2-button-bg-green',
cancelButton: '!swal2-button-bg-gray',
},
}).then((result) => {
if (result.isConfirmed && this.appraisalPms) {
this.saveApi(approveStatus)
} else if (result.dismiss === Swal.DismissReason.cancel) {
Swal.fire({
title: 'ยกเลิก!',
text: 'การบันทึกถูกยกเลิก',
icon: 'error',
customClass: {
confirmButton: '!swal2-button-bg-danger',
}
})
}
})
}
saveApi(approveStatus: string) {
let body = this.appraisalPms.data
switch (this.appraisalPms.data?.currentStep) {
case ("0"): {
body = {
...this.appraisalPms.data,
apsassessyStatus: approveStatus
}
break
}
case ("1"): {
body = {
...this.appraisalPms.data,
apsapprove1Status: approveStatus
}
break
}
case ("2"): {
body = {
...this.appraisalPms.data,
apsapprove1Status: approveStatus == '0' ? approveStatus : this.appraisalPms.data.apsapprove1Status,
apsapprove2Status: approveStatus
}
break
}
case ("3"): {
body = {
...this.appraisalPms.data,
apsapprove2Status: approveStatus == '0' ? approveStatus : this.appraisalPms.data.apsapprove2Status,
apsapprove3Status: approveStatus
}
break
}
case ("4"): {
body = {
...this.appraisalPms.data,
apsapprove3Status: approveStatus == '0' ? approveStatus : this.appraisalPms.data.apsapprove3Status,
apsapprove4Status: approveStatus
}
break
}
case ("5"): {
body = {
...this.appraisalPms.data,
apsapprove4Status: approveStatus == '0' ? approveStatus : this.appraisalPms.data.apsapprove4Status,
apsapprove5Status: approveStatus
}
break
}
default: { return }
}
this.appraisalService.postPms(body).subscribe({
next: response => {
if (response.success) {
Swal.fire({
title: 'บันทึกสำเร็จ!',
text: 'การประเมินของคุณถูกบันทึกแล้ว',
icon: 'success',
customClass: {
confirmButton: '!swal2-button-bg-green',
}
});
this.getAppraisalPmsForm()
} else {
Swal.fire({
title: 'ยกเลิก!',
text: 'การบันทึกถูกยกเลิก',
icon: 'error',
customClass: {
confirmButton: '!swal2-button-bg-danger',
}
});
}
}, error: error => {
Swal.fire({
title: 'ยกเลิก!',
text: 'การบันทึกถูกยกเลิก',
icon: 'error',
customClass: {
confirmButton: '!swal2-button-bg-danger',
}
});
}
})
}
toggleAllParts(check: boolean) {
this.part1show = check
this.part2show = check
this.part3show = check
this.part4show = check
this.part5show = check
this.part6show = check
this.part7show = check
this.part8show = check
this.part9show = check
this.part10show = check
}
}
\ No newline at end of file
......@@ -150,10 +150,10 @@
style="border-radius:10px"
(mouseenter)="biScore.set(bi.behavioralIndicators+bi.assessmentId,item)"
(mouseleave)="biScore.clear()"
(click)="bi.competencyBehavioral.scoreTopicExpectation=item;calnumberCheck()" [ngClass]="{
'!border-secondary': bi.competencyBehavioral.scoreTopicExpectation>=item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)>=item ,
'!text-indigo-600':bi.competencyBehavioral.scoreTopicExpectation>item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)>item,
'!text-white !bg-secondary': bi.competencyBehavioral.scoreTopicExpectation==item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)==item ,
(click)="bi.competencyBehavioral.scoreTopicExpectationBoss=item;calnumberCheck()" [ngClass]="{
'!border-secondary': bi.competencyBehavioral.scoreTopicExpectationBoss>=item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)>=item ,
'!text-indigo-600':bi.competencyBehavioral.scoreTopicExpectationBoss>item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)>item,
'!text-white !bg-secondary': bi.competencyBehavioral.scoreTopicExpectationBoss==item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)==item ,
'pointer-events-none':!canEdit}">
{{item}}
</button>
......@@ -164,11 +164,11 @@
style="border-radius:10px"
(mouseenter)="biScore.set(bi.behavioralIndicators+bi.assessmentId,item)"
(mouseleave)="biScore.clear()"
(click)="bi.competencyBehavioral.scoreTopicExpectationEmp=item;bi.competencyBehavioral.scoreTopicExpectation=item;calnumberCheck()"
(click)="bi.competencyBehavioral.scoreTopicExpectationBoss=item;bi.competencyBehavioral.scoreTopicExpectationBoss=item;calnumberCheck()"
[ngClass]="{
'!border-secondary': bi.competencyBehavioral.scoreTopicExpectation>=item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)>=item ,
'!text-indigo-600':bi.competencyBehavioral.scoreTopicExpectation>item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)>item,
'!text-white !bg-secondary': bi.competencyBehavioral.scoreTopicExpectation==item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)==item ,
'!border-secondary': bi.competencyBehavioral.scoreTopicExpectationBoss>=item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)>=item ,
'!text-indigo-600':bi.competencyBehavioral.scoreTopicExpectationBoss>item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)>item,
'!text-white !bg-secondary': bi.competencyBehavioral.scoreTopicExpectationBoss==item||(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)==item ,
'pointer-events-none':!canEdit}">
{{item}}
</button>
......@@ -180,13 +180,13 @@
{{scoreDescriptions[(biScore.get(bi.behavioralIndicators+bi.assessmentId) ?? 0)] }}
</span>
<span *ngIf="!biScore.get(bi.behavioralIndicators+bi.assessmentId)" class="text-indigo-600">
{{scoreDescriptions[bi.competencyBehavioral.scoreTopicExpectation] }}
{{scoreDescriptions[bi.competencyBehavioral.scoreTopicExpectationBoss] }}
</span>
</div>
</td>
<ng-container *ngIf="evaluaterId!=evaluateeId&&!complete">
<td class="py-2 text-center text-indigo-600 font-semibold" style="vertical-align: top">
{{bi.competencyBehavioral.scoreTopicExpectationEmp}}
{{bi.competencyBehavioral.scoreTopicExpectationBoss}}
</td>
</ng-container>
</tr>
......
......@@ -179,19 +179,19 @@ export class PmsCompetencyComponent {
calnumberCheck() {
if (this.evaluaterId != this.evaluateeId || this.currentStep != '0') {
if (this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0]) {
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck1Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationEmp == 1).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck2Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationEmp == 2).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck3Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationEmp == 3).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck4Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationEmp == 4).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck5Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationEmp == 5).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck1Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 1).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck2Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 2).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck3Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 3).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck4Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 4).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck5Emp = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 5).length).reduce((acc: any, num: any) => acc + num, 0)
}
}
if (this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0]) {
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck1 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 1).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck2 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 2).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck3 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 3).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck4 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 4).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck5 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 5).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck1 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationBoss == 1).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck2 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationBoss == 2).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck3 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationBoss == 3).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck4 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationBoss == 4).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].numberCheck5 = this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].masfromEvaluationAssessment2List.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectationBoss == 5).length).reduce((acc: any, num: any) => acc + num, 0)
this.calWeightTotal()
}
this.cdr.detectChanges()
......@@ -330,7 +330,7 @@ export class PmsCompetencyComponent {
}
inFormRemain(data: MasfromEvaluationAssessment2List) {
const remain = data.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter(x => x.competencyBehavioral.scoreTopicExpectation == 0).length
const remain = data.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter(x => x.competencyBehavioral.scoreTopicExpectationBoss == 0).length
return remain
}
formRemain(index: number) {
......
......@@ -322,7 +322,7 @@ export class PmsFormEmployeeComponent {
selectDataList(data: CompetencyModel) {
this.compentency.originalData = this.deepClone(data)
this.compentency.data = this.deepClone(data)
this.complete = this.compentency.data?.statusAll == 'complete'
this.complete = this.compentency.data?.statusType == 'complete'
this.cdr.detectChanges()
if (this.compentency.data) {
this.currentTap = this.firstCurrentTap || "ข้อมูลการประเมิน"
......
......@@ -19,7 +19,7 @@
</div>
</div>
<div class="grid grid-cols-6">
<input type="text" class="ti-form-input !bg-input-readonly" readonly [(ngModel)]="pl.plId">
<input type="text" class="ti-form-input !bg-input-readonly" readonly [(ngModel)]="pl.jobCodeId">
</div>
<div class="grid grid-cols-3 gap-6 mt-5">
<div class="col-span-1">
......
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyPLModel, PLModel } from 'src/app/shared/model/pl.model';
import { MyJobcodeModel, JobcodeModel } from 'src/app/shared/model/jobcode.model';
import { MyPLModel } from 'src/app/shared/model/pl.model';
import { MyPmsGroupAssessmentModel } from 'src/app/shared/model/pms-group-assessment.model';
import { MyPmsGroupAssessment1Model, PmsGroupAssessment1Model } from 'src/app/shared/model/pms-group-assessment1.model';
import { MyPmstopicModel, PmstopicModel } from 'src/app/shared/model/pmstopic.model';
......@@ -18,7 +19,7 @@ export interface DataModal {
})
export class EditEvaluationGroupingComponent {
@Output() sendOnEdit: EventEmitter<boolean> = new EventEmitter<boolean>();
@Input() pl: PLModel = new MyPLModel()
@Input() pl: JobcodeModel = new MyJobcodeModel()
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
......@@ -83,7 +84,7 @@ export class EditEvaluationGroupingComponent {
getPmsGroupAssessmentBy_plId() {
this.pmsGroupAssessment.loading = true
this.pmsGroupAssessmentService.getBy_plId(this.pl.plId).subscribe({
this.pmsGroupAssessmentService.getBy_plId(this.pl.jobCodeId).subscribe({
next: response => {
this.pmsGroupAssessment.dataList = response.pmsGroupAssessment1List.map(x => ({ check: false, data: new MyPmsGroupAssessment1Model(x) }))
this.pmsGroupAssessment.dataList.sort((a, b) => a.data.pmsTopic.pmsTopicId.localeCompare(b.data.pmsTopic.pmsTopicId))
......@@ -137,7 +138,8 @@ export class EditEvaluationGroupingComponent {
savePmsGroupAssessment() {
const body = {
personalLevel: new MyPLModel(this.pl),
personalLevel: new MyPLModel(),
jd: new MyJobcodeModel(this.pl),
companyId: "",
pmsGroupAssessment1List: this.pmsGroupAssessment.dataList.map(x => new MyPmsGroupAssessment1Model(x.data))
}
......
import { ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { PLModel, MyPLModel } from 'src/app/shared/model/pl.model';
import { FileService } from 'src/app/shared/services/file.service';
import { PLService } from 'src/app/shared/services/pl.service';
import { ColumnModel } from '@syncfusion/ej2-grids';
import { JobcodeService } from 'src/app/shared/services/jobcode.service';
import { JobcodeModel, MyJobcodeModel } from 'src/app/shared/model/jobcode.model';
@Component({
selector: 'app-evaluation-grouping',
......@@ -24,14 +25,14 @@ export class EvaluationGroupingComponent {
selectedFileName: string = 'กรุณาเลือกไฟล์';
columns: ColumnModel[] = [{
field: "plId",
field: "jobCodeId",
headerText: "รหัส",
type: "string",
isPrimaryKey: true,
},
{
field: "tdesc",
headerText: "ชื่อระดับพนักงาน (ไทย)",
headerText: "ชื่อลักษณะงาน (ไทย)",
type: "string"
}]
searchSettings = {
......@@ -41,8 +42,8 @@ export class EvaluationGroupingComponent {
};
selectedItems: { key: string, count: number, data: Map<string, boolean> } = { key: '', count: 0, data: new Map<string, boolean>() };
pl: { loading: boolean, select: PLModel, dataList: PLModel [] } = { loading: false, select: new MyPLModel(), dataList: [] }
constructor(private toastr: ToastrService, private plService: PLService, private cdr: ChangeDetectorRef, private fileService: FileService) { }
pl: { loading: boolean, select: JobcodeModel, dataList: JobcodeModel [] } = { loading: false, select: new MyJobcodeModel(), dataList: [] }
constructor(private toastr: ToastrService, private jobcodeService: JobcodeService, private cdr: ChangeDetectorRef, private fileService: FileService) { }
ngOnInit(): void {
this.onSendPathTitle()
this.getPLList()
......@@ -97,10 +98,10 @@ export class EvaluationGroupingComponent {
}
getPLList() {
this.pl.loading = true
this.plService.getList().subscribe({
this.jobcodeService.getGroupAssessmentList().subscribe({
next: response => {
this.pl.dataList = response.map(x => {
return new MyPLModel(x)
return new MyJobcodeModel(x)
})
this.pl.loading = false
this.cdr.detectChanges();
......@@ -114,17 +115,17 @@ export class EvaluationGroupingComponent {
plListFilter() {
return this.pl.dataList.filter(x => {
const data = x
const match = data.plId.toLowerCase().includes(this.search.toLowerCase()) || data.tdesc.toLowerCase().includes(this.search.toLowerCase())
const match = data.jobCodeId.toLowerCase().includes(this.search.toLowerCase()) || data.tdesc.toLowerCase().includes(this.search.toLowerCase())
return match;
});
}
selectPl(data?: PLModel) {
selectPl(data?: JobcodeModel) {
if (data) {
this.pl.select = new MyPLModel(data)
this.pl.select = new MyJobcodeModel(data)
} else if (this.currentModal == 'add') {
this.pl.select = new MyPLModel()
this.pl.select = new MyJobcodeModel()
} else if (this.currentModal == 'edit') {
this.pl.select = new MyPLModel({ plId: this.pl.select.plId })
this.pl.select = new MyJobcodeModel({ jobCodeId: this.pl.select.jobCodeId })
}
}
searchChange() {
......
......@@ -59,7 +59,7 @@
<thead>
<tr>
<ng-container
*ngFor="let item of ['รหัสแบบฟอร์ม','ชื่อพนักงาน','ตำแหน่ง','ระดับพนักงาน','การจัดการ']; let f = first; let l = last; let i = index">
*ngFor="let item of ['รหัสแบบฟอร์ม','ชื่อพนักงาน','ตำแหน่ง','ลักษณะงาน','การจัดการ']; let f = first; let l = last; let i = index">
<th scope="col"
class="relative px-10px py-10px bg-soft-secondary text-primary !text-center">
<span class="font-size-12px font-weight-700">{{ item }}</span>
......@@ -77,7 +77,7 @@
{{item.pmsMasfromEvaluationRound.pmsEvaluationRoundId}}</td>
<td>{{item.apsassessy.fname}} {{item.apsassessy.lname}}</td>
<td class="text-center">{{item.apsassessy.position.tdesc}}</td>
<td class="text-center">{{item.personalLevel.tdesc}}</td>
<td class="text-center">{{item.jd.tdesc}}</td>
<td class="flex justify-center items-center space-x-2">
<i class="ti ti-edit cursor-pointer i-gray fs-xl px-1" *ngIf="item.active" (click)="openAddRoundModel(item.pmsMasfromEvaluationRound.pmsEvaluationRoundId,item.apsassessy.employeeId,item,'form-pm-emp')" ></i>
<input type="checkbox" id="hs-small-switch{{i+1}}" [(ngModel)]="item.active" (ngModelChange)="saveAssessmentOne(item)"
......
......@@ -115,9 +115,10 @@ export class EditEvaluationFormComponent {
x.apsassessy.efname.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.elname.toLowerCase().includes(this.search.toLowerCase()) ||
x.pmsMasfromEvaluationRound.pmsEvaluationRoundId.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.employeeId.toLowerCase().includes(this.search.toLowerCase())||
x.apsassessy.position.tdesc.toLowerCase().includes(this.search.toLowerCase())||
x.personalLevel.tdesc.toLowerCase().includes(this.search.toLowerCase())
x.apsassessy.employeeId.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.position.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
x.personalLevel.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
x.jd.tdesc.toLowerCase().includes(this.search.toLowerCase())
)
}
searchChange() {
......@@ -126,7 +127,7 @@ export class EditEvaluationFormComponent {
this.page = Array.from({ length: Math.ceil(filteredData.length / this.pageSize) }, (_, i) => i + 1);
}
saveAssessmentOne(item:PmsMasfromEvaluationFullModel) {
saveAssessmentOne(item: PmsMasfromEvaluationFullModel) {
this.pmsEvaluationAssessmentService.post(item).subscribe({
next: response => {
if (response.success) {
......@@ -135,7 +136,7 @@ export class EditEvaluationFormComponent {
}
}
})
}
}
saveAssessmentList() {
let body = this.assessmentList.filter(x => x.active == true)
if (body.length > 0) {
......@@ -177,7 +178,7 @@ export class EditEvaluationFormComponent {
console.error('Error fetching evaluation cycles:', err);
}
})
}else {
} else {
this.showAlert('กรุณาเลือกรายการ', 'error');
}
}
......@@ -351,7 +352,7 @@ export class EditEvaluationFormComponent {
this.apsassessy = apsassessy
this.getApsassessy()
this.getApsassessyMini();
}
......
......@@ -122,14 +122,14 @@
[(ngModel)]="pmsMasfromEvaluation.select.apsPeriodEnd" [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}"
[readonly]="modalStatus =='edit'">
<label for="input-label" class="ti-form-label mt-2rem">ระดับพนักงาน (JL)</label>
<div *ngFor="let item of pmsMasfromEvaluation.select.personalLevel;let i = index;let f=first;let l = last"
<label for="input-label" class="ti-form-label mt-2rem">ลักษณะงาน (JD)</label>
<div *ngFor="let item of pmsMasfromEvaluation.select.jd;let i = index;let f=first;let l = last"
class="grid grid-cols-2">
<div class="col-span-1">
<div class="flex relative">
<input type="text" class="ti-form-input pointer-events-none" readonly
[ngClass]="{'input-list-f1': f&&!l, 'input-list-c1': !f&&!l, 'input-list-l1': !f&&l, 'input-list-fl1': f&&l,'!bg-input-readonly':modalStatus == 'edit'}"
[(ngModel)]="item.plId">
[(ngModel)]="item.jobCodeId">
<div
[ngClass]="{'input-list-line-f': f&&!l, 'input-list-line-c': !f&&!l, 'input-list-line-l': !f&&l, 'input-list-line-fl': f&&l}">
<div class="input-list-line"></div>
......@@ -138,7 +138,7 @@
[ngClass]="{'input-list-f2': f&&!l, 'input-list-c2': !f&&!l, 'input-list-l2': !f&&l, 'input-list-fl2': f&&l,'!bg-input-readonly':modalStatus == 'edit'}"
[(ngModel)]="item.tdesc">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button *ngIf="item.plId && modalStatus !== 'edit'" type="button" class="flex items-center text-red-500"
<button *ngIf="item.jobCodeId && modalStatus !== 'edit'" type="button" class="flex items-center text-red-500"
(click)="pl.selectIndex=i;selectPl();">
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
......@@ -149,7 +149,7 @@
<ng-component *ngTemplateOutlet="plSearchButton"></ng-component>
</div>
</div>
<div class="grid grid-cols-2" *ngIf="!pmsMasfromEvaluation.select.personalLevel.length">
<div class="grid grid-cols-2" *ngIf="!pmsMasfromEvaluation.select.jd.length">
<div class="col-span-1">
<div class="flex relative">
<input type="text" class="ti-form-input input-list-fl1 pointer-events-none" readonly>
......@@ -170,7 +170,7 @@
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</ng-template>
<span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JL ระบบจะทำการเลือกทั้งหมด</span>
<span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JD ระบบจะทำการเลือกทั้งหมด</span>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button type="button" mat-button [mat-dialog-close]
......@@ -207,7 +207,7 @@
<ng-template #PLModal let-modal>
<h3 mat-dialog-title>
ข้อมูลระดับพนักงาน (JL)
ข้อมูลลักษณะงาน (JD)
</h3>
<mat-dialog-content>
<div class="flex justify-end pb-1rem">
......@@ -228,7 +228,7 @@
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสระดับพนักงาน (JL)','รายละเอียดฝ่าย (ไทย)','รายละเอียดฝ่าย (อังกฤษ)']; let f = first; let l = last">
*ngFor="let item of ['ลำดับ','รหัสลักษณะงาน (JD)','รายละเอียดฝ่าย (ไทย)','รายละเอียดฝ่าย (อังกฤษ)']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary" [class.!text-center]="f">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
......@@ -252,7 +252,7 @@
<td class="flex justify-center">
{{((PLsearchmodal.currentPage-1) * PLsearchmodal.pageSize)+(i+1)}}
</td>
<td>{{item.plId}}</td>
<td>{{item.jobCodeId}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
</tr>
......@@ -487,7 +487,7 @@
<label for="input-label" class="ti-form-label mt-2rem">สิ้นสุดวันที่<span class="text-danger">*</span></label>
<input type="date" id="input-label" class="ti-form-input w-1/2" [(ngModel)]="pmsMasfromEvaluation.apsPeriodEnd" [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [readonly]="modalStatus =='edit'">
<label for="input-label" class="ti-form-label mt-2rem">ระดับพนักงาน (JL)</label>
<label for="input-label" class="ti-form-label mt-2rem">ลักษณะงาน (JD)</label>
<div *ngFor="let item of pmsMasfromEvaluation.personalLevel;let i = index;let f=first;let l = last"
class="grid grid-cols-2">
<div class="col-span-1">
......@@ -536,7 +536,7 @@
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</ng-template>
<span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JL ระบบจะทำการเลือกทั้งหมด</span>
<span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JD ระบบจะทำการเลือกทั้งหมด</span>
<div class="flex justify-end mt-2rem mb-1rem">
<button type="button"
......@@ -643,7 +643,7 @@
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
ข้อมูลระดับพนักงาน (JL)
ข้อมูลลักษณะงาน (JD)
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
......@@ -672,7 +672,7 @@
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสระดับพนักงาน (JL)','รายละเอียดฝ่าย(ไทย)','รายละเอียดฝ่าย(อังกฤษ)']; let f = first; let l = last">
*ngFor="let item of ['ลำดับ','รหัสลักษณะงาน (JD)','รายละเอียดฝ่าย(ไทย)','รายละเอียดฝ่าย(อังกฤษ)']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f">
<span class="text-sm">{{ item }}</span>
......
import { ChangeDetectorRef, Component, EventEmitter, Input, Output, Renderer2, ViewChild } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { PLModel, MyPLModel } from 'src/app/shared/model/pl.model';
import { MyPmsMasfromEvaluationModel, PmsMasfromEvaluationModel } from 'src/app/shared/model/pms-masfrom-evaluation.model';
import { PLService } from 'src/app/shared/services/pl.service';
import { PmsMasfromEvaluationCycleService } from 'src/app/shared/services/pms-masfrom-evaluation.service';
import { ColumnModel } from '@syncfusion/ej2-grids';
import { MatDialog } from '@angular/material/dialog';
import Swal from 'sweetalert2';
import { JobcodeService } from 'src/app/shared/services/jobcode.service';
import { JobcodeModel, MyJobcodeModel } from 'src/app/shared/model/jobcode.model';
export interface DataModal {
search: string,
......@@ -58,7 +58,7 @@ export class ManagementCycleComponent {
search: "",
pageSize: 10
}
pl: { loading: boolean, selectIndex: number, dataList: PLModel[] } = { loading: false, selectIndex: -1, dataList: [] }
pl: { loading: boolean, selectIndex: number, dataList: JobcodeModel[] } = { loading: false, selectIndex: -1, dataList: [] }
currentDate = new Date()
yearList = [
......@@ -117,7 +117,7 @@ export class ManagementCycleComponent {
private dialog: MatDialog,
private cdr: ChangeDetectorRef,
private renderer: Renderer2,
private pLService: PLService
private jobcodeService: JobcodeService
) { }
ngOnInit(): void {
......@@ -137,9 +137,9 @@ export class ManagementCycleComponent {
getPlList() {
this.pl.loading = false
this.pLService.getList().subscribe({
this.jobcodeService.getGroupAssessmentList().subscribe({
next: response => {
this.pl.dataList = response.map((x: any) => new MyPLModel(x))
this.pl.dataList = response.map((x: any) => new MyJobcodeModel(x))
this.pl.loading = false
// this.searchChange()
this.cdr.detectChanges()
......@@ -151,10 +151,10 @@ export class ManagementCycleComponent {
}
plListFilter() {
return this.pl.dataList.filter(x =>
(x.plId.toLowerCase().includes(this.PLsearchmodal.search.toLowerCase()) ||
(x.jobCodeId.toLowerCase().includes(this.PLsearchmodal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.PLsearchmodal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.PLsearchmodal.search.toLowerCase())) &&
!this.pmsMasfromEvaluation.select.personalLevel.some(y => y.plId == x.plId)
!this.pmsMasfromEvaluation.select.jd.some(y => y.jobCodeId == x.jobCodeId)
);
}
......@@ -162,12 +162,12 @@ export class ManagementCycleComponent {
this.PLsearchmodal.currentPage = 1
this.PLsearchmodal.page = Array.from({ length: Math.ceil(this.plListFilter().length / 10) }, (_, i) => i + 1);
}
selectPl(data?: PLModel) {
selectPl(data?: JobcodeModel) {
if (!data) {
this.pmsMasfromEvaluation.select.personalLevel.splice(this.pl.selectIndex, 1);
this.pmsMasfromEvaluation.select.jd.splice(this.pl.selectIndex, 1);
return;
}
this.pmsMasfromEvaluation.select.personalLevel.push(new MyPLModel(data))
this.pmsMasfromEvaluation.select.jd.push(new MyJobcodeModel(data))
}
......@@ -198,7 +198,7 @@ export class ManagementCycleComponent {
} else if (this.modalStatus == 'add') {
this.pmsMasfromEvaluation.select = new MyPmsMasfromEvaluationModel()
} else if (this.modalStatus == 'edit') {
this.pmsMasfromEvaluation.select = new MyPmsMasfromEvaluationModel({ pmsEvaluationRoundId: this.pmsMasfromEvaluation.select.pmsEvaluationRoundId })
this.pmsMasfromEvaluation.select = new MyPmsMasfromEvaluationModel(this.pmsMasfromEvaluation.select)
}
}
......@@ -217,7 +217,7 @@ export class ManagementCycleComponent {
reverseButtons: true,
}).then((result) => {
if (result.isConfirmed) {
if (this.pmsMasfromEvaluation.select.personalLevel.length === 0) {
if (this.pmsMasfromEvaluation.select.jd.length === 0) {
this.plListFilter().forEach(x => this.selectPl(x));
}
const body = new MyPmsMasfromEvaluationModel(this.pmsMasfromEvaluation.select);
......@@ -299,7 +299,7 @@ export class ManagementCycleComponent {
if (this.modalStatus == 'add') {
this.setData()
} else if (this.modalStatus == 'edit') {
this.setData(new MyPmsMasfromEvaluationModel({ pmsEvaluationRoundId: this.pmsMasfromEvaluation.select.pmsEvaluationRoundId }))
this.setData(new MyPmsMasfromEvaluationModel(this.pmsMasfromEvaluation.select))
}
}
......
import { AppraisalFormModel, MyAppraisalFormModel } from "./appraisal-form.model"
import { EmployeeModel, MyEmployeeModel } from "./employee.model"
import { EvaluationCycleModel, MyEvaluationCycleModel } from "./evaluation-cycle.model"
import { JobcodeModel, MyJobcodeModel } from "./jobcode.model"
import { MyPLModel, PLModel } from "./pl.model"
export interface AppraisalModel {
personalLevel: PLModel
jd: JobcodeModel
masfromEvaluationRound: EvaluationCycleModel
companyId: string
active: boolean
......@@ -19,6 +21,7 @@ export interface AppraisalModel {
}
export class MyAppraisalModel implements AppraisalModel {
personalLevel: PLModel
jd: JobcodeModel
masfromEvaluationRound: EvaluationCycleModel
companyId: string
active: boolean
......@@ -32,6 +35,7 @@ export class MyAppraisalModel implements AppraisalModel {
masfromEvaluationAssessment1: AppraisalFormModel[]
constructor(data?: Partial<AppraisalModel>) {
this.personalLevel = new MyPLModel(data?.personalLevel)
this.jd = new MyJobcodeModel(data?.jd)
this.masfromEvaluationRound = new MyEvaluationCycleModel(data?.masfromEvaluationRound)
this.companyId = data?.companyId || ""
this.active = data?.active ?? false
......
......@@ -2,7 +2,6 @@ export interface CompetencyModel {
competency: Competency[]
idp: Idp
pms: Pms
statusAll: string
evaluationRoundId: string
tdesc: string
edesc: string
......@@ -875,8 +874,8 @@ export interface BehavioralIndicatorsList {
}
export interface CompetencyBehavioral {
scoreTopicExpectationBoss: number
scoreTopicExpectation: number
scoreTopicExpectationEmp: number
companyId: string
}
......
import { JobcodeModel, MyJobcodeModel } from "./jobcode.model";
import { MyPLModel, PLModel } from "./pl.model";
import { MyStatusCodeModel, StatusCodeModel } from "./status-code.model";
import { MyStatusFromModel, StatusFromModel } from "./status-from.model";
......@@ -13,6 +15,7 @@ export interface EvaluationCycleModel {
statusCode: StatusCodeModel
statusFrom: StatusFromModel
personalLevel: PLModel[]
jd: JobcodeModel[]
jlId: string
active: number
}
......@@ -28,6 +31,7 @@ export class MyEvaluationCycleModel implements EvaluationCycleModel {
statusCode: StatusCodeModel
statusFrom: StatusFromModel
personalLevel: PLModel[]
jd: JobcodeModel[]
jlId: string
active: number
constructor(data?: Partial<EvaluationCycleModel>) {
......@@ -43,6 +47,7 @@ export class MyEvaluationCycleModel implements EvaluationCycleModel {
this.statusCode = new MyStatusCodeModel(data?.statusCode || {})
this.statusFrom = new MyStatusFromModel(data?.statusFrom || {})
this.personalLevel = data?.personalLevel?.map(x => new MyPLModel(x)) || []
this.jd = data?.jd?.map(x => new MyJobcodeModel(x)) || []
}
}
import { EmployeeModel, MyEmployeeModel } from "./employee.model";
import { JobcodeModel, MyJobcodeModel } from "./jobcode.model";
import { MyPLModel, PLModel } from "./pl.model";
export interface GroupApproveModel {
personalLevel: PLModel;
jd: JobcodeModel;
apsassessy: EmployeeModel;
companyId: string;
apsapprove1: EmployeeModel;
......@@ -16,6 +18,7 @@ export interface GroupApproveModel {
export class MyGroupApproveModel implements GroupApproveModel {
personalLevel: PLModel;
jd: JobcodeModel;
apsassessy: EmployeeModel
companyId: string;
apsapprove1: EmployeeModel;
......@@ -25,6 +28,7 @@ export class MyGroupApproveModel implements GroupApproveModel {
apsapprove5: EmployeeModel;
constructor(data: Partial<GroupApproveModel> = {}) {
this.personalLevel = new MyPLModel(data.personalLevel || {});
this.jd = new MyJobcodeModel(data.jd || {});
this.apsassessy = new MyEmployeeModel(data.apsassessy || {})
this.companyId = data.companyId || '';
this.apsapprove1 = new MyEmployeeModel(data.apsapprove1 || {});
......
import { GroupAssessment1ListModel, MyGroupAssessment1ListModel } from "./group-assessment1-list.model"
import { JobcodeModel, MyJobcodeModel } from "./jobcode.model"
import { MyPLModel, PLModel } from "./pl.model"
export interface GroupAssessmentModel {
personalLevel: PLModel
jd: JobcodeModel
companyId: string
groupAssessment1List: GroupAssessment1ListModel[]
}
......@@ -10,10 +12,12 @@ export interface GroupAssessmentModel {
export class MyGroupAssessmentModel implements GroupAssessmentModel {
personalLevel: PLModel
jd: JobcodeModel
companyId: string
groupAssessment1List: GroupAssessment1ListModel[]
constructor(data?: Partial<GroupAssessmentModel>) {
this.personalLevel = new MyPLModel(data?.personalLevel || {})
this.jd = new MyJobcodeModel(data?.jd || {})
this.companyId = data?.companyId || ""
this.groupAssessment1List = data?.groupAssessment1List?.map(x => new MyGroupAssessment1ListModel(x)) || []
}
......
......@@ -3,12 +3,15 @@ import { CompetencyIndicatorsCourses1MiniModel, MyCompetencyIndicatorsCourses1Mi
export interface GroupAssessment1ListModel {
competencyIndicatorsCourses1Mini: CompetencyIndicatorsCourses1MiniModel
companyId: string
jlId: string
}
export class MyGroupAssessment1ListModel implements GroupAssessment1ListModel {
competencyIndicatorsCourses1Mini: CompetencyIndicatorsCourses1MiniModel
companyId: string
jlId: string
constructor(data?: Partial<GroupAssessment1ListModel>) {
this.competencyIndicatorsCourses1Mini = new MyCompetencyIndicatorsCourses1MiniModel(data?.competencyIndicatorsCourses1Mini || {})
this.companyId = data?.companyId || ""
this.jlId = data?.jlId || ""
}
}
export interface JobcodeModel {
jobCodeId: string
tdesc: string
edesc: string
companyId: string
statusCom: boolean
statusPms: boolean
}
export class MyJobcodeModel implements JobcodeModel {
jobCodeId: string
tdesc: string
edesc: string
companyId: string
statusCom: boolean
statusPms: boolean
constructor(data?: Partial<JobcodeModel>) {
this.jobCodeId = data?.jobCodeId || ""
this.tdesc = data?.tdesc || ""
this.edesc = data?.edesc || ""
this.companyId = data?.companyId || ""
this.statusCom = data?.statusCom ?? false
this.statusPms = data?.statusPms ?? false
}
}
import { JobcodeModel, MyJobcodeModel } from "./jobcode.model"
import { MyPLModel, PLModel } from "./pl.model"
import { MyPmsGroupAssessment1Model, PmsGroupAssessment1Model } from "./pms-group-assessment1.model"
export interface PmsGroupAssessmentModel {
personalLevel: PLModel
jd: JobcodeModel
companyId: string
pmsGroupAssessment1List: PmsGroupAssessment1Model[]
}
......@@ -10,10 +12,12 @@ export interface PmsGroupAssessmentModel {
export class MyPmsGroupAssessmentModel implements PmsGroupAssessmentModel {
personalLevel: PLModel
jd: JobcodeModel
companyId: string
pmsGroupAssessment1List: PmsGroupAssessment1Model[]
constructor(data?: Partial<PmsGroupAssessmentModel>) {
this.personalLevel = new MyPLModel(data?.personalLevel)
this.jd = new MyJobcodeModel(data?.jd)
this.companyId = data?.companyId || ""
this.pmsGroupAssessment1List = data?.pmsGroupAssessment1List?.map(x => new MyPmsGroupAssessment1Model(x)) || []
}
......
import { JobcodeModel } from "./jobcode.model"
export interface PmsMasfromEvaluationFullModel {
personalLevel: PersonalLevel
jd: JobcodeModel
pmsMasfromEvaluationRound: PmsMasfromEvaluationRoundModel
companyId?: string
active?: boolean
......
import { JobcodeModel, MyJobcodeModel } from "./jobcode.model";
import { PLModel, MyPLModel } from "./pl.model";
import { MyStatusCodeModel, StatusCodeModel } from "./status-code.model";
import { MyStatusFromModel, StatusFromModel } from "./status-from.model";
......@@ -11,9 +12,10 @@ export interface PmsMasfromEvaluationModel {
apsPeriodStart: string
apsPeriodEnd: string
statusCode: StatusCodeModel
statusFrom: StatusFromModel
statusFrom: StatusFromModel
active: number
personalLevel: PLModel[]
jd: JobcodeModel[]
}
export class MyPmsMasfromEvaluationModel implements PmsMasfromEvaluationModel {
......@@ -28,6 +30,7 @@ export class MyPmsMasfromEvaluationModel implements PmsMasfromEvaluationModel {
statusFrom: StatusFromModel
active: number
personalLevel: PLModel[]
jd: JobcodeModel[]
constructor(data?: Partial<PmsMasfromEvaluationModel>) {
this.pmsEvaluationRoundId = data?.pmsEvaluationRoundId || "";
this.companyId = data?.companyId || "";
......@@ -38,8 +41,9 @@ export class MyPmsMasfromEvaluationModel implements PmsMasfromEvaluationModel {
this.apsPeriodEnd = data?.apsPeriodEnd || "";
this.active = data?.active || 0
this.statusCode = new MyStatusCodeModel(data?.statusCode)
this.statusFrom = new MyStatusFromModel(data?.statusFrom || {})
this.statusFrom = new MyStatusFromModel(data?.statusFrom || {})
this.personalLevel = data?.personalLevel?.map(x => new MyPLModel(x)) || []
this.jd = data?.jd?.map(x => new MyJobcodeModel(x)) || []
}
}
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 { JobcodeModel } from '../model/jobcode.model';
@Injectable({
providedIn: 'root'
})
export class JobcodeService {
api = "/jobcode"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(plId: string): Observable<JobcodeModel> {
return this.http.get<JobcodeModel>(this.urlApi + "/" + plId)
}
getList(): Observable<JobcodeModel[]> {
return this.http.get<JobcodeModel[]>(this.urlApi + "/lists")
}
getGroupAssessmentList(): Observable<JobcodeModel[]> {
return this.http.get<JobcodeModel[]>(this.urlApi + "/group-assessment/lists")
}
post(body: JobcodeModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: JobcodeModel | JobcodeModel[]): 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
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