Files
Timetable-V2/src/util.js

37 lines
1.1 KiB
JavaScript

import { substitutionTexts } from "./definitions";
export function getSubstitutionText(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;
}
export function getSubstitutionColor(substitution) {
if (!substitution) return;
switch (substitution.type) {
case "change":
return "background-color: #14587e;";
case "cancellation":
return "background-color: #7d2b2d;";
}
}