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> <template>
<c-r-u-d-iterator <c-r-u-d-iterator
i18n-key="alsijil.coursebook" i18n-key="alsijil.coursebook"
:gql-query="gqlQuery" :gql-query="gqlQuery"
:gql-additional-query-args="gqlQueryArgs" :gql-additional-query-args="gqlQueryArgs"
:enable-create="false" :enable-create="false"
:enable-edit="false" :enable-edit="false"
@lastQuery="lastQuery = $event" @lastQuery="lastQuery = $event"
ref="iterator" ref="iterator"
> >
<template #additionalActions="{ attrs, on }"> <template #additionalActions="{ attrs, on }">
<v-autocomplete <v-autocomplete
:items="selectable" :items="selectable"
item-text="name" item-text="name"
clearable clearable
return-object return-object
filled filled
dense dense
hide-details hide-details
:placeholder="$t('alsijil.coursebook.filter.filter_for_obj')" :placeholder="$t('alsijil.coursebook.filter.filter_for_obj')"
:loading="selectLoading" :loading="selectLoading"
:value="currentObj" :value="currentObj"
@input="changeSelection" @input="changeSelection"
@click:clear="changeSelection" @click:clear="changeSelection"
/> />
<v-switch <v-switch
:loading="selectLoading" :loading="selectLoading"
:label="$t('alsijil.coursebook.filter.own')" :label="$t('alsijil.coursebook.filter.own')"
:input-value="filterType === 'my'" :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>
<template #default="{ items }"> <template #default="{ items }">
...@@ -51,22 +57,30 @@ ...@@ -51,22 +57,30 @@
<template #no-data> <template #no-data>
<v-list-item> <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"> <div class="mb-4">
<v-icon large color="primary">mdi-book-off-outline</v-icon> <v-icon large color="primary">mdi-book-off-outline</v-icon>
</div> </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-content>
</v-list-item> </v-list-item>
</template> </template>
<template #no-results> <template #no-results>
<v-list-item> <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"> <div class="mb-4">
<v-icon large color="primary">mdi-book-alert-outline</v-icon> <v-icon large color="primary">mdi-book-alert-outline</v-icon>
</div> </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-content>
</v-list-item> </v-list-item>
</template> </template>
...@@ -78,9 +92,9 @@ import CRUDIterator from "aleksis.core/components/generic/CRUDIterator.vue"; ...@@ -78,9 +92,9 @@ import CRUDIterator from "aleksis.core/components/generic/CRUDIterator.vue";
import DocumentationModal from "./documentation/DocumentationModal.vue"; import DocumentationModal from "./documentation/DocumentationModal.vue";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import { import {
groupsByOwner,
coursesOfTeacher, coursesOfTeacher,
documentationsForCoursebook, documentationsForCoursebook,
groupsByOwner,
} from "./coursebook.graphql"; } from "./coursebook.graphql";
import CoursebookLoader from "./CoursebookLoader.vue"; import CoursebookLoader from "./CoursebookLoader.vue";
...@@ -157,18 +171,25 @@ export default { ...@@ -157,18 +171,25 @@ export default {
]; ];
}, },
currentObj() { 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() { selectLoading() {
return this.$apollo.queries.groups.loading || this.$apollo.queries.courses.loading; return (
} this.$apollo.queries.groups.loading ||
this.$apollo.queries.courses.loading
);
},
}, },
methods: { methods: {
changeSelection(selection) { changeSelection(selection) {
this.$router.push({ this.$router.push({
name: "alsijil.coursebook_by_type_and_date", name: "alsijil.coursebook_by_type_and_date",
params: { params: {
filterType: selection.filterType ? selection.filterType : this.filterType, filterType: selection.filterType
? selection.filterType
: this.filterType,
objType: selection.type, objType: selection.type,
objId: selection.id, objId: selection.id,
dateStart: this.dateStart, dateStart: this.dateStart,
......
...@@ -33,6 +33,6 @@ export default { ...@@ -33,6 +33,6 @@ export default {
<style scoped> <style scoped>
.gap { .gap {
gap: 0.25em gap: 0.25em;
} }
</style> </style>
...@@ -155,15 +155,23 @@ export default { ...@@ -155,15 +155,23 @@ export default {
computed: { computed: {
homeworkIcon() { homeworkIcon() {
if (this.documentation.homework) { 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() { groupNoteIcon() {
if (this.documentation.groupNote) { 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