Add buy link (VBV-682)
This commit is contained in:
parent
eeb0ca1969
commit
029ca0140f
|
|
@ -21,7 +21,9 @@ import {
|
||||||
getLearningMentorUrl,
|
getLearningMentorUrl,
|
||||||
getLearningPathUrl,
|
getLearningPathUrl,
|
||||||
getMediaCenterUrl,
|
getMediaCenterUrl,
|
||||||
|
isVVLearningMentor,
|
||||||
} from "@/utils/utils";
|
} from "@/utils/utils";
|
||||||
|
import { useVVByLink } from "@/composables";
|
||||||
|
|
||||||
log.debug("MainNavigationBar created");
|
log.debug("MainNavigationBar created");
|
||||||
|
|
||||||
|
|
@ -29,6 +31,7 @@ const breakpoints = useBreakpoints(breakpointsTailwind);
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const courseSessionsStore = useCourseSessionsStore();
|
const courseSessionsStore = useCourseSessionsStore();
|
||||||
const notificationsStore = useNotificationsStore();
|
const notificationsStore = useNotificationsStore();
|
||||||
|
const vvBuyLink = useVVByLink();
|
||||||
const {
|
const {
|
||||||
inCockpit,
|
inCockpit,
|
||||||
inCompetenceProfile,
|
inCompetenceProfile,
|
||||||
|
|
@ -291,7 +294,14 @@ const mentorTabTitle = computed(() =>
|
||||||
>
|
>
|
||||||
<it-icon-media-library class="h-8 w-8" />
|
<it-icon-media-library class="h-8 w-8" />
|
||||||
</router-link>
|
</router-link>
|
||||||
|
<router-link
|
||||||
|
v-if="isVVLearningMentor(courseSessionsStore.currentCourseSession)"
|
||||||
|
:to="vvBuyLink.href.value"
|
||||||
|
data-cy="buy-vv-link"
|
||||||
|
class="nav-item-no-mobile"
|
||||||
|
>
|
||||||
|
{{ $t("a.Lehrgang kaufen") }}
|
||||||
|
</router-link>
|
||||||
<router-link
|
<router-link
|
||||||
v-if="hasAppointmentsMenu"
|
v-if="hasAppointmentsMenu"
|
||||||
:to="appointmentsUrl"
|
:to="appointmentsUrl"
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,11 @@ import {
|
||||||
getLearningMentorUrl,
|
getLearningMentorUrl,
|
||||||
getLearningPathUrl,
|
getLearningPathUrl,
|
||||||
getMediaCenterUrl,
|
getMediaCenterUrl,
|
||||||
|
isVVLearningMentor,
|
||||||
} from "@/utils/utils";
|
} from "@/utils/utils";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||||
|
import { useVVByLink } from "@/composables";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
@ -33,6 +35,7 @@ defineProps<{
|
||||||
const emit = defineEmits(["closemodal", "logout"]);
|
const emit = defineEmits(["closemodal", "logout"]);
|
||||||
|
|
||||||
const courseSessionsStore = useCourseSessionsStore();
|
const courseSessionsStore = useCourseSessionsStore();
|
||||||
|
const vvBuyLink = useVVByLink();
|
||||||
|
|
||||||
const clickLink = (to: string | undefined) => {
|
const clickLink = (to: string | undefined) => {
|
||||||
if (to) {
|
if (to) {
|
||||||
|
|
@ -119,6 +122,17 @@ const mentorTabTitle = computed(() =>
|
||||||
{{ $t("a.Mediathek") }}
|
{{ $t("a.Mediathek") }}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
<li
|
||||||
|
v-if="isVVLearningMentor(courseSessionsStore.currentCourseSession)"
|
||||||
|
class="mb-6"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
data-cy="vv-buy-link"
|
||||||
|
@click="clickLink(vvBuyLink.href.value as string)"
|
||||||
|
>
|
||||||
|
{{ $t("Lernpfad kaufen") }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-6 border-b">
|
<div class="mt-6 border-b">
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ import orderBy from "lodash/orderBy";
|
||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
import type { ComputedRef, Ref } from "vue";
|
import type { ComputedRef, Ref } from "vue";
|
||||||
import { computed, onMounted, ref, watchEffect } from "vue";
|
import { computed, onMounted, ref, watchEffect } from "vue";
|
||||||
|
import { useRouter, type RouteLocationRaw } from "vue-router";
|
||||||
|
|
||||||
export function useCurrentCourseSession() {
|
export function useCurrentCourseSession() {
|
||||||
/**
|
/**
|
||||||
|
|
@ -728,3 +729,17 @@ export function useEvaluationWithFeedback() {
|
||||||
|
|
||||||
return { hasFeedback };
|
return { hasFeedback };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function useVVByLink() {
|
||||||
|
const router = useRouter();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const href = computed(
|
||||||
|
() =>
|
||||||
|
router.resolve({
|
||||||
|
name: "accountConfirm",
|
||||||
|
params: { courseType: `vv-${userStore.language}` },
|
||||||
|
}).href as RouteLocationRaw
|
||||||
|
);
|
||||||
|
|
||||||
|
return { href };
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AssignmentType } from "@/types";
|
import type { AssignmentType, CourseSession } from "@/types";
|
||||||
import { useTranslation } from "i18next-vue";
|
import { useTranslation } from "i18next-vue";
|
||||||
|
|
||||||
export function assertUnreachable(msg: string): never {
|
export function assertUnreachable(msg: string): never {
|
||||||
|
|
@ -66,3 +66,12 @@ export function getAssignmentTypeIcon(assignmentType: AssignmentType): string {
|
||||||
return "it-icon-lc-assignment";
|
return "it-icon-lc-assignment";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isVVLearningMentor(courseSession: CourseSession | undefined): boolean {
|
||||||
|
return (
|
||||||
|
(courseSession?.actions.includes("is_learning_mentor") &&
|
||||||
|
!courseSession?.actions.includes("learning-mentor::edit-mentors") &&
|
||||||
|
courseSession?.course.configuration.is_vv) ??
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue