diff --git a/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionOverview.vue b/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionOverview.vue index 2865dcf0a4a2d05f3600397a0ee44f9e5dd6357d..1adc330d7548daf51aebeef075c99d3f83809a49 100644 --- a/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionOverview.vue +++ b/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionOverview.vue @@ -34,14 +34,14 @@ import { <v-autocomplete :items="groups" item-text="name" + item-value="id" clearable - return-object filled dense hide-details :placeholder="$t('chronos.substitutions.overview.filter.groups')" :loading="$apollo.queries.groups.loading" - :value="currentGroup" + :value="objId" @input="changeGroup" @click:clear="changeGroup" /> @@ -55,7 +55,9 @@ import { hide-details :placeholder="$t('chronos.substitutions.overview.filter.teachers')" :loading="$apollo.queries.amendableTeachers.loading" - v-model="selectedTeacher" + :value="teacherId" + @input="changeTeacher" + @click:clear="changeTeacher" /> <v-switch :loading="$apollo.queries.groups.loading" @@ -111,6 +113,11 @@ export default { required: false, default: null, }, + teacherId: { + type: [Number, String], + required: false, + default: null, + }, }, data() { return { @@ -119,7 +126,6 @@ export default { gqlDeleteMutation: deleteAmendLessons, groups: [], amendableTeachers: [], - selectedTeacher: null, incomplete: false, }; }, @@ -127,11 +133,23 @@ export default { gqlGetPatchData(item) { return { id: item.id, teachers: item.teachers }; }, - changeGroup(selection) { + changeGroup(group) { + this.$router.push({ + name: "chronos.substitutionOverview", + params: { + objId: group ? group : "all", + teacherId: this.teacherId, + }, + hash: this.$route.hash, + }); + this.$refs.iterator.resetDate(); + }, + changeTeacher(teacher) { this.$router.push({ name: "chronos.substitutionOverview", params: { - objId: selection.id, + teacherId: teacher ? teacher : "all", + objId: this.objId, }, hash: this.$route.hash, }); @@ -141,14 +159,11 @@ export default { computed: { gqlQueryArgs() { return { - objId: this.objId ? Number(this.objId) : null, - teacher: this.selectedTeacher, + objId: this.objId === "all" ? null : Number(this.objId), + teacherId: this.teacherId === "all" ? null : Number(this.teacherId), incomplete: !!this.incomplete, }; }, - currentGroup() { - return this.groups.find((o) => o.id === this.objId); - }, }, apollo: { groups: gqlGroups, diff --git a/aleksis/apps/chronos/frontend/index.js b/aleksis/apps/chronos/frontend/index.js index 6c75eb1ac79d983a1584a81cadd0c579c74513d1..2a76a198e6ae807c085b72cdb2efbac0426ff200 100644 --- a/aleksis/apps/chronos/frontend/index.js +++ b/aleksis/apps/chronos/frontend/index.js @@ -49,7 +49,7 @@ export default { component: () => import("./components/substitutions/SubstitutionOverview.vue"), redirect: () => { return { - name: "chronos.substitutionOverview", + path: "substitution_overview/group/all/person/all/", hash: "#" + DateTime.now().toISODate(), }; }, @@ -65,7 +65,7 @@ export default { }, children: [ { - path: ":objId(\\d+)?/", + path: "group/:objId(all|\\d+)?/person/:teacherId(all|\\d+)?/", component: () => import("./components/substitutions/SubstitutionOverview.vue"), name: "chronos.substitutionOverview", meta: {