feat: Implement instructor course management pages and service for listing, creating, viewing, and editing courses.

This commit is contained in:
Missez 2026-01-21 09:52:10 +07:00
parent cad3f276f5
commit 1e06041769
5 changed files with 838 additions and 9 deletions

View file

@ -236,7 +236,7 @@ const fetchCourses = async () => {
const getStatusColor = (status: string) => {
const colors: Record<string, string> = {
APPROVED: 'green',
PENDING: 'yellow',
PENDING: 'orange',
DRAFT: 'grey',
REJECTED: 'red'
};
@ -275,12 +275,23 @@ const confirmDelete = (course: CourseResponse) => {
message: `คุณต้องการลบหลักสูตร "${course.title.th}" หรือไม่?`,
cancel: true,
persistent: true
}).onOk(() => {
$q.notify({
type: 'positive',
message: 'ลบหลักสูตรสำเร็จ',
position: 'top'
});
}).onOk(async () => {
try {
await instructorService.deleteCourse(course.id);
$q.notify({
type: 'positive',
message: 'ลบหลักสูตรสำเร็จ',
position: 'top'
});
// Refresh list
fetchCourses();
} catch (error) {
$q.notify({
type: 'negative',
message: 'ไม่สามารถลบหลักสูตรได้',
position: 'top'
});
}
});
};