From 25c4a42e37a2fd71ca14c78d5e4d8c854677a89a Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 13 Feb 2025 03:20:58 +0100
Subject: [PATCH] In Booking balance view, highlight accounts directly targeted
 in Booking.

---
 src/run.py                         |  1 +
 src/templates/_macros.tmpl         | 14 +++++++-------
 src/templates/edit_structured.tmpl |  1 +
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/run.py b/src/run.py
index bafb5bb..351e1fa 100755
--- a/src/run.py
+++ b/src/run.py
@@ -483,6 +483,7 @@ class Handler(PlomHttpHandler):
                         wealth.purge_currencies_except(displayed_currencies)
                     node: dict[str, Any] = {
                             'name': path,
+                            'directly_set': directly_set,
                             'wealth_before': wealth_before.moneys,
                             'wealth_diff': diff,
                             'wealth_after': wealth_after.moneys,
diff --git a/src/templates/_macros.tmpl b/src/templates/_macros.tmpl
index c93ceb9..f5d7943 100644
--- a/src/templates/_macros.tmpl
+++ b/src/templates/_macros.tmpl
@@ -121,33 +121,33 @@ function taint() {
 {% endmacro %}
 
 
-{% macro booking_balance_account_with_children(account) %}
-<tr class="alternating">
-<td>{{account.name}}{% if account.children %}:{% endif %}</td>
+{% macro booking_balance_account_with_children(node) %}
+<tr class="alternating{% if node.directly_set %} directly_set{% endif %}">
+<td>{{node.name}}{% if node.children %}:{% endif %}</td>
 <td class="money">
 <table>
-{% for curr, amt in account.wealth_before.items() %}
+{% for curr, amt in node.wealth_before.items() %}
   {{ tr_money_balance(amt, curr) }}
 {% endfor %}
 </table>
 </td>
 <td class="money">
 <table>
-{% for curr, amt in account.wealth_diff.items() %}
+{% for curr, amt in node.wealth_diff.items() %}
   {{ tr_money_balance(amt, curr) }}
 {% endfor %}
 </table>
 </td>
 <td class="money">
 <table>
-{% for curr, amt in account.wealth_after.items() %}
+{% for curr, amt in node.wealth_after.items() %}
   {{ tr_money_balance(amt, curr) }}
 {% endfor %}
 </table>
 </td>
 <td></td>
 </tr>
-{% for child in account.children %}
+{% for child in node.children %}
   {{ booking_balance_account_with_children(child) }}
 {% endfor %}
 {% endmacro %}
diff --git a/src/templates/edit_structured.tmpl b/src/templates/edit_structured.tmpl
index 8569dea..ba99349 100644
--- a/src/templates/edit_structured.tmpl
+++ b/src/templates/edit_structured.tmpl
@@ -8,6 +8,7 @@
 input.date_input, input.number_input { font-family: monospace; }
 input.number_input { text-align: right; }
 input.date_input { margin-right: 0.1em; }
+tr.directly_set > td { font-weight: bold; }
 {% endblock %}
 
 
-- 
2.30.2