wip: Add routes
This commit is contained in:
parent
db7fbdd03a
commit
2318135f50
|
|
@ -1,11 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import CockpitProfileContent from "@/components/userProfile/UserProfileContent.vue";
|
import CockpitProfileContent from "@/components/userProfile/UserProfileContent.vue";
|
||||||
import { ref } from "vue";
|
import { computed } from "vue";
|
||||||
import SelfEvaluationAndFeedbackList from "@/components/selfEvaluationFeedback/SelfEvaluationAndFeedbackList.vue";
|
import SelfEvaluationAndFeedbackList from "@/components/selfEvaluationFeedback/SelfEvaluationAndFeedbackList.vue";
|
||||||
import SelfEvaluationAndFeedbackOverview from "@/components/selfEvaluationFeedback/SelfEvaluationAndFeedbackOverview.vue";
|
import SelfEvaluationAndFeedbackOverview from "@/components/selfEvaluationFeedback/SelfEvaluationAndFeedbackOverview.vue";
|
||||||
import { useCurrentCourseSession } from "@/composables";
|
import { useCurrentCourseSession } from "@/composables";
|
||||||
|
import CompetenceCertificateListPage from "@/pages/competence/CompetenceCertificateListPage.vue";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
|
||||||
type SubMenuType = "OVERVIEW" | "DETAILS";
|
type SubMenuType = "OVERVIEW" | "EVALUATIONS" | "COMPETENCES";
|
||||||
|
const subMenuOptions: SubMenuType[] = ["OVERVIEW", "EVALUATIONS", "COMPETENCES"];
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
userId: string;
|
userId: string;
|
||||||
|
|
@ -15,49 +18,71 @@ const props = defineProps<{
|
||||||
interface SubMenuItem {
|
interface SubMenuItem {
|
||||||
type: SubMenuType;
|
type: SubMenuType;
|
||||||
label: string;
|
label: string;
|
||||||
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MENU_ENTRIES: SubMenuItem[] = [
|
const MENU_ENTRIES: SubMenuItem[] = [
|
||||||
{ type: "OVERVIEW", label: "a.Übersicht" },
|
|
||||||
{
|
{
|
||||||
type: "DETAILS",
|
type: "OVERVIEW",
|
||||||
label: useCurrentCourseSession().value.course.configuration.enable_learning_mentor
|
label: "a.Übersicht",
|
||||||
|
url: `/course/${props.courseSlug}/profile/${props.userId}/competence`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "EVALUATIONS",
|
||||||
|
label: useCurrentCourseSession().value.course.configuration.is_vv
|
||||||
? "a.Selbst- und Fremdeinschätzungen"
|
? "a.Selbst- und Fremdeinschätzungen"
|
||||||
: "a.Selbsteinschätzungen",
|
: "a.Selbsteinschätzungen",
|
||||||
|
url: `/course/${props.courseSlug}/profile/${props.userId}/competence/evaluations`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const active = ref<SubMenuItem>(MENU_ENTRIES[0]);
|
if (useCurrentCourseSession().value.course.configuration.is_uk) {
|
||||||
const selectDetails = () => {
|
MENU_ENTRIES.push({
|
||||||
active.value = MENU_ENTRIES[1];
|
type: "COMPETENCES",
|
||||||
};
|
label: "Kompetenznachweise",
|
||||||
|
url: `/course/${props.courseSlug}/profile/${props.userId}/competence/competences`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const active = computed(() => {
|
||||||
|
const index = subMenuOptions.indexOf(route.meta?.subpage);
|
||||||
|
if (index > -1) {
|
||||||
|
return MENU_ENTRIES[index];
|
||||||
|
}
|
||||||
|
return MENU_ENTRIES[0];
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CockpitProfileContent>
|
<CockpitProfileContent>
|
||||||
<template #side>
|
<template #side>
|
||||||
<div v-for="(entry, index) in MENU_ENTRIES" :key="index" class="mb-2">
|
<div v-for="(entry, index) in MENU_ENTRIES" :key="index" class="mb-2">
|
||||||
<button
|
<router-link
|
||||||
|
v-if="active"
|
||||||
|
:to="entry.url"
|
||||||
class="flex w-full items-center space-x-2 p-2 pr-4 text-blue-900 hover:bg-gray-200 lg:pr-8"
|
class="flex w-full items-center space-x-2 p-2 pr-4 text-blue-900 hover:bg-gray-200 lg:pr-8"
|
||||||
:class="{ 'text-bold bg-gray-200': active.type === entry.type }"
|
:class="{ 'text-bold bg-gray-200': active.type === entry.type }"
|
||||||
@click="active = entry"
|
|
||||||
>
|
>
|
||||||
<span>{{ $t(entry.label) }}</span>
|
<span>{{ $t(entry.label) }}</span>
|
||||||
</button>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #main>
|
<template #main>
|
||||||
<div class="container-large">
|
<div v-if="active" class="container-large">
|
||||||
<SelfEvaluationAndFeedbackOverview
|
<SelfEvaluationAndFeedbackOverview
|
||||||
v-if="active.type === 'OVERVIEW'"
|
v-if="active.type === 'OVERVIEW'"
|
||||||
:profile-user-id="props.userId"
|
:profile-user-id="props.userId"
|
||||||
@show-all="selectDetails"
|
|
||||||
/>
|
/>
|
||||||
<SelfEvaluationAndFeedbackList
|
<SelfEvaluationAndFeedbackList
|
||||||
v-else-if="active.type === 'DETAILS'"
|
v-else-if="active.type === 'EVALUATIONS'"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
:profile-user-id="props.userId"
|
:profile-user-id="props.userId"
|
||||||
/>
|
/>
|
||||||
|
<CompetenceCertificateListPage
|
||||||
|
v-else-if="active.type === 'COMPETENCES'"
|
||||||
|
:course-slug="useCurrentCourseSession().value.course.slug"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</CockpitProfileContent>
|
</CockpitProfileContent>
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,26 @@ const router = createRouter({
|
||||||
component: () => import("@/pages/userProfile/CompetenceProfilePage.vue"),
|
component: () => import("@/pages/userProfile/CompetenceProfilePage.vue"),
|
||||||
props: true,
|
props: true,
|
||||||
name: "profileCompetence",
|
name: "profileCompetence",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "", // Default path (e.g., /competence)
|
||||||
|
name: "competenceMain",
|
||||||
|
meta: { subpage: "OVERVIEW" },
|
||||||
|
component: () => import("@/pages/userProfile/CompetenceProfilePage.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "evaluations", // Subpath (e.g., /competence/evaluations)
|
||||||
|
name: "competenceEvaluations",
|
||||||
|
meta: { subpage: "EVALUATIONS" },
|
||||||
|
component: () => import("@/pages/userProfile/CompetenceProfilePage.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "competences", // Another subpath (e.g., /competence/competences)
|
||||||
|
name: "profileCompetences",
|
||||||
|
meta: { subpage: "COMPETENCES" },
|
||||||
|
component: () => import("@/pages/userProfile/CompetenceProfilePage.vue"),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,7 @@ export interface CourseConfiguration {
|
||||||
enable_learning_mentor: boolean;
|
enable_learning_mentor: boolean;
|
||||||
enable_competence_certificates: boolean;
|
enable_competence_certificates: boolean;
|
||||||
is_uk: boolean;
|
is_uk: boolean;
|
||||||
|
is_vv: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Course {
|
export interface Course {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue