From 3f9742550f1659001f2362d7d5b042b5ead21d14 Mon Sep 17 00:00:00 2001 From: Livio Bieri Date: Fri, 19 Jan 2024 13:20:44 +0100 Subject: [PATCH] wip: self evaluation mentor --- .../assignment/PraxisAssignmentSubmit.vue | 34 +------ .../mentor/LearningMentorSelector.vue | 23 ----- .../mentor/NoMentorInformationPanel.vue | 29 ++++++ client/src/composables.ts | 21 ++++- .../SelfEvaluationSubmit.vue | 93 +++++++++++++++++-- 5 files changed, 137 insertions(+), 63 deletions(-) delete mode 100644 client/src/components/mentor/LearningMentorSelector.vue create mode 100644 client/src/components/mentor/NoMentorInformationPanel.vue diff --git a/client/src/components/learningPath/assignment/PraxisAssignmentSubmit.vue b/client/src/components/learningPath/assignment/PraxisAssignmentSubmit.vue index b1c31c88..fe8bbd27 100644 --- a/client/src/components/learningPath/assignment/PraxisAssignmentSubmit.vue +++ b/client/src/components/learningPath/assignment/PraxisAssignmentSubmit.vue @@ -2,7 +2,7 @@ import ItButton from "@/components/ui/ItButton.vue"; import ItCheckbox from "@/components/ui/ItCheckbox.vue"; import { ref } from "vue"; -import { bustItGetCache, useCSRFFetch } from "@/fetchHelpers"; +import { bustItGetCache } from "@/fetchHelpers"; import { useUserStore } from "@/stores/user"; import eventBus from "@/utils/eventBus"; import log from "loglevel"; @@ -12,9 +12,8 @@ import { useMutation } from "@urql/vue"; import { UPSERT_ASSIGNMENT_COMPLETION_MUTATION } from "@/graphql/mutations"; import type { Assignment } from "@/types"; import DateEmbedding from "@/components/dueDates/DateEmbedding.vue"; -import { useCurrentCourseSession } from "@/composables"; - -const currentCourseSession = useCurrentCourseSession(); +import { useLearningMentors } from "@/composables"; +import NoMentorInformationPanel from "@/components/mentor/NoMentorInformationPanel.vue"; const props = defineProps<{ submissionDeadlineStart?: string | null; @@ -29,10 +28,7 @@ const upsertAssignmentCompletionMutation = useMutation( UPSERT_ASSIGNMENT_COMPLETION_MUTATION ); -const { data: learningMentors } = useCSRFFetch( - `/api/mentor/${props.courseSessionId}/mentors` -).json(); - +const learningMentors = useLearningMentors().learningMentors; const selectedLearningMentor = ref(); const onSubmit = async () => { @@ -85,27 +81,7 @@ const onSubmit = async () => {
-
- -
-
- {{ - $t( - "a.Aktuell hast du noch keine Person als Lernbegleitung eingeladen. Lade jetzt jemanden ein." - ) - }} -
- - {{ $t("a.Lernbegleitung einladen") }} - -
-
+

diff --git a/client/src/components/mentor/LearningMentorSelector.vue b/client/src/components/mentor/LearningMentorSelector.vue deleted file mode 100644 index c4fdc832..00000000 --- a/client/src/components/mentor/LearningMentorSelector.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/client/src/components/mentor/NoMentorInformationPanel.vue b/client/src/components/mentor/NoMentorInformationPanel.vue new file mode 100644 index 00000000..d6170bc3 --- /dev/null +++ b/client/src/components/mentor/NoMentorInformationPanel.vue @@ -0,0 +1,29 @@ + + + diff --git a/client/src/composables.ts b/client/src/composables.ts index af4fda5b..3b8730e2 100644 --- a/client/src/composables.ts +++ b/client/src/composables.ts @@ -1,3 +1,4 @@ +import { useCSRFFetch } from "@/fetchHelpers"; import type { CourseStatisticsType } from "@/gql/graphql"; import { graphqlClient } from "@/graphql/client"; import { COURSE_QUERY, COURSE_SESSION_DETAIL_QUERY } from "@/graphql/queries"; @@ -27,7 +28,7 @@ import { useQuery } from "@urql/vue"; import orderBy from "lodash/orderBy"; import log from "loglevel"; import type { ComputedRef } from "vue"; -import { computed, ref, watchEffect } from "vue"; +import { computed, onMounted, ref, watchEffect } from "vue"; export function useCurrentCourseSession() { /** @@ -463,3 +464,21 @@ export function useFileUpload() { return { upload, error, loading, fileInfo }; } + +export function useLearningMentors() { + const learningMentors = ref([]); + const currentCourseSessionId = useCurrentCourseSession().value.id; + + const fetchMentors = async () => { + const { data } = await useCSRFFetch( + `/api/mentor/${currentCourseSessionId}/mentors` + ).json(); + learningMentors.value = data.value; + }; + + onMounted(fetchMentors); + + return { + learningMentors, + }; +} diff --git a/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluationSubmit.vue b/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluationSubmit.vue index 46118b95..2faea23c 100644 --- a/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluationSubmit.vue +++ b/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluationSubmit.vue @@ -1,24 +1,97 @@