Newer
Older
<script setup>
import CRUDList from "aleksis.core/components/generic/CRUDList.vue";
</script>
<template>
<c-r-u-d-list
: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,
},
},
query: substitutionsForDate,
affectedTeachers: [],
affectedGroups: [],
// TODO: i18n
text: "teachers",
value: "teachers",
},
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,
};
});
},
},
};