✨ Switch to global date selector
This commit is contained in:
@ -1,9 +1,14 @@
|
||||
<script setup>
|
||||
import { historyOfDate } from "../store";
|
||||
import { dayNames, uiTexts } from "../definitions";
|
||||
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":
|
||||
@ -29,47 +34,38 @@ function getColor(type) {
|
||||
|
||||
<template>
|
||||
<div class="history">
|
||||
<template v-for="(events, date) of historyOfDate" :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="(event, index) in events" :key="index">
|
||||
<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>
|
||||
<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">
|
||||
{{ dayjs(event.updatedAt).format("DD.MM.YYYY, HH:mm") }}
|
||||
{{ event.change.notes ? uiTexts.substitutionNotes + ": " : "" }}
|
||||
{{ event.change.notes }}
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
<span class="notes">
|
||||
{{ dayjs(event.updatedAt).format("DD.MM.YYYY, HH:mm") }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.history {
|
||||
padding: 65px 10px 80px 10px;
|
||||
padding: 0px 10px 80px 10px;
|
||||
}
|
||||
|
||||
.title {
|
||||
|
Reference in New Issue
Block a user