Snapshot table

This commit is contained in:
Edgar P. Burkhart 2022-05-22 09:21:30 +02:00
parent a3797bb7fb
commit 15a317dc0f
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
7 changed files with 87 additions and 8 deletions

View file

@ -1,5 +1,6 @@
{% extends "main/base.html" %}
{% load static %}
{% load main_extras %}
{% block link %}
{{ block.super }}
@ -23,7 +24,7 @@
<div class="transaction {% cycle 'w' 'g' %}">
<span class="date num center">{{ trans.date|date:"Y-m-d" }}</span>
<span class="name text"><a href="{% url 'transaction' trans.id %}">{{ trans.name }}</a></span>
<span class="value num right">{% if trans.value > 0 %}+{% endif %}{{ trans.value|floatformat:"2g" }} €</span>
<span class="value num right">{{ trans.value|floatformat:"2g"|pm }} €</span>
<span class="trader text center">{{ trans.trader|default_if_none:"" }}</span>
<span class="category text center">
{% if trans.category %}
@ -43,15 +44,33 @@
{% if snapshots %}
<h2>Relevés</h2>
<div id="snapshots" class="table col2">
<div id="snapshots" class="table col5">
<div class="header">
<strong class="date center">Date</strong>
<strong class="value center">Valeur</strong>
<strong class="diff center">Différence</strong>
<strong class="diff center">Transactions</strong>
<strong class="diff center">Valide</strong>
</div>
{% for snap in snapshots %}
<div class="snapshot {% cycle 'w' 'g' %}">
<span class="date num center">{{ snap.date|date:"Y-m-d" }}</span>
<span class="value num right">{{ snap.value }} €</span>
<span class="value num right">{{ snap.value|floatformat:"2g" }} €</span>
<span class="diff num right">{{ snap.diff|floatformat:"2g"|pm }} €</span>
{% with sum=snap.sum %}
<span class="sum num right">
{% if sum is not None %}{{ sum|floatformat:"2g"|pm }} €{% endif %}
</span>
<span class="valid center">
{% if snap.previous is not None %}
{% if sum == snap.diff %}
<i class="fa fa-check green"></i>
{% else %}
<i class="fa fa-xmark red"></i>
{% endif %}
{% endif %}
</span>
{% endwith %}
</div>
{% endfor %}
</div>