diff --git a/nummi/main/static/main/css/plot.css b/nummi/main/static/main/css/plot.css
index 4a9eb36..3ec218b 100644
--- a/nummi/main/static/main/css/plot.css
+++ b/nummi/main/static/main/css/plot.css
@@ -77,10 +77,6 @@ table.full-width col.bar {
background: #eeeeff;
}
}
-
- tfoot {
- background: var(--bg-01);
- }
}
.calendar {
diff --git a/nummi/main/static/main/css/table.css b/nummi/main/static/main/css/table.css
index c2c9fec..e93c777 100644
--- a/nummi/main/static/main/css/table.css
+++ b/nummi/main/static/main/css/table.css
@@ -45,6 +45,9 @@ table {
font-weight: 300;
}
}
+ tfoot tr:not(.new) {
+ background: var(--bg-01);
+ }
}
.date,
diff --git a/nummi/main/templates/main/index.html b/nummi/main/templates/main/index.html
index 1c278b0..19a5b54 100644
--- a/nummi/main/templates/main/index.html
+++ b/nummi/main/templates/main/index.html
@@ -41,6 +41,12 @@
{% endfor %}
+
+ {{ "functions"|remix }} |
+ {% translate "Total" %} |
+ {{ accounts|balance|value }} |
+ |
+
{% translate "Create account" %}
diff --git a/nummi/main/templatetags/main_extras.py b/nummi/main/templatetags/main_extras.py
index fd29a10..8234b3f 100644
--- a/nummi/main/templatetags/main_extras.py
+++ b/nummi/main/templatetags/main_extras.py
@@ -59,3 +59,10 @@ def css(href):
return mark_safe(
f""""""
)
+
+
+@register.filter
+def balance(accounts):
+ return sum(
+ statement.value for acc in accounts if (statement := acc.statement_set.first())
+ )
diff --git a/nummi/main/views.py b/nummi/main/views.py
index a6361ab..72e6840 100644
--- a/nummi/main/views.py
+++ b/nummi/main/views.py
@@ -26,9 +26,10 @@ class IndexView(LoginRequiredMixin, TemplateView):
_max = 8
_transactions = Transaction.objects.filter(user=self.request.user)
_statements = Statement.objects.filter(user=self.request.user)
+ _accounts = Account.objects.filter(user=self.request.user)
res = {
- "accounts": Account.objects.filter(user=self.request.user),
+ "accounts": _accounts,
"transactions": _transactions[:_max],
"categories": Category.objects.filter(user=self.request.user),
"statements": _statements[:_max],
|