feat(frontend): leerkracht kan alle groepen binnen een assignment zien en leerling kan zijn group zien

This commit is contained in:
Joyelle Ndagijimana 2025-04-18 23:16:59 +02:00
parent 83f01830e3
commit 20cf276faf
15 changed files with 397 additions and 341 deletions

View file

@ -4,27 +4,14 @@ import auth from "@/services/auth/auth-service.ts";
import {computed, ref} from "vue";
import StudentAssignment from "@/views/assignments/StudentAssignment.vue";
import TeacherAssignment from "@/views/assignments/TeacherAssignment.vue";
import {asyncComputed} from "@vueuse/core";
import {GroupController} from "@/controllers/groups.ts";
import {useRoute} from "vue-router";
const role = auth.authState.activeRole;
const isTeacher = computed(() => role === 'teacher');
// Get the user's username/id
const username = asyncComputed(async () => {
const user = await auth.loadUser();
return user?.profile?.preferred_username ?? undefined
});
const route = useRoute();
const classId = ref<string>(route.params.classId as string);
const assignmentId = ref(Number(route.params.id));
const classId = window.history.state?.class_id;
const groupController = new GroupController(classId, assignmentId.value);
const groupDTOs = asyncComputed(async () => await groupController.getAll(true));
console.log(groupDTOs.value);
</script>
@ -32,14 +19,12 @@ console.log(groupDTOs.value);
<TeacherAssignment
:class-id="classId"
:assignment-id="assignmentId"
:groups="groupDTOs"
v-if="isTeacher"
>
</TeacherAssignment>
<StudentAssignment
:class-id="classId"
:assignment-id="assignmentId"
:groups="groupDTOs"
v-else
>
</StudentAssignment>