Add total line in account list on index page
This commit is contained in:
parent
18a58783c8
commit
50ae922a99
5 changed files with 18 additions and 5 deletions
|
@ -77,10 +77,6 @@ table.full-width col.bar {
|
||||||
background: #eeeeff;
|
background: #eeeeff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tfoot {
|
|
||||||
background: var(--bg-01);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar {
|
.calendar {
|
||||||
|
|
|
@ -45,6 +45,9 @@ table {
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tfoot tr:not(.new) {
|
||||||
|
background: var(--bg-01);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.date,
|
.date,
|
||||||
|
|
|
@ -41,6 +41,12 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td>{{ "functions"|remix }}</td>
|
||||||
|
<th class="l">{% translate "Total" %}</th>
|
||||||
|
<td class="value">{{ accounts|balance|value }}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr class="new">
|
<tr class="new">
|
||||||
<td colspan="4">
|
<td colspan="4">
|
||||||
<a href="{% url "new_account" %}">{% translate "Create account" %}</a>
|
<a href="{% url "new_account" %}">{% translate "Create account" %}</a>
|
||||||
|
|
|
@ -59,3 +59,10 @@ def css(href):
|
||||||
return mark_safe(
|
return mark_safe(
|
||||||
f"""<link rel="stylesheet" href="{static(href)}" type="text/css">"""
|
f"""<link rel="stylesheet" href="{static(href)}" type="text/css">"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def balance(accounts):
|
||||||
|
return sum(
|
||||||
|
statement.value for acc in accounts if (statement := acc.statement_set.first())
|
||||||
|
)
|
||||||
|
|
|
@ -26,9 +26,10 @@ class IndexView(LoginRequiredMixin, TemplateView):
|
||||||
_max = 8
|
_max = 8
|
||||||
_transactions = Transaction.objects.filter(user=self.request.user)
|
_transactions = Transaction.objects.filter(user=self.request.user)
|
||||||
_statements = Statement.objects.filter(user=self.request.user)
|
_statements = Statement.objects.filter(user=self.request.user)
|
||||||
|
_accounts = Account.objects.filter(user=self.request.user)
|
||||||
|
|
||||||
res = {
|
res = {
|
||||||
"accounts": Account.objects.filter(user=self.request.user),
|
"accounts": _accounts,
|
||||||
"transactions": _transactions[:_max],
|
"transactions": _transactions[:_max],
|
||||||
"categories": Category.objects.filter(user=self.request.user),
|
"categories": Category.objects.filter(user=self.request.user),
|
||||||
"statements": _statements[:_max],
|
"statements": _statements[:_max],
|
||||||
|
|
Loading…
Reference in a new issue