Skip to content
Snippets Groups Projects
Commit bd0eee36 authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Add column for subject

parent 78d36d1e
No related branches found
No related tags found
2 merge requests!10Resolve "Add model for planning of courses (dependend on ValidityRange)",!2Resolve "Frontend for Models"
...@@ -36,7 +36,24 @@ import ValidityRangeField from "./ValidityRangeField.vue";</script> ...@@ -36,7 +36,24 @@ import ValidityRangeField from "./ValidityRangeField.vue";</script>
<save-button /> <save-button />
</v-toolbar> </v-toolbar>
</template> </template>
<template v-for="header in headers" #[tableItemSlotName(header)]="{ item, value }">
<template #item.subject="{ item, value }">
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-chip
:color="value.colourFg"
v-on="on"
v-bind="attrs"
outlined
>
{{ value.shortName }}
</v-chip>
</template>
<span>{{ value.name }}</span>
</v-tooltip>
</template>
<template v-for="header in groupHeaders" #[tableItemSlotName(header)]="{ item, value }">
<template v-for="(course, index) in value"> <template v-for="(course, index) in value">
<v-card class="ma-2"> <v-card class="ma-2">
<v-card-title> <v-card-title>
...@@ -182,13 +199,19 @@ export default { ...@@ -182,13 +199,19 @@ export default {
subjectGroupCombinations() { subjectGroupCombinations() {
return [].concat.apply([], this.items.map(subject => Object.keys(subject.groupCombinations))); return [].concat.apply([], this.items.map(subject => Object.keys(subject.groupCombinations)));
}, },
headers() { groupHeaders() {
return this.groups.map(group => ({text: group.shortName, value: JSON.stringify([group.id])})).concat(this.subjectGroupCombinations.map(combination => { return this.groups.map(group => ({text: group.shortName, value: JSON.stringify([group.id])})).concat(this.subjectGroupCombinations.map(combination => {
let parsedCombination = JSON.parse(combination); let parsedCombination = JSON.parse(combination);
return { return {
text: parsedCombination.map(groupID => this.groups.find(group => group.id === groupID).shortName).join(", "), value: combination text: parsedCombination.map(groupID => this.groups.find(group => group.id === groupID).shortName).join(", "), value: combination
}; };
})).filter((obj, index, self) => index === self.findIndex((o) => o.value === obj.value)); })).filter((obj, index, self) => index === self.findIndex((o) => o.value === obj.value))
},
headers() {
return [{
text: this.$t("lesrooster.timebound_course_config.subject"),
value: "subject",
}].concat(this.groupHeaders);
}, },
items() { items() {
return this.subjects.map(subject => { return this.subjects.map(subject => {
...@@ -212,7 +235,10 @@ export default { ...@@ -212,7 +235,10 @@ export default {
}); });
}, },
tableItems() { tableItems() {
return this.items.map(subject => subject.groupCombinations); return this.items.map(subject => {
let { courses, groupCombinations, ...reducedSubject } = subject;
return {subject: reducedSubject, ...subject.groupCombinations};
});
}, },
}, },
apollo: { apollo: {
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
"scheduled_slot_count": "Scheduled lesson quota", "scheduled_slot_count": "Scheduled lesson quota",
"course": "Course", "course": "Course",
"teachers": "Teachers", "teachers": "Teachers",
"create_timebound_course_config": "Create timebound course config" "create_timebound_course_config": "Create timebound course config",
"subject": "Subject"
}, },
"lesson_raster": { "lesson_raster": {
"menu_title": "Lesson Raster" "menu_title": "Lesson Raster"
......
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