Show "noMenteesText" for Lernbegleiter

This commit is contained in:
Daniel Egger 2024-05-02 12:02:03 +02:00
parent 92d96f4710
commit f11d51b333
1 changed files with 52 additions and 53 deletions

View File

@ -3,6 +3,7 @@ import { useLearningMentees } from "@/services/learningMentees";
import { useCurrentCourseSession } from "@/composables";
import { useCSRFFetch } from "@/fetchHelpers";
import { computed } from "vue";
import LoadingSpinner from "@/components/ui/LoadingSpinner.vue";
const courseSession = useCurrentCourseSession();
const { isLoading, summary, fetchData } = useLearningMentees(courseSession.value.id);
@ -22,63 +23,61 @@ const noMenteesText = computed(() =>
</script>
<template>
<div v-if="summary">
<template v-if="summary.participants.length > 0">
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div class="bg-white px-4 py-2">
<div
v-for="participant in summary.participants"
:key="participant.id"
data-cy="lm-my-mentee-list-item"
class="flex flex-col items-start justify-between gap-4 border-b py-2 last:border-b-0 md:flex-row md:items-center md:gap-16"
>
<div class="flex items-center space-x-2">
<img
:alt="participant.last_name"
class="h-11 w-11 rounded-full"
:src="
participant.avatar_url || '/static/avatars/myvbv-default-avatar.png'
"
/>
<div>
<div class="text-bold">
{{ participant.first_name }}
{{ participant.last_name }}
</div>
{{ participant.email }}
<div v-if="isLoading" class="m-8 flex justify-center">
<LoadingSpinner />
</div>
<div v-else>
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div v-if="(summary?.participants?.length ?? 0) > 0" class="bg-white px-4 py-2">
<div
v-for="participant in summary?.participants ?? []"
:key="participant.id"
data-cy="lm-my-mentee-list-item"
class="flex flex-col items-start justify-between gap-4 border-b py-2 last:border-b-0 md:flex-row md:items-center md:gap-16"
>
<div class="flex items-center space-x-2">
<img
:alt="participant.last_name"
class="h-11 w-11 rounded-full"
:src="participant.avatar_url || '/static/avatars/myvbv-default-avatar.png'"
/>
<div>
<div class="text-bold">
{{ participant.first_name }}
{{ participant.last_name }}
</div>
</div>
<div class="space-x-5">
<router-link
data-cy="lm-my-mentee-profile"
:to="{
name: 'profileLearningPath',
params: {
userId: participant.id,
courseSlug: courseSession.course.slug,
},
}"
class="underline"
>
{{ $t("cockpit.profileLink") }}
</router-link>
<button
class="underline"
data-cy="lm-my-mentee-remove"
@click="removeMyMentee(participant.id)"
>
{{ $t("a.Entfernen") }}
</button>
{{ participant.email }}
</div>
</div>
<div class="space-x-5">
<router-link
data-cy="lm-my-mentee-profile"
:to="{
name: 'profileLearningPath',
params: {
userId: participant.id,
courseSlug: courseSession.course.slug,
},
}"
class="underline"
>
{{ $t("cockpit.profileLink") }}
</router-link>
<button
class="underline"
data-cy="lm-my-mentee-remove"
@click="removeMyMentee(participant.id)"
>
{{ $t("a.Entfernen") }}
</button>
</div>
</div>
</div>
<div v-else>
<div class="flex items-center bg-white px-4 py-2">
<it-icon-info class="it-icon mr-2 h-6 w-6" />
{{ $t(noMenteesText) }}
</div>
</template>
</div>
<div v-if="!isLoading && !summary">
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div class="flex items-center bg-white px-4 py-2">
<it-icon-info class="it-icon mr-2 h-6 w-6" />
{{ $t(noMenteesText) }}
</div>
</div>
</template>