Commit 0bf09667 by Nattana Chaiyamat

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

parent 5ba477dd
...@@ -28,16 +28,18 @@ ...@@ -28,16 +28,18 @@
</a> </a>
</nav> </nav>
</div> </div>
<div class="mt-3 px-3rem !-mt-3 pt-50px"> <div class="mt-3 px-2rem !-mt-3 pt-50px">
<div *ngIf="currentPath==1" 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> <app-indicators-and-curriculum (sendPathTitle)="pathTitle=$event"></app-indicators-and-curriculum>
</div> </div>
<div *ngIf="currentPath==2" id="underline-2" class="hidden" role="tabpanel" aria-labelledby="underline-item-2"> <div *ngIf="currentPath==2" id="underline-2" class="hidden" role="tabpanel"
<app-group-competencies (sendPathTitle)="pathTitle=$event" ></app-group-competencies> aria-labelledby="underline-item-2">
<app-group-competencies (sendPathTitle)="pathTitle=$event"></app-group-competencies>
</div> </div>
<div *ngIf="currentPath==3" id="underline-3" class="hidden" role="tabpanel" aria-labelledby="underline-item-3"> <div *ngIf="currentPath==3" id="underline-3" class="hidden" role="tabpanel"
<app-set-approvers [pathTitle]="pathTitle" (sendPathTitle)="pathTitle=$event"></app-set-approvers> aria-labelledby="underline-item-3">
<app-set-approvers (sendPathTitle)="pathTitle=$event"></app-set-approvers>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
</div> </div>
<div class="px-1"> <div class="px-1">
<button type="button" <button type="button"
class="ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 h-45px m-0 shadow-md"> class="ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 h-45px m-0 shadow-md"
data-hs-overlay="#edit-group-indicators-upload-modal"
(click)="fileInput.value = '';selectedFile=null;selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ti ti-file-plus"></i> <i class="ti ti-file-plus"></i>
import import
</button> </button>
...@@ -66,17 +68,16 @@ ...@@ -66,17 +68,16 @@
<div class="space-y-2 col-span-2"> <div class="space-y-2 col-span-2">
<label class="ti-form-label">ประเภท</label> <label class="ti-form-label">ประเภท</label>
<input type="text" class="ti-form-input bg-input-readonly" readonly <input type="text" class="ti-form-input bg-input-readonly" readonly
[(ngModel)]="indicatorsCourses.competencyTopic.competencyType.tdesc"> [(ngModel)]="indicatorsCourses.competencyTopic.competencyType.shortName">
</div> </div>
</div> </div>
<div class="space-y-2"> <div class="space-y-2">
<label class="ti-form-label">ชื่อสมรรถนะ</label> <label class="ti-form-label">ชื่อสมรรถนะ</label>
<textarea type="text" rows="2" class="ti-form-input bg-input-readonly" readonly <textarea type="text" rows="2" class="ti-form-input" [(ngModel)]="indicatorsCourses.tdesc"> </textarea>
[(ngModel)]="indicatorsCourses.tdesc"> </textarea>
</div> </div>
<div class="space-y-2"> <div class="space-y-2">
<label class="ti-form-label">นิยามสมรรถนะ</label> <label class="ti-form-label">นิยามสมรรถนะ</label>
<textarea type="text" rows="3" class="ti-form-input bg-input-readonly" readonly <textarea type="text" rows="3" class="ti-form-input"
[(ngModel)]="indicatorsCourses.indicatorsCourseDetailTh"></textarea> [(ngModel)]="indicatorsCourses.indicatorsCourseDetailTh"></textarea>
</div> </div>
</div> </div>
...@@ -583,4 +584,41 @@ ...@@ -583,4 +584,41 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="edit-group-indicators-upload-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white">
นำเข้าตัวชี้วัดเเละหลักสูตร
</h5>
</div>
<div class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
<h1 class="mt-2" style="text-align: center;">ไฟล์</h1>
<div class="mt-2 p-2">
<div class="flex rounded-md">
<input #fileInput id="fileInput" type="file" (change)="onFileSelected($event)" hidden>
<input type="text" [value]="selectedFileName" readonly (click)="fileInput.click()"
class="ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10 cursor-pointer">
<button type="button" (click)="fileInput.click()"
class="inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border border-transparent font-semibold bg-secondary text-white hover:bg-secondary focus:z-10 focus:outline-none focus:ring-0 focus:ring-secondary transition-all text-sm">
<i class="ti ti-upload"></i>
</button>
</div>
<div class="flex justify-center mt-2rem ">
<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)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์</h1>
</div>
<div class="flex justify-center mt-2rem mb-1rem space-x-4">
<button type="submit" class="ti-btn ti-btn-secondary"
data-hs-overlay="#edit-group-indicators-upload-modal" [class.ti-btn-disabled]="!selectedFile"
(click)="uploadFile()" [disabled]="!selectedFile" [disabled]="!selectedFile">
อัปโหลด
</button>
</div>
</div>
</div>
</div>
</div> </div>
\ No newline at end of file
...@@ -9,6 +9,7 @@ import { CompetencytopicModel, MyCompetencytopicModel } from 'src/app/shared/mod ...@@ -9,6 +9,7 @@ import { CompetencytopicModel, MyCompetencytopicModel } from 'src/app/shared/mod
import { IndicatorsCoursesModel, MyIndicatorsCoursesModel } from 'src/app/shared/model/indicators-courses.model'; import { IndicatorsCoursesModel, MyIndicatorsCoursesModel } from 'src/app/shared/model/indicators-courses.model';
import { AssessmentService } from 'src/app/shared/services/assessment.service'; import { AssessmentService } from 'src/app/shared/services/assessment.service';
import { CompetencycourseService } from 'src/app/shared/services/competencycourse.service'; import { CompetencycourseService } from 'src/app/shared/services/competencycourse.service';
import { FileService } from 'src/app/shared/services/file.service';
import { IndicatorsCoursesService } from 'src/app/shared/services/indicators-courses.service'; import { IndicatorsCoursesService } from 'src/app/shared/services/indicators-courses.service';
export interface DataModel { export interface DataModel {
code: string, code: string,
...@@ -57,11 +58,15 @@ export class EditGroupIndicators implements OnInit { ...@@ -57,11 +58,15 @@ export class EditGroupIndicators implements OnInit {
curriculumLoading = false curriculumLoading = false
curriculumSelectIndex: number = -1 curriculumSelectIndex: number = -1
dataLoading = false dataLoading = false
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
constructor(private assessmentService: AssessmentService, constructor(private assessmentService: AssessmentService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
private toastr: ToastrService, private toastr: ToastrService,
private competencycourseService: CompetencycourseService, private competencycourseService: CompetencycourseService,
private indicatorsCoursesService: IndicatorsCoursesService) { private indicatorsCoursesService: IndicatorsCoursesService,
private fileService: FileService) {
} }
...@@ -71,6 +76,65 @@ export class EditGroupIndicators implements OnInit { ...@@ -71,6 +76,65 @@ export class EditGroupIndicators implements OnInit {
this.getCompetencycourseList() this.getCompetencycourseList()
} }
onFileSelected(event: any) {
this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
this.selectedFileName = this.selectedFile?.name || "กรุณาเลือกไฟล์"
}
uploadFile() {
if (!this.selectedFile) {
alert('กรุณาเลือกไฟล์ก่อนอัปโหลด')
return
}
const formData = new FormData();
formData.append('file', this.selectedFile);
this.dataLoading = true
this.fileService.uploadExcel(formData, '').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getIndicatorsCoursesById()
} else {
this.showAlert(response.message, 'error')
this.dataLoading = false
this.cdr.detectChanges();
}
}, error: error => {
this.showAlert(error.message, 'error')
this.dataLoading = false
this.cdr.detectChanges();
}
})
}
downloadFile() {
const fileName = '.xlsx'
this.fileService.downloadTemplate(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);
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
clearDataList() {
this.indicatorsCourses.tdesc = ""
this.indicatorsCourses.indicatorsCourseDetailTh = ""
this.dataList = this.dataList.map(x => ({
code: x.code,
behaviorIndicators: [],
assessmentTools: [],
curriculum: []
}))
}
getIndicatorsCoursesById() { getIndicatorsCoursesById() {
this.dataLoading = true this.dataLoading = true
this.indicatorsCoursesService.getById(this.competencytopic.competencyTopicId).subscribe({ this.indicatorsCoursesService.getById(this.competencytopic.competencyTopicId).subscribe({
......
...@@ -16,15 +16,7 @@ interface table { ...@@ -16,15 +16,7 @@ interface table {
styleUrls: ['./set-approvers.component.scss'] styleUrls: ['./set-approvers.component.scss']
}) })
export class SetApproversComponent { export class SetApproversComponent {
@Input() pathTitle = ['การประเมินจัดประเมินสมรรถนะ', 'การจัดการสมรรถนะ', 'กำหนดผู้ประเมิน'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>(); @Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
activeTab: string = 'tab1';
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การสมรรถนะจัดประเมินสมรรถนะ', 'การจัดการประเมิน', tab.text]);
this.activeTab = tab.id;
}
currentPage = 1 currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1); page = Array.from({ length: 1 }, (_, i) => i + 1);
groupapprove_list: GroupApproveModel[] = [] groupapprove_list: GroupApproveModel[] = []
......
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