✨ Add substitution plan
This commit is contained in:
101
src/views/SubstitutionView.vue
Normal file
101
src/views/SubstitutionView.vue
Normal file
@ -0,0 +1,101 @@
|
||||
<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;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="substitutions">
|
||||
<template v-for="(substitutions, date) of substitutionsForDate" :key="date">
|
||||
<div class="title">
|
||||
<span class="day">
|
||||
{{ dayNames[new Date(parseInt(date)).getDay() - 1] }},
|
||||
{{ dayjs(parseInt(date)).format("DD.MM.YYYY") }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<template v-for="(substitution, index) in substitutions" :key="index">
|
||||
<div class="substitution">
|
||||
<span class="hour">{{ substitution.lesson }}</span>
|
||||
<div class="infos">
|
||||
<span class="text">{{ getText(substitution) }}</span>
|
||||
<span class="notes">
|
||||
{{ substitution.notes ? uiTexts.substitutionNotes + ": " : "" }}
|
||||
{{ substitution.notes }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.substitutions {
|
||||
padding: 65px 10px 80px 10px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.substitution {
|
||||
display: grid;
|
||||
background-color: #26272a;
|
||||
min-height: 35px;
|
||||
border-radius: 11px;
|
||||
margin: 10px 0px;
|
||||
padding: 10px;
|
||||
grid-template-columns: max-content auto;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.hour {
|
||||
font-size: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.infos {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: 100;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.notes {
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user