diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForGroupTab.vue b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForGroupTab.vue index 8f7d5b428da74d4bc3dc438dea0e0140678378cd..95d377ac652b5e40a7cb9d606ae2d17831e2c015 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForGroupTab.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForGroupTab.vue @@ -65,11 +65,11 @@ i18n-key="alsijil.coursebook.statistics.person_view_details" icon-text="mdi-open-in-new" :to="{ - name: 'alsijil.coursebook_statistics', + name: 'core.personById', params: { personId: item.person.id, - mode: MODE.PARTICIPATIONS, }, + hash: '#' + MODE.PARTICIPATIONS, }" /> </template> diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue index 546fc8e00701798b801427355328c14d0237578b..fd270fc374e7df35ed27fe76cef779fdf402ae47 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue @@ -7,18 +7,7 @@ <v-card-title v-else-if="compact"> {{ $t("alsijil.coursebook.statistics.person_compact.title") }} <v-spacer /> - <base-button - :icon="true" - icon-text="mdi-open-in-new" - i18n-key="" - :to="{ - name: 'alsijil.coursebook_statistics', - params: { - personId: person.id, - mode: MODE.PARTICIPATIONS, - }, - }" - /> + <slot name="header" /> </v-card-title> <v-card-title v-else> {{ $t("alsijil.coursebook.statistics.title_plural") }} @@ -59,7 +48,6 @@ <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"; @@ -73,7 +61,6 @@ export default { name: "StatisticsForPersonCard", mixins: [personOverviewCardMixin], components: { - BaseButton, MessageBox, StatisticsAbsencesCard, StatisticsTardinessCard, @@ -111,6 +98,9 @@ export default { MODE() { return MODE; }, + mode() { + return this.$hash; + }, gridTemplateAreas() { return this.compact ? `"absences extra_marks" "tardinesses tardinesses"` diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonPage.vue b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonPage.vue index d90e166d264c5fde89d87d2bcd2c5366836149d1..eb54b829fd2a04690465a25c0ad66366e30a36ee 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonPage.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonPage.vue @@ -1,7 +1,13 @@ <template> - <fullscreen-dialog-page - :fallback-url="{ name: 'core.personById', props: { id: personId } }" - > + <fullscreen-dialog-page :fallback-url="{ name: 'core.personById', props: { id: personId } }" +> + <template #title> + {{ + $t("alsijil.coursebook.statistics.person_page.title", { + fullName: personName?.fullName || "???", + }) + }} + </template> <div class="d-flex" style="gap: 4em"> <div class="flex-grow-1" style="max-width: 100%"> <!-- documentations for person list --> @@ -301,11 +307,6 @@ export default { type: [Number, String], required: true, }, - mode: { - type: String, - required: false, - default: MODE.PARTICIPATIONS, - }, }, apollo: { personName: { @@ -315,13 +316,6 @@ export default { person: this.personId, }; }, - result({ data }) { - this.$setToolBarTitle( - this.$t("alsijil.coursebook.statistics.person_page.title", { - fullName: data.personName.fullName || "???", - }), - ); - }, }, absenceReasons: { query: absenceReasons, @@ -346,6 +340,9 @@ export default { MODE() { return MODE; }, + mode() { + return this.$hash; + }, }, methods: { gqlQuery() { @@ -360,12 +357,9 @@ export default { this.selected = []; - this.$router.push({ - name: "alsijil.coursebook_statistics", - params: { - personId: this.personId, - mode: mode, - }, + this.$router.replace({ + ...this.$route, + hash: "#" + mode, }); }, showEdit(item) { diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonWidget.vue b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonWidget.vue new file mode 100644 index 0000000000000000000000000000000000000000..495e08c016bbcb9cb3dfc5f4a1bd9475da1a4c6a --- /dev/null +++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonWidget.vue @@ -0,0 +1,47 @@ +<template> + <statistics-for-person-card v-bind="{ ...$attrs, ...$props }"> + <template #header> + <base-button + :icon="true" + icon-text="mdi-open-in-new" + i18n-key="" + :to="{ + name: $route.name, + params: $route.params, + hash: '#' + MODE.PARTICIPATIONS, + }" + /> + <statistics-for-person-page + v-if="Object.values(MODE).includes(mode)" + :person-id="person.id" + /> + </template> + </statistics-for-person-card> +</template> + +<script> +import personOverviewCardMixin from "aleksis.core/mixins/personOverviewCardMixin.js"; +import BaseButton from "aleksis.core/components/generic/buttons/BaseButton.vue"; +import StatisticsForPersonPage from "./StatisticsForPersonPage.vue"; +import StatisticsForPersonCard from "./StatisticsForPersonCard.vue"; + +import { MODE } from "./modes"; + +export default { + name: "StatisticsForPersonWidget", + mixins: [personOverviewCardMixin], + components: { + BaseButton, + StatisticsForPersonPage, + StatisticsForPersonCard, + }, + computed: { + MODE() { + return MODE; + }, + mode() { + return this.$hash; + }, + }, +}; +</script> diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/modes.js b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/modes.js index c345316a23b880f73acddf2271759de63a6e760d..54ca270a7dd598878bed03179206e7cd1edce7be 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/modes.js +++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/modes.js @@ -1,4 +1,4 @@ export const MODE = { - PARTICIPATIONS: "participations", - PERSONAL_NOTES: "personal_notes", + PARTICIPATIONS: "alsijil.participations", + PERSONAL_NOTES: "alsijil.personal_notes", }; diff --git a/aleksis/apps/alsijil/frontend/index.js b/aleksis/apps/alsijil/frontend/index.js index fe222f4fee3fcc28ad93448b4482babcf0ab32cf..18e0f68eaca178cbaf3b358a8065257cc3e745b3 100644 --- a/aleksis/apps/alsijil/frontend/index.js +++ b/aleksis/apps/alsijil/frontend/index.js @@ -1,5 +1,4 @@ import { DateTime } from "luxon"; -import { MODE } from "./components/coursebook/statistics/modes"; export const collectionItems = { coreGroupActions: [ @@ -32,7 +31,7 @@ export const collectionItems = { key: "core-person-widgets", component: () => import( - "./components/coursebook/statistics/StatisticsForPersonCard.vue" + "./components/coursebook/statistics/StatisticsForPersonWidget.vue" ), shouldDisplay: () => true, colProps: { @@ -113,21 +112,5 @@ export default { permission: "alsijil.view_extramarks_rule", }, }, - { - path: `statistics/:personId/:mode(${Object.values(MODE).join("|")})`, - component: () => - import( - "./components/coursebook/statistics/StatisticsForPersonPage.vue" - ), - name: "alsijil.coursebook_statistics", - props: true, - meta: { - inMenu: false, - titleKey: "alsijil.coursebook.statistics.person_compact.title", - toolbarTitle: "alsijil.coursebook.statistics.person_compact.title", - // TODO: Add permission & change it here. - permission: "alsijil.view_documentations_menu_rule", - }, - }, ], };