Commit 4ad5679c by Nattana Chaiyamat

การจัดการตัวชี้วัดเเละหลักสูตร

parent f9cc9cf9
......@@ -11,14 +11,14 @@
</div>
</div>
<div class="flex justify-end">
<div class="px-1">
<div class="px-1" *ngIf="!seeTab">
<button type="button" class="ti-btn ti-btn-soft-success h-45px m-0 shadow-md"
data-hs-overlay="#edit-group-indicators-alert-modal">
<i class="ri-save-3-line"></i>
Save
</button>
</div>
<div class="px-1">
<div class="px-1" *ngIf="!seeTab">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md" (click)="clearDataList()">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
......@@ -63,11 +63,12 @@
</div>
<div class="space-y-2">
<label class="ti-form-label">ชื่อสมรรถนะ</label>
<textarea type="text" rows="2" class="ti-form-input" [(ngModel)]="indicatorsCourses.tdesc"> </textarea>
<textarea type="text" rows="2" class="ti-form-input bg-input-readonly" readonly
[(ngModel)]="indicatorsCourses.tdesc"> </textarea>
</div>
<div class="space-y-2">
<label class="ti-form-label">นิยามสมรรถนะ</label>
<textarea type="text" rows="3" class="ti-form-input"
<textarea type="text" rows="3" class="ti-form-input bg-input-readonly" readonly
[(ngModel)]="indicatorsCourses.indicatorsCourseDetailTh"></textarea>
</div>
</div>
......@@ -80,7 +81,7 @@
<thead class="height-50px">
<tr class="font-size-12px">
<ng-container
*ngFor="let item of ['รหัสความคาดหวัง','ตัวชี้วัดพฤติกรรม','เครื่องมือประเมิน','หลักสูตร']; let f = first; let l = last">
*ngFor="let item of ['ระดับความคาดหวัง','ตัวชี้วัดพฤติกรรม','เครื่องมือประเมิน','หลักสูตร']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f||l">
<span class="font-size-12px font-weight-700">{{ item }}</span>
......@@ -118,7 +119,7 @@
</a>
</div>
</div>
<div class="col-span-1 text-center align-center">
<div class="col-span-1 text-center align-center" *ngIf="!seeTab">
<div class="ciricon border cursor-pointer"
(click)="dataSelect=data;dataSelectIndex=i;behaviorIndicatorsSelectIndex=l;deleteBehaviorIndicators()">
<i class="ri-close-line text-red-500"></i>
......@@ -126,7 +127,7 @@
</div>
</span>
</div>
<div class="flex rounded-md">
<div class="flex rounded-md" *ngIf="!seeTab">
<input type="text"
class="ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10"
[(ngModel)]="data.behaviorIndicators[data.behaviorIndicators.length-1]">
......@@ -159,6 +160,7 @@
</div>
</a>
<div class="ciricon flex text-start items-center cursor-pointer"
*ngIf="!seeTab"
(click)="assessmentToolsSelectIndex=[l,m];deleteAssessmentTools()">
<i class="ri-close-line text-red-500"></i>
</div>
......@@ -174,13 +176,14 @@
</ng-container>
</ng-container>
</button>
<button type="button" class="flex text-start items-center cursor-default">
<button type="button" class="flex text-start items-center cursor-default"
*ngIf="!seeTab">
<i class="ti ti-circle-plus text-green-500 cursor-pointer"
(click)="dataSelectIndex=i;dataSelect=data;assessmentToolsSelectIndex=[l,data.assessmentTools.length]"
data-hs-overlay="#assessment-tools-modal"></i>
</button>
</span>
<button *ngIf="!data.assessmentTools.length" type="button"
<button *ngIf="!data.assessmentTools.length&&!seeTab" type="button"
class="flex text-start items-center cursor-default">
<i class="ti ti-circle-plus text-green-500 cursor-pointer"
(click)="dataSelectIndex=i;dataSelect=data;assessmentToolsSelectIndex=[0,data.assessmentTools.length]"
......@@ -190,7 +193,7 @@
</td>
<td class="items-center justify-center">
<div class="flex items-center w-full space-x-2">
<i class="ti ti ti-book cursor-pointer i-gray px-1" style="font-size: 28px;"
<i *ngIf="!seeTab" class="ti ti ti-book cursor-pointer i-gray px-1" style="font-size: 28px;"
(click)="dataSelectIndex=i" data-hs-overlay="#curriculum-modal"></i>
<div class="flex flex-col flex-grow" *ngIf="data.curriculum.length">
<div class="grid grid-cols-1 gap-1">
......@@ -209,7 +212,7 @@
</div>
</span>
<div class="col-span-1 flex justify-end items-center ">
<div class="col-span-1 flex justify-end items-center " *ngIf="!seeTab">
<div class="ciricon border cursor-pointer"
(click)="dataSelectIndex=i;curriculumSelectIndex=l;deleteCurriculumList()">
<i class="ri-close-line text-red-500"></i>
......
......@@ -33,6 +33,7 @@ export interface CurriculumModal {
})
export class EditGroupIndicators implements OnInit {
@Input() competencytopic: CompetencytopicModel = new MyCompetencytopicModel({})
@Input() seeTab = false
indicatorsCourses: IndicatorsCoursesModel = new MyIndicatorsCoursesModel({})
@Output() sendEdit: EventEmitter<boolean> = new EventEmitter<boolean>();
search = ""
......@@ -59,13 +60,13 @@ export class EditGroupIndicators implements OnInit {
curriculumSelectIndex: number = -1
dataLoading = false
constructor(private assessmentService: AssessmentService,
private cdr: ChangeDetectorRef,
private toastr: ToastrService,
private competencycourseService: CompetencycourseService,
private indicatorsCoursesService: IndicatorsCoursesService,
) {
) {
}
......
<ng-container *ngIf="!editTab">
<ng-container *ngIf="!editTab&&!seeTab">
<div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-end">
<div class="px-1">
......@@ -33,7 +33,7 @@
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered">
<thead>
<tr>
<ng-container *ngFor="let item of ['รหัส','ชื่อหัวข้อ','ประเมิน','การจัดการ']; let f = first; let l = last">
<ng-container *ngFor="let item of ['รหัส','ชื่อหัวข้อ','ประเภท','การจัดการ']; let f = first; let l = last">
<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>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
......@@ -69,10 +69,12 @@
<td>{{item.name}}</td>
<td class="text-center">{{item.type}}</td>
<td class="flex justify-center">
<i class="ti ti-eye cursor-pointer i-gray fs-l px-1"></i>
<i class="ti ti-eye cursor-pointer i-gray fs-l px-1"
(click)="selectIndicatorsCourses(item);seeTab=true;editTab=false;pathTitleChange()"></i>
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="selectIndicatorsCourses(item);editTab=true;pathTitleChange()"></i>
<i class="ti ti-file-download cursor-pointer i-gray fs-l px-1"></i>
(click)="selectIndicatorsCourses(item);seeTab=false;editTab=true;pathTitleChange()"></i>
<i *ngIf="item.file" class="ti ti-file-download cursor-pointer i-gray fs-l px-1"
(click)="dowloadExam(item.file)"></i>
</td>
</tr>
</tbody>
......@@ -119,9 +121,9 @@
</ng-container>
<ng-container *ngIf="editTab">
<app-edit-group-indicators [competencytopic]="indicatorsCourses"
(sendEdit)="editTab=$event;pathTitleChange()"></app-edit-group-indicators>
<ng-container *ngIf="editTab||seeTab">
<app-edit-group-indicators [competencytopic]="indicatorsCourses" [seeTab]="seeTab"
(sendEdit)="editTab=$event;pathTitleChange()" (sendEdit)="seeTab=$event"></app-edit-group-indicators>
</ng-container>
......
......@@ -7,6 +7,7 @@ export interface DataModel {
code: string,
name: string,
type: string
file: string
}
@Component({
selector: 'app-indicators-and-curriculum',
......@@ -16,6 +17,7 @@ export interface DataModel {
export class IndicatorsAndCurriculumComponent {
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
editTab = false
seeTab = false
currentPage = 1
search = ""
page = Array.from({ length: 1 }, (_, i) => i + 1);
......@@ -35,6 +37,25 @@ export class IndicatorsAndCurriculumComponent {
this.pathTitleChange()
}
dowloadExam(fileName: string) {
this.fileService.dowloadFiles(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
a.href = url;
a.download = fileName;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
this.cdr.detectChanges()
}, error: error => {
this.showAlert(error.message, 'error')
this.cdr.detectChanges()
}
})
}
onFileSelected(event: any) {
this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
this.selectedFileName = this.selectedFile?.name || "กรุณาเลือกไฟล์"
......@@ -98,7 +119,7 @@ export class IndicatorsAndCurriculumComponent {
this.dataLoading = true
this.competencytopicService.getList().subscribe({
next: response => {
this.dataList = response.map(x => ({ code: x.competencyTopicId, name: x.tdesc, type: x.competencyType.tdesc }))
this.dataList = response.map(x => ({ code: x.competencyTopicId, name: x.tdesc, type: x.competencyType.tdesc, file: x.competencyFiles || "" }))
this.indicatorsCoursesList = response
this.dataLoading = false
this.searchChange()
......@@ -125,7 +146,7 @@ export class IndicatorsAndCurriculumComponent {
dataListFilter() {
return this.dataList.filter(x => {
const match = x.code.includes(this.search) || x.name.includes(this.search);
const match = x.code.toLowerCase().includes(this.search.toLowerCase()) || x.name.toLowerCase().includes(this.search.toLowerCase());
return match;
});
}
......
......@@ -107,6 +107,7 @@ export class SelfEvaluationComponent implements OnInit {
this.appraisalService.getFormCompentencyById(this.appraisalCompentency.select.masfromEvaluationRoundModel.evaluationRoundId, this.employee.data.employeeId).subscribe({
next: response => {
this.appraisalCompentencyForm.data = new MyAppraisalFormModel(response)
this.appraisalCompentencyForm.data = response
this.calnumberCheck()
this.appraisalCompentencyForm.loading = false
this.cdr.detectChanges()
......@@ -160,7 +161,7 @@ export class SelfEvaluationComponent implements OnInit {
},
}).then((result) => {
if (result.isConfirmed) {
const body = new MyAppraisalFormModel({ ...this.appraisalCompentencyForm.data, apsassessyStatus: '1' })
const body = { ...this.appraisalCompentencyForm.data, apsassessyStatus: '2' }
this.appraisalService.postCompetency(body).subscribe({
next: response => {
if (response.success) {
......@@ -238,7 +239,7 @@ export class SelfEvaluationComponent implements OnInit {
},
}).then((result) => {
if (result.isConfirmed) {
const body = new MyAppraisalFormModel({ ...this.appraisalCompentencyForm.data, apsassessyStatus: '2' })
const body = { ...this.appraisalCompentencyForm.data, apsassessyStatus: '2' }
this.appraisalService.postCompetency(body).subscribe({
next: response => {
if (response.success) {
......@@ -291,11 +292,11 @@ export class SelfEvaluationComponent implements OnInit {
}
calnumberCheck() {
this.appraisalCompentencyForm.data.numberCheck1 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map(x => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter(y => y.competencyBehavioral.scoreTopicExpectation == 1).length).reduce((acc, num) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck2 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map(x => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter(y => y.competencyBehavioral.scoreTopicExpectation == 2).length).reduce((acc, num) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck3 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map(x => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter(y => y.competencyBehavioral.scoreTopicExpectation == 3).length).reduce((acc, num) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck4 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map(x => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter(y => y.competencyBehavioral.scoreTopicExpectation == 4).length).reduce((acc, num) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck5 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map(x => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter(y => y.competencyBehavioral.scoreTopicExpectation == 5).length).reduce((acc, num) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck1 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 1).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck2 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 2).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck3 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 3).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck4 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 4).length).reduce((acc: any, num: any) => acc + num, 0)
this.appraisalCompentencyForm.data.numberCheck5 = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.filter((y: any) => y.competencyBehavioral.scoreTopicExpectation == 5).length).reduce((acc: any, num: any) => acc + num, 0)
this.calWeightTotal()
this.cdr.detectChanges()
......@@ -327,7 +328,7 @@ export class SelfEvaluationComponent implements OnInit {
this.calAverageScore()
}
calAverageScore() {
const total = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map(x => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.length).reduce((acc, num) => acc + num, 0) * 5
const total = this.appraisalCompentencyForm.data.masfromEvaluationAssessment1lList.map((x: any) => x.groupAssessment1.competencyIndicatorsCourses1Mini.behavioralIndicatorsList.length).reduce((acc: any, num: any) => acc + num, 0) * 5
if (total) {
this.appraisalCompentencyForm.data.averageScore = 0
this.appraisalCompentencyForm.data.averageScore = (this.appraisalCompentencyForm.data.weightedTotal / total) * 100
......
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