Fixed bugs and added webinterface

This commit is contained in:
fleaz 2020-03-05 23:52:33 +01:00
parent 9c59b349c2
commit afbe8a96b1
11 changed files with 171 additions and 4 deletions

34
views/base.tpl Normal file
View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="d">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Schmeckels</title>
<link href="https://unpkg.com/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
<link href="https://unpkg.com/@tailwindcss/custom-forms/dist/custom-forms.min.css" rel="stylesheet">
</head>
<body class="bg-grey-100 font-sans leading-normal tracking-normal">
<div class="bg-gray-300">
<ul class="flex pb-3 pt-3">
<li class="ml-12 mr-12">
<a class="text-blue-500 hover:text-blue-800" href="/">SCHMECKELS</a>
</li>
<li class="mr-2">
<a class="text-blue-500 hover:text-blue-800" href="/transactions">Transactions</a>
</li>
<li class="mr-2">
<a class="text-blue-500 hover:text-blue-800" href="/categories">Categories</a>
</li>
</ul>
</div>
<div class="container mx-auto">
{{!base}}
</div>
</body>
</html>

8
views/categories.tpl Normal file
View file

@ -0,0 +1,8 @@
% rebase("base.tpl")
List of categories:
<ul>
% for c in categories:
<li><a href="/category/{{ c.name }}">{{ c.full_name() }}</a></li>
% end
</ul>

26
views/category.tpl Normal file
View file

@ -0,0 +1,26 @@
% rebase("base.tpl")
<h1>Transaktionen aus {{ category.full_name() }}</h1>
<table class="table-auto">
<thead>
<tr>
<th class="px-4 py-2">Date</th>
<th class="px-4 py-2">Sender/Empfänger</th>
<th class="px-4 py-2">Verwendungszweck</th>
<th class="px-4 py-2">Betrag</th>
<th class="px-4 py-2">Kategorie</th>
</tr>
</thead>
<tbody>
% for t in transactions:
<tr>
<td class="border px-4 py-2">{{ t.get_date("de") }}</td>
<td class="border px-4 py-2">{{ t.name }}</td>
<td class="border px-4 py-2">{{ t.description }}</td>
<td class="border px-4 py-2 {{ 'text-green-500' if t.is_positive() else 'text-red-500' }}">{{ t.pretty_amount() }}</td>
<td class="border px-4 py-2">{{ t.category.full_name() if t.category else "-" }}</td>
</tr>
% end
</tbody>
</table>

3
views/index.tpl Normal file
View file

@ -0,0 +1,3 @@
% rebase("base.tpl")
<h1 class="text-2xl font-bold text-indigo-500">Hello World</h1>

28
views/transactions.tpl Normal file
View file

@ -0,0 +1,28 @@
% rebase("base.tpl")
<table class="table-auto">
<thead>
<tr>
<th class="px-4 py-2">Date</th>
<th class="px-4 py-2">Sender/Empfänger</th>
<th class="px-4 py-2">Verwendungszweck</th>
<th class="px-4 py-2">Betrag</th>
<th class="px-4 py-2">Kategorie</th>
</tr>
</thead>
<tbody>
% for t in transactions:
<tr>
<td class="border px-4 py-2">{{ t.get_date("de") }}</td>
<td class="border px-4 py-2">{{ t.name }}</td>
<td class="border px-4 py-2">{{ t.description }}</td>
<td class="border px-4 py-2 {{ 'text-green-500' if t.is_positive() else 'text-red-500' }}">{{ t.pretty_amount() }}</td>
% if t.category:
<td class="border px-4 py-2"> <a href="/category/{{ t.category.name }}"> {{ t.category.full_name()}}</a></td>
% else:
<td class="border px-4 py-2"> - </td>
% end
</tr>
% end
</tbody>
</table>