From 4fd72ce56e9116b4ae70baf1474e9eb4b7678068 Mon Sep 17 00:00:00 2001
From: Julian Leucker <leuckerj@gmail.com>
Date: Tue, 8 Mar 2022 22:20:27 +0100
Subject: [PATCH] Rewrite PDF template

---
 .../templates/paweljong/invoice_pdf.html      | 412 ++++++++++--------
 1 file changed, 237 insertions(+), 175 deletions(-)

diff --git a/aleksis/apps/paweljong/templates/paweljong/invoice_pdf.html b/aleksis/apps/paweljong/templates/paweljong/invoice_pdf.html
index ee63ec6..84e3d94 100644
--- a/aleksis/apps/paweljong/templates/paweljong/invoice_pdf.html
+++ b/aleksis/apps/paweljong/templates/paweljong/invoice_pdf.html
@@ -1,186 +1,248 @@
 {# -*- engine:django -*- #}
 
-{% extends "core/base_print.html" %}
-
-{% load i18n %}
+{% load i18n static any_js sass_tags %}
 {% load render_table from django_tables2 %}
 
-{% block browser_title %}{% blocktrans %}Invoice{% endblocktrans %}{% endblock %}
-{% block page_title %}{% blocktrans %}Invoice{% endblocktrans %}{% endblock %}
+{% get_current_language as LANGUAGE_CODE %}
+
+<!DOCTYPE html>
+<html lang="{{ LANGUAGE_CODE }}">
+<head>
+  {% include "core/partials/meta.html" %}
+
+  <title>
+    {% blocktrans %}Invoice{% endblocktrans %} – {{ SITE_PREFERENCES.general__title }}
+  </title>
+
+  {% include_css "material-design-icons" %}
+  {% include_css "Roboto100" %}
+  {% include_css "Roboto300" %}
+  {% include_css "Roboto400" %}
+  {% include_css "Roboto500" %}
+  {% include_css "Roboto700" %}
+  {% include_css "Roboto900" %}
+  {% include_css "paper-css" %}
+  <link rel="stylesheet" href="{% sass_src 'public/style.scss' %}"/>
+  <link rel="stylesheet" href="{% static "print.css" %}"/>
 
-{% block extra_head %}
-<style>
-#logo {
-    float: right;
-    height: calc(44.7mm/2);
-}
-#address-window {
-    width: 85mm;
-    height: 40mm;
-    outline: solid red;
-    position: absolute;
-    top: 44.7mm;
-}
-#sender {
-    font-size: 10pt;
-    height: 12pt;
-    text-decoration: underline black solid;
-    font-style: normal;
-}
-#recipient p {
-    line-height: 1.03;
-    margin: 0;
-    font-style: normal;
-    font-size: 11pt;
-}
-#side-information {
-    position: absolute;
-    top: 44.7mm;
-    left: 125mm;
-    width: 75mm;
-}
-dl {
-    display: grid;
-    grid-template-columns: repeat(2, min-content);
-    gap: 4px;
-    align-items: center;
-    margin: 0;
-}
-dl div {
-    /*margin: 0.4pt 0 0 0;*/
-}
-dt, dd {
-    margin: 0;
-    font-style: normal;
-    font-size: 11pt;
-    line-height: 1.03;
-}
-body.A4 .sheet {
-    position: relative;
-    font-size: 11pt;
-    padding: 1cm 2cm;
-    text-align: justify;
-}
-i.material-icons {
-    font-size: 11pt;
-    vertical-align: text-top;
-}
-article {
-    margin-top: calc(105mm - 1cm);
-}
-#date {
-    display: block;
-    text-align: right;
-}
-h1 {
-    font-size: 12pt;
-    margin: auto;
-    font-weight: 500;
-}
-.page-mark {
-    width: 2.5mm;
-    border-top: solid 1pt black;
-    position: absolute;
-    left: 2.5mm;
-}
-.page-mark-1 {
-    top: calc(105mm - .5pt);
-}
-.page-mark-2 {
-    top: calc(50% - .5pt);
-    width: 5mm;
-}
+  <style>
+    #logo {
+        float: right;
+        height: calc(44.7mm/2);
+    }
+    #address-window {
+        width: 85mm;
+        height: 40mm;
+        /*outline: solid red;*/
+        position: absolute;
+        top: 44.7mm;
+    }
+    #sender {
+        font-size: 10pt;
+        height: 12pt;
+        text-decoration: underline black solid;
+        font-style: normal;
+    }
+    #recipient p {
+        line-height: 1.03;
+        margin: 0;
+        font-style: normal;
+        font-size: 11pt;
+    }
+    #side-information {
+        position: absolute;
+        top: 44.7mm;
+        left: 125mm;
+        width: 75mm;
+    }
+    dl {
+        display: grid;
+        grid-template-columns: repeat(2, min-content);
+        gap: 4px;
+        align-items: center;
+        margin: 0;
+    }
+    dl div {
+        /*margin: 0.4pt 0 0 0;*/
+    }
+    dt, dd {
+        margin: 0;
+        font-style: normal;
+        font-size: 11pt;
+        line-height: 1.03;
+    }
+    body.A4 .sheet {
+        position: relative;
+        font-size: 11pt;
+        padding: 1cm 2cm;
+        text-align: justify;
+    }
+    i.material-icons {
+        font-size: 11pt;
+        vertical-align: text-top;
+    }
+    article {
+        margin-top: calc(105mm - 1cm);
+    }
+    #date {
+        display: block;
+        text-align: right;
+    }
+    h1 {
+        font-size: 12pt;
+        margin: auto;
+        font-weight: 500;
+    }
+    .page-mark {
+        width: 2.5mm;
+        border-top: solid 1pt black;
+        position: absolute;
+        left: 2.5mm;
+    }
+    .page-mark-1 {
+        top: calc(105mm - .5pt);
+    }
+    .page-mark-2 {
+        top: calc(50% - .5pt);
+        width: 5mm;
+    }
 
-.page-mark-3 {
-    top: calc(210mm - 1pt);
-}
-</style>
-{% endblock %}
+    .page-mark-3 {
+        top: calc(210mm - 1pt);
+    }
+    footer {
+        width: calc(100% - 4cm);
+        display: flex;
+        font-size: 9pt;
+        text-align: left;
+        position: absolute;
+        bottom: 1cm;
+    }
+    .text {
+        flex-grow: 999;
+    }
+    .text p {
+        margin: 0;
+    }
+    td:not(.hero-col), th {
+        white-space: nowrap;
+    }
+    td.hero-col {
+        width: 100%;
+    }
+    td, th {
+        padding: 0 .5cm;
+    }
+    table {
+        margin-top: 1cm;
+    }
+  </style>
+<head>
 
-{% block content %}
-<div class="page-mark page-mark-1" aria-hidden="aria-hidden"></div>
-<div class="page-mark page-mark-2" aria-hidden="aria-hidden"></div>
-<div class="page-mark page-mark-3" aria-hidden="aria-hidden"></div>
-<img src="https://teckids.org/images/logo.png" alt="Teckids Logo" id="logo"/>
-<div id="address-window">
-    <address id="sender">Teckids e.V. · Kennedyallee 18 · 53175 Bonn</address>
-    <address id="recipient">
-	<p>{{ invoice.billing_first_name }} {{ invoice.billing_last_name }}</p>
-	<p>{{ invoice.billing_address_1 }}</p>
-	<p>{{ invoice.billing_address_2 }}</p>
-	<p>{{ invoice.billing_postcode }} {{ invoice.billing_city }}</p>
+<body class="A4 print-body">
+  <main class="sheet">
+    <div class="page-mark page-mark-1" aria-hidden="aria-hidden"></div>
+    <div class="page-mark page-mark-2" aria-hidden="aria-hidden"></div>
+    <div class="page-mark page-mark-3" aria-hidden="aria-hidden"></div>
+    <img src="https://teckids.org/images/logo.png" alt="Teckids Logo" id="logo"/>
+    <div id="address-window">
+        <address id="sender">Teckids e.V. · Kennedyallee 18 · 53175 Bonn</address>
+        <address id="recipient">
+            <p>&nbsp;</p>
+            <p>{{ invoice.billing_first_name }} {{ invoice.billing_last_name }}</p>
+            <p>{{ invoice.billing_address_1 }}</p>
+            <p>{{ invoice.billing_address_2 }}</p>
+            <p>{{ invoice.billing_postcode }} {{ invoice.billing_city }}</p>
+        </address>
+    </div>
+    <address id="side-information">
+        <dl>
+            <dt>
+                <i class="material-icons">mail</i><br/>
+                &nbsp;<br/>
+                &nbsp;
+            </dt>
+            <dd>
+                Teckids e.V.<br/>
+                Kennedyallee 18<br/>
+                53175 Bonn
+            </dd>
+            <dt>
+                <i class="material-icons small">phone</i>
+            </dt>
+            <dd>
+                <a href="tel:+4922892934160">+49 228 9293416–0</a>
+            </dd>
+            <dt>
+                <i class="material-icons">fax</i>
+            </dt>
+            <dd>
+                +49 228 9293416–9
+            </dd>
+            <dt>
+                <i class="material-icons">alternate_email</i>
+            </dt>
+            <dd>
+                <a href="mailto:verein@teckids.org">verein@teckids.org</a>
+            </dd>
+            <dt>
+                <i class="material-icons">info</i>
+            </dt>
+            <dd>
+                <a href="https://www.teckids.org/">https://www.teckids.org/</a>
+            </dd>
+        </dl>
     </address>
-</div>
-<address id="side-information">
-    <dl>
-	<dt>
-	    <i class="material-icons">mail</i><br/>
-	    &nbsp;<br/>
-	    &nbsp;
-	</dt>
-	<dd>
-	    Teckids e.V.<br/>
-	    Kennedyallee 18<br/>
-	    53175 Bonn
-	</dd>
-	<dt>
-	    <i class="material-icons small">phone</i>
-	</dt>
-	<dd>
-	    <a href="tel:+4922892934160">+49 228 9293416–0</a>
-	</dd>
-	<dt>
-	    <i class="material-icons">fax</i>
-	</dt>
-	<dd>
-	    +49 228 9293416–9
-	</dd>
-	<dt>
-	    <i class="material-icons">alternate_email</i>
-	</dt>
-	<dd>
-	    <a href="mailto:verein@teckids.org">verein@teckids.org</a>
-	</dd>
-	<dt>
-	    <i class="material-icons">info</i>
-	</dt>
-	<dd>
-	    <a href="https://www.teckids.org/">https://www.teckids.org/</a>
-	</dd>
-    </dl>
-</address>
-<article>
-    <date id="date">{{ invoice.created }}</date>
-    <h1>{% trans "Invoice" %} {{ invoice.transaction_id }}</h1>
+    <article>
+        <date id="date">{{ invoice.created.date }}</date>
+        <h1>{% trans "Invoice" %} {{ invoice.transaction_id }}</h1>
 
-    {% render_table invoice.purchased_items_table %}
-    {% render_table invoice.totals_table %}
+        {% render_table invoice.purchased_items_table %}
+        {% render_table invoice.totals_table %}
 
-    {% if invoice.variant == "transfer" %}
-    {% blocktrans %}
-    Please make the payment with a member of the board or by bank transfer to the following
-    account within 7 days:
-    {% endblocktrans %}
-    <table>
-	<tr>
-	    <td>Bank:</td>
-	    <td>Sparkasse KölnBonn</td>
-	</tr>
-	<tr>
-	    <td>IBAN:</td>
-	    <td>DE31 3705 0198 1933 0485 46</td>
-	</tr>
-	<tr>
-	    <td>BIC:</td>
-	    <td>COLSDE33XXX</td>
-	</tr>
-    </table>
-    {% endif %}
+        {% if invoice.variant == "transfer" %}
+        <p>
+            {% blocktrans %}
+            Please make the payment with a member of the board or by bank transfer to the following
+            account within 7 days:
+            {% endblocktrans %}
+        </p>
+        <table>
+            <tr>
+                <td>Bank:</td>
+                <td>Sparkasse KölnBonn</td>
+            </tr>
+            <tr>
+                <td>IBAN:</td>
+                <td>DE31 3705 0198 1933 0485 46</td>
+            </tr>
+            <tr>
+                <td>BIC:</td>
+                <td>COLSDE33XXX</td>
+            </tr>
+        </table>
+        {% endif %}
 
-    {% if invoice.variant == "sepa" %}
-    {% blocktrans %}
-    The payment will be withdrawn using SEPA direct debit from your bank account.
-    {% endblocktrans %}
-    {% endif %}
-</article>
-{% endblock %}
+        {% if invoice.variant == "sepa" %}
+        <p>
+            {% blocktrans %}
+            The payment will be withdrawn using SEPA direct debit from your bank account.
+            {% endblocktrans %}
+            {% endif %}
+        </p>
+    </article>
+    <footer>
+        <div class="text"><p>Vereinsregister Amtsgericht Bonn · VR 9846</p>
+            <p>Vorstand: Dominik George, Tom Teichler, Benedict Suska</p>
+            <p>Stadtsparkasse KölnBonn · IBAN: DE31 3705 0198 1933 0485 46 · BIC: COLSDE33XXX</p>
+            <p>Anerkannt als gemeinnützig beim Finanzamt Bonn-Außenstadt</p>
+            <p>Steuernummer 206/5879/1026 · USt-ID: DE313359560</p>
+        </div>
+        <!--
+        <div class="supporters">
+            <div>Unterstützt durch:<img src=""/></div>
+        </div>
+        -->
+    </footer>
+  </main>
+</body>
-- 
GitLab