Merged develop into feature/bugfix-dashboar-open-tasks

This commit is contained in:
Christian Cueni 2024-05-02 10:20:49 +00:00
commit d1c0518d88
10 changed files with 116 additions and 113 deletions

View File

@ -42,25 +42,21 @@ function hasWidget(widget: WidgetType) {
const actionButtonProps = computed<{ href: string; text: string; cyKey: string }>(
() => {
if (props.courseConfig?.role_key === "Member") {
return {
href: getLearningPathUrl(props.courseConfig?.course_slug),
text: "Weiter lernen",
cyKey: "progress-dashboard-continue-course-link",
};
} else if (props.courseConfig?.role_key === "Expert") {
if (props.courseConfig?.role_key === "Supervisor") {
return {
href: getCockpitUrl(props.courseConfig?.course_slug),
text: "Cockpit anschauen",
cyKey: "cockpit-dashboard-link",
};
} else if (props.courseConfig?.role_key === "Supervisor") {
}
if (props.courseConfig?.role_key === "Trainer") {
return {
href: getCockpitUrl(props.courseConfig?.course_slug),
text: "Cockpit anschauen",
cyKey: "cockpit-dashboard-link",
};
} else if (props.courseConfig?.role_key === "MentorVV") {
}
if (props.courseConfig?.role_key === "MentorVV") {
return {
href: getLearningMentorUrl(props.courseConfig?.course_slug),
text: "a.Übersicht anschauen",

View File

@ -22,7 +22,6 @@ import {
getLearningPathUrl,
getMediaCenterUrl,
} from "@/utils/utils";
import { useMentorTexts } from "@/composables";
log.debug("MainNavigationBar created");
@ -123,7 +122,11 @@ const hasLearningMentor = computed(() => {
return courseSession.actions.includes("learning-mentor");
});
const mentorTabTitle = useMentorTexts().mentorTabTitle;
const mentorTabTitle = computed(() =>
courseSessionsStore.currentCourseSession?.course.configuration.is_uk
? "a.Praxisbildner"
: "a.Lernbegleitung"
);
</script>
<template>

View File

@ -10,7 +10,8 @@ import {
getLearningPathUrl,
getMediaCenterUrl,
} from "@/utils/utils";
import { useMentorTexts } from "@/composables";
import { computed } from "vue";
import { useCourseSessionsStore } from "@/stores/courseSessions";
const router = useRouter();
@ -31,6 +32,8 @@ defineProps<{
const emit = defineEmits(["closemodal", "logout"]);
const courseSessionsStore = useCourseSessionsStore();
const clickLink = (to: string | undefined) => {
if (to) {
router.push(to);
@ -38,7 +41,11 @@ const clickLink = (to: string | undefined) => {
}
};
const mentorTabTitle = useMentorTexts().mentorTabTitle;
const mentorTabTitle = computed(() =>
courseSessionsStore.currentCourseSession?.course.configuration.is_uk
? "a.Praxisbildner"
: "a.Lernbegleitung"
);
</script>
<template>

View File

@ -2,9 +2,11 @@
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 { summary, fetchData } = useLearningMentees(courseSession.value.id);
const { isLoading, summary, fetchData } = useLearningMentees(courseSession.value.id);
const removeMyMentee = async (menteeId: string) => {
await useCSRFFetch(
@ -12,65 +14,69 @@ const removeMyMentee = async (menteeId: string) => {
).delete();
fetchData();
};
const noMenteesText = computed(() =>
courseSession.value.course.configuration.is_uk
? "a.Aktuell begleitest du niemanden als Praxisbildner."
: "a.Aktuell begleitest du niemanden als Lernbegleitung."
);
</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>
</template>
</div>
<div v-else>
<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("a.Aktuell begleitest du niemanden als Lernbegleitung.") }}
{{ $t(noMenteesText) }}
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { useCurrentCourseSession, useMentorTexts } from "@/composables";
import { useCurrentCourseSession } from "@/composables";
import ItModal from "@/components/ui/ItModal.vue";
import { computed, ref } from "vue";
import { useCSRFFetch } from "@/fetchHelpers";
@ -69,7 +69,23 @@ const inviteMentor = async () => {
inviteeEmail.value = "";
};
const { myLearningMentors, inviteLearningMentor, noLearningMentors } = useMentorTexts();
const myLearningMentors = computed(() =>
courseSession.value.course.configuration.is_uk
? "Meine Praxisbildner"
: "Meine Lernbegleiter"
);
const inviteLearningMentor = computed(() =>
courseSession.value.course.configuration.is_uk
? "Neuen Praxisbildner einladen"
: "a.Neue Lernbegleitung einladen"
);
const noLearningMentors = computed(() =>
courseSession.value.course.configuration.is_uk
? "a.Aktuell hast du noch keine Person als Praxisbildner eingeladen."
: "a.Aktuell hast du noch keine Person als Lernbegleitung eingeladen."
);
</script>
<template>

View File

@ -1,8 +1,20 @@
<script setup lang="ts">
import { useCurrentCourseSession, useMentorTexts } from "@/composables";
import { useCurrentCourseSession } from "@/composables";
import { computed } from "vue";
const currentCourseSession = useCurrentCourseSession();
const { actionNoLearningMentors, inviteLearningMentorShort } = useMentorTexts();
const actionNoLearningMentors = computed(() =>
currentCourseSession.value.course.configuration.is_uk
? "a.Aktuell hast du noch keine Person als Praxisbildner eingeladen. Lade jetzt jemanden ein."
: "a.Aktuell hast du noch keine Person als Lernbegleitung eingeladen. Lade jetzt jemanden ein."
);
const inviteLearningMentorShort = computed(() =>
currentCourseSession.value.course.configuration.is_uk
? "Neuen Praxisbildner einladen"
: "a.Neue Lernbegleitung einladen"
);
</script>
<template>

View File

@ -46,7 +46,9 @@ const previousRoute = getPreviousRoute();
const learningUnitHasFeedbackPage = computed(
() =>
courseSession.value.course.configuration.enable_learning_mentor && !isReadOnly.value
courseSession.value.course.configuration.enable_learning_mentor &&
!courseSession.value.course.configuration.is_uk &&
!isReadOnly.value
);
const currentQuestion = computed(() => questions.value[questionIndex.value]);

View File

@ -630,48 +630,6 @@ export function useDashboardPersonsDueDates(
};
}
export function useMentorTexts() {
const texts = computed(() => {
try {
const is_uk =
useCourseSessionsStore().currentCourseSession?.course.configuration.is_uk;
const mentorTabTitle = is_uk ? "a.Praxisbildner" : "a.Lernbegleitung";
const myLearningMentors = is_uk ? "Meine Praxisbildner" : "Meine Lernbegleiter";
const inviteLearningMentor = is_uk
? "Neuen Praxisbildner einladen"
: "a.Neue Lernbegleitung einladen";
const inviteLearningMentorShort = is_uk
? "Praxisbildner einladen"
: "Lernbegleitung einladen";
const noLearningMentors = is_uk
? "a.Aktuell hast du noch keine Person als Praxisbildner eingeladen."
: "a.Aktuell hast du noch keine Person als Lernbegleitung eingeladen.";
const actionNoLearningMentors = is_uk
? "a.Aktuell hast du noch keine Person als Praxisbildner eingeladen. Lade jetzt jemanden ein."
: "a.Aktuell hast du noch keine Person als Lernbegleitung eingeladen. Lade jetzt jemanden ein.";
return {
mentorTabTitle,
myLearningMentors,
inviteLearningMentor,
inviteLearningMentorShort,
noLearningMentors,
actionNoLearningMentors,
};
} catch (e) {
return {
mentorTabTitle: "",
myLearningMentors: "",
inviteLearningMentor: "",
inviteLearningMentorShort: "",
noLearningMentors: "",
actionNoLearningMentors: "",
};
}
});
return { ...texts.value };
}
export function useCourseCircleProgress(circles: Ref<CircleType[] | undefined>) {
const inProgressCirclesCount = computed(() => {
if (circles.value?.length) {

View File

@ -10,8 +10,11 @@ const isMyMentorsVisible = computed(() =>
courseSession.value.actions.includes("learning-mentor::edit-mentors")
);
const isMyMenteesVisible = computed(() =>
courseSession.value.actions.includes("learning-mentor::guide-members")
const isMyMenteesVisible = computed(
() =>
courseSession.value.actions.includes("learning-mentor::guide-members") ||
courseSession.value.actions.includes("is_expert") ||
courseSession.value.actions.includes("is_supervisor")
);
</script>

View File

@ -24,7 +24,7 @@ export type DashboardPersonRoleType =
export type DashboardRoleKeyType =
| "Supervisor"
| "Expert"
| "Trainer"
| "Member"
| "MentorUK"
| "MentorVV";