Add history view

This commit is contained in:
2022-04-30 18:21:45 +02:00
parent 63d335d04a
commit 6e118221b9
5 changed files with 166 additions and 29 deletions

View File

@ -1,32 +1,8 @@
<script setup>
import { substitutionsForDate } from "../store";
import dayjs from "dayjs";
import { dayNames, substitutionTexts, uiTexts } from "../definitions";
function getText(substitution) {
var text = "";
if (substitution.type == "change") {
const change = substitution.change;
if (change.subject) {
text += substitutionTexts.subjectChange + " " + change.subject;
}
if (change.teacher && text == "") {
text += substitutionTexts.teacherChange + " " + change.teacher;
} else if (change.teacher) {
text += " " + substitutionTexts.teacherChangePartial;
text += " " + change.teacher;
}
if (change.room && text == "") {
text += substitutionTexts.roomChange + " " + change.room;
} else if (change.room) {
text += " " + substitutionTexts.roomChangePartial;
text += " " + change.room;
}
} else if (substitution.type == "cancellation") {
text += substitutionTexts.cancellation;
}
return text;
}
import { dayNames, uiTexts } from "../definitions";
import { getSubstitutionText } from "../util";
</script>
<template>
@ -43,7 +19,7 @@ function getText(substitution) {
<div class="substitution">
<span class="hour">{{ substitution.lesson }}</span>
<div class="infos">
<span class="text">{{ getText(substitution) }}</span>
<span class="text">{{ getSubstitutionText(substitution) }}</span>
<span class="notes">
{{ substitution.notes ? uiTexts.substitutionNotes + ": " : "" }}
{{ substitution.notes }}