From 822d0d180bafdde2ee49b8ba03ed145743ae4c6d Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Sun, 15 Sep 2019 22:45:24 +0200
Subject: [PATCH] Add first pages of cladss register reporting template.
 Advances #26.

---
 .../static/css/alsijil/full_register.css      | 93 +++++++++++++++++++
 .../alsijil/print/full_register.html          | 93 +++++++++++++++++++
 2 files changed, 186 insertions(+)
 create mode 100644 biscuit/apps/alsijil/static/css/alsijil/full_register.css
 create mode 100644 biscuit/apps/alsijil/templates/alsijil/print/full_register.html

diff --git a/biscuit/apps/alsijil/static/css/alsijil/full_register.css b/biscuit/apps/alsijil/static/css/alsijil/full_register.css
new file mode 100644
index 000000000..d538f3a79
--- /dev/null
+++ b/biscuit/apps/alsijil/static/css/alsijil/full_register.css
@@ -0,0 +1,93 @@
+/* paper.css */
+
+@page { margin: 0 }
+body { margin: 0 }
+.sheet {
+  margin: 0;
+  overflow: hidden;
+  position: relative;
+  box-sizing: border-box;
+  page-break-after: always;
+}
+/** Paper sizes **/
+body.A3               .sheet { width: 297mm; height: 419mm }
+body.A3.landscape     .sheet { width: 420mm; height: 296mm }
+body.A4               .sheet { width: 210mm; height: 296mm }
+body.A4.landscape     .sheet { width: 297mm; height: 209mm }
+body.A5               .sheet { width: 148mm; height: 209mm }
+body.A5.landscape     .sheet { width: 210mm; height: 147mm }
+body.letter           .sheet { width: 216mm; height: 279mm }
+body.letter.landscape .sheet { width: 280mm; height: 215mm }
+body.legal            .sheet { width: 216mm; height: 356mm }
+body.legal.landscape  .sheet { width: 357mm; height: 215mm }
+/** Padding area **/
+.sheet.padding-10mm { padding: 10mm }
+.sheet.padding-15mm { padding: 15mm }
+.sheet.padding-20mm { padding: 20mm }
+.sheet.padding-25mm { padding: 25mm }
+/** For screen preview **/
+@media screen {
+  body { background: #e0e0e0 }
+  .sheet {
+    background: white;
+    box-shadow: 0 .5mm 2mm rgba(0,0,0,.3);
+    margin: 5mm auto;
+  }
+}
+/** Fix for Chrome issue #273306 **/
+@media print {
+           body.A3.landscape { width: 420mm }
+  body.A3, body.A4.landscape { width: 297mm }
+  body.A4, body.A5.landscape { width: 210mm }
+  body.A5                    { width: 148mm }
+  body.letter, body.legal    { width: 216mm }
+  body.letter.landscape      { width: 280mm }
+  body.legal.landscape       { width: 357mm }
+}
+/* END paper.css */
+
+
+@page {
+  size: A4;
+}
+
+body {
+  font-family: Arial, Helvetica, san-serif;
+  font-size: 11pt;
+}
+
+#titlepage h1 {
+  text-align: center;
+}
+
+#titlepage img#school-logo {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+  width: 50%;
+}
+
+#titlepage p#group-desc {
+  font-weight: bold;
+  font-size: 150%;
+  text-align: center;
+}
+
+#titlepage p#group-owners {
+  font-size: 130%;
+  text-align: center;
+}
+
+table {
+  width: 100%;
+  border: 1px solid black;
+  border-collapse: collapse;
+}
+
+th, td {
+  border: 1px solid black;
+}
+
+tr:nth-child(even) {
+  background-color: #f2f2f2;
+}
diff --git a/biscuit/apps/alsijil/templates/alsijil/print/full_register.html b/biscuit/apps/alsijil/templates/alsijil/print/full_register.html
new file mode 100644
index 000000000..9557c61a7
--- /dev/null
+++ b/biscuit/apps/alsijil/templates/alsijil/print/full_register.html
@@ -0,0 +1,93 @@
+{% load staticfiles i18n cropping data_helpers %}
+
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8" />
+
+    <link rel="stylesheet"
+      href="https://raw.githubusercontent.com/cognitom/paper-css/master/paper.min.css" />
+    <link rel="stylesheet"
+      href="{% static 'css/alsijil/full_register.css' %}" />
+  </head>
+
+  <body class="A4">
+    <section class="sheet padding-10mm" id="titlepage">
+      <h1>{% trans 'Class register' %}</h1>
+      <img src="{% cropped_thumbnail group.school 'logo_cropping' max_size='600x600' %}" id="school-logo" />
+      <p id="group-desc">
+        {{ group.name }}
+      </p>
+      <p id="group-owners">
+        {{ group.owners.all|join:', ' }}
+      </p>
+    </section>
+
+    <section class="sheet padding-10mm" id="persons-overview">
+      <h2>{% trans 'Persons in group' %} {{ group.name }}</h2>
+
+      <table id="persons">
+        <thead>
+          <tr>
+            <th>{% trans 'No.' %}</th>
+            <th>{% trans 'Last name' %}</th>
+            <th>{% trans 'First name' %}</th>
+            <th>{% trans 'Sex' %}</th>
+            <th>{% trans 'Date of birth' %}</th>
+          </tr>
+        </thead>
+
+        <tbody>
+          {% for person in group.members.all %}
+            <tr>
+              <td>{{ forloop.counter }}</td>
+              <td>{{ person.last_name }}</td>
+              <td>{{ person.first_name }}</td>
+              <td>{{ person.get_sex_display }}</td>
+              <td>{{ person.date_of_birth }}</td>
+            </tr>
+          {% endfor %}
+        </tbody>
+      </table>
+    </section>
+
+    <section class="sheet padding-10mm" id="lessons-overview">
+      <h2>{% trans 'Teachers and lessons in group' %} {{ group.name }}</h2>
+
+      <table id="lessons">
+        <thead>
+          <tr>
+            <th>{% trans 'Subject' %}</th>
+            <th>{% trans 'Teacher' %}</th>
+            <th>{% trans 'Lesson start' %}</th>
+            <th>{% trans 'Lesson end' %}</th>
+            <th>{% trans 'Per week' %}</th>
+          </tr>
+        </thead>
+
+        <tbody>
+          {% for lesson in group.lessons.all %}
+            <tr>
+              <td>{{ lesson.subject.name }}</td>
+              <td>{{ lesson.teachers.all|join:', ' }}</td>
+              <td>{{ lesson.date_start }}</td>
+              <td>{{ lesson.date_end }}</td>
+              <td>{{ lesson.lesson_periods.count }}</td>
+            </tr>
+          {% endfor %}
+        </tbody>
+      </table>
+    </section>
+
+    {% for week in weeks %}
+      <section class="sheet padding-10mm">
+        <h2>{% trans 'Lesson documentation for week' %} {{ week }}</h2>
+
+        {% for day in week %}
+          <h3>{{ day }}</h3>
+          {{ periods_by_day|get_dict:day }}
+        {% endfor %}
+      </section>
+    {% endfor %}
+  </body>
+</html>
-- 
GitLab