Add export to feedback cockpit page
This commit is contained in:
parent
5f9fae37fa
commit
767f6c42f6
|
|
@ -11,7 +11,18 @@
|
|||
</router-link>
|
||||
</nav>
|
||||
<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">
|
||||
<span class="font-bold" data-cy="feedback-data-amount">
|
||||
{{ feedbackData.amount }}
|
||||
|
|
@ -37,6 +48,9 @@ import type { FeedbackData, FeedbackType } from "@/types";
|
|||
import FeedbackPageVV from "@/pages/cockpit/FeedbackPageVV.vue";
|
||||
import FeedbackPageUK from "@/pages/cockpit/FeedbackPageUK.vue";
|
||||
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<{
|
||||
courseSlug: string;
|
||||
|
|
@ -46,9 +60,23 @@ const props = defineProps<{
|
|||
log.debug("FeedbackPage created", props.circleId);
|
||||
const { loading } = useExpertCockpitPageData(props.courseSlug);
|
||||
const courseSession = useCurrentCourseSession();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const feedbackData = ref<FeedbackData | 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 () => {
|
||||
log.debug("FeedbackPage mounted");
|
||||
feedbackData.value = await itGet(
|
||||
|
|
|
|||
Loading…
Reference in New Issue