From 7356d02adad8794eedb1b5683dc1e255fa1f9732 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Thu, 29 Dec 2022 19:54:15 +0100 Subject: [PATCH] Add account column to tables --- nummi/main/static/main/css/index.css | 6 ++++-- nummi/main/static/main/css/table.css | 1 + nummi/main/templates/main/base.html | 5 +++++ nummi/main/templates/main/index.html | 21 ++++++++++++++++++- .../templates/main/tag/transaction_table.html | 11 +++++++++- nummi/main/views.py | 1 + 6 files changed, 41 insertions(+), 4 deletions(-) diff --git a/nummi/main/static/main/css/index.css b/nummi/main/static/main/css/index.css index 712c4ac..f900910 100644 --- a/nummi/main/static/main/css/index.css +++ b/nummi/main/static/main/css/index.css @@ -12,10 +12,12 @@ h1 img { margin-right: var(--gap); } -#categories > a { +#categories > a, +#accounts > a { display: inline-block; padding: 1em; } -#categories > a > i { +#categories > a > i, +#accounts > a > i { margin-right: .5rem; } diff --git a/nummi/main/static/main/css/table.css b/nummi/main/static/main/css/table.css index edec06e..358ac2b 100644 --- a/nummi/main/static/main/css/table.css +++ b/nummi/main/static/main/css/table.css @@ -14,6 +14,7 @@ .table.col1-1-1 {grid-template-columns: min-content auto min-content} .table.col1-5 {grid-template-columns: min-content repeat(5, auto)} .table.col1-6 {grid-template-columns: min-content repeat(6, auto)} +.table.col1-7 {grid-template-columns: min-content repeat(7, auto)} .table > div { display: contents; diff --git a/nummi/main/templates/main/base.html b/nummi/main/templates/main/base.html index afa55f6..0af4e63 100644 --- a/nummi/main/templates/main/base.html +++ b/nummi/main/templates/main/base.html @@ -33,6 +33,11 @@

Nummi

+ + {% translate "Account" %} + diff --git a/nummi/main/templates/main/index.html b/nummi/main/templates/main/index.html index d7c9053..c4e5c84 100644 --- a/nummi/main/templates/main/index.html +++ b/nummi/main/templates/main/index.html @@ -12,6 +12,16 @@ type="text/css"/> {% endblock %} {% block body %} + {% if accounts %} +

{% translate "Accounts" %}

+ {% spaceless %} +
+ {% for acc in accounts %} + {{ acc }} + {% endfor %} +
+ {% endspaceless %} + {% endif %} {% if transactions %}

{% translate "Transactions" %} @@ -33,10 +43,11 @@ {% endif %} {% if snapshots %}

{% translate "Snapshots" %}

-
+
{% translate "Date" %} + {% translate "Value" %} {% translate "Difference" %} {% translate "Transactions" %} @@ -54,6 +65,14 @@ {{ snap.date|date:"Y-m-d" }} + {{ snap.value|value }} {{ snap.diff|pmvalue }} {% with sum=snap.sum %} diff --git a/nummi/main/templates/main/tag/transaction_table.html b/nummi/main/templates/main/tag/transaction_table.html index b1a1263..aae4664 100644 --- a/nummi/main/templates/main/tag/transaction_table.html +++ b/nummi/main/templates/main/tag/transaction_table.html @@ -1,6 +1,6 @@ {% load main_extras %} {% load i18n %} -
+
{% translate "Date" %} @@ -8,6 +8,7 @@ {% translate "Value" %} {% translate "Trader" %} {% translate "Category" %} + {% translate "Description" %}
{% for trans in transactions %} @@ -33,6 +34,14 @@ – {% endif %} + {{ trans.description }}
{% endfor %} diff --git a/nummi/main/views.py b/nummi/main/views.py index 495a9d6..9347e4e 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -37,6 +37,7 @@ class IndexView(LoginRequiredMixin, TemplateView): def get_context_data(self, **kwargs): return super().get_context_data(**kwargs) | { + "accounts": Account.objects.filter(user=self.request.user), "transactions": Transaction.objects.filter(user=self.request.user)[:10], "categories": Category.objects.filter(user=self.request.user), "snapshots": Snapshot.objects.filter(user=self.request.user),