117 lines
2.4 KiB
Vue
117 lines
2.4 KiB
Vue
<script setup>
|
|
import { historyOfDate, selectedDate } from "../store";
|
|
import { uiTexts } from "../definitions";
|
|
import { getSubstitutionText } from "../util";
|
|
import { computed } from "vue";
|
|
import dayjs from "dayjs";
|
|
|
|
const history = computed(() => {
|
|
return historyOfDate.value[selectedDate.value.setUTCHours(0, 0, 0, 0)];
|
|
});
|
|
|
|
function getChar(type) {
|
|
switch (type) {
|
|
case "change":
|
|
return "~";
|
|
case "addition":
|
|
return "+";
|
|
case "deletion":
|
|
return "-";
|
|
}
|
|
}
|
|
|
|
function getColor(type) {
|
|
switch (type) {
|
|
case "change":
|
|
return "background-color: #14587E;";
|
|
case "addition":
|
|
return "background-color: #476331;";
|
|
case "deletion":
|
|
return "background-color: #7D2B2D;";
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="history">
|
|
<template v-for="event in history" :key="event">
|
|
<div class="change" :style="getColor(event.type)">
|
|
<span class="hour">{{ event.lesson }}{{ getChar(event.type) }}</span>
|
|
<div class="infos">
|
|
<span class="text" v-if="event.type == 'change'">
|
|
<template v-for="(change, key) in event.change" :key="key">
|
|
<p>
|
|
{{ key }}:
|
|
<s>{{ change.before }}</s>
|
|
{{ change.after }}
|
|
</p>
|
|
</template>
|
|
</span>
|
|
<span class="text" v-else>
|
|
{{ getSubstitutionText(event.change) }}
|
|
<span class="notes">
|
|
{{ event.change.notes ? uiTexts.substitutionNotes + ": " : "" }}
|
|
{{ event.change.notes }}
|
|
</span>
|
|
</span>
|
|
<span class="notes">
|
|
{{ dayjs(event.updatedAt).format("DD.MM.YYYY, HH:mm") }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.history {
|
|
padding: 0px 10px 80px 10px;
|
|
}
|
|
|
|
.title {
|
|
font-size: 18px;
|
|
}
|
|
|
|
.change {
|
|
display: grid;
|
|
background-color: #26272a;
|
|
min-height: 35px;
|
|
border-radius: 11px;
|
|
margin: 10px 0px;
|
|
padding: 10px 10px;
|
|
grid-template-columns: 40px auto;
|
|
gap: 5px;
|
|
}
|
|
|
|
.hour {
|
|
font-size: 30px;
|
|
display: flex;
|
|
align-items: center;
|
|
letter-spacing: 5px;
|
|
}
|
|
|
|
.infos {
|
|
display: flex;
|
|
justify-content: center;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.text {
|
|
font-size: 18px;
|
|
display: flex;
|
|
align-items: center;
|
|
word-wrap: break-word;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
p {
|
|
margin: 0px;
|
|
}
|
|
|
|
.notes {
|
|
font-size: 13px;
|
|
font-weight: 100;
|
|
}
|
|
</style>
|