diff --git a/client/src/pages/learningPath/circlePage/DocumentListItem.vue b/client/src/components/circle/DocumentListItem.vue similarity index 79% rename from client/src/pages/learningPath/circlePage/DocumentListItem.vue rename to client/src/components/circle/DocumentListItem.vue index c9b4632f..b11f8327 100644 --- a/client/src/pages/learningPath/circlePage/DocumentListItem.vue +++ b/client/src/components/circle/DocumentListItem.vue @@ -20,14 +20,19 @@ diff --git a/client/src/pages/cockpit/cockpitPage/CockpitDates.vue b/client/src/pages/cockpit/cockpitPage/CockpitDates.vue index c3724c96..f1cea728 100644 --- a/client/src/pages/cockpit/cockpitPage/CockpitDates.vue +++ b/client/src/pages/cockpit/cockpitPage/CockpitDates.vue @@ -9,9 +9,9 @@ const courseSession = useCurrentCourseSession(); const circleDates = computed(() => { const dueDates = courseSession.value.due_dates.filter((dueDate) => { - if (!cockpitStore.selectedCircle) return false; + if (!cockpitStore.currentCircle) return false; return ( - cockpitStore.selectedCircle.translation_key == dueDate?.circle?.translation_key + cockpitStore.currentCircle.translation_key == dueDate?.circle?.translation_key ); }); return dueDates.slice(0, 4); diff --git a/client/src/pages/cockpit/cockpitPage/CockpitPage.vue b/client/src/pages/cockpit/cockpitPage/CockpitPage.vue index 1bc0ffac..99c0668b 100644 --- a/client/src/pages/cockpit/cockpitPage/CockpitPage.vue +++ b/client/src/pages/cockpit/cockpitPage/CockpitPage.vue @@ -10,6 +10,7 @@ import { useCompetenceStore } from "@/stores/competence"; import { useLearningPathStore } from "@/stores/learningPath"; import log from "loglevel"; import CockpitDates from "@/pages/cockpit/cockpitPage/CockpitDates.vue"; +import { useCourseSessionsStore } from "@/stores/courseSessions"; import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue"; const props = defineProps<{ @@ -22,12 +23,13 @@ const cockpitStore = useCockpitStore(); const competenceStore = useCompetenceStore(); const learningPathStore = useLearningPathStore(); const courseSession = useCurrentCourseSession(); +const courseSessionsStore = useCourseSessionsStore(); function userCountStatusForCircle(userId: string) { - if (!cockpitStore.selectedCircle) return { FAIL: 0, SUCCESS: 0, UNKNOWN: 0 }; + if (!cockpitStore.currentCircle) return { FAIL: 0, SUCCESS: 0, UNKNOWN: 0 }; const criteria = competenceStore.flatPerformanceCriteria( userId, - cockpitStore.selectedCircle.id + cockpitStore.currentCircle.id ); return competenceStore.calcStatusCount(criteria); } @@ -35,146 +37,173 @@ function userCountStatusForCircle(userId: string) { -
- -
- - - - - -
-

- {{ $t("circlePage.documents.trainerTitle") }} -

-
- {{ $t("circlePage.documents.trainerDescription") }} -
- - {{ $t("circlePage.documents.trainerLinkText") }} -
diff --git a/client/src/router/index.ts b/client/src/router/index.ts index dac7036f..28f710de 100644 --- a/client/src/router/index.ts +++ b/client/src/router/index.ts @@ -165,6 +165,11 @@ const router = createRouter({ import("@/pages/cockpit/attendanceCheckPage/AttendanceCheckPage.vue"), props: true, }, + { + path: "documents", + component: () => import("@/pages/cockpit/documentPage/DocumentPage.vue"), + props: true, + }, ], }, { diff --git a/client/src/stores/cockpit.ts b/client/src/stores/cockpit.ts index 096e7699..a1f72db0 100644 --- a/client/src/stores/cockpit.ts +++ b/client/src/stores/cockpit.ts @@ -2,26 +2,18 @@ import { itGetCached } from "@/fetchHelpers"; import type { CourseSessionUser, ExpertSessionUser } from "@/types"; import log from "loglevel"; +import { useCircleStore } from "@/stores/circle"; import { useLearningPathStore } from "@/stores/learningPath"; import { useUserStore } from "@/stores/user"; import { defineStore } from "pinia"; export type CockpitStoreState = { courseSessionMembers: CourseSessionUser[] | undefined; - selectedCircle: - | { - id: number; - name: string; - slug: string; - translation_key: string; - } - | undefined; circles: { - id: number; + id: string; name: string; - slug: string; - translation_key: string; }[]; + currentCourseSlug: string | undefined; }; export const useCockpitStore = defineStore({ @@ -29,29 +21,38 @@ export const useCockpitStore = defineStore({ state: () => { return { courseSessionMembers: undefined, - selectedCircle: undefined, circles: [], + currentCourseSlug: undefined, } as CockpitStoreState; }, actions: { async loadCircles(courseSlug: string, courseSessionId: number) { - log.debug("loadCircles called"); + log.debug("loadCircles called", courseSlug, courseSessionId); + this.currentCourseSlug = courseSlug; - const f = await courseCircles(courseSlug, courseSessionId); + const f = await courseCircles(this.currentCourseSlug, courseSessionId); this.circles = f.map((c) => { return { - id: c.id, + id: c.slug, name: c.title, - slug: c.slug, - translation_key: c.translation_key, }; }); if (this.circles.length > 0) { - this.selectedCircle = this.circles[0]; + await this.setCurrentCourseCircle(this.circles[0].id); } }, + async setCurrentCourseCircle(circleSlug: string) { + if (!this.currentCourseSlug) { + throw new Error("currentCourseSlug is undefined"); + } + const circleStore = useCircleStore(); + await circleStore.loadCircle(this.currentCourseSlug, circleSlug); + }, + async setCurrentCourseCircleFromEvent(event: { id: string }) { + await this.setCurrentCourseCircle(event.id); + }, async loadCourseSessionMembers(courseSessionId: number, reload = false) { log.debug("loadCourseSessionMembers called"); const users = (await itGetCached( @@ -65,6 +66,19 @@ export const useCockpitStore = defineStore({ return this.courseSessionMembers; }, }, + getters: { + currentCircle: () => { + const circleStore = useCircleStore(); + return circleStore.circle; + }, + selectedCircle: () => { + const circleStore = useCircleStore(); + return { + id: circleStore.circle?.id || 0, + name: circleStore.circle?.title || "", + }; + }, + }, }); async function courseCircles(courseSlug: string, courseSessionId: number) {