Update snapshot table

This commit is contained in:
Edgar P. Burkhart 2023-04-18 10:35:12 +02:00
parent 6ca8ca6493
commit a364b38651
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 72 additions and 50 deletions

View file

@ -1,56 +1,74 @@
{% load main_extras %}
{% load i18n %}
<div id="snapshots"
class="table {% if account %}col2-4{% else %}col2-5{% endif %}">
<div class="header">
<strong class="diff center"><i class="fa fa-check"></i></strong>
<strong class="attach center"><i class="fa fa-paperclip"></i></strong>
<strong class="date center">{% translate "Date" %}</strong>
{% if not account %}
<strong class="account center">{% translate "Account" %}</strong>
{% endif %}
<strong class="value center">{% translate "Value" %}</strong>
<strong class="diff center">{% translate "Difference" %}</strong>
<strong class="diff center">{% translate "Transactions" %}</strong>
</div>
<div id="snapshots">
<table>
<colgroup>
<col class="icon" span="2">
<col class="date">
{% if not account %}
<col class="icon">
<col class="desc">
{% endif %}
<col class="value" span="3">
</colgroup>
<thead>
<th>
<i class="fa fa-check"></i>
</th>
<th>
<i class="fa fa-paperclip"></i>
</th>
<th>{% translate "Date" %}</th>
{% if not account %}
<th colspan="2">{% translate "Account" %}</th>
{% endif %}
<th>{% translate "Value" %}</th>
<th>{% translate "Difference" %}</th>
<th>{% translate "Transactions" %}</th>
</thead>
<tbody>
{% for snap in snapshots %}
<tr>
<td class="c">
<i class="fa fa-{% if snap.sum == snap.diff %}check green{% else %}xmark red{% endif %}"></i>
</td>
<td class="c">
{% if snap.file %}
<a href="{{ snap.file.url }}">
<i class="fa fa-paperclip"></i>
</a>
{% endif %}
</td>
<th class="date" scope="row">
<a href="{% url "snapshot" pk=snap.id %}">{{ snap.date|date:"Y-m-d" }}</a>
</th>
{% if not account %}
<td class="r">
<i class="fa fa-{{ snap.account.icon }}"></i>
</td>
<td>
<a href="{% url "account" pk=snap.account.id %}">{{ snap.account }}</a>
</td>
<td class="value">{{ snap.value|value }}</td>
<td class="value">{{ snap.diff|pmvalue }}</td>
<td class="value">{{ snap.sum|pmvalue }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% comment %}
<div id="snapshots" class="table {% if account %}col2-4{% else %}col2-5{% endif %}">
{% if new_snapshot_url %}
<div class="full-line">
<a href="{{ new_snapshot_url }}">{% translate "New statement" %}</a>
</div>
{% endif %}
{% for snap in snapshots %}
<div class="snapshot">
<span class="valid center">
{% if snap.sum == snap.diff %}
<i class="fa fa-check green"></i>
{% else %}
<i class="fa fa-xmark red"></i>
{% endif %}
</span>
<span class="attach center">
{% if snap.file %}
<a href="{{ snap.file.url }}">
<i class="fa fa-paperclip"></i>
</a>
{% endif %}
</span>
<span class="date num center">
<a href="{% url 'snapshot' pk=snap.id %}">{{ snap.date|date:"Y-m-d" }}</a>
</span>
{% if not account %}
<span class="account text center">
<i class="fa fa-{{ snap.account.icon }}"></i>
<a href="{% url 'account' pk=snap.account.id %}">{{ snap.account }}</a>
</span>
{% endif %}
<span class="value num right">{{ snap.value|value }}</span>
<span class="diff num right">{{ snap.diff|pmvalue }}</span>
<span class="sum num right">{{ snap.sum|pmvalue }}</span>
</div>
{% endfor %}
{% if snapshots_url %}
<div class="full-line">
<a href="{{ snapshots_url }}">{% translate "View all statements" %}</a>
</div>
{% endif %}
</div>
{% endcomment %}

View file

@ -3,15 +3,19 @@
<div id="transactions">
<table>
<colgroup>
<col class="icon c">
<col class="icon">
<col class="date">
<col class="desc">
<col class="value">
<col class="desc">
<col class="icon">
<col class="desc">
<col class="icon">
<col class="desc">
{% if not category %}
<col class="icon">
<col class="desc">
{% endif %}
{% if not account %}
<col class="icon">
<col class="desc">
{% endif %}
</colgroup>
<thead>
<th>
@ -50,7 +54,7 @@
<i class="fa fa-{{ trans.category.icon }}"></i>
</td>
<td>
<a href="{% url 'category' pk=trans.category.id %}">{{ trans.category }}</a>
<a href="{% url "category" pk=trans.category.id %}">{{ trans.category }}</a>
</td>
{% else %}
<td class="c" colspan="2"></td>
@ -62,7 +66,7 @@
<i class="fa fa-{{ trans.account.icon }}"></i>
</td>
<td>
<a href="{% url 'account' pk=trans.account.id %}">{{ trans.account }}</a>
<a href="{% url "account" pk=trans.account.id %}">{{ trans.account }}</a>
</td>
{% endif %}
</tr>