diff --git a/client/src/components/selfEvaluationFeedback/FeedbackProviderRankCriteria.vue b/client/src/components/selfEvaluationFeedback/FeedbackProviderRankCriteria.vue new file mode 100644 index 00000000..41506379 --- /dev/null +++ b/client/src/components/selfEvaluationFeedback/FeedbackProviderRankCriteria.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/client/src/components/selfEvaluationFeedback/FeedbackProviderReleaseOverview.vue b/client/src/components/selfEvaluationFeedback/FeedbackProviderReleaseOverview.vue new file mode 100644 index 00000000..25fa6707 --- /dev/null +++ b/client/src/components/selfEvaluationFeedback/FeedbackProviderReleaseOverview.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/client/src/components/selfEvaluationFeedback/FeedbackRequested.vue b/client/src/components/selfEvaluationFeedback/FeedbackRequested.vue index 07615ef5..0f3028f5 100644 --- a/client/src/components/selfEvaluationFeedback/FeedbackRequested.vue +++ b/client/src/components/selfEvaluationFeedback/FeedbackRequested.vue @@ -31,10 +31,20 @@ defineProps<{ {{ $t("selfEvaluation.yes") }} -
+
{{ $t("selfEvaluation.no") }}
+
+ + {{ $t("a.Nicht bewertet") }} +
diff --git a/client/src/pages/cockpit/cockpitPage/mentor/SelfEvaluationFeedback.vue b/client/src/pages/cockpit/cockpitPage/mentor/SelfEvaluationFeedback.vue index e18d6df5..c08fe633 100644 --- a/client/src/pages/cockpit/cockpitPage/mentor/SelfEvaluationFeedback.vue +++ b/client/src/pages/cockpit/cockpitPage/mentor/SelfEvaluationFeedback.vue @@ -2,9 +2,14 @@ import LearningContentMultiLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentMultiLayout.vue"; import LearningContentContainer from "@/pages/learningPath/learningContentPage/LearningContentContainer.vue"; import { useRouter } from "vue-router"; -import { computed, onMounted, ref, toValue } from "vue"; -import { useCSRFFetch } from "@/fetchHelpers"; -import type { FeedbackRequest } from "@/services/selfEvaluationFeedback"; +import { computed, ref } from "vue"; +import { + type Criterion, + useSelfEvaluationFeedback, +} from "@/services/selfEvaluationFeedback"; +import { useRouteQuery } from "@vueuse/router"; +import FeedbackProviderRankCriteria from "@/components/selfEvaluationFeedback/FeedbackProviderRankCriteria.vue"; +import FeedbackProviderReleaseOverview from "@/components/selfEvaluationFeedback/FeedbackProviderReleaseOverview.vue"; const router = useRouter(); const props = defineProps<{ @@ -12,47 +17,62 @@ const props = defineProps<{ courseSlug: string; }>(); -const url = computed( - () => - `/api/self-evaluation-feedback/provider/${toValue(props.learningUnitId)}/feedback` -); - -const feedback = ref(); -const isFeedbackLoading = ref(false); - -onMounted(async () => { - feedback.value = null; - isFeedbackLoading.value = true; - const { data, error } = await useCSRFFetch(url.value).json(); - isFeedbackLoading.value = false; - if (error.value) { - console.error(error.value); - return; - } else { - feedback.value = data.value; - } +const currentStepRouteParam = useRouteQuery("step", "0", { + transform: Number, + mode: "push", }); -const stepsCount = computed(() => 10); -const currentStep = 1; +const selfEvaluationFeedback = useSelfEvaluationFeedback( + props.learningUnitId, + "provider" +); -const title = "TITLE " + props.learningUnitId; +const feedback = computed(() => selfEvaluationFeedback?.feedback.value); -const showNextButton = true; -const showExitButton = true; -const showPreviousButton = true; -const base_url = "BASE_URL"; +const title = computed(() => { + if (feedback.value) { + return feedback.value.title; + } + return ""; +}); -const endBadgeText = "END_BADGE_TEXT"; +const currentStep = ref(currentStepRouteParam); + +const stepsCount = computed(() => { + if (feedback.value) { + return feedback.value.criteria.length + 1; + } + return 0; +}); + +const currentCriteria = computed(() => { + if (feedback.value && currentStep.value < stepsCount.value - 1) { + return feedback.value.criteria[currentStep.value]; + } + return null; +}); + +const showNextButton = computed(() => { + if (feedback.value) { + return currentStep.value < stepsCount.value - 1; + } + return false; +}); const handleBack = () => { - console.log("handleBack"); + if (currentStep.value > 0) { + currentStep.value--; + } }; + const handleContinue = () => { - console.log("handleContinue"); + if (currentStep.value < stepsCount.value) { + currentStep.value++; + } }; const clickExit = () => { + console.log("clickExit"); router.push({ name: "mentorCockpitSelfEvaluationFeedbackAssignments", params: { @@ -60,35 +80,60 @@ const clickExit = () => { }, }); }; + +const handleFeedbackEvaluation = async ( + criteria: Criterion, + evaluation: "SUCCESS" | "FAIL" +) => { + if (!feedback.value) { + return; + } + await selfEvaluationFeedback.addFeedbackAssessment( + criteria.course_completion_id, + evaluation + ); +}; + +const handleFeedbackRelease = async () => { + if (!feedback.value) { + return; + } + await selfEvaluationFeedback.releaseFeedback(); +};