From edbf4d23d35be21bf766fc7fa59037d699eea5dc Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 22 Jan 2025 13:22:28 +0100
Subject: [PATCH] Refactor templates.

---
 templates/_base.tmpl   |  2 ++
 templates/_macros.tmpl | 16 ++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/templates/_base.tmpl b/templates/_base.tmpl
index 217af12..74ed6b1 100644
--- a/templates/_base.tmpl
+++ b/templates/_base.tmpl
@@ -6,6 +6,8 @@
 <style>
 body { background-color: white; font-family: sans-serif; }
 tr:nth-child(odd) { background-color: #dcdcdc; }
+tr.warning td { background-color: #ff8888; }
+td.invalid, tr.warning td.invalid { background-color: #ff0000; }
 {% block css %}{% endblock %}
 </style>
 </head>
diff --git a/templates/_macros.tmpl b/templates/_macros.tmpl
index cabb83c..d1f6cf2 100644
--- a/templates/_macros.tmpl
+++ b/templates/_macros.tmpl
@@ -21,14 +21,16 @@ td.curr { text-align: center; }
     {% endif %}
   {% endif %}
   {% if raw %}
+    <td{% if dat_line.error %} class="invalid"{% endif %}>
     {% if dat_line.is_intro %}
-      <td {% if dat_line.error %}class="invalid"{% endif %}><a href="/booking/{{dat_line.booking_id}}"/>{{dat_line.raw_nbsp}}</a></td>
+      <a href="/booking/{{dat_line.booking_id}}"/>{{dat_line.raw_nbsp}}</a>
     {% else %}
-      <td {% if dat_line.error %}class="invalid"{% endif %}>{{dat_line.raw_nbsp}}</td>
+      {{dat_line.raw_nbsp}}
     {% endif %}
+    </td>
   {% else %}
     {% if dat_line.is_intro %}
-      <td class="code{% if dat_line.error %} invalid{% endif %}" colspan=3><a href="/booking/{{dat_line.booking_id}}">{{dat_line.code}}</a></td>
+      <td{% if dat_line.error %} class="invalid"{% endif %} colspan=3><a href="/booking/{{dat_line.booking_id}}">{{dat_line.code}}</a></td>
     {% elif not dat_line.error %}
       <td class="amt">{{dat_line.booking_line.amount_short}}</td>
       <td class="curr">{{dat_line.booking_line.currency|truncate(4,true,"…")}}</td>
@@ -40,7 +42,13 @@ td.curr { text-align: center; }
   {% endif %}
   </tr>
   {% if dat_line.error and not raw %}
-    <tr class="warning">{% if not single %}<td></td>{% endif %}<td class="invalid" colspan=3>{{dat_line.error}}</td><td></td></tr>
+    <tr class="warning">
+    {% if not single %}
+      <td></td>
+    {% endif %}
+    <td class="invalid" colspan=3>{{dat_line.error}}</td>
+    <td></td>
+    </tr>
   {% endif %}
 {% endfor %}
 </table>
-- 
2.30.2