Empty tables are now visible
This commit is contained in:
parent
a3f28631df
commit
2d7957b813
7 changed files with 45 additions and 32 deletions
|
@ -10,13 +10,11 @@
|
|||
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
|
||||
{% block tables %}
|
||||
{% if not form.instance|adding %}
|
||||
{% if statements %}
|
||||
<h3>{% translate "Statements" %}</h3>
|
||||
{% include "statement/statement_table.html" %}
|
||||
{% endif %}
|
||||
{% if transactions %}
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
{% if history.data %}
|
||||
<h3>{% translate "History" %}</h3>
|
||||
{% include "history/plot.html" %}
|
||||
{% endif %}
|
||||
|
|
|
@ -9,10 +9,8 @@
|
|||
{% endblock %}
|
||||
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
|
||||
{% block tables %}
|
||||
{% if transactions %}
|
||||
<h3>{% translate "Transactions" %}</h3>
|
||||
{% include "transaction/transaction_table.html" %}
|
||||
{% endif %}
|
||||
{% if history.data %}
|
||||
<h3>{% translate "History" %}</h3>
|
||||
{% include "history/plot.html" %}
|
||||
|
|
|
@ -19,14 +19,17 @@ class CategoryUpdateView(NummiUpdateView):
|
|||
pk_url_kwarg = "category"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
_max = 8
|
||||
data = super().get_context_data(**kwargs)
|
||||
category = data["form"].instance
|
||||
|
||||
return data | {
|
||||
"transactions": category.transaction_set.all()[:8],
|
||||
"transactions_url": reverse_lazy(
|
||||
data["transactions"] = category.transaction_set.all()[:_max]
|
||||
if len(data["transactions"]) == _max:
|
||||
data["transactions_url"] = reverse_lazy(
|
||||
"category_transactions", args=(category.pk,)
|
||||
),
|
||||
)
|
||||
|
||||
return data | {
|
||||
"history": history(category.transaction_set),
|
||||
}
|
||||
|
||||
|
|
|
@ -47,3 +47,8 @@ th {
|
|||
.date {
|
||||
text-align: center;
|
||||
}
|
||||
td.empty {
|
||||
text-align: center;
|
||||
opacity: 0.8;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,10 @@
|
|||
<td class="value">{{ snap.diff|pmvalue }}</td>
|
||||
<td class="value">{{ snap.sum|pmvalue }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td class="empty" colspan="{% if account %}6{% else %}8{% endif %}">{% translate "No transaction" %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<th>{% translate "Delete" %}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if transaction.invoices %}
|
||||
{% for invoice in transaction.invoices %}
|
||||
<tr>
|
||||
<th scope="row" class="l">
|
||||
|
@ -24,12 +23,11 @@
|
|||
<a href="{{ invoice.get_delete_url }}">{% translate "Delete" %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="3">{% translate "No invoice" %}</td>
|
||||
<td class="empty" colspan="3">{% translate "No invoice" %}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
|
|
|
@ -64,6 +64,13 @@
|
|||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td class="empty"
|
||||
colspan="{% if category and account %}5{% elif category or account %}7{% else %}9{% endif %}">
|
||||
{% translate "No transaction" %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Reference in a new issue