Skip to content
Snippets Groups Projects
Commit ccb26fb3 authored by permcu's avatar permcu
Browse files

Add group-selection to the coursebook-print-dialog

parent 2016b446
No related branches found
No related tags found
1 merge request!422Resolve "Add export functionality to course book"
...@@ -72,6 +72,8 @@ import CoursebookPrintDialog from "./CoursebookPrintDialog.vue"; ...@@ -72,6 +72,8 @@ import CoursebookPrintDialog from "./CoursebookPrintDialog.vue";
<coursebook-print-dialog <coursebook-print-dialog
v-if="pageType === 'documentations'" v-if="pageType === 'documentations'"
:loading="selectLoading" :loading="selectLoading"
:available-groups="groups"
:value="currentGroups"
/> />
</div> </div>
</div> </div>
...@@ -135,6 +137,13 @@ export default { ...@@ -135,6 +137,13 @@ export default {
o.id === this.value.objId, o.id === this.value.objId,
); );
}, },
currentGroups() {
return this.groups.filter(
(o) =>
TYPENAMES_TO_TYPES[o.__typename] === this.value.objType &&
o.id === this.value.objId,
);
},
pageTypeButtonText() { pageTypeButtonText() {
if (this.value.pageType === "documentations") { if (this.value.pageType === "documentations") {
return this.$t("alsijil.coursebook.filter.page_type.absences"); return this.$t("alsijil.coursebook.filter.page_type.absences");
......
...@@ -19,6 +19,19 @@ import SecondaryActionButton from "aleksis.core/components/generic/buttons/Secon ...@@ -19,6 +19,19 @@ import SecondaryActionButton from "aleksis.core/components/generic/buttons/Secon
<template #title> <template #title>
{{ $t("alsijil.coursebook.print_title") }} {{ $t("alsijil.coursebook.print_title") }}
</template> </template>
<template #content>
<v-autocomplete
:items="availableGroups"
item-text="name"
item-value="id"
:value="value"
@input="setGroupSelection"
@click:clear="setGroupSelection"
multiple
chips
deletable-chips
/>
</template>
</mobile-fullscreen-dialog> </mobile-fullscreen-dialog>
</template> </template>
...@@ -29,6 +42,21 @@ import SecondaryActionButton from "aleksis.core/components/generic/buttons/Secon ...@@ -29,6 +42,21 @@ import SecondaryActionButton from "aleksis.core/components/generic/buttons/Secon
export default { export default {
name: "CoursebookPrintDialog", name: "CoursebookPrintDialog",
props: { props: {
/**
* Groups available for selection
*/
availableGroups: {
type: Array,
required: true,
},
/**
* Initially selected groups
*/
value: {
type: Array,
required: false,
default: [],
},
/** /**
* Loading state * Loading state
*/ */
...@@ -38,10 +66,28 @@ export default { ...@@ -38,10 +66,28 @@ export default {
default: false, default: false,
}, },
}, },
emits: ["input"],
data() { data() {
return { return {
dialog: false, dialog: false,
currentGroupSelection: [],
}; };
}, },
computed: {
selectedGroups() {
if (this.currentGroupSelection.length == 0) {
return this.value.map((group) => group.id);
} else {
return this.currentGroupSelection;
}
},
},
methods: {
setGroupSelection(groups) {
this.$emit("input", groups);
this.currentGroupSelection=groups;
console.log(groups);
},
},
}; };
</script> </script>
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