Add feedback completion

This commit is contained in:
Christian Cueni 2023-01-17 08:09:00 +01:00
parent c36df95e02
commit 142d0f374e
13 changed files with 99 additions and 31 deletions

View File

@ -3,7 +3,11 @@
<FeedbackIntro
v-if="stepNo === 0"
:title="circleStore.circle?.title"
:intro="$t('feedback.intro', {name: `${courseSessionsStore.circleExperts[0].first_name} ${courseSessionsStore.circleExperts[0].last_name}`})"
:intro="
$t('feedback.intro', {
name: `${courseSessionsStore.circleExperts[0].first_name} ${courseSessionsStore.circleExperts[0].last_name}`,
})
"
@start="stepNo = 1"
></FeedbackIntro>
<ItRadioGroup
@ -75,19 +79,32 @@
class="mb-8"
/>
<ItTextarea
v-if="stepNo === 8"
v-if="stepNo === 10"
v-model="coursePositiveFeedback"
:label="$t('feedback.coursePositiveFeedbackLabel')"
class="mb-8"
/>
<FeedbackCompletition
v-if="stepNo === 11"
:avatar-url="courseSessionsStore.circleExperts[0].avatar_url"
:title="
$t('feedback.completionTitle', {
name: `${courseSessionsStore.circleExperts[0].first_name} ${courseSessionsStore.circleExperts[0].last_name}`,
})
"
:description="$t('feedback.completionDescription')"
:feedback-sent="mutationResult != null"
@send-feedback="sendFeedback"
/>
<LearningContentNavigation
:show-back-button="stepNo > 0"
:show-next-button="stepNo > 0"
:question-index="stepNo"
:max-question-index="MAX_STEPS"
@back="previousStep"
@continue="nextStep"
></LearningContentNavigation>
:show-back-button="stepNo > 0"
:show-next-button="stepNo > 0 && stepNo < MAX_STEPS - 1"
:question-index="stepNo"
:max-question-index="MAX_STEPS"
@back="previousStep"
@continue="nextStep"
></LearningContentNavigation>
<hr class="mb-10 mt-10" />
<pre>
satisfaction {{ satisfaction }}
@ -112,14 +129,15 @@ import {
RATINGS,
YES_NO,
} from "@/components/learningPath/feedback.constants";
import ItRadioGroup from "@/components/ui/ItRadioGroup.vue";
import ItTextarea from "@/components/ui/ItTextarea.vue";
import FeedbackCompletition from "@/components/learningPath/FeedbackCompletition.vue";
import FeedbackIntro from "@/components/learningPath/FeedbackIntro.vue";
import LearningContentNavigation from "@/components/learningPath/LearningContentNavigation.vue";
import ItRadioGroup from "@/components/ui/ItRadioGroup.vue";
import ItTextarea from "@/components/ui/ItTextarea.vue";
import { graphql } from "@/gql/";
import type { SendFeedbackInput } from "@/gql/graphql";
import { useCourseSessionsStore } from "@/stores/courseSessions";
import { useCircleStore } from "@/stores/circle";
import { useCourseSessionsStore } from "@/stores/courseSessions";
import type { LearningContent } from "@/types";
import { useMutation } from "@urql/vue";
import log from "loglevel";
@ -134,7 +152,7 @@ onMounted(async () => {
});
const stepNo = ref(0);
const MAX_STEPS = 10;
const MAX_STEPS = 12;
const sendFeedbackMutation = graphql(`
mutation SendFeedbackMutation($input: SendFeedbackInput!) {

View File

@ -80,6 +80,7 @@ const clickLink = (to: string | undefined) => {
</li>
<li class="mt-6">
<button
data-cy="medialibrary-link"
@click="
clickLink(
courseSessionsStore.courseSessionForRoute?.media_library_url

View File

@ -0,0 +1,41 @@
<template>
<div>
<h1 class="hidden lg:block lg:mb-12">{{ title }}</h1>
<div
class="b-0 lg:border lg:border-gray-400 p-8 flex flex-col lg:items-center lg:flex-row"
>
<img :src="avatarUrl" class="w-16 h-16 rounded-full mb-6 lg:mr-12" />
<h1 class="block lg:hidden mb-8">{{ title }}</h1>
<div>
<p class="mb-6">{{ description }}</p>
<button v-if="!feedbackSent" class="btn-primary" @click="$emit('sendFeedback')">
{{ $t("feedback.sendFeedback") }}
</button>
<p v-else class="bg-green-200 px-6 py-4 flex items-center">
<it-icon-check
class="text-green-800 w-7 h-7 mr-2 inline-block"
></it-icon-check>
{{ $t("feedback.feedbackSent") }}
</p>
</div>
</div>
</div>
</template>
<script setup lang="ts">
interface Props {
avatarUrl: string;
title: string;
description: string;
feedbackSent: boolean;
}
const _props = withDefaults(defineProps<Props>(), {
avatarUrl: "",
title: "",
description: "",
feedbackSent: false,
});
defineEmits(["sendFeedback"]);
</script>

View File

@ -1,10 +1,10 @@
<template>
<div>
<h1 class="mb-8">«{{ title }}»: {{ $t("feedback.areYouSatisfied") }}</h1>
<p class="mb-8"> {{ intro }}</p>
<button
class="btn-primary"
@click="$emit('start')">{{ $t("general.start") }}</button>
<p class="mb-8">{{ intro }}</p>
<button class="btn-primary" @click="$emit('start')">
{{ $t("general.start") }}
</button>
</div>
</template>
@ -12,7 +12,7 @@
interface Props {
title: string;
intro: string;
};
}
const _props = withDefaults(defineProps<Props>(), {
title: "",

View File

@ -52,7 +52,6 @@ const component = computed(() => {
const showNavigationBorder = computed(() => {
return block.value?.type !== "feedback";
});
</script>
<template>

View File

@ -47,11 +47,11 @@ defineEmits(["next", "exit"]);
:class="{ 'border-t': showBorder }"
>
<div class="flex justify-between">
<!-- <LearningContentBadge
<LearningContentBadge
v-if="learningContentBlock && learningContentBlock.type"
:learning-content-type="learningContentBlock.type"
class="mr-2"
/> -->
/>
<h1 class="text-base font-normal hidden lg:inline-block" data-cy="ln-title">
{{ title }}
</h1>

View File

@ -4,7 +4,7 @@ interface Props {
showNextButton: boolean;
questionIndex: number;
maxQuestionIndex: number;
};
}
const _props = withDefaults(defineProps<Props>(), {
showBackButton: true,
@ -13,7 +13,6 @@ const _props = withDefaults(defineProps<Props>(), {
maxQuestionIndex: 0,
});
defineEmits(["back", "continue"]);
</script>
@ -23,8 +22,8 @@ defineEmits(["back", "continue"]);
<button
v-if="showBackButton"
class="btn-secondary flex items-center mr-2"
@click="$emit('back')"
data-cy="previous-step"
@click="$emit('back')"
>
<it-icon-arrow-left class="w-6 h-6 mr-2"></it-icon-arrow-left>
{{ $t("general.backCapitalized") }}
@ -32,8 +31,9 @@ defineEmits(["back", "continue"]);
<button
v-if="showNextButton"
class="btn-secondary flex items-center"
data-cy="next-step"
@click="$emit('continue')"
data-cy="next-step">
>
{{ $t("general.next") }}
<it-icon-arrow-right class="w-6 h-6 ml-2"></it-icon-arrow-right>
</button>
@ -47,6 +47,7 @@ defineEmits(["back", "continue"]);
>
<span
v-for="i in maxQuestionIndex"
:key="i"
class="w-full"
:class="{
'bg-sky-500': i <= questionIndex + 1,

View File

@ -4,9 +4,9 @@ import type { LearningUnit } from "@/types";
import * as log from "loglevel";
import LearningContentContainer from "@/components/learningPath/LearningContentContainer.vue";
import LearningContentNavigation from "./LearningContentNavigation.vue";
import { COMPLETION_FAILURE, COMPLETION_SUCCESS } from "@/constants";
import { computed, reactive } from "vue";
import LearningContentNavigation from "./LearningContentNavigation.vue";
log.debug("LearningContent.vue setup");

View File

@ -6,7 +6,9 @@
<RadioGroupLabel class="heading-1 mb-8 block">
{{ label }}
</RadioGroupLabel>
<div class="flex flex-col md:flex-row justify-between align-items-center justify-items-center space-y-6 md:space-y-0 md:space-x-6">
<div
class="flex flex-col md:flex-row justify-between align-items-center justify-items-center space-y-6 md:space-y-0 md:space-x-6"
>
<RadioGroupOption
v-for="item in items"
:key="item.value"

View File

@ -1,6 +1,6 @@
<template>
<div>
<h2 class="text-5xl mb-12 leading-normal font-bold block">{{ label }}</h2>
<h2 class="heading-1 mb-8 block">{{ label }}</h2>
<textarea
:value="modelValue"
class="w-full border-gray-500 h-40"

View File

@ -59,7 +59,7 @@
}
},
"learningContent": {
"completeAndContinue": "Abschliessen und weiter"
"completeAndContinue": "Als erledigt markieren"
},
"selfEvaluation": {
"selfEvaluation": "Selbsteinschätzung",
@ -127,7 +127,11 @@
"instructorRespectLabel": "Fragen und Anregungen der Kursteilnehmenden wurden ernst genommen u. aufgegriffen.",
"instructorOpenFeedbackLabel": "Was ich dem Kursleiter sonst noch sagen wollte:",
"courseNegativeFeedbackLabel": "Wo sehen Sie Verbesserungspotenzial?",
"coursePositiveFeedbackLabel": "Was hat Ihnen besonders gut gefallen?"
"coursePositiveFeedbackLabel": "Was hat Ihnen besonders gut gefallen?",
"completionTitle": "Schicke dein Feedback an {name}",
"completionDescription": "Dein Feedback ist anonym. Dein Vor- und Nachname werden bei deiner Trainer/-in nicht angezeigt.",
"sendFeedback": "Feedback abschicken",
"feedbackSent": "Dein Feedback wurde abgeschickt"
},
"constants": {
"yes": "Ja",

View File

@ -52,6 +52,8 @@ describe("circle page", () => {
"Selbsteinschätzung Fahrzeug"
);
cy.get('[data-cy="success"]').click();
cy.get('[data-cy="next-step"]').click();
cy.get('[data-cy="success"]').click();
cy.get('[data-cy="complete-and-continue"]').click();
cy.get('[data-cy="ln-title"]').should(

View File

@ -5,7 +5,7 @@ describe("MediaLibrary", () => {
cy.manageCommand("cypress_reset");
login("admin", "test");
cy.visit("/");
cy.visit("/course/test-lehrgang");
});
it("should be accessible", () => {