diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue index b857a1ba59b7a61263bf2cfc6f2c7ac6e8af102a..f68d0dd84f8a97408980213399f60b587d15f150 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue @@ -24,12 +24,22 @@ {{ $t("alsijil.coursebook.statistics.title_plural") }} </v-card-title> - <v-card-text> + <v-card-text + v-if="!$apollo.queries.statistics.loading && statistics == null" + > + <message-box type="error"> + <div>{{ $t("generic_messages.error") }}</div> + <small> + {{ $t("error_code", { errorCode }) }} + </small> + </message-box> + </v-card-text> + <v-card-text v-else> <div class="grid"> <statistics-absences-card style="grid-area: absences" :absence-reasons="statistics.absenceReasons" - :loading="$apollo.loading" + :loading="$apollo.queries.statistics.loading" /> <statistics-tardiness-card style="grid-area: tardinesses" @@ -50,17 +60,20 @@ <script> import personOverviewCardMixin from "aleksis.core/mixins/personOverviewCardMixin.js"; import BaseButton from "aleksis.core/components/generic/buttons/BaseButton.vue"; +import MessageBox from "aleksis.core/components/generic/MessageBox.vue"; import StatisticsAbsencesCard from "./StatisticsAbsencesCard.vue"; import StatisticsTardinessCard from "./StatisticsTardinessCard.vue"; import StatisticsExtraMarksCard from "./StatisticsExtraMarksCard.vue"; import { statisticsByPerson } from "./statistics.graphql"; +import errorCodes from "../../../errorCodes"; export default { name: "StatisticsForPersonCard", mixins: [personOverviewCardMixin], components: { BaseButton, + MessageBox, StatisticsAbsencesCard, StatisticsTardinessCard, StatisticsExtraMarksCard, @@ -80,6 +93,7 @@ export default { tardinessCount: 0, extraMarks: [], }, + errorCode: errorCodes.statisticsEmpty, }; }, apollo: { diff --git a/aleksis/apps/alsijil/frontend/errorCodes.js b/aleksis/apps/alsijil/frontend/errorCodes.js new file mode 100644 index 0000000000000000000000000000000000000000..27681138a971547448885dfaad4f4b14497b0ded --- /dev/null +++ b/aleksis/apps/alsijil/frontend/errorCodes.js @@ -0,0 +1,17 @@ +/** + * Alsijil Error Codes. + * + * Schema: + * abb. + * a: A|C|D|P|S: + * Component inside Alsijil + * - Absences + * - Coursebook + * - Documentation + * - Personal Notes + * - Statistics + * bb: incrementing number + */ +export default { + statisticsEmpty: "ALSIJIL_S01", +};