Show different links for different roles

This commit is contained in:
Christian Cueni 2024-08-05 14:11:26 +02:00
parent f2a765ee3b
commit 6b2628b333
3 changed files with 19 additions and 2 deletions

View File

@ -23,6 +23,7 @@ export interface Props {
courseSession: CourseSession;
learningContent: LearningContentAssignment | LearningContentEdoniqTest;
userSelectionIds?: string[];
linkToResults?: boolean;
}
const props = defineProps<Props>();
@ -85,6 +86,12 @@ function findUserPointsHtml(userId: string) {
}
return result;
}
function generateCertificatesLink(userId: string) {
const parts = props.learningContent.competence_certificate?.frontend_url?.split("/");
const certificatePart = parts[parts.length - 1];
return `/course/${props.courseSession.course.slug}/profile/${userId}/competence/certificates/${certificatePart}`;
}
</script>
<template>
@ -178,11 +185,19 @@ function findUserPointsHtml(userId: string) {
props.learningContent.content_type !==
'learnpath.LearningContentEdoniqTest'
"
:to="`/course/${props.courseSession.course.slug}/assignment-evaluation/${learningContent.content_assignment.id}/${csu.user_id}`"
:to="
props.linkToResults
? `/course/${props.courseSession.course.slug}/assignment-evaluation/${learningContent.content_assignment.id}/${csu.user_id}`
: generateCertificatesLink(csu.user_id)
"
class="link lg:w-full lg:text-right"
data-cy="show-results"
>
{{ $t("a.Ergebnisse anschauen") }}
{{
props.linkToResults
? $t("a.Ergebnisse anschauen")
: $t("a.Profil anzeigen")
}}
</router-link>
</div>
</template>

View File

@ -53,6 +53,7 @@ const backRoute = computed(() => {
v-if="learningContentAssignment"
:course-session="courseSession"
:learning-content="learningContentAssignment as (LearningContentAssignment | LearningContentEdoniqTest)"
:link-to-results="true"
/>
</div>
</main>

View File

@ -53,6 +53,7 @@ const learningContentAssignment = computed(() => {
:course-session="courseSession"
:learning-content="learningContentAssignment as (LearningContentAssignment | LearningContentEdoniqTest)"
:user-selection-ids="participantUserIds"
:link-to-results="props.agentRole.toLowerCase() !== 'berufsbildner'"
/>
</div>
</main>