Skip to content
Snippets Groups Projects
Verified Commit f5c2d1a0 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Make select for groups and courses faster

parent 28332a17
No related branches found
No related tags found
1 merge request!360Resolve "Add absence management to course book student dialog"
......@@ -45,6 +45,10 @@
<script>
import { coursesOfPerson, groupsByPerson } from "./coursebook.graphql";
const TYPENAMES_TO_TYPES = {
CourseType: "course",
GroupType: "group",
};
export default {
name: "CoursebookFilters",
data() {
......@@ -73,9 +77,9 @@ export default {
selectable() {
return [
{ header: this.$t("alsijil.coursebook.filter.groups") },
...this.groups.map((group) => ({ type: "group", ...group })),
...this.groups,
{ header: this.$t("alsijil.coursebook.filter.courses") },
...this.courses.map((course) => ({ type: "course", ...course })),
...this.courses,
];
},
selectLoading() {
......@@ -86,14 +90,16 @@ export default {
},
currentObj() {
return this.selectable.find(
(o) => o.type === this.value.objType && o.id === this.value.objId,
(o) =>
TYPENAMES_TO_TYPES[o.__typename] === this.value.objType &&
o.id === this.value.objId,
);
},
},
methods: {
selectObject(selection) {
this.$emit("input", {
objType: selection ? selection.type : null,
objType: selection ? TYPENAMES_TO_TYPES[selection.__typename] : null,
objId: selection ? selection.id : null,
});
},
......
......@@ -9,10 +9,6 @@ query coursesOfPerson {
courses: coursesOfPerson {
id
name
groups {
id
name
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment