Commit 1ffef9dc by Natthaphat Pankiang

การประเมินสมรรถนะ > การจัดการสมรรถนะ > จัดกลุ่มสมรรถนะ

parent 33e760c9
......@@ -11,34 +11,31 @@
<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 = ['การประเมินสมรรถนะ','การจัดการสมรรถนะ','ตัวชี้วัดเเละหลักสูตร']">
(click)="currentPath = 1;pathTitle = ['การประเมินสมรรถนะ','การจัดการสมรรถนะ','ตัวชี้วัดเเละหลักสูตร']">
ตัวชี้วัดเเละหลักสูตร
</a>
<a class="font-size-16px font-weight-500 hs-tab-active:font-weight-700 hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary"
href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2"
aria-controls="underline-2"
(click)="pathTitle = ['การประเมินสมรรถนะ','การจัดการสมรรถนะ','จัดกลุ่มสมรรถนะ']">
(click)="currentPath = 2;pathTitle = ['การประเมินสมรรถนะ','การจัดการสมรรถนะ','จัดกลุ่มสมรรถนะ']">
จัดกลุ่มสมรรถนะ
</a>
<a class="font-size-16px font-weight-500 hs-tab-active:font-weight-700 hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary"
href="javascript:void(0);" id="underline-item-3" data-hs-tab="#underline-3"
aria-controls="underline-3"
(click)="pathTitle = ['การประเมินสมรรถนะ','การจัดการสมรรถนะ','กำหนดผู้ประเมิน']">
(click)="currentPath = 3;pathTitle = ['การประเมินสมรรถนะ','การจัดการสมรรถนะ','กำหนดผู้ประเมิน']">
กำหนดผู้ประเมิน
</a>
</nav>
</div>
<div class="mt-3 px-3rem !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<div *ngIf="currentPath==1" id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-indicators-and-curriculum (sendPathTitle)="pathTitle=$event"></app-indicators-and-curriculum>
</div>
<div id="underline-2" class="hidden" role="tabpanel" aria-labelledby="underline-item-2">
<app-group-competencies *ngIf="groupShow=='1'" [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event" (sendGroupShow)="groupShow=$event"></app-group-competencies>
<app-edit-group-competencies *ngIf="groupShow=='2'" [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event" (sendGroupShow)="groupShow=$event"></app-edit-group-competencies>
<div *ngIf="currentPath==2" id="underline-2" class="hidden" role="tabpanel" aria-labelledby="underline-item-2">
<app-group-competencies (sendPathTitle)="pathTitle=$event" ></app-group-competencies>
</div>
<div id="underline-3" class="hidden" role="tabpanel" aria-labelledby="underline-item-3">
<div *ngIf="currentPath==3" id="underline-3" class="hidden" role="tabpanel" aria-labelledby="underline-item-3">
<app-set-approvers [pathTitle]="pathTitle" (sendPathTitle)="pathTitle=$event"></app-set-approvers>
</div>
</div>
......
......@@ -7,5 +7,5 @@ import { Component } from '@angular/core';
})
export class CompetencyManagementComponent {
pathTitle = ['การประเมินสมรรถนะ', 'การจัดการสมรรถนะ','ตัวชี้วัดและหลักสูตร']
groupShow = '1'
currentPath = 1
}
import { Component, EventEmitter, Input, Output } from '@angular/core';
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 { PLService } from 'src/app/shared/services/pl.service';
export interface DataModel {
code: string
name: string
edesc: string
companyId: string
}
@Component({
selector: 'app-group-competencies',
......@@ -7,81 +15,66 @@ import { ToastrService } from 'ngx-toastr';
styleUrls: ['./group-competencies.component.scss']
})
export class GroupCompetenciesComponent {
@Input() pathTitle = ['การประเมินสมรรถนะ', 'การจัดการสมรรถนะ', 'จัดกลุ่มสมรรถนะ'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
@Output() sendGroupShow: EventEmitter<string> = new EventEmitter<string>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
editTab = false
currentPage = 1
search = ""
page = Array.from({ length: 1 }, (_, i) => i + 1);
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'การจัดการสมรรถนะ', tab.text]);
this.activeTab = tab.id;
}
onEdit(){
this.sendGroupShow.emit('2');
}
// การจัดการการเปิดปิด modal
modalOptions: {
[nameModal: string]: {
isModalOpen: boolean;
modalSize: string;
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
dataList: DataModel[] = []
dataSelect: DataModel = { code: '', name: '', edesc: '', companyId: '' }
groupCompetenciesList: PLModel[] = []
groupCompetencies: PLModel = new MyPLModel({})
dataLoading = false
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
this.currentModal = name; // ตั้งค่าค่าของ currentModal เป็น 'add' หรือ 'edit'
document.body.style.overflow = 'hidden';
constructor(private toastr: ToastrService,
private cdr: ChangeDetectorRef,
private pLService: PLService,
) {
this.pathTitleChange()
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
ngOnInit(): void {
this.getList()
}
getList() {
this.dataLoading = true
this.pLService.getList().subscribe({
next: response => {
this.dataList = response.map(x => ({ code: x.plId, name: x.tdesc, edesc: x.edesc, companyId: x.companyId }))
this.groupCompetenciesList = response
this.dataLoading = false
this.searchChange()
this.cdr.detectChanges()
}, error: error => {
this.dataLoading = false
this.cdr.detectChanges()
}
isAnyModalOpen(): boolean {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
})
}
// ฟังก์ชัน toggle checkbox
isChecked: boolean = false; // ใช้สำหรับตรวจสอบสถานะของ checkbox
toggleCheckbox() {
this.isChecked = !this.isChecked; // สลับสถานะ
selectData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { code: '', name: '', edesc: '', companyId: '' }))
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
console.log('เพิ่มผู้ใช้งาน');
selectGroupCompetencies(data: DataModel) {
const groupCompetencies = this.groupCompetenciesList.find(x => x.plId == data.code)
this.groupCompetencies = new MyPLModel(groupCompetencies)
}
deleteUser() {
console.log('ลบผู้ใช้งาน');
pathTitleChange() {
this.sendPathTitle.emit(this.editTab ? ['การประเมินสมรรถนะ', 'การจัดการสมรรถนะ', 'จัดกลุ่มสมรรถนะ', 'แก้ไขกลุ่มสมรรถนะ'] : ['การประเมินสมรรถนะ', 'การจัดการสมรรถนะ', 'จัดกลุ่มสมรรถนะ'])
}
editUser() {
console.log('แก้ไขผู้ใช้งาน');
searchChange() {
this.currentPage = 1;
const filteredData = this.dataListFilter();
this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1);
}
currentModal = "";
constructor(private toastr: ToastrService) { }
dataListFilter() {
return this.dataList.filter(x => {
const match = x.code.toLocaleLowerCase().includes(this.search.toLocaleLowerCase()) || x.name.toLocaleLowerCase().includes(this.search.toLocaleLowerCase());
return match;
});
}
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
......@@ -103,4 +96,17 @@ export class GroupCompetenciesComponent {
positionClass: 'toast-top-right',
});
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
console.log('เพิ่มผู้ใช้งาน');
}
deleteUser() {
console.log('ลบผู้ใช้งาน');
}
editUser() {
console.log('แก้ไขผู้ใช้งาน');
}
}
......@@ -134,6 +134,7 @@ import { FileService } from 'src/app/shared/services/file.service';
import { CompetencyGroupGradeService } from 'src/app/shared/services/competency-group-grade.service';
import { IndicatorsCoursesService } from 'src/app/shared/services/indicators-courses.service';
import { IdpDevelopmentService } from 'src/app/shared/services/idp-development.service';
import { GroupAssessmentService } from 'src/app/shared/services/group-assessment.service';
export const MY_DATE_FORMATS = {
parse: {
......@@ -298,6 +299,7 @@ export class CustomDateAdapter extends NativeDateAdapter {
CompetencyGroupGradeService,
IndicatorsCoursesService,
IdpDevelopmentService,
GroupAssessmentService,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
......
import { CompetencytopicModel, MyCompetencytopicModel } from "./competencytopic.model"
export interface CompetencyIndicatorsCourses0Model {
competencyTopic: CompetencytopicModel
companyId: string
edesc: string
tdesc: string
indicatorsCourseDetailTh: string
indicatorsCourseDetailEn: string
expectation:string
}
export class MyCompetencyIndicatorsCourses0Model implements CompetencyIndicatorsCourses0Model {
competencyTopic: CompetencytopicModel
companyId: string
edesc: string
tdesc: string
indicatorsCourseDetailTh: string
indicatorsCourseDetailEn: string
expectation:string
constructor(data: Partial<CompetencyIndicatorsCourses0Model>) {
this.competencyTopic = new MyCompetencytopicModel(data.competencyTopic || {})
this.companyId = data.companyId || ""
this.edesc = data.edesc || ""
this.tdesc = data.tdesc || ""
this.indicatorsCourseDetailTh = data.indicatorsCourseDetailTh || ""
this.indicatorsCourseDetailEn = data.indicatorsCourseDetailEn || ""
this.expectation = data.expectation || ""
}
}
......@@ -14,12 +14,12 @@ export class MyCompetencyIndicatorsCourses1ListModel implements CompetencyIndica
competencyCourseId: string
competencyCourse: CompetencyCourseModel[]
competencyIndicatorsCourses2List: CompetencyIndicatorsCourses2ListModel[]
constructor(data: Partial<CompetencyIndicatorsCourses1ListModel>) {
this.lineNo = data.lineNo ?? 0
this.companyId = data.companyId || ""
this.competencyCourseId = data.competencyCourseId || ""
this.competencyCourse = data.competencyCourse?.map(x => new MyCompetencyCourseModel(x)) || []
this.competencyIndicatorsCourses2List = data.competencyIndicatorsCourses2List?.map(x => new MyCompetencyIndicatorsCourses2ListModel(x)) || []
constructor(data?: Partial<CompetencyIndicatorsCourses1ListModel>) {
this.lineNo = data?.lineNo ?? 0
this.companyId = data?.companyId || ""
this.competencyCourseId = data?.competencyCourseId || ""
this.competencyCourse = data?.competencyCourse?.map(x => new MyCompetencyCourseModel(x)) || []
this.competencyIndicatorsCourses2List = data?.competencyIndicatorsCourses2List?.map(x => new MyCompetencyIndicatorsCourses2ListModel(x)) || []
}
}
import { CompetencyCourseModel, MyCompetencyCourseModel } from "./competency-course.model"
import { CompetencyIndicatorsCourses0Model, MyCompetencyIndicatorsCourses0Model } from "./competency-indicators-courses0.model"
export interface CompetencyIndicatorsCourses1MiniModel {
competencyIndicatorsCourses0: CompetencyIndicatorsCourses0Model
lineNo: number
companyId: string
competencyCourseId: string
competencyCourse: CompetencyCourseModel[]
}
export class MyCompetencyIndicatorsCourses1MiniModel implements CompetencyIndicatorsCourses1MiniModel {
competencyIndicatorsCourses0: CompetencyIndicatorsCourses0Model
lineNo: number
companyId: string
competencyCourseId: string
competencyCourse: CompetencyCourseModel[]
constructor(data?: Partial<CompetencyIndicatorsCourses1MiniModel>) {
this.competencyIndicatorsCourses0 = new MyCompetencyIndicatorsCourses0Model(data?.competencyIndicatorsCourses0 || {})
this.lineNo = data?.lineNo ?? 0
this.companyId = data?.companyId || ""
this.competencyCourseId = data?.competencyCourseId || ""
this.competencyCourse = data?.competencyCourse?.map(x => new MyCompetencyCourseModel(x)) || []
}
}
import { GroupAssessment1ListModel, MyGroupAssessment1ListModel } from "./group-assessment1-list.model"
import { MyPLModel, PLModel } from "./pl.model"
export interface GroupAssessmentModel {
personalLevel: PLModel
companyId: string
groupAssessment1List: GroupAssessment1ListModel[]
}
export class MyGroupAssessmentModel implements GroupAssessmentModel {
personalLevel: PLModel
companyId: string
groupAssessment1List: GroupAssessment1ListModel[]
constructor(data?: Partial<GroupAssessmentModel>) {
this.personalLevel = new MyPLModel(data?.personalLevel || {})
this.companyId = data?.companyId || ""
this.groupAssessment1List = data?.groupAssessment1List?.map(x => new MyGroupAssessment1ListModel(x)) || []
}
}
import { CompetencyIndicatorsCourses1MiniModel, MyCompetencyIndicatorsCourses1MiniModel } from "./competency-indicators-courses1-mini.model"
export interface GroupAssessment1ListModel {
competencyIndicatorsCourses1Mini: CompetencyIndicatorsCourses1MiniModel
companyId: string
}
export class MyGroupAssessment1ListModel implements GroupAssessment1ListModel {
competencyIndicatorsCourses1Mini: CompetencyIndicatorsCourses1MiniModel
companyId: string
constructor(data?: Partial<GroupAssessment1ListModel>) {
this.competencyIndicatorsCourses1Mini = new MyCompetencyIndicatorsCourses1MiniModel(data?.competencyIndicatorsCourses1Mini || {})
this.companyId = data?.companyId || ""
}
}
......@@ -9,6 +9,7 @@ export interface IndicatorsCoursesModel {
tdesc: string
indicatorsCourseDetailTh: string
indicatorsCourseDetailEn: string
expectation:string
competencyIndicatorsCourses1List: CompetencyIndicatorsCourses1ListModel[]
}
......@@ -19,15 +20,17 @@ export class MyIndicatorsCoursesModel implements IndicatorsCoursesModel {
tdesc: string
indicatorsCourseDetailTh: string
indicatorsCourseDetailEn: string
expectation:string
competencyIndicatorsCourses1List: CompetencyIndicatorsCourses1ListModel[]
constructor(data: Partial<IndicatorsCoursesModel>) {
this.competencyTopic = new MyCompetencytopicModel(data.competencyTopic || {})
this.companyId = data.companyId || ""
this.edesc = data.edesc || ""
this.tdesc = data.tdesc || ""
this.indicatorsCourseDetailTh = data.indicatorsCourseDetailTh || ""
this.indicatorsCourseDetailEn = data.indicatorsCourseDetailEn || ""
this.competencyIndicatorsCourses1List = data.competencyIndicatorsCourses1List?.map(x => new MyCompetencyIndicatorsCourses1ListModel(x)) || []
constructor(data?: Partial<IndicatorsCoursesModel>) {
this.competencyTopic = new MyCompetencytopicModel(data?.competencyTopic || {})
this.companyId = data?.companyId || ""
this.edesc = data?.edesc || ""
this.tdesc = data?.tdesc || ""
this.indicatorsCourseDetailTh = data?.indicatorsCourseDetailTh || ""
this.indicatorsCourseDetailEn = data?.indicatorsCourseDetailEn || ""
this.expectation = data?.expectation || ""
this.competencyIndicatorsCourses1List = data?.competencyIndicatorsCourses1List?.map(x => new MyCompetencyIndicatorsCourses1ListModel(x)) || []
}
}
......@@ -11,11 +11,11 @@ export class MyPLModel implements PLModel {
tdesc: string;
edesc: string;
companyId: string
constructor(data: Partial<PLModel>) {
this.plId = data.plId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.companyId = data.companyId || ""
constructor(data?: Partial<PLModel>) {
this.plId = data?.plId || ""
this.tdesc = data?.tdesc || ""
this.edesc = data?.edesc || ""
this.companyId = data?.companyId || ""
}
}
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 { GroupAssessmentModel } from '../model/group-assessment.model';
@Injectable({
providedIn: 'root'
})
export class GroupAssessmentService {
api = "/groupassessment"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(plId: string): Observable<GroupAssessmentModel> {
return this.http.get<GroupAssessmentModel>(this.urlApi + "/" + plId)
}
getList(): Observable<GroupAssessmentModel[]> {
return this.http.get<GroupAssessmentModel[]>(this.urlApi + "/lists")
}
post(body: GroupAssessmentModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: GroupAssessmentModel | GroupAssessmentModel[]): 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
......@@ -13,7 +13,7 @@ export class IndicatorsCoursesService {
constructor(private http: HttpClient) {
}
getList(): Observable<IndicatorsCoursesModel[]> {
return this.http.get<IndicatorsCoursesModel[]>(this.urlApi + "/lists")
return this.http.get<IndicatorsCoursesModel[]>(this.urlApi + "/lists/indicators-courses")
}
getById(competencyIndicatorsId: string): Observable<IndicatorsCoursesModel> {
return this.http.get<IndicatorsCoursesModel>(this.urlApi + "/" + competencyIndicatorsId)
......
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