Add export to feedback cockpit page
This commit is contained in:
parent
5f9fae37fa
commit
767f6c42f6
|
|
@ -11,7 +11,18 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</nav>
|
</nav>
|
||||||
<main v-if="feedbackData">
|
<main v-if="feedbackData">
|
||||||
<h1 class="mb-2">{{ $t("feedback.feedbackPageTitle") }}</h1>
|
<div class="flex items-center justify-between">
|
||||||
|
<h2 class="mb-2">{{ $t("feedback.feedbackPageTitle") }}</h2>
|
||||||
|
<button
|
||||||
|
v-if="feedbackType == 'uk'"
|
||||||
|
class="flex"
|
||||||
|
data-cy="export-button"
|
||||||
|
@click="exportData"
|
||||||
|
>
|
||||||
|
<it-icon-export></it-icon-export>
|
||||||
|
<span class="ml inline-block">{{ $t("a.Als Excel exportieren") }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<p class="mb-10">
|
<p class="mb-10">
|
||||||
<span class="font-bold" data-cy="feedback-data-amount">
|
<span class="font-bold" data-cy="feedback-data-amount">
|
||||||
{{ feedbackData.amount }}
|
{{ feedbackData.amount }}
|
||||||
|
|
@ -37,6 +48,9 @@ import type { FeedbackData, FeedbackType } from "@/types";
|
||||||
import FeedbackPageVV from "@/pages/cockpit/FeedbackPageVV.vue";
|
import FeedbackPageVV from "@/pages/cockpit/FeedbackPageVV.vue";
|
||||||
import FeedbackPageUK from "@/pages/cockpit/FeedbackPageUK.vue";
|
import FeedbackPageUK from "@/pages/cockpit/FeedbackPageUK.vue";
|
||||||
import { useExpertCockpitPageData } from "@/pages/cockpit/cockpitPage/composables";
|
import { useExpertCockpitPageData } from "@/pages/cockpit/cockpitPage/composables";
|
||||||
|
import { exportFeedback } from "@/services/dashboard";
|
||||||
|
import { useUserStore } from "@/stores/user";
|
||||||
|
import { openDataAsXls } from "@/utils/export";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
courseSlug: string;
|
courseSlug: string;
|
||||||
|
|
@ -46,9 +60,23 @@ const props = defineProps<{
|
||||||
log.debug("FeedbackPage created", props.circleId);
|
log.debug("FeedbackPage created", props.circleId);
|
||||||
const { loading } = useExpertCockpitPageData(props.courseSlug);
|
const { loading } = useExpertCockpitPageData(props.courseSlug);
|
||||||
const courseSession = useCurrentCourseSession();
|
const courseSession = useCurrentCourseSession();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const feedbackData = ref<FeedbackData | undefined>(undefined);
|
const feedbackData = ref<FeedbackData | undefined>(undefined);
|
||||||
const feedbackType = ref<FeedbackType | undefined>(undefined);
|
const feedbackType = ref<FeedbackType | undefined>(undefined);
|
||||||
|
|
||||||
|
async function exportData() {
|
||||||
|
log.debug("FeedbackPage exportData");
|
||||||
|
const data = await exportFeedback(
|
||||||
|
{
|
||||||
|
courseSessionIds: [Number(courseSession.value.id)],
|
||||||
|
circleIds: [Number(props.circleId)],
|
||||||
|
},
|
||||||
|
userStore.language
|
||||||
|
);
|
||||||
|
openDataAsXls(data.encoded_data, data.file_name);
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
log.debug("FeedbackPage mounted");
|
log.debug("FeedbackPage mounted");
|
||||||
feedbackData.value = await itGet(
|
feedbackData.value = await itGet(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue