Skip to content
Snippets Groups Projects
Commit 1c632786 authored by Julian's avatar Julian
Browse files

Reformat

parent 13c28933
No related branches found
No related tags found
2 merge requests!352Draft: Resolve "Add dialog with each lesson's students",!350Resolve "Add simple course book list"
<template>
<c-r-u-d-iterator
i18n-key="alsijil.coursebook"
:gql-query="gqlQuery"
:gql-additional-query-args="gqlQueryArgs"
:enable-create="false"
:enable-edit="false"
@lastQuery="lastQuery = $event"
ref="iterator"
i18n-key="alsijil.coursebook"
:gql-query="gqlQuery"
:gql-additional-query-args="gqlQueryArgs"
:enable-create="false"
:enable-edit="false"
@lastQuery="lastQuery = $event"
ref="iterator"
>
<template #additionalActions="{ attrs, on }">
<v-autocomplete
:items="selectable"
item-text="name"
clearable
return-object
filled
dense
hide-details
:placeholder="$t('alsijil.coursebook.filter.filter_for_obj')"
:loading="selectLoading"
:value="currentObj"
@input="changeSelection"
@click:clear="changeSelection"
:items="selectable"
item-text="name"
clearable
return-object
filled
dense
hide-details
:placeholder="$t('alsijil.coursebook.filter.filter_for_obj')"
:loading="selectLoading"
:value="currentObj"
@input="changeSelection"
@click:clear="changeSelection"
/>
<v-switch
:loading="selectLoading"
:label="$t('alsijil.coursebook.filter.own')"
:input-value="filterType === 'my'"
@change="changeSelection({ filterType: $event ? 'my' : 'all', type: objType, id: objId })"
@change="
changeSelection({
filterType: $event ? 'my' : 'all',
type: objType,
id: objId,
})
"
/>
</template>
<template #default="{ items }">
......@@ -51,22 +57,30 @@
<template #no-data>
<v-list-item>
<v-list-item-content class="d-flex justify-center align-center flex-column full-width">
<v-list-item-content
class="d-flex justify-center align-center flex-column full-width"
>
<div class="mb-4">
<v-icon large color="primary">mdi-book-off-outline</v-icon>
</div>
<v-list-item-title>{{ $t("alsijil.coursebook.no_data") }}</v-list-item-title>
<v-list-item-title>
{{ $t("alsijil.coursebook.no_data") }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
</template>
<template #no-results>
<v-list-item>
<v-list-item-content class="d-flex justify-center align-center flex-column full-width">
<v-list-item-content
class="d-flex justify-center align-center flex-column full-width"
>
<div class="mb-4">
<v-icon large color="primary">mdi-book-alert-outline</v-icon>
</div>
<v-list-item-title>{{ $t("alsijil.coursebook.no_results", { search: $refs.iterator.search }) }}</v-list-item-title>
<v-list-item-title>
{{ $t("alsijil.coursebook.no_results", { search: $refs.iterator.search }) }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
</template>
......@@ -78,9 +92,9 @@ import CRUDIterator from "aleksis.core/components/generic/CRUDIterator.vue";
import DocumentationModal from "./documentation/DocumentationModal.vue";
import { DateTime } from "luxon";
import {
groupsByOwner,
coursesOfTeacher,
documentationsForCoursebook,
groupsByOwner,
} from "./coursebook.graphql";
import CoursebookLoader from "./CoursebookLoader.vue";
......@@ -157,18 +171,25 @@ export default {
];
},
currentObj() {
return this.selectable.find((o) => o.type === this.objType && o.id === this.objId);
return this.selectable.find(
(o) => o.type === this.objType && o.id === this.objId,
);
},
selectLoading() {
return this.$apollo.queries.groups.loading || this.$apollo.queries.courses.loading;
}
return (
this.$apollo.queries.groups.loading ||
this.$apollo.queries.courses.loading
);
},
},
methods: {
changeSelection(selection) {
this.$router.push({
name: "alsijil.coursebook_by_type_and_date",
params: {
filterType: selection.filterType ? selection.filterType : this.filterType,
filterType: selection.filterType
? selection.filterType
: this.filterType,
objType: selection.type,
objId: selection.id,
dateStart: this.dateStart,
......
......@@ -33,6 +33,6 @@ export default {
<style scoped>
.gap {
gap: 0.25em
gap: 0.25em;
}
</style>
......@@ -155,15 +155,23 @@ export default {
computed: {
homeworkIcon() {
if (this.documentation.homework) {
return this.documentation.canEdit ? "mdi-book-edit-outline" : "mdi-book-alert-outline";
return this.documentation.canEdit
? "mdi-book-edit-outline"
: "mdi-book-alert-outline";
}
return this.documentation.canEdit ? "mdi-book-plus-outline" : "mdi-book-off-outline";
return this.documentation.canEdit
? "mdi-book-plus-outline"
: "mdi-book-off-outline";
},
groupNoteIcon() {
if (this.documentation.groupNote) {
return this.documentation.canEdit ? "mdi-note-edit-outline" : "mdi-note-alert-outline";
return this.documentation.canEdit
? "mdi-note-edit-outline"
: "mdi-note-alert-outline";
}
return this.documentation.canEdit ? "mdi-note-plus-outline" : "mdi-note-off-outline";
return this.documentation.canEdit
? "mdi-note-plus-outline"
: "mdi-note-off-outline";
},
},
};
......
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