VBV-672: Link zu gefilteter Personenliste
This commit is contained in:
parent
9c1e399f4d
commit
d15eb70792
|
|
@ -20,7 +20,7 @@ onMounted(async () => {
|
||||||
<template>
|
<template>
|
||||||
<div class="w-[325px]">
|
<div class="w-[325px]">
|
||||||
<BaseBox
|
<BaseBox
|
||||||
:details-link="`/dashboard/persons`"
|
:details-link="`/dashboard/persons?course=${props.courseId}`"
|
||||||
data-cy="dashboard.mentor.competenceSummary"
|
data-cy="dashboard.mentor.competenceSummary"
|
||||||
>
|
>
|
||||||
<template #title>{{ $t("a.Personen") }}</template>
|
<template #title>{{ $t("a.Personen") }}</template>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { computed, ref, watch } from "vue";
|
||||||
import { useTranslation } from "i18next-vue";
|
import { useTranslation } from "i18next-vue";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import type { DashboardPersonCourseSessionType } from "@/services/dashboard";
|
import type { DashboardPersonCourseSessionType } from "@/services/dashboard";
|
||||||
|
import { useRouteQuery } from "@vueuse/router";
|
||||||
|
|
||||||
log.debug("DashboardPersonsPage created");
|
log.debug("DashboardPersonsPage created");
|
||||||
|
|
||||||
|
|
@ -38,6 +39,20 @@ const courses = computed(() => {
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
const selectedCourse = ref<MenuItem>(courses.value[0]);
|
const selectedCourse = ref<MenuItem>(courses.value[0]);
|
||||||
|
const selectedCourseRouteQuery = useRouteQuery("course", UNFILTERED, {
|
||||||
|
mode: "replace",
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(selectedCourse, () => {
|
||||||
|
selectedCourseRouteQuery.value = selectedCourse.value.id;
|
||||||
|
});
|
||||||
|
watch(courses, () => {
|
||||||
|
if (selectedCourseRouteQuery.value !== UNFILTERED) {
|
||||||
|
selectedCourse.value =
|
||||||
|
courses.value.find((course) => course.id === selectedCourseRouteQuery.value) ||
|
||||||
|
courses.value[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const regions = computed(() => {
|
const regions = computed(() => {
|
||||||
let values = _(dashboardPersons.value)
|
let values = _(dashboardPersons.value)
|
||||||
|
|
@ -45,6 +60,7 @@ const regions = computed(() => {
|
||||||
.map((cs) => {
|
.map((cs) => {
|
||||||
return Object.assign({}, cs, { name: cs.region, id: cs.region });
|
return Object.assign({}, cs, { name: cs.region, id: cs.region });
|
||||||
})
|
})
|
||||||
|
.filter((cs) => !!cs.region)
|
||||||
.uniqBy("id")
|
.uniqBy("id")
|
||||||
.orderBy("name")
|
.orderBy("name")
|
||||||
.value();
|
.value();
|
||||||
|
|
@ -99,6 +115,7 @@ const generations = computed(() => {
|
||||||
.map((cs) => {
|
.map((cs) => {
|
||||||
return Object.assign({}, cs, { name: cs.generation, id: cs.generation });
|
return Object.assign({}, cs, { name: cs.generation, id: cs.generation });
|
||||||
})
|
})
|
||||||
|
.filter((cs) => !!cs.generation)
|
||||||
.uniqBy("id")
|
.uniqBy("id")
|
||||||
.orderBy("name")
|
.orderBy("name")
|
||||||
.value();
|
.value();
|
||||||
|
|
@ -117,7 +134,10 @@ const roles = computed(() => {
|
||||||
const values = _(dashboardPersons.value)
|
const values = _(dashboardPersons.value)
|
||||||
.flatMap((person) => person.course_sessions)
|
.flatMap((person) => person.course_sessions)
|
||||||
.map((cs) => {
|
.map((cs) => {
|
||||||
return Object.assign({}, cs, { name: cs.user_role_display, id: cs.user_role_display });
|
return Object.assign({}, cs, {
|
||||||
|
name: cs.user_role_display,
|
||||||
|
id: cs.user_role_display,
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.uniqBy("id")
|
.uniqBy("id")
|
||||||
.orderBy("name")
|
.orderBy("name")
|
||||||
|
|
@ -133,7 +153,6 @@ const roles = computed(() => {
|
||||||
});
|
});
|
||||||
const selectedRole = ref<MenuItem>(roles.value[0]);
|
const selectedRole = ref<MenuItem>(roles.value[0]);
|
||||||
|
|
||||||
|
|
||||||
const filteredPersons = computed(() => {
|
const filteredPersons = computed(() => {
|
||||||
return _.orderBy(
|
return _.orderBy(
|
||||||
dashboardPersons.value
|
dashboardPersons.value
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue