2024-07-03 13:55:34 +00:00
|
|
|
|
<script lang="ts" setup>
|
2022-10-07 14:15:53 +00:00
|
|
|
|
|
2024-07-03 13:55:34 +00:00
|
|
|
|
import {type Quiz, useQuizStore} from "~/store/quiz";
|
|
|
|
|
import {useBundleStore} from "~/store/bundle";
|
2022-10-07 14:15:53 +00:00
|
|
|
|
|
2024-07-03 13:55:34 +00:00
|
|
|
|
const quizzes = ref<Quiz[]>([]);
|
|
|
|
|
const currentResult = ref<Quiz>();
|
2022-10-07 14:15:53 +00:00
|
|
|
|
|
2024-07-03 13:55:34 +00:00
|
|
|
|
onMounted(() => {
|
|
|
|
|
useQuizStore().findQuizzes(useBundleStore().selectedBundle.id).then((response: Page<Quiz>) => {
|
|
|
|
|
quizzes.value = response.content;
|
|
|
|
|
currentResult.value = quizzes.value.length > 0 ? quizzes.value[0] : null;
|
|
|
|
|
});
|
|
|
|
|
});
|
2022-10-07 14:15:53 +00:00
|
|
|
|
|
|
|
|
|
|
2024-07-03 13:55:34 +00:00
|
|
|
|
function setCurrent(quiz: Quiz) {
|
|
|
|
|
currentResult.value = quiz;
|
2022-10-07 14:15:53 +00:00
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2024-07-03 13:55:34 +00:00
|
|
|
|
<template>
|
|
|
|
|
<section v-if="currentResult" class="last-quiz">
|
|
|
|
|
<div class="last-quiz-header">
|
|
|
|
|
<span class="date"> {{ formatDateTime(currentResult.createdDate) }}</span>
|
|
|
|
|
<nuxt-link
|
|
|
|
|
class="button blue" :to="{ path: '/details', query: { quiz: currentResult.id }}">
|
|
|
|
|
+ Voir le détail
|
|
|
|
|
</nuxt-link>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="currentResult && currentResult.axes" class="chart-area">
|
|
|
|
|
<polar-area-chart :data="currentResult.axes.map(value => value.average)"/>
|
|
|
|
|
<Legend/>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
<section v-if="quizzes.length > 0">
|
|
|
|
|
<ul class="history">
|
|
|
|
|
<li class="history__item" v-for="q in quizzes">
|
|
|
|
|
<input :id="q.id" type="radio" @change="setCurrent(q)" :checked="q === currentResult" name="quiz"/>
|
|
|
|
|
<label :for="q.id">
|
|
|
|
|
<span>{{useBundleStore().selectedBundle.label }} - {{ formatDateTime(q.createdDate) }}</span>
|
|
|
|
|
</label>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
|
|
|
|
<section v-else class="center">
|
|
|
|
|
Aucune auto-évaluation n'a été faite. Veuillez en réaliser une première.
|
|
|
|
|
</section>
|
|
|
|
|
<div class="button-container">
|
|
|
|
|
<nuxt-link class="button gray button-back" to="/bundle" aria-label="Retour à la page précédente">❮</nuxt-link>
|
|
|
|
|
<nuxt-link class="button orange" to="/quiz">S'évaluer</nuxt-link>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2022-10-07 14:15:53 +00:00
|
|
|
|
|
2024-07-03 13:55:34 +00:00
|
|
|
|
<style lang="scss" scoped>
|
2022-10-07 14:15:53 +00:00
|
|
|
|
.last-quiz {
|
2024-07-03 13:55:34 +00:00
|
|
|
|
margin: $small 0;
|
2022-10-07 14:15:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.last-quiz-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-size: $tertiary-font-size;
|
|
|
|
|
|
|
|
|
|
.date {
|
|
|
|
|
color: $gray_4;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.chart-area {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
justify-content: space-around;
|
2024-07-03 13:55:34 +00:00
|
|
|
|
gap: $small;
|
2022-10-07 14:15:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.history {
|
2024-07-03 13:55:34 +00:00
|
|
|
|
margin-top: $small;
|
2022-10-07 14:15:53 +00:00
|
|
|
|
display: flex;
|
2024-07-03 13:55:34 +00:00
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: $xxx_small;
|
|
|
|
|
list-style: none;
|
|
|
|
|
|
|
|
|
|
.history__item {
|
|
|
|
|
|
|
|
|
|
input {
|
|
|
|
|
position: absolute;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
|
|
|
|
&:checked + label {
|
|
|
|
|
outline: 3px solid $gray_4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
label {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 16px;
|
|
|
|
|
background: $gray_1;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
color: $gray_4;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
font-size: $tertiary-font-size;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
background: $gray_3;
|
|
|
|
|
color: $gray_1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-07 14:15:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|