diff --git a/nummi/main/static/main/css/index.css b/nummi/main/static/main/css/index.css index ca11863..9a68717 100644 --- a/nummi/main/static/main/css/index.css +++ b/nummi/main/static/main/css/index.css @@ -6,47 +6,55 @@ h1 { margin: 0; } -#transactions { +.table { display: grid; - grid-template-columns: repeat(6, auto); margin: 2em 0; border-radius: 1em 0 1em 0; overflow: hidden; - border-bottom: .5em solid var(--text); + border-bottom: .5em solid var(--bg-inv); } +.table.col2 {grid-template-columns: repeat(2, auto)} +.table.col3 {grid-template-columns: repeat(3, auto)} +.table.col4 {grid-template-columns: repeat(4, auto)} +.table.col5 {grid-template-columns: repeat(5, auto)} +.table.col6 {grid-template-columns: repeat(6, auto)} -#transactions > div { +.table > div { display: contents; } -#transactions > div > * { +.table > div > * { padding: 1em; white-space: nowrap; } -#transactions > div.g> * { +.table > div.g> * { background: var(--bg-01); } -#transactions > div.header > * { +.table > div.header > * { background: var(--bg-inv); color: var(--text-inv); } -#transactions > div > .center { +.table > div > .center { text-align: center; } -#transactions > div > span.value { +.table > div > .right { text-align: right; } -#transactions > div > .num { +.table > div > .num { font-feature-settings: "tnum", "ss01"; } -#transactions > div > span.text { +.table > div > span.text { overflow: hidden; text-overflow: ellipsis; } #categories > a { - margin-right: 1em; + margin-right: var(--gap); +} + +#snapshots { + max-width: 24rem; } diff --git a/nummi/main/templates/main/index.html b/nummi/main/templates/main/index.html index 876716e..daa7cef 100644 --- a/nummi/main/templates/main/index.html +++ b/nummi/main/templates/main/index.html @@ -10,7 +10,7 @@

Nummi

{% if transactions %} -
+
Date Nom @@ -23,7 +23,7 @@
{{ trans.date|date:"Y-m-d" }} {{ trans.name }} - {% if trans.value > 0 %}+{% endif %}{{ trans.value|floatformat:"2g" }} € + {% if trans.value > 0 %}+{% endif %}{{ trans.value|floatformat:"2g" }} € {{ trans.trader|default_if_none:"–" }} {% if trans.category %} @@ -41,6 +41,22 @@
{% endif %} +{% if snapshots %} +

Relevés

+
+
+ Date + Valeur +
+ {% for snap in snapshots %} +
+ {{ snap.date|date:"Y-m-d" }} + {{ snap.value }} € +
+ {% endfor %} +
+{% endif %} + {% if categories %}

Catégories

diff --git a/nummi/main/views.py b/nummi/main/views.py index 8afcc8c..f3805df 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -10,17 +10,20 @@ from .models import ( InvoiceForm, Category, CategoryForm, + Snapshot, ) @login_required def index(request): - _transactions = Transaction.objects.order_by("-date")[:5] + _transactions = Transaction.objects.all()[:5] _categories = Category.objects.all() + _snapshots = Snapshot.objects.all()[:5] context = { "transactions": _transactions, "categories": _categories, + "snapshots": _snapshots, } return render(request, "main/index.html", context)