feat: Implement course instructor management UI with search, add, set primary, and remove instructor capabilities.
This commit is contained in:
parent
7ad15778e6
commit
5b1af9d43b
5 changed files with 27 additions and 6 deletions
3
frontend_management/.gitignore
vendored
3
frontend_management/.gitignore
vendored
|
|
@ -22,4 +22,5 @@ logs
|
||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
deploy.ps1
|
deploy.ps1
|
||||||
|
*.tar
|
||||||
|
|
@ -62,4 +62,24 @@ h6, .text-h6 { font-size: 1rem !important; }
|
||||||
.text-overline { font-size: 0.75rem !important; }
|
.text-overline { font-size: 0.75rem !important; }
|
||||||
.text-subtitle1 { font-size: 1rem !important; }
|
.text-subtitle1 { font-size: 1rem !important; }
|
||||||
.text-subtitle2 { font-size: 0.875rem !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>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ const addInstructor = async () => {
|
||||||
if (!selectedUser.value) return;
|
if (!selectedUser.value) return;
|
||||||
addingInstructor.value = true;
|
addingInstructor.value = true;
|
||||||
try {
|
try {
|
||||||
await instructorService.addCourseInstructor(props.courseId, selectedUser.value.id);
|
await instructorService.addInstructor(props.courseId, selectedUser.value.email);
|
||||||
$q.notify({ type: 'positive', message: 'เพิ่มผู้สอนสำเร็จ', position: 'top' });
|
$q.notify({ type: 'positive', message: 'เพิ่มผู้สอนสำเร็จ', position: 'top' });
|
||||||
showAddDialog.value = false;
|
showAddDialog.value = false;
|
||||||
selectedUser.value = null;
|
selectedUser.value = null;
|
||||||
|
|
@ -213,7 +213,7 @@ const removeInstructor = async (userId: number) => {
|
||||||
persistent: true
|
persistent: true
|
||||||
}).onOk(async () => {
|
}).onOk(async () => {
|
||||||
try {
|
try {
|
||||||
await instructorService.removeCourseInstructor(props.courseId, userId);
|
await instructorService.removeInstructor(props.courseId, userId);
|
||||||
$q.notify({ type: 'positive', message: 'ลบผู้สอนสำเร็จ', position: 'top' });
|
$q.notify({ type: 'positive', message: 'ลบผู้สอนสำเร็จ', position: 'top' });
|
||||||
fetchInstructors();
|
fetchInstructors();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ services:
|
||||||
- apparmor=unconfined
|
- apparmor=unconfined
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- 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
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001" ]
|
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001" ]
|
||||||
|
|
|
||||||
|
|
@ -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>(
|
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;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue