From a1e36348e4a1bef362c9f628d70ca9d56ca6ae9f Mon Sep 17 00:00:00 2001
From: Frank Poetzsch-Heffter <p-h@katharineum.de>
Date: Sat, 23 Oct 2021 17:28:43 +0200
Subject: [PATCH] improve the formatting of the substitution plan

---
 CHANGELOG.rst                                 | 11 +++++++++
 .../chronos/static/css/chronos/timetable.css  | 24 ++++++++++++++++++-
 .../templates/chronos/partials/headerbox.html | 16 ++++++-------
 .../chronos/substitutions_print.html          |  2 +-
 4 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 8e5936c5..eacc9ac2 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -6,6 +6,17 @@ All notable changes to this project will be documented in this file.
 The format is based on `Keep a Changelog`_,
 and this project adheres to `Semantic Versioning`_.
 
+Unrelease
+---------
+
+Changed
+~~~~~~~
+
+* Reduce the margin to 5mm
+* Set width to 200mm
+* Reduce the space between the header and the heading
+* Display block of absentees as a table
+
 `2.0rc3`_ - 2021-09-24
 ----------------------
 
diff --git a/aleksis/apps/chronos/static/css/chronos/timetable.css b/aleksis/apps/chronos/static/css/chronos/timetable.css
index bbdbb5b8..df0286b6 100644
--- a/aleksis/apps/chronos/static/css/chronos/timetable.css
+++ b/aleksis/apps/chronos/static/css/chronos/timetable.css
@@ -103,8 +103,9 @@ table.substitutions td, table.substitutions th {
     width: 30%;
 }
 
+
 .print-body table.substitutions td, .print-body table.substitutions th {
-    padding: 0 2px;
+    padding: 0;
 }
 
 .print-body span.badge.new {
@@ -138,3 +139,24 @@ table.substitutions td, table.substitutions th {
 .holiday-card .holiday-badge {
     margin-top: 0;
 }
+
+@media print {
+    header {
+        width: 200mm;
+        top: 5mm;
+    }
+
+    .header-space {
+        height: 30mm;
+    }
+
+    .sheet {
+        padding: 5mm;
+    }
+
+    .print-layout-table, .print-layout-table > td {
+        width: 200mm;
+        max-width: 200mm;
+        min-width: 200mm;
+    }
+}
diff --git a/aleksis/apps/chronos/templates/chronos/partials/headerbox.html b/aleksis/apps/chronos/templates/chronos/partials/headerbox.html
index d298d5fc..1ed1e7de 100644
--- a/aleksis/apps/chronos/templates/chronos/partials/headerbox.html
+++ b/aleksis/apps/chronos/templates/chronos/partials/headerbox.html
@@ -5,48 +5,48 @@
     <div class="{% if not print %}card-content{% endif %}">
       {% if absent_teachers %}
         <div class="row no-margin">
-          <div class="col s12 m3">
+          <div class="col {% if not print %}s12 m3{% else %}s3{% endif %}">
             <strong class="truncate">
               {% trans "Absent teachers" %}
             </strong>
           </div>
-          <div class="col s12 m9 black-text-a">
+          <div class="col {% if not print %}s12 m9{% else %}s9{% endif %} black-text-a">
             {% include "chronos/partials/teachers.html" with teachers=absent_teachers %}
           </div>
         </div>
       {% endif %}
       {% if absent_groups %}
         <div class="row no-margin">
-          <div class="col s12 m3">
+          <div class="col {% if not print %}s12 m3{% else %}s3{% endif %}">
             <strong class="truncate">
               {% trans "Absent groups" %}
             </strong>
           </div>
-          <div class="col s12 m9 black-text-a">
+          <div class="col {% if not print %}s12 m9{% else %}s9{% endif %} black-text-a">
             {% include "chronos/partials/groups.html" with groups=absent_groups no_collapsible=True %}
           </div>
         </div>
       {% endif %}
       {% if affected_teachers %}
         <div class="row no-margin">
-          <div class="col s12 m3">
+          <div class="col {% if not print %}s12 m3{% else %}s3{% endif %}">
             <strong class="truncate">
               {% trans "Affected teachers" %}
             </strong>
           </div>
-          <div class="col s12 m9 black-text-a">
+          <div class="col {% if not print %}s12 m9{% else %}s9{% endif %} black-text-a">
             {% include "chronos/partials/teachers.html" with teachers=affected_teachers %}
           </div>
         </div>
       {% endif %}
       {% if affected_groups %}
         <div class="row no-margin">
-          <div class="col s12 m3">
+          <div class="col {% if not print %}s12 m3{% else %}s3{% endif %}">
             <strong class="truncate">
               {% trans "Affected groups" %}
             </strong>
           </div>
-          <div class="col s12 m9 black-text-a">
+          <div class="col {% if not print %}s12 m9{% else %}s9{% endif %} black-text-a">
             {% include "chronos/partials/groups.html" with groups=affected_groups no_collapsible=True %}
           </div>
         </div>
diff --git a/aleksis/apps/chronos/templates/chronos/substitutions_print.html b/aleksis/apps/chronos/templates/chronos/substitutions_print.html
index adfdfebe..c94a5125 100644
--- a/aleksis/apps/chronos/templates/chronos/substitutions_print.html
+++ b/aleksis/apps/chronos/templates/chronos/substitutions_print.html
@@ -14,7 +14,7 @@
 
 {% block content %}
   {% for day, c in days.items %}
-    <h4>{% trans "Substitutions" %} {{ c.day|date:"l" }} {{ c.day }}</h4>
+    <h4>{{ c.day|date:"l" }} {{ c.day|date:"SHORT_DATE_FORMAT" }}</h4>
 
     {% include "core/partials/announcements.html" with announcements=announcements show_recipients=1 %}
 
-- 
GitLab