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

View file

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