Add account column to tables
This commit is contained in:
parent
f2df88d091
commit
7356d02ada
6 changed files with 41 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -33,6 +33,11 @@
|
|||
<img src="{% static 'main/svg/logo.svg' %}" alt="" />
|
||||
<h1>Nummi</h1>
|
||||
</a>
|
||||
<a href="{% url 'account' %}"
|
||||
class="{% if request.resolver_match.url_name == 'account' %}cur{% endif %}"
|
||||
accesskey="n">
|
||||
{% translate "Account" %}
|
||||
</a>
|
||||
<a href="{% url 'transaction' %}"
|
||||
class="{% if request.resolver_match.url_name == 'transaction' %}cur{% endif %}"
|
||||
accesskey="n">
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
type="text/css"/>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
{% if accounts %}
|
||||
<h2>{% translate "Accounts" %}</h2>
|
||||
{% spaceless %}
|
||||
<div id="accounts">
|
||||
{% for acc in accounts %}
|
||||
<a href="{% url 'account' acc.id %}"><i class="fa fa-{{ acc.icon }}"></i>{{ acc }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endspaceless %}
|
||||
{% endif %}
|
||||
{% if transactions %}
|
||||
<h2>
|
||||
{% translate "Transactions" %}
|
||||
|
@ -33,10 +43,11 @@
|
|||
{% endif %}
|
||||
{% if snapshots %}
|
||||
<h2>{% translate "Snapshots" %}</h2>
|
||||
<div id="snapshots" class="table col1-5">
|
||||
<div id="snapshots" class="table col1-6">
|
||||
<div class="header">
|
||||
<strong class="attach center"><i class="fa fa-paperclip"></i></strong>
|
||||
<strong class="date center">{% translate "Date" %}</strong>
|
||||
<strong class="account center">{% translate "Account" %}</strong>
|
||||
<strong class="value center">{% translate "Value" %}</strong>
|
||||
<strong class="diff center">{% translate "Difference" %}</strong>
|
||||
<strong class="diff center">{% translate "Transactions" %}</strong>
|
||||
|
@ -54,6 +65,14 @@
|
|||
<span class="date num center">
|
||||
<a href="{% url 'snapshot' snap.id %}">{{ snap.date|date:"Y-m-d" }}</a>
|
||||
</span>
|
||||
<span class="account text center">
|
||||
{% if trans.account %}
|
||||
<i class="fa fa-{{ trans.account.icon }}"></i>
|
||||
<a href="{% url 'account' trans.account.id %}">{{ trans.account }}</a>
|
||||
{% else %}
|
||||
–
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="value num right">{{ snap.value|value }}</span>
|
||||
<span class="diff num right">{{ snap.diff|pmvalue }}</span>
|
||||
{% with sum=snap.sum %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% load main_extras %}
|
||||
{% load i18n %}
|
||||
<div id="transactions" class="table col1-6">
|
||||
<div id="transactions" class="table col1-7">
|
||||
<div class="header">
|
||||
<strong class="attach center"><i class="fa fa-paperclip"></i></strong>
|
||||
<strong class="date center">{% translate "Date" %}</strong>
|
||||
|
@ -8,6 +8,7 @@
|
|||
<strong class="value center">{% translate "Value" %}</strong>
|
||||
<strong class="trader center">{% translate "Trader" %}</strong>
|
||||
<strong class="category center">{% translate "Category" %}</strong>
|
||||
<strong class="account center">{% translate "Account" %}</strong>
|
||||
<strong class="description">{% translate "Description" %}</strong>
|
||||
</div>
|
||||
{% for trans in transactions %}
|
||||
|
@ -33,6 +34,14 @@
|
|||
–
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="account text center">
|
||||
{% if trans.account %}
|
||||
<i class="fa fa-{{ trans.account.icon }}"></i>
|
||||
<a href="{% url 'account' trans.account.id %}">{{ trans.account }}</a>
|
||||
{% else %}
|
||||
–
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="description text">{{ trans.description }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue