feat: Implement course instructor management UI with search, add, set primary, and remove instructor capabilities.

This commit is contained in:
Missez 2026-02-05 16:39:58 +07:00
parent 7ad15778e6
commit 5b1af9d43b
5 changed files with 27 additions and 6 deletions

View file

@ -22,4 +22,5 @@ logs
.env
.env.*
!.env.example
deploy.ps1
deploy.ps1
*.tar

View file

@ -62,4 +62,24 @@ h6, .text-h6 { font-size: 1rem !important; }
.text-overline { font-size: 0.75rem !important; }
.text-subtitle1 { font-size: 1rem !important; }
.text-subtitle2 { font-size: 0.875rem !important; }
/* Fix Quasar button full width - only for buttons */
.q-btn.w-full,
button.w-full {
width: 100% !important;
}
/* Fix Quasar checkbox styling */
.q-checkbox__inner {
font-size: 40px !important;
}
.q-checkbox__bg {
border-radius: 4px !important;
}
.q-checkbox__inner--truthy .q-checkbox__bg {
background-color: var(--q-primary) !important;
border-color: var(--q-primary) !important;
}
</style>

View file

@ -175,7 +175,7 @@ const addInstructor = async () => {
if (!selectedUser.value) return;
addingInstructor.value = true;
try {
await instructorService.addCourseInstructor(props.courseId, selectedUser.value.id);
await instructorService.addInstructor(props.courseId, selectedUser.value.email);
$q.notify({ type: 'positive', message: 'เพิ่มผู้สอนสำเร็จ', position: 'top' });
showAddDialog.value = false;
selectedUser.value = null;
@ -213,7 +213,7 @@ const removeInstructor = async (userId: number) => {
persistent: true
}).onOk(async () => {
try {
await instructorService.removeCourseInstructor(props.courseId, userId);
await instructorService.removeInstructor(props.courseId, userId);
$q.notify({ type: 'positive', message: 'ลบผู้สอนสำเร็จ', position: 'top' });
fetchInstructors();
} catch (error: any) {

View file

@ -12,7 +12,7 @@ services:
- apparmor=unconfined
environment:
- NODE_ENV=production
- NUXT_PUBLIC_API_BASE_URL=${NUXT_PUBLIC_API_BASE_URL:-http://localhost:4000/api}
- NUXT_PUBLIC_API_BASE_URL=${NUXT_PUBLIC_API_BASE_URL:-http://localhost:4000}
restart: unless-stopped
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001" ]

View file

@ -286,9 +286,9 @@ export const instructorService = {
);
},
async searchInstructors(query: string): Promise<SearchInstructorResult[]> {
async searchInstructors(query: string, courseId: number): Promise<SearchInstructorResult[]> {
const response = await authRequest<SearchInstructorsResponse>(
`/api/instructors/courses/search-instructors?query=${encodeURIComponent(query)}`
`/api/instructors/courses/${courseId}/search-instructors?query=${encodeURIComponent(query)}`
);
return response.data;
},