Skip to content
Snippets Groups Projects
Verified Commit e819ee3b authored by permcu's avatar permcu Committed by Jonathan Weth
Browse files

Implement rudimentary substitutions-list

parent 2e38ae32
No related branches found
No related tags found
1 merge request!373Resolve "Substitutions table for new data model"
......@@ -4,46 +4,79 @@ import CRUDList from "aleksis.core/components/generic/CRUDList.vue";
<template>
<c-r-u-d-list
headers="headers"
show-select="false"
enable-create="false"
enable-edit="false"
:gql-query="query"
:gql-additional-query-args="{ date: date }"
:get-gql-data="prepareList"
:headers="headers"
:show-select="false"
:enable-create="false"
:enable-edit="false"
/>
</c-r-u-d-list>
</template>
<script>
import { substitutionsForDate } from "./substitutions.graphql";
import { DateTime } from "luxon";
export default {
name: "Substitutions",
props: {
date: {
type: String,
required: true,
},
},
data() {
return {
query: substitutionsForDate,
affectedTeachers: [],
affectedGroups: [],
// TODO: i18n
headers: [
{
text:
value:
text: "groups",
value: "groups",
},
{
text:
value:
text: "time",
value: "time",
},
{
text:
value:
text: "teachers",
value: "teachers",
},
{
text:
value:
text: "subject",
value: "subject",
},
{
text:
value:
text: "room",
value: "room",
},
{
text:
value:
text: "notes",
value: "notes",
},
],
};
},
}
},
methods: {
prepareList(data) {
this.affectedTeachers = data.affectedTeachers;
this.affectedGroups = data.affectedGroups;
return data.substitutions.map((sub) => {
return {
groups: sub.oldGroups[0].shortName,
time: sub.startTime,
teachers: sub.oldTeachers[0].shortName,
subject: sub.oldSubject,
room: sub.oldRooms[0].shortName,
notes: sub.comment,
};
});
},
},
};
</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