Fix URL in SinglePerformanceCriteria
This commit is contained in:
parent
9a70b3005a
commit
26b986b732
|
|
@ -4,6 +4,7 @@ import ItProgress from "@/components/ui/ItProgress.vue";
|
||||||
import ItToggleArrow from "@/components/ui/ItToggleArrow.vue";
|
import ItToggleArrow from "@/components/ui/ItToggleArrow.vue";
|
||||||
import { useCompetenceStore } from "@/stores/competence";
|
import { useCompetenceStore } from "@/stores/competence";
|
||||||
import type { CompetencePage } from "@/types";
|
import type { CompetencePage } from "@/types";
|
||||||
|
import log from "loglevel";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
const competenceStore = useCompetenceStore();
|
const competenceStore = useCompetenceStore();
|
||||||
|
|
@ -20,6 +21,8 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
isInline: false,
|
isInline: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
log.debug("PerformanceCriteriaRow created", props);
|
||||||
|
|
||||||
const isOpen = ref(false);
|
const isOpen = ref(false);
|
||||||
|
|
||||||
const togglePerformanceCriteria = () => {
|
const togglePerformanceCriteria = () => {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ const props = defineProps<{
|
||||||
courseSlug: string;
|
courseSlug: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
log.debug("CompetenceIndexPage created", props);
|
||||||
|
|
||||||
const competenceStore = useCompetenceStore();
|
const competenceStore = useCompetenceStore();
|
||||||
|
|
||||||
const failedCriteria = computed(() => {
|
const failedCriteria = computed(() => {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ import type { Ref } from "vue";
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
log.debug("PerformanceCriteriaPage created");
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
courseSlug: string;
|
courseSlug: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
@ -20,6 +18,8 @@ interface MenuItem {
|
||||||
iconName: string;
|
iconName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.debug("PerformanceCriteriaPage created", props);
|
||||||
|
|
||||||
const competenceStore = useCompetenceStore();
|
const competenceStore = useCompetenceStore();
|
||||||
|
|
||||||
const shownCriteria = computed(() => {
|
const shownCriteria = computed(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useCircleStore } from "@/stores/circle";
|
import { useCircleStore } from "@/stores/circle";
|
||||||
import { useCompetenceStore } from "@/stores/competence";
|
import { useCompetenceStore } from "@/stores/competence";
|
||||||
import type { CompetencePage, PerformanceCriteria } from "@/types";
|
|
||||||
import * as log from "loglevel";
|
import * as log from "loglevel";
|
||||||
|
|
||||||
import LearningContentContainer from "@/components/learningPath/LearningContentContainer.vue";
|
import LearningContentContainer from "@/components/learningPath/LearningContentContainer.vue";
|
||||||
|
import { computed } from "vue";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
courseSlug: string;
|
||||||
|
criteriaSlug: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
log.debug("SinglePerformanceCriteriaPage.vue setup");
|
log.debug("SinglePerformanceCriteriaPage.vue setup");
|
||||||
|
|
||||||
const competenceStore = useCompetenceStore();
|
const competenceStore = useCompetenceStore();
|
||||||
|
|
@ -15,68 +20,40 @@ const circleStore = useCircleStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
let currentQuestion: PerformanceCriteria | undefined;
|
const singleCriteria = computed(() => {
|
||||||
let competencePage: CompetencePage | undefined;
|
return competenceStore.flatPerformanceCriteria().find((criteria) => {
|
||||||
|
return criteria.slug === props.criteriaSlug;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const findCriteria = () => {
|
function close() {
|
||||||
for (const page of competenceStore.competenceProfilePage()
|
router.push(`/course/${props.courseSlug}/competence`);
|
||||||
?.children as CompetencePage[]) {
|
}
|
||||||
for (const criteria of page.children) {
|
|
||||||
if (criteria.slug === route.params["criteriaSlug"]) {
|
|
||||||
currentQuestion = criteria;
|
|
||||||
competencePage = page;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (competencePage) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
findCriteria();
|
|
||||||
// onMounted(() => {
|
|
||||||
// console.log(route.params)
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const questions = computed(() => props.learningUnit?.children);
|
|
||||||
// const currentQuestion = computed(() => questions.value[state.questionIndex]);
|
|
||||||
//
|
|
||||||
// function handleContinue() {
|
|
||||||
// log.debug("handleContinue");
|
|
||||||
// if (state.questionIndex + 1 < questions.value.length) {
|
|
||||||
// log.debug("increment questionIndex", state.questionIndex);
|
|
||||||
// state.questionIndex += 1;
|
|
||||||
// } else {
|
|
||||||
// log.debug("continue to next learning content");
|
|
||||||
// circleStore.continueFromSelfEvaluation(props.learningUnit);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="competencePage" class="absolute bottom-0 top-0 w-full bg-white">
|
<div v-if="singleCriteria" class="absolute bottom-0 top-0 w-full bg-white">
|
||||||
<LearningContentContainer
|
<LearningContentContainer
|
||||||
:title="''"
|
:title="''"
|
||||||
:next-button-text="$t('general.save')"
|
:next-button-text="$t('general.save')"
|
||||||
@exit="router.back()"
|
@exit="router.back()"
|
||||||
@next="router.back()"
|
@next="router.back()"
|
||||||
>
|
>
|
||||||
<div v-if="currentQuestion" class="container-medium">
|
<div v-if="singleCriteria" class="container-medium">
|
||||||
<div class="mt-4 border p-6 lg:mt-8 lg:p-12">
|
<div class="mt-4 border p-6 lg:mt-8 lg:p-12">
|
||||||
<h2 class="heading-2">
|
<h2 class="heading-2">
|
||||||
{{ currentQuestion.competence_id }} {{ currentQuestion.title }}
|
{{ singleCriteria.competence_id }} {{ singleCriteria.title }}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="mt-4 flex flex-col justify-between gap-6 lg:mt-8 lg:flex-row">
|
<div class="mt-4 flex flex-col justify-between gap-6 lg:mt-8 lg:flex-row">
|
||||||
<button
|
<button
|
||||||
class="inline-flex flex-1 items-center border p-4 text-left"
|
class="inline-flex flex-1 items-center border p-4 text-left"
|
||||||
:class="{
|
:class="{
|
||||||
'border-green-500': currentQuestion.completion_status === 'success',
|
'border-green-500': singleCriteria.completion_status === 'success',
|
||||||
'border-2': currentQuestion.completion_status === 'success',
|
'border-2': singleCriteria.completion_status === 'success',
|
||||||
}"
|
}"
|
||||||
data-cy="success"
|
data-cy="success"
|
||||||
@click="circleStore.markCompletion(currentQuestion, 'success')"
|
@click="circleStore.markCompletion(singleCriteria, 'success')"
|
||||||
>
|
>
|
||||||
<it-icon-smiley-happy class="mr-4 h-16 w-16"></it-icon-smiley-happy>
|
<it-icon-smiley-happy class="mr-4 h-16 w-16"></it-icon-smiley-happy>
|
||||||
<span class="text-large font-bold">{{ $t("selfEvaluation.yes") }}</span>
|
<span class="text-large font-bold">{{ $t("selfEvaluation.yes") }}</span>
|
||||||
|
|
@ -84,11 +61,11 @@ findCriteria();
|
||||||
<button
|
<button
|
||||||
class="inline-flex flex-1 items-center border p-4 text-left"
|
class="inline-flex flex-1 items-center border p-4 text-left"
|
||||||
:class="{
|
:class="{
|
||||||
'border-orange-500': currentQuestion.completion_status === 'fail',
|
'border-orange-500': singleCriteria.completion_status === 'fail',
|
||||||
'border-2': currentQuestion.completion_status === 'fail',
|
'border-2': singleCriteria.completion_status === 'fail',
|
||||||
}"
|
}"
|
||||||
data-cy="fail"
|
data-cy="fail"
|
||||||
@click="circleStore.markCompletion(currentQuestion, 'fail')"
|
@click="circleStore.markCompletion(singleCriteria, 'fail')"
|
||||||
>
|
>
|
||||||
<it-icon-smiley-thinking class="mr-4 h-16 w-16"></it-icon-smiley-thinking>
|
<it-icon-smiley-thinking class="mr-4 h-16 w-16"></it-icon-smiley-thinking>
|
||||||
<span class="text-xl font-bold">{{ $t("selfEvaluation.no") }}</span>
|
<span class="text-xl font-bold">{{ $t("selfEvaluation.no") }}</span>
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ const router = createRouter({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "criteria",
|
path: "criteria",
|
||||||
|
props: true,
|
||||||
component: () => import("@/pages/competence/PerformanceCriteriaPage.vue"),
|
component: () => import("@/pages/competence/PerformanceCriteriaPage.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,7 @@ export const useCompletionStore = defineStore({
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
userId = userStore.id;
|
userId = userStore.id;
|
||||||
}
|
}
|
||||||
bustItGetCache(
|
bustItGetCache(`/api/course/completion/${courseSessionId}/${userId}/`);
|
||||||
`/api/course/completion/${completionData[0].course}/${userId}/`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return completionData as CourseCompletion[];
|
return completionData as CourseCompletion[];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue