refactor(backend): Ondersteuning voor gepersonaliseerde leerpaden toegevoegd.
This commit is contained in:
parent
a17e2b2793
commit
dc99835a9d
3 changed files with 99 additions and 78 deletions
|
@ -16,7 +16,7 @@ export function useGetLearningPathQuery(
|
||||||
queryKey: [LEARNING_PATH_KEY, "get", hruid, language, options],
|
queryKey: [LEARNING_PATH_KEY, "get", hruid, language, options],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
const [hruidVal, languageVal, optionsVal] = [toValue(hruid), toValue(language), toValue(options)];
|
const [hruidVal, languageVal, optionsVal] = [toValue(hruid), toValue(language), toValue(options)];
|
||||||
return learningPathController.getBy(hruidVal, languageVal)
|
return learningPathController.getBy(hruidVal, languageVal, optionsVal)
|
||||||
},
|
},
|
||||||
enabled: () => Boolean(toValue(hruid)) && Boolean(toValue(language)),
|
enabled: () => Boolean(toValue(hruid)) && Boolean(toValue(language)),
|
||||||
})
|
})
|
||||||
|
|
|
@ -18,10 +18,15 @@ const learningObjectHtmlQueryResult: UseQueryReturnType<Document, Error> = useLe
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.learning-object-container {
|
.learning-object-container {
|
||||||
margin: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
:deep(hr) {
|
:deep(hr) {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
:deep(li) {
|
||||||
|
margin-left: 30px;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
import {useGetLearningPathQuery} from "@/queries/learning-paths.ts";
|
import {useGetLearningPathQuery} from "@/queries/learning-paths.ts";
|
||||||
import {useLearningObjectListForPathQuery} from "@/queries/learning-objects.ts";
|
import {useLearningObjectListForPathQuery} from "@/queries/learning-objects.ts";
|
||||||
import UsingQueryResult from "@/components/UsingQueryResult.vue";
|
import UsingQueryResult from "@/components/UsingQueryResult.vue";
|
||||||
|
import authService from "@/services/auth/auth-service.ts";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -18,14 +19,29 @@
|
||||||
|
|
||||||
const props = defineProps<{hruid: string, language: Language, learningObjectHruid?: string}>()
|
const props = defineProps<{hruid: string, language: Language, learningObjectHruid?: string}>()
|
||||||
|
|
||||||
interface QueryParams {
|
interface Personalization {
|
||||||
forStudent?: string,
|
forStudent?: string,
|
||||||
forGroup?: string
|
forGroup?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const typedQuery = computed(() => route.query as QueryParams)
|
const personalization = computed(() => {
|
||||||
|
if (route.query.forStudent || route.query.forGroup) {
|
||||||
|
return {
|
||||||
|
forStudent: route.query.forStudent,
|
||||||
|
forGroup: route.query.forGroup
|
||||||
|
} as Personalization
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
forStudent: authService.authState.user?.profile?.preferred_username
|
||||||
|
} as Personalization
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const learningPathQueryResult = useGetLearningPathQuery(props.hruid, props.language, typedQuery.value);
|
const learningPathQueryResult = useGetLearningPathQuery(
|
||||||
|
props.hruid,
|
||||||
|
props.language,
|
||||||
|
personalization
|
||||||
|
);
|
||||||
|
|
||||||
const learningObjectListQueryResult = useLearningObjectListForPathQuery(learningPathQueryResult.data);
|
const learningObjectListQueryResult = useLearningObjectListForPathQuery(learningPathQueryResult.data);
|
||||||
|
|
||||||
|
@ -107,82 +123,82 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<using-query-result
|
<using-query-result
|
||||||
:query-result="learningPathQueryResult"
|
:query-result="learningPathQueryResult"
|
||||||
v-slot="learningPath: {data: LearningPath}"
|
v-slot="learningPath: {data: LearningPath}"
|
||||||
>
|
>
|
||||||
<v-navigation-drawer v-model="navigationDrawerShown">
|
<v-navigation-drawer v-model="navigationDrawerShown">
|
||||||
<v-list-item
|
<v-list-item
|
||||||
:title="learningPath.data.title"
|
:title="learningPath.data.title"
|
||||||
:subtitle="learningPath.data.description"
|
:subtitle="learningPath.data.description"
|
||||||
></v-list-item>
|
></v-list-item>
|
||||||
<v-list-item>
|
<v-list-item>
|
||||||
<template v-slot:subtitle>
|
<template v-slot:subtitle>
|
||||||
<p><v-icon :color="COLORS.notCompleted" :icon="ICONS.notCompleted"></v-icon> {{ t("legendNotCompletedYet") }}</p>
|
<p><v-icon :color="COLORS.notCompleted" :icon="ICONS.notCompleted"></v-icon> {{ t("legendNotCompletedYet") }}</p>
|
||||||
<p><v-icon :color="COLORS.completed" :icon="ICONS.completed"></v-icon> {{ t("legendCompleted") }}</p>
|
<p><v-icon :color="COLORS.completed" :icon="ICONS.completed"></v-icon> {{ t("legendCompleted") }}</p>
|
||||||
<p><v-icon :color="COLORS.teacherExclusive" :icon="ICONS.teacherExclusive"></v-icon> {{ t("legendTeacherExclusive") }}</p>
|
<p><v-icon :color="COLORS.teacherExclusive" :icon="ICONS.teacherExclusive"></v-icon> {{ t("legendTeacherExclusive") }}</p>
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<div v-if="props.learningObjectHruid">
|
<div v-if="props.learningObjectHruid">
|
||||||
<using-query-result
|
<using-query-result
|
||||||
:query-result="learningObjectListQueryResult"
|
:query-result="learningObjectListQueryResult"
|
||||||
v-slot="learningObjects: {data: LearningObject[]}"
|
v-slot="learningObjects: {data: LearningObject[]}"
|
||||||
|
>
|
||||||
|
<v-list-item
|
||||||
|
link
|
||||||
|
:to="{path: node.key, query: route.query}"
|
||||||
|
:title="node.title"
|
||||||
|
:active="node.key === props.learningObjectHruid"
|
||||||
|
v-for="node in learningObjects.data"
|
||||||
>
|
>
|
||||||
<v-list-item
|
<template v-slot:prepend>
|
||||||
link
|
<v-icon
|
||||||
:to="{path: node.key, query: route.query}"
|
:color="COLORS[getNavItemState(node)]"
|
||||||
:title="node.title"
|
:icon="ICONS[getNavItemState(node)]"></v-icon>
|
||||||
:active="node.key === props.learningObjectHruid"
|
</template>
|
||||||
v-for="node in learningObjects.data"
|
<template v-slot:append>
|
||||||
>
|
{{ node.estimatedTime }}'
|
||||||
<template v-slot:prepend>
|
</template>
|
||||||
<v-icon
|
</v-list-item>
|
||||||
:color="COLORS[getNavItemState(node)]"
|
</using-query-result>
|
||||||
:icon="ICONS[getNavItemState(node)]"></v-icon>
|
|
||||||
</template>
|
|
||||||
<template v-slot:append>
|
|
||||||
{{ node.estimatedTime }}'
|
|
||||||
</template>
|
|
||||||
</v-list-item>
|
|
||||||
</using-query-result>
|
|
||||||
</div>
|
|
||||||
</v-navigation-drawer>
|
|
||||||
<div class="control-bar-above-content">
|
|
||||||
<v-btn
|
|
||||||
:icon="navigationDrawerShown ? 'mdi-menu-open' : 'mdi-menu'"
|
|
||||||
class="navigation-drawer-toggle-button"
|
|
||||||
variant="plain"
|
|
||||||
@click="navigationDrawerShown = !navigationDrawerShown"></v-btn>
|
|
||||||
<div class="search-field-container">
|
|
||||||
<learning-path-search-field></learning-path-search-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<learning-object-view
|
</v-navigation-drawer>
|
||||||
:hruid="currentNode.learningobjectHruid"
|
<div class="control-bar-above-content">
|
||||||
:language="currentNode.language"
|
<v-btn
|
||||||
:version="currentNode.version"
|
:icon="navigationDrawerShown ? 'mdi-menu-open' : 'mdi-menu'"
|
||||||
v-if="currentNode"
|
class="navigation-drawer-toggle-button"
|
||||||
></learning-object-view>
|
variant="plain"
|
||||||
<div class="navigation-buttons-container">
|
@click="navigationDrawerShown = !navigationDrawerShown"></v-btn>
|
||||||
<v-btn
|
<div class="search-field-container">
|
||||||
prepend-icon="mdi-chevron-left"
|
<learning-path-search-field></learning-path-search-field>
|
||||||
variant="text"
|
|
||||||
:disabled="!previousNode"
|
|
||||||
:to="previousNode ? {path: previousNode.learningobjectHruid, query: route.query} : undefined"
|
|
||||||
>
|
|
||||||
{{ t("previous") }}
|
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
append-icon="mdi-chevron-right"
|
|
||||||
variant="text"
|
|
||||||
:disabled="!nextNode"
|
|
||||||
:to="nextNode ? {path: nextNode.learningobjectHruid, query: route.query} : undefined"
|
|
||||||
>
|
|
||||||
{{ t("next") }}
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
</div>
|
||||||
</using-query-result>
|
</div>
|
||||||
|
<learning-object-view
|
||||||
|
:hruid="currentNode.learningobjectHruid"
|
||||||
|
:language="currentNode.language"
|
||||||
|
:version="currentNode.version"
|
||||||
|
v-if="currentNode"
|
||||||
|
></learning-object-view>
|
||||||
|
<div class="navigation-buttons-container">
|
||||||
|
<v-btn
|
||||||
|
prepend-icon="mdi-chevron-left"
|
||||||
|
variant="text"
|
||||||
|
:disabled="!previousNode"
|
||||||
|
:to="previousNode ? {path: previousNode.learningobjectHruid, query: route.query} : undefined"
|
||||||
|
>
|
||||||
|
{{ t("previous") }}
|
||||||
|
</v-btn>
|
||||||
|
<v-btn
|
||||||
|
append-icon="mdi-chevron-right"
|
||||||
|
variant="text"
|
||||||
|
:disabled="!nextNode"
|
||||||
|
:to="nextNode ? {path: nextNode.learningobjectHruid, query: route.query} : undefined"
|
||||||
|
>
|
||||||
|
{{ t("next") }}
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</using-query-result>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue