From 77bfa49dce3eb7b883f01b90a225d29f3761a186 Mon Sep 17 00:00:00 2001
From: Michael Bauer <michael-bauer@posteo.de>
Date: Tue, 15 Oct 2024 20:20:44 +0200
Subject: [PATCH] Add print-button & reformat header

---
 .../frontend/components/Substitutions.vue     | 78 ++++++++++---------
 .../apps/chronos/frontend/messages/de.json    |  1 +
 .../apps/chronos/frontend/messages/en.json    |  1 +
 3 files changed, 44 insertions(+), 36 deletions(-)

diff --git a/aleksis/apps/chronos/frontend/components/Substitutions.vue b/aleksis/apps/chronos/frontend/components/Substitutions.vue
index abb9e121..833a49bf 100644
--- a/aleksis/apps/chronos/frontend/components/Substitutions.vue
+++ b/aleksis/apps/chronos/frontend/components/Substitutions.vue
@@ -1,5 +1,6 @@
 <script setup>
 import CRUDList from "aleksis.core/components/generic/CRUDList.vue";
+import PrimaryActionButton from "aleksis.core/components/generic/buttons/PrimaryActionButton.vue";
 </script>
 
 <template>
@@ -14,43 +15,48 @@ import CRUDList from "aleksis.core/components/generic/CRUDList.vue";
     :enable-edit="false"
   >
     <template #title>
-      <v-card-title class="text-h3"> {{ $d(new Date(date), "dateWithWeekday") }} </v-card-title>
-      <v-container>
-      <v-row>
-        <v-col cols="4"> {{ $t("chronos.substitutions.affected_teachers") }} </v-col>
-        <v-col cols="8">
-          <v-chip
-            v-for="(teacher, i) in affectedTeachers"
-            class="ma-1"
-            :to="{
-              name: 'chronos.timetableWithId',
-              params: {
-                type: 'person',
-                id: teacher.id,
-              },
-            }"
-          >
-            {{ teacher.shortName || teacher.fullName }}
-          </v-chip>
-        </v-col>
-        <v-spacer/>
+      <v-row class="d-flex align-center pt-2 pa-2">
+      <v-card-title class="text-h4"> {{ $d(new Date(date), "dateWithWeekday") }} </v-card-title>
+      <v-spacer/>
+      <primary-action-button
+        class="mr-4"
+        i18n-key="chronos.substitutions.print"
+        :to="{
+          name: 'chronos.printSubstitutionsForDate',
+          params: {
+            date: date,
+          },
+        }"
+        />
       </v-row>
-      <v-row>
-        <v-col> {{ $t("chronos.substitutions.affected_groups") }} </v-col>
-        <v-col>
-          <!-- TODO: Link to group-timetable as well -->
-          <!-- as soon as it becomes possible to resolve a -->
-          <!-- group-timetable from the lesson-event group too. -->
-          <v-chip
-            v-for="group in affectedGroups"
-            class="ma-1"
-          >
-            {{ group.shortName }}
-          </v-chip>
-        </v-col>
-        <v-spacer/>
-      </v-row>
-      </v-container>
+      <v-card-text>
+        <span> {{ $t("chronos.substitutions.affected_teachers") }} </span>
+        <v-chip
+          v-for="(teacher, i) in affectedTeachers"
+          class="ma-1"
+          :to="{
+            name: 'chronos.timetableWithId',
+            params: {
+              type: 'person',
+              id: teacher.id,
+            },
+          }"
+        >
+          {{ teacher.shortName || teacher.fullName }}
+        </v-chip>
+      </v-card-text>
+      <v-card-text>
+        <span> {{ $t("chronos.substitutions.affected_groups") }} </span>
+        <!-- TODO: Link to group-timetable as well -->
+        <!-- as soon as it becomes possible to resolve a -->
+        <!-- group-timetable from the lesson-event group too. -->
+        <v-chip
+          v-for="group in affectedGroups"
+          class="ma-1"
+        >
+          {{ group.shortName }}
+        </v-chip>
+      </v-card-text>
     </template>
     <!-- TODO: Component for strike -> bold || normal -->
     <template #groups="{ item: { oldGroups, newGroups } }">
diff --git a/aleksis/apps/chronos/frontend/messages/de.json b/aleksis/apps/chronos/frontend/messages/de.json
index 52c603bc..7727f35d 100644
--- a/aleksis/apps/chronos/frontend/messages/de.json
+++ b/aleksis/apps/chronos/frontend/messages/de.json
@@ -23,6 +23,7 @@
     "menu_title": "Stundenpläne",
     "substitutions": {
       "menu_title": "Vertretungen",
+      "print": "Drucken",
       "groups": "Gruppen",
       "time": "Zeit",
       "teachers": "Lehrer",
diff --git a/aleksis/apps/chronos/frontend/messages/en.json b/aleksis/apps/chronos/frontend/messages/en.json
index d02f3699..5e59a4e3 100644
--- a/aleksis/apps/chronos/frontend/messages/en.json
+++ b/aleksis/apps/chronos/frontend/messages/en.json
@@ -24,6 +24,7 @@
     },
     "substitutions": {
       "menu_title": "Substitutions",
+      "print": "Print",
       "groups": "Groups",
       "time": "Time",
       "teachers": "Teachers",
-- 
GitLab