Commit 396dec01 by Nattana Chaiyamat

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

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