diff --git a/src/definitions.js b/src/definitions.js index e15e644..aba55dd 100644 --- a/src/definitions.js +++ b/src/definitions.js @@ -1 +1,12 @@ export const dayNames = ["Monday", "Tuesday", "Wednesday", "Thursay", "Friday"]; +export const substitutionTexts = { + subjectChange: "Unterrichtsänderung im Fach", + teacherChange: "Vertretung mit", + teacherChangePartial: "mit", + roomChange: "Raumvertretung in Raum", + roomChangePartial: "in Raum", + cancellation: "Ausfall", +}; +export const uiTexts = { + substitutionNotes: "Notes", +}; diff --git a/src/router/index.js b/src/router/index.js index 76da57a..68257a6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,5 +1,6 @@ import { createRouter, createWebHistory } from "vue-router"; import TimetableView from "../views/TimetableView.vue"; +import SubstitutionView from "../views/SubstitutionView.vue"; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -13,6 +14,11 @@ const router = createRouter({ name: "Timetable", component: TimetableView, }, + { + path: "/substitutions", + name: "Substitutions", + component: SubstitutionView, + }, ], }); diff --git a/src/store.js b/src/store.js index 4fe6abe..d207f82 100644 --- a/src/store.js +++ b/src/store.js @@ -2,6 +2,17 @@ import { computed } from "@vue/reactivity"; import { ref } from "vue"; export const timetable = ref([]); +export const substitutions = ref([]); + +export const substitutionsForDate = computed(() => { + const dates = {}; + for (const substitution of substitutions.value) { + const date = substitution.date; + if (!dates[date]) dates[date] = []; + dates[substitution.date].push(substitution); + } + return dates; +}); export const parsedTimetable = computed(() => { return timetable.value.map((day) => { diff --git a/src/views/SubstitutionView.vue b/src/views/SubstitutionView.vue new file mode 100644 index 0000000..fc92479 --- /dev/null +++ b/src/views/SubstitutionView.vue @@ -0,0 +1,101 @@ + + + + + + + + {{ dayNames[new Date(parseInt(date)).getDay() - 1] }}, + {{ dayjs(parseInt(date)).format("DD.MM.YYYY") }} + + + + + + {{ substitution.lesson }} + + {{ getText(substitution) }} + + {{ substitution.notes ? uiTexts.substitutionNotes + ": " : "" }} + {{ substitution.notes }} + + + + + + + + +