From a878af28f1aca69754e9b2e9ac07fe743ddcc510 Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Wed, 5 Nov 2025 13:09:31 -0300 Subject: [PATCH] feat: more changes and fixes --- .../templatetags/currency_display.py | 16 +- app/templates/cotton/amount/display.html | 7 +- app/templates/cotton/msg/empty.html | 2 +- app/templates/cotton/transaction/item.html | 32 +- app/templates/cotton/ui/account_card.html | 319 ++++++++---------- app/templates/cotton/ui/currency_card.html | 311 ++++++++--------- .../cotton/ui/transactions_action_bar.html | 50 ++- app/templates/includes/scripts.html | 10 +- .../scripts/hyperscript/hide_amount.html | 17 +- .../category_explorer/charts/account.html | 4 +- .../category_explorer/charts/currency.html | 4 +- .../fragments/category_explorer/index.html | 66 ++-- .../fragments/category_overview/index.html | 101 +++--- .../fragments/latest_transactions.html | 2 +- app/templates/insights/fragments/sankey.html | 17 +- app/templates/insights/pages/index.html | 20 +- app/templates/layouts/base.html | 2 +- app/templates/net_worth/net_worth.html | 67 ++-- .../pages/overview_by_account.html | 2 +- .../pages/yearly_overview_base.html | 2 +- frontend/src/{ => js}/_htmx.js | 0 frontend/src/js/_utils.js | 37 ++ frontend/src/{ => js}/autosize.js | 0 frontend/src/{ => js}/bootstrap.js | 2 +- frontend/src/{ => js}/charts.js | 0 frontend/src/{ => js}/datepicker.js | 0 frontend/src/{ => js}/htmx.js | 0 frontend/src/{ => js}/jquery.js | 0 frontend/src/{ => js}/select.js | 0 frontend/src/{ => js}/style.js | 4 +- frontend/src/{ => js}/sweetalert2.js | 0 frontend/src/main.js | 9 + frontend/src/styles/tailwind.css | 38 ++- frontend/vite.config.js | 10 +- 34 files changed, 595 insertions(+), 556 deletions(-) rename frontend/src/{ => js}/_htmx.js (100%) create mode 100644 frontend/src/js/_utils.js rename frontend/src/{ => js}/autosize.js (100%) rename frontend/src/{ => js}/bootstrap.js (95%) rename frontend/src/{ => js}/charts.js (100%) rename frontend/src/{ => js}/datepicker.js (100%) rename frontend/src/{ => js}/htmx.js (100%) rename frontend/src/{ => js}/jquery.js (100%) rename frontend/src/{ => js}/select.js (100%) rename frontend/src/{ => js}/style.js (62%) rename frontend/src/{ => js}/sweetalert2.js (100%) create mode 100644 frontend/src/main.js diff --git a/app/apps/transactions/templatetags/currency_display.py b/app/apps/transactions/templatetags/currency_display.py index 43106e6..a202a09 100644 --- a/app/apps/transactions/templatetags/currency_display.py +++ b/app/apps/transactions/templatetags/currency_display.py @@ -3,7 +3,6 @@ from decimal import Decimal from django import template from django.utils.formats import number_format - register = template.Library() @@ -13,13 +12,24 @@ def _format_string(prefix, amount, decimal_places, suffix): value=abs(amount), decimal_pos=decimal_places, force_grouping=True ) if amount < 0: + return "-", prefix, formatted_amount, suffix return f"-{prefix}{formatted_amount}{suffix}" else: + return "", prefix, formatted_amount, suffix return f"{prefix}{formatted_amount}{suffix}" else: - return "ERR" + return "", "", "ERR", "" @register.simple_tag(name="currency_display") def currency_display(amount, prefix, suffix, decimal_places): - return _format_string(prefix, amount, decimal_places, suffix) + sign, prefix, amount, suffix = _format_string( + prefix, amount, decimal_places, suffix + ) + + return { + "sign": sign, + "prefix": prefix, + "amount": amount, + "suffix": suffix, + } diff --git a/app/templates/cotton/amount/display.html b/app/templates/cotton/amount/display.html index 226fc27..9def514 100644 --- a/app/templates/cotton/amount/display.html +++ b/app/templates/cotton/amount/display.html @@ -1,10 +1,15 @@ {% load currency_display %} +{% currency_display amount=amount prefix=prefix suffix=suffix decimal_places=decimal_places as formatted_amount %} + {% if not divless %}
{% endif %} {{ slot }} {% if not divless %} diff --git a/app/templates/cotton/msg/empty.html b/app/templates/cotton/msg/empty.html index 22dff39..5dd49d5 100644 --- a/app/templates/cotton/msg/empty.html +++ b/app/templates/cotton/msg/empty.html @@ -3,7 +3,7 @@

{{ title }}

-

{{ subtitle }}

+

{{ subtitle }}

diff --git a/app/templates/cotton/transaction/item.html b/app/templates/cotton/transaction/item.html index d184e45..0c54fa3 100644 --- a/app/templates/cotton/transaction/item.html +++ b/app/templates/cotton/transaction/item.html @@ -1,7 +1,7 @@ {% load markdown %} {% load i18n %}
+ class="transaction {% if transaction.type == "EX" %}expense{% else %}income{% endif %} group/transaction relative">
{% if not disable_selection or not dummy %}