Fix bugs and update templating

This commit is contained in:
Edgar P. Burkhart 2022-05-22 12:32:26 +02:00
parent 5d6f47b852
commit df0882bd88
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
9 changed files with 105 additions and 100 deletions

View file

@ -26,35 +26,6 @@
{% if transactions %}
<h2>Transactions</h2>
<div id="transactions" class="table col6">
<div class="header">
<strong class="date center">Date</strong>
<strong class="name">Nom</strong>
<strong class="value center">Valeur</strong>
<strong class="trader center">Commerçant</strong>
<strong class="category center">Catégorie</strong>
<strong class="description">Description</strong>
</div>
{% for trans in transactions %}
<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">{{ 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 %}
<i class="fa fa-{{ trans.category.icon }}"></i>
<a href="{% url 'category' trans.category.id %}">
{{ trans.category }}
</a>
{% else %}
{% endif %}
</span>
<span class="description text">{{ trans.description }}</span>
</div>
{% endfor %}
</div>
{% transaction_table transactions %}
{% endif %}
{% endblock %}

View file

@ -12,35 +12,8 @@
<h1>Nummi</h1>
{% if transactions %}
<div id="transactions" class="table col6">
<div class="header">
<strong class="date center">Date</strong>
<strong class="name">Nom</strong>
<strong class="value center">Valeur</strong>
<strong class="trader center">Commerçant</strong>
<strong class="category center">Catégorie</strong>
<strong class="description">Description</strong>
</div>
{% for trans in transactions %}
<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">{{ 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 %}
<i class="fa fa-{{ trans.category.icon }}"></i>
<a href="{% url 'category' trans.category.id %}">
{{ trans.category }}
</a>
{% else %}
{% endif %}
</span>
<span class="description text">{{ trans.description }}</span>
</div>
{% endfor %}
</div>
<h2>Transactions</h2>
{% transaction_table transactions %}
{% endif %}
{% if snapshots %}
@ -58,11 +31,13 @@
<span class="date num center">
<a href="{% url 'snapshot' snap.date %}">{{ snap.date|date:"Y-m-d" }}</a>
</span>
<span class="value num right">{{ snap.value|floatformat:"2g" }} €</span>
<span class="diff num right">{{ snap.diff|floatformat:"2g"|pm }} €</span>
<span class="value num right">{% value snap.value %}</span>
<span class="diff num right">
{% pmvalue snap.diff %}
</span>
{% with sum=snap.sum %}
<span class="sum num right">
{% if sum is not None %}{{ sum|floatformat:"2g"|pm }} €{% endif %}
{% pmvalue sum %}
</span>
<span class="valid center">
{% if snap.previous is not None %}

View file

@ -36,37 +36,9 @@
</form>
{% if transactions %}
<h2>Transactions ({{ sum|floatformat:"2g"|pm }} € / {{ snapshot.diff|floatformat:"2g"|pm }} €)</h2>
<h2>Transactions ({% pmvalue sum %} / {% pmvalue snapshot.diff %})</h2>
<div id="transactions" class="table col6">
<div class="header">
<strong class="date center">Date</strong>
<strong class="name">Nom</strong>
<strong class="value center">Valeur</strong>
<strong class="trader center">Commerçant</strong>
<strong class="category center">Catégorie</strong>
<strong class="description">Description</strong>
</div>
{% for trans in transactions %}
<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">{{ 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 %}
<i class="fa fa-{{ trans.category.icon }}"></i>
<a href="{% url 'category' trans.category.id %}">
{{ trans.category }}
</a>
{% else %}
{% endif %}
</span>
<span class="description text">{{ trans.description }}</span>
</div>
{% endfor %}
</div>
{% transaction_table transactions %}
{% endif %}
{% endwith %}
{% endblock %}

View file

@ -0,0 +1,8 @@
{% extends "main/tag/value.html" %}
{% block "value" %}
{% if value %}
{% if value > 0 %}+{% endif %}
{{ block.super }}
{% else %}{% endif %}
{% endblock %}

View file

@ -0,0 +1,31 @@
{% load main_extras %}
<div id="transactions" class="table col6">
<div class="header">
<strong class="date center">Date</strong>
<strong class="name">Nom</strong>
<strong class="value center">Valeur</strong>
<strong class="trader center">Commerçant</strong>
<strong class="category center">Catégorie</strong>
<strong class="description">Description</strong>
</div>
{% for trans in transactions %}
<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">{% pmvalue trans.value %}</span>
<span class="trader text center">{{ trans.trader|default_if_none:"" }}</span>
<span class="category text center">
{% if trans.category %}
<i class="fa fa-{{ trans.category.icon }}"></i>
<a href="{% url 'category' trans.category.id %}">
{{ trans.category }}
</a>
{% else %}
{% endif %}
</span>
<span class="description text">{{ trans.description }}</span>
</div>
{% endfor %}
</div>

View file

@ -0,0 +1,7 @@
{% spaceless %}
<span>
{% block "value" %}
{{ value|floatformat:"2g" }} €
{% endblock %}
</span>
{% endspaceless %}