Add conditional Cockpit link to navigation
This commit is contained in:
parent
3375d0f121
commit
fd2aaadedb
|
|
@ -183,7 +183,20 @@ const profileDropdownData: DropdownListItem[] = [
|
|||
class="nav-item"
|
||||
:class="{ 'nav-item--active': inCompetenceProfile() }"
|
||||
>
|
||||
KompetenzNavi
|
||||
{{ $t("competences.title") }}
|
||||
</router-link>
|
||||
|
||||
<router-link
|
||||
v-if="
|
||||
inCourse() &&
|
||||
courseSessionsStore.courseSessionForRoute &&
|
||||
courseSessionsStore.hasCockpit
|
||||
"
|
||||
:to="`${courseSessionsStore.courseSessionForRoute.course_url}/cockpit`"
|
||||
class="nav-item"
|
||||
:class="{ 'nav-item--active': inCockpit() }"
|
||||
>
|
||||
{{ $t("cockpit.title") }}
|
||||
</router-link>
|
||||
|
||||
<div class="hidden lg:block flex-auto"></div>
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ const clickLink = (to: string | undefined) => {
|
|||
</button>
|
||||
</li>
|
||||
<li class="mt-6">
|
||||
<button @click="clickLink(courseSession?.competence_url)">
|
||||
KompetenzNavi
|
||||
<button @click="clickLink(`${courseSession?.course_url}/cockpit`)">
|
||||
{{ $t("cockpit.title") }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@
|
|||
"faq": "FAQ"
|
||||
},
|
||||
"cockpit": {
|
||||
"title": "Cockpit",
|
||||
"tasksDone": "Erledigte Transferaufträge von Teilnehmer.",
|
||||
"feedbacksDone": "Abgeschickte Feedbacks von Teilnehmer.",
|
||||
"examsDone": "Abgelegte Prüfungen von Teilnehmer.",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import log from "loglevel";
|
|||
|
||||
import { defineStore } from "pinia";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useUserStore } from "./user";
|
||||
|
||||
export type CourseSessionsStoreState = {
|
||||
courseSessions: CourseSession[] | undefined;
|
||||
|
|
@ -30,6 +31,14 @@ export const useCourseSessionsStore = defineStore({
|
|||
return _.uniqBy(state.courseSessions, "course.id");
|
||||
}
|
||||
},
|
||||
hasCockpit() {
|
||||
const userStore = useUserStore();
|
||||
return (
|
||||
this.courseSessionForRoute.experts.filter(
|
||||
(expert) => expert.user_id === userStore.id
|
||||
).length > 0
|
||||
);
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async loadCourseSessionsData(reload = false) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue