Commit 396dec01 by Nattana Chaiyamat

แก้ไข Individual KPI ตัวเอง

parent 9bae4e07
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
[dataSource]="indicatorsCoursesList" [checkBoxSetting]="false" [columns]="columns" [childView]="true" [dataSource]="indicatorsCoursesList" [checkBoxSetting]="false" [columns]="columns" [childView]="true"
[canDownload]="true" (sendNextPageView)="onViewClicked($event)" [canDownload]="true" (sendNextPageView)="onViewClicked($event)"
(sendSelectData)="selectIndicatorsCourses($event); onEditClicked($event)" (sendSelectData)="selectIndicatorsCourses($event); onEditClicked($event)"
(sendFileDownload)="dowloadExam($event)"> (sendFileDownload)="downloadExam($event)">
</app-datagrid-syncfution> </app-datagrid-syncfution>
</div> </div>
</ng-container> </ng-container>
......
...@@ -63,8 +63,8 @@ export class IndicatorsAndCurriculumComponent { ...@@ -63,8 +63,8 @@ export class IndicatorsAndCurriculumComponent {
this.getIndicatorsCoursesList() this.getIndicatorsCoursesList()
} }
dowloadExam(data: CompetencytopicModel) { downloadExam(data: CompetencytopicModel) {
this.fileService.dowloadFiles(data.competencyFiles).subscribe({ this.fileService.downloadFiles(data.competencyFiles).subscribe({
next: response => { next: response => {
const url = window.URL.createObjectURL(response); const url = window.URL.createObjectURL(response);
const a = document.createElement("a"); const a = document.createElement("a");
......
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
<div class="flex" *ngIf="examFileName==competencyTopic.select.competencyFiles"> <div class="flex" *ngIf="examFileName==competencyTopic.select.competencyFiles">
<h1 class="cursor-pointer justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px <h1 class="cursor-pointer justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px
text-center text-secondary border-secondary border-b-2 align-items-end" text-center text-secondary border-secondary border-b-2 align-items-end"
(click)="dowloadExam(examFileName)"> (click)="downloadExam(examFileName)">
ดาวน์โหลดไฟล์ข้อสอบ</h1> ดาวน์โหลดไฟล์ข้อสอบ</h1>
</div> </div>
</mat-dialog-content> </mat-dialog-content>
......
...@@ -102,12 +102,12 @@ export class CompetencyTopic implements OnInit { ...@@ -102,12 +102,12 @@ export class CompetencyTopic implements OnInit {
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
private fileService: FileService, private fileService: FileService,
private competencytopicService: CompetencytopicService, private competencytopicService: CompetencytopicService,
// private competencytypeService: CompetencytypeService, private competencytypeService: CompetencytypeService,
private tokenService: TokenService private tokenService: TokenService
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
this.getCompetencytopicList() this.getCompetencytopicList()
// this.getCompetencytypeList() this.getCompetencytypeList()
} }
onExamSelected(event: any) { onExamSelected(event: any) {
...@@ -140,8 +140,8 @@ export class CompetencyTopic implements OnInit { ...@@ -140,8 +140,8 @@ export class CompetencyTopic implements OnInit {
dowloadExam(fileName: string) { downloadExam(fileName: string) {
this.fileService.dowloadFiles(fileName).subscribe({ this.fileService.downloadFiles(fileName).subscribe({
next: response => { next: response => {
const url = window.URL.createObjectURL(response); const url = window.URL.createObjectURL(response);
const a = document.createElement("a"); const a = document.createElement("a");
...@@ -176,7 +176,7 @@ export class CompetencyTopic implements OnInit { ...@@ -176,7 +176,7 @@ export class CompetencyTopic implements OnInit {
next: response => { next: response => {
if (response.success) { if (response.success) {
this.showAlert(response.message, 'success') this.showAlert(response.message, 'success')
// this.getCompetencytypeList() this.getCompetencytypeList()
this.getCompetencytopicList() this.getCompetencytopicList()
} else { } else {
this.showAlert(response.message, 'error') this.showAlert(response.message, 'error')
...@@ -211,23 +211,20 @@ export class CompetencyTopic implements OnInit { ...@@ -211,23 +211,20 @@ export class CompetencyTopic implements OnInit {
} }
getCompetencytypeList() { getCompetencytypeList() {
// this.competencytypeListLoading = true this.competencytypeListLoading = true
// this.selectedItems.data.clear() this.selectedItems.data.clear()
// this.competencytypeService.getList().subscribe({ this.competencytypeService.getList().subscribe({
// next: response => { next: response => {
// this.typeList = response.map(x => { this.typeList = response.map(x => {
// this.selectedItems.data.set(x.competencyTypeId, false) return new MyCompetencytypeModel(x)
// return new MyCompetencytypeModel(x) })
// }) this.competencytypeListLoading = false
// this.selectedItems.key = 'competencyTypeId' this.cdr.detectChanges()
// this.selectedItems.count = 0 }, error: error => {
// this.competencytypeListLoading = false this.competencytypeListLoading = false
// this.cdr.detectChanges() this.cdr.detectChanges()
// }, error: error => { }
// this.competencytypeListLoading = false })
// this.cdr.detectChanges()
// }
// })
} }
...@@ -280,7 +277,7 @@ export class CompetencyTopic implements OnInit { ...@@ -280,7 +277,7 @@ export class CompetencyTopic implements OnInit {
this.uploadExam(); this.uploadExam();
return; return;
} }
const user = this.tokenService.getUser(); const user = this.tokenService.getUser();
const body = new MyCompetencytopicModel({ const body = new MyCompetencytopicModel({
...this.competencyTopic.select, ...this.competencyTopic.select,
...@@ -292,7 +289,7 @@ export class CompetencyTopic implements OnInit { ...@@ -292,7 +289,7 @@ export class CompetencyTopic implements OnInit {
next: response => { next: response => {
if (response.success) { if (response.success) {
this.showAlert(response.message, 'success'); this.showAlert(response.message, 'success');
// this.getCompetencytypeList(); this.getCompetencytypeList();
this.getCompetencytopicList(); this.getCompetencytopicList();
this.closeDialog() this.closeDialog()
} else { } else {
...@@ -326,51 +323,51 @@ export class CompetencyTopic implements OnInit { ...@@ -326,51 +323,51 @@ export class CompetencyTopic implements OnInit {
} }
deleteCompetency_topic() { deleteCompetency_topic() {
if (!this.numSelectItem()) { if (!this.numSelectItem()) {
this.showAlert('กรุณาเลือกข้อมูลที่ต้องการลบ', 'error'); this.showAlert('กรุณาเลือกข้อมูลที่ต้องการลบ', 'error');
return; return;
} }
Swal.fire({ Swal.fire({
icon: 'question', icon: 'question',
title: 'แจ้งเตือน', title: 'แจ้งเตือน',
text: 'ยืนยันการลบข้อมูลหรือไม่', text: 'ยืนยันการลบข้อมูลหรือไม่',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'ลบข้อมูล', confirmButtonText: 'ลบข้อมูล',
cancelButtonText: 'ย้อนกลับ', cancelButtonText: 'ย้อนกลับ',
reverseButtons: true, reverseButtons: true,
}).then(result => { }).then(result => {
if (result.isConfirmed) { if (result.isConfirmed) {
let body: MyCompetencytopicModel[] = []; let body: MyCompetencytopicModel[] = [];
if (this.currentModal === "delete") { if (this.currentModal === "delete") {
const selectedKeys = Array.from(this.selectedItems.data.keys()); const selectedKeys = Array.from(this.selectedItems.data.keys());
body = this.competencyTopic.dataList body = this.competencyTopic.dataList
.filter(x => selectedKeys.includes(x.competencyTopicId) && this.selectedItems.data.get(x.competencyTopicId)) .filter(x => selectedKeys.includes(x.competencyTopicId) && this.selectedItems.data.get(x.competencyTopicId))
.map(x => new MyCompetencytopicModel(x)); .map(x => new MyCompetencytopicModel(x));
} }
this.competencyTopic.loading = true; this.competencyTopic.loading = true;
this.competencytopicService.delete(body).subscribe({ this.competencytopicService.delete(body).subscribe({
next: response => { next: response => {
this.competencyTopic.loading = false; this.competencyTopic.loading = false;
if (response.success) { if (response.success) {
this.showAlert(response.message, 'success'); this.showAlert(response.message, 'success');
// this.getCompetencytypeList(); this.getCompetencytypeList();
this.getCompetencytopicList(); this.getCompetencytopicList();
} else { } else {
this.showAlert(response.message, 'error'); this.showAlert(response.message, 'error');
this.cdr.detectChanges();
}
},
error: error => {
this.competencyTopic.loading = false;
this.showAlert(error.message, 'error');
this.cdr.detectChanges(); this.cdr.detectChanges();
} }
}, });
error: error => { }
this.competencyTopic.loading = false; });
this.showAlert(error.message, 'error'); }
this.cdr.detectChanges();
}
});
}
});
}
showAlert(text: string, type: 'success' | 'error') { showAlert(text: string, type: 'success' | 'error') {
......
...@@ -12,7 +12,7 @@ export class FileService { ...@@ -12,7 +12,7 @@ export class FileService {
uploadFiles(formData: any): Observable<AlertModel> { uploadFiles(formData: any): Observable<AlertModel> {
return this.http.post<AlertModel>(environment.baseUrl + '/files/upload', formData) return this.http.post<AlertModel>(environment.baseUrl + '/files/upload', formData)
} }
dowloadFiles(filename: string) { downloadFiles(filename: string) {
return this.http.get(environment.baseUrl + '/files/download/' + filename, { responseType: "blob" }) return this.http.get(environment.baseUrl + '/files/download/' + filename, { responseType: "blob" })
} }
uploadExcel(formData: any, table: string): Observable<AlertModel> { uploadExcel(formData: any, table: string): Observable<AlertModel> {
......
...@@ -122,26 +122,26 @@ export class NavService implements OnDestroy { ...@@ -122,26 +122,26 @@ export class NavService implements OnDestroy {
// { id: 'm12', path: 'ess/supervisor-evaluation', title: 'ประเมินโดยหัวหน้า', type: 'link', show: true }, // { id: 'm12', path: 'ess/supervisor-evaluation', title: 'ประเมินโดยหัวหน้า', type: 'link', show: true },
// ], // ],
}, },
// { {
// title: 'แก้ไข Individual KPI ตนเอง', title: 'แก้ไข Individual KPI ตนเอง',
// type: 'link', type: 'link',
// selected: false, selected: false,
// active: false, active: false,
// path: 'ess/self-setting-individual-kpi', path: 'ess/self-setting-individual-kpi',
// id: 'm3', id: 'm3',
// show: false, show: true,
// icon: '' icon: ''
// }, },
// { {
// title: 'แก้ไข Individual KPI โดยหัวหน้า', title: 'แก้ไข Individual KPI โดยหัวหน้า',
// type: 'link', type: 'link',
// selected: false, selected: false,
// active: false, active: false,
// path: 'ess/supervisor-setting-individual-kpi', path: 'ess/supervisor-setting-individual-kpi',
// id: 'm4', id: 'm4',
// show: false, show: true,
// icon: '' icon: ''
// }, },
]; ];
} }
......
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