Added categry table to website

This commit is contained in:
fleaz 2020-03-30 21:24:11 +02:00
parent 1f54614ae7
commit 851ecdbc57
4 changed files with 52 additions and 9 deletions

View file

@ -1,11 +1,17 @@
% rebase("base.tpl")
List of categories:
<h1 class="text-2xl font-bold text-indigo-500">Category overview</h1>
<ul>
% for c in categories:
<li>
<a href="/category/{{ c.name }}">{{ c.full_name() }}</a>
<a class="text-red-600 ml-2" href="/category/{{ c.name }}/delete">❌</a>
% for c in categories:
<li class="p-2">
{{ c.full_name() }}
<a class="float-right" href="/category/{{ c.name }}">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold mx-2 y-1 px-2 rounded"> Transactions </button>
</a>
<a class="float-right" href="/category/{{ c.name }}/delete">
<button class="bg-red-500 hover:bg-red-700 text-white font-bold y-1 px-2 rounded"> Delete </button>
</a>
</li>
% end
</ul>
% end
</ul>

View file

@ -1,3 +1,19 @@
% rebase("base.tpl")
<h1 class="text-2xl font-bold text-indigo-500">Hello World</h1>
<h1 class="text-2xl font-bold text-indigo-500">Monatsübersicht</h1>
<table class="table-auto border-none">
<thead>
<tr>
<th class="px-4 py-2">Categorie</th>
<th class="px-4 py-2 text-right">Summe</th>
</tr>
</thead>
<tbody>
% for c in categories:
<tr>
<td class="border px-4 py-2">{{ c["name"] }}</td>
<td class="border px-4 py-2 text-right {{ 'text-green-500' if c['amount'] > 0 else 'text-red-500' }}">{{ c["amount"] }} €</td>
</tr>
% end
</tbody>