From 275f44228c11f3dab319d3e22defb590e3d4b187 Mon Sep 17 00:00:00 2001 From: def Date: Sun, 8 Mar 2026 20:40:54 +0000 Subject: [PATCH] Add color-coded client ledger links and edit-page ledger shortcut --- VERSION | 2 +- backend/app.py | 7 +++++++ templates/clients/edit.html | 6 ++++++ templates/clients/list.html | 5 ++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 0ea3a94..0c62199 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.0 +0.2.1 diff --git a/backend/app.py b/backend/app.py index 81c200a..fb4d762 100644 --- a/backend/app.py +++ b/backend/app.py @@ -202,6 +202,10 @@ def clients(): cursor.execute("SELECT * FROM clients ORDER BY id DESC") clients = cursor.fetchall() conn.close() + + for client in clients: + client["credit_balance"] = get_client_credit_balance(client["id"]) + return render_template("clients/list.html", clients=clients) @app.route("/clients/new", methods=["GET", "POST"]) @@ -259,6 +263,7 @@ def edit_client(client_id): if errors: cursor.execute("SELECT * FROM clients WHERE id = %s", (client_id,)) client = cursor.fetchone() + client["credit_balance"] = get_client_credit_balance(client_id) conn.close() return render_template("clients/edit.html", client=client, errors=errors) @@ -292,6 +297,8 @@ def edit_client(client_id): if not client: return "Client not found", 404 + client["credit_balance"] = get_client_credit_balance(client_id) + return render_template("clients/edit.html", client=client, errors=[]) @app.route("/credits/") diff --git a/templates/clients/edit.html b/templates/clients/edit.html index 1f7a39e..f3cb1ab 100644 --- a/templates/clients/edit.html +++ b/templates/clients/edit.html @@ -10,6 +10,12 @@

Home

Back to Clients

+

+ + Ledger ({{ client.credit_balance|money('CAD') }}) + +

{% if errors %}
diff --git a/templates/clients/list.html b/templates/clients/list.html index 6a09262..80f144e 100644 --- a/templates/clients/list.html +++ b/templates/clients/list.html @@ -34,7 +34,10 @@ {{ c.status }} Edit | - Ledger + + Ledger ({{ c.credit_balance|money('CAD') }}) + {% endfor %}