summaryrefslogtreecommitdiff
path: root/kosten/templates
diff options
context:
space:
mode:
Diffstat (limited to 'kosten/templates')
-rw-r--r--kosten/templates/404.jinja10
-rw-r--r--kosten/templates/categories/manage.jinja19
-rw-r--r--kosten/templates/consts/add.jinja13
-rw-r--r--kosten/templates/consts/edit.jinja14
-rw-r--r--kosten/templates/consts/list.jinja24
-rw-r--r--kosten/templates/consts/show.jinja39
-rw-r--r--kosten/templates/expenses/add.jinja13
-rw-r--r--kosten/templates/expenses/edit.jinja14
-rw-r--r--kosten/templates/expenses/search.jinja25
-rw-r--r--kosten/templates/expenses/show.jinja64
-rw-r--r--kosten/templates/js.jinja25
-rw-r--r--kosten/templates/layout.jinja81
-rw-r--r--kosten/templates/macros.jinja39
-rw-r--r--kosten/templates/menu.jinja14
-rw-r--r--kosten/templates/stats/const_dialog.jinja8
-rw-r--r--kosten/templates/stats/show.jinja12
-rw-r--r--kosten/templates/user/cpw.jinja13
-rw-r--r--kosten/templates/user/login.jinja13
18 files changed, 440 insertions, 0 deletions
diff --git a/kosten/templates/404.jinja b/kosten/templates/404.jinja
new file mode 100644
index 0000000..7142f5f
--- /dev/null
+++ b/kosten/templates/404.jinja
@@ -0,0 +1,10 @@
+{% extends "layout.jinja" %}
+{% set title = "404 -- Seite konnte nicht gefunden werden!" %}
+
+{% block heading %}404 -- Seite nicht gefunden{% endblock %}
+
+{% block content %}
+<p>
+ Sorry - die Seite <i>{{page}}</i> konnte nicht gefunden werden.
+</p>
+{% endblock %}
diff --git a/kosten/templates/categories/manage.jinja b/kosten/templates/categories/manage.jinja
new file mode 100644
index 0000000..7125c53
--- /dev/null
+++ b/kosten/templates/categories/manage.jinja
@@ -0,0 +1,19 @@
+{% extends "layout.jinja" %}
+
+{% block heading %} Kategorien {% endblock %}
+
+{% set JSFunction = "catsJS" %}
+
+{% block content %}
+ <form name="categories" method="post">
+ <ul class="arrow">
+ {% for c in cats %}
+ <li><span>{{c.name}}</span><input name="{{c.id}}" type="text" value="{{c.name}}" style="display:none;"></li>
+ {%- endfor %}
+ <div><img id="add" src="{{ "images/add.png" | static_url }}"></div>
+ </ul>
+ <input type="submit">
+ </form>
+ <input id="new" name="n-" style="display:none;" >
+{% endblock %}
+
diff --git a/kosten/templates/consts/add.jinja b/kosten/templates/consts/add.jinja
new file mode 100644
index 0000000..1ddad4a
--- /dev/null
+++ b/kosten/templates/consts/add.jinja
@@ -0,0 +1,13 @@
+{% extends "layout.jinja" %}
+{% from "macros.jinja" import render_form %}
+
+{% block heading %}
+ Füge neue konstante Ausgabe hinzu
+{% endblock %}
+
+{% block content %}
+ <form name="add_const_expense" method="post" action="{{ url_for(".add") }}">
+ {{ render_form(form) }}
+ <input type="submit" name="changeB">
+ </form>
+{% endblock %}
diff --git a/kosten/templates/consts/edit.jinja b/kosten/templates/consts/edit.jinja
new file mode 100644
index 0000000..b313704
--- /dev/null
+++ b/kosten/templates/consts/edit.jinja
@@ -0,0 +1,14 @@
+{% extends "layout.jinja" %}
+{% from "macros.jinja" import render_form %}
+
+{% block heading %}
+ Konstante Ausgabe bearbeiten
+{% endblock %}
+
+{% block content %}
+ <form name="edit_const_expense" method="post">
+ {{ render_form(form) }}
+ <input type="submit" name="changeB">
+ <input type="submit" name="deleteB" value="Eintrag löschen" />
+ </form>
+{% endblock %}
diff --git a/kosten/templates/consts/list.jinja b/kosten/templates/consts/list.jinja
new file mode 100644
index 0000000..7fef344
--- /dev/null
+++ b/kosten/templates/consts/list.jinja
@@ -0,0 +1,24 @@
+{% extends "layout.jinja" %}
+
+{% block heading %}
+ Konstante Kosten
+{% endblock %}
+
+{% block content %}
+ <p><a href="{{ url_for(".add") }}">Neuen Eintrag hinzufügen</a></p>
+
+ {{ list(current, "Aktuell") }}
+
+ {% if last_month %} {{ list(last_month, "Endeten letzten Monat") }} {% endif %}
+ {% if future %} {{ list(future, "Zukünftige") }} {% endif %}
+ {% if old %} {{ list(old, "Veraltet") }} {% endif %}
+{% endblock %}
+
+{% macro list(list, h) %}
+ <h2>{{ h }}</h2>
+ <ul class="arrow">
+ {% for c in list -%}
+ <li><a href="{{ url_for(".show", id = c.id) }}">{{c.description}} ({{c.expense | eur}})</a></li>
+ {% endfor %}
+ </ul>
+{% endmacro %}
diff --git a/kosten/templates/consts/show.jinja b/kosten/templates/consts/show.jinja
new file mode 100644
index 0000000..c09fc3b
--- /dev/null
+++ b/kosten/templates/consts/show.jinja
@@ -0,0 +1,39 @@
+{% extends "layout.jinja" %}
+{% from "macros.jinja" import left_arrow, right_arrow %}
+{% set fmt="%m.%Y" %}
+
+{% block heading %}
+ Konstante Kosten
+{% endblock %}
+
+{% block content %}
+ <ul class="arrow">
+ <li><span class="heading">Beschreibung:</span> {{exp.description}}</li>
+ <li><span class="heading">Kategorie:</span> {{exp.category.name}}</li>
+ <li><span class="heading">Betrag:</span> {{exp.expense | eur}}</li>
+ <li><span class="heading">Betrag pro Monat:</span> {{exp.monthly | eur}}</li>
+ <li><span class="heading">Start:</span> {{exp.start | date(format=fmt)}}</li>
+ <li><span class="heading">Ende:</span> {{exp.end | date(format=fmt)}}</li>
+ <li><span class="heading">Zahlungsrhythmus:</span>
+ {% if exp.months == 1 %}
+ monatlich
+ {% elif exp.months == 6 %}
+ halbjährlich
+ {% elif exp.months == 12 %}
+ jährlich
+ {% else %}
+ alle {{exp.months}} Monate
+ {% endif %}
+ </ul>
+ <p>
+ <a href="{{ url_for(".edit", id = exp.id) }}">Bearbeiten</a>&nbsp;
+ <a href="{{ url_for(".add_from", other = exp.id) }}">Erstelle neuen auf dem jetzigen basierenden Eintrag</a>
+ </p>
+ {% if exp.prev %} {{ left_arrow(url_for(".show", id = exp.prev.id), target(exp.prev)) }} {% endif %}
+ {% if exp.next %} {{ right_arrow(url_for(".show", id = exp.next.id), target(exp.next)) }} {% endif %}
+{% endblock %}
+
+{% macro target(p) -%}
+ {{ p.description }} ({{ p.start | date(fmt) ~ "-" ~ p.end | date(fmt) }})<br>
+ {{ p.expense | eur }}
+{%- endmacro %}
diff --git a/kosten/templates/expenses/add.jinja b/kosten/templates/expenses/add.jinja
new file mode 100644
index 0000000..cc0680f
--- /dev/null
+++ b/kosten/templates/expenses/add.jinja
@@ -0,0 +1,13 @@
+{% extends "layout.jinja" %}
+{% from "macros.jinja" import render_form %}
+
+{% block heading %}
+ Neue Ausgabe hinzufügen
+{% endblock %}
+
+{% block content %}
+ <form name="add_expense" method="post">
+ {{ render_form(form, expense = {'autofocus' : True}) }}
+ <input type="submit" name="changeB">
+ </form>
+{% endblock %}
diff --git a/kosten/templates/expenses/edit.jinja b/kosten/templates/expenses/edit.jinja
new file mode 100644
index 0000000..c871eb1
--- /dev/null
+++ b/kosten/templates/expenses/edit.jinja
@@ -0,0 +1,14 @@
+{% extends "expenses/add.jinja" %}
+{% from "macros.jinja" import render_form %}
+
+{% block heading %}
+ Bearbeite Kosteneintrag
+{% endblock %}
+
+{% block content %}
+ <form name="edit_expense" method="post">
+ {{ render_form(form) }}
+ <input type="submit" name="changeB">
+ <input type="submit" name="deleteB" value="Eintrag löschen" />
+ </form>
+{% endblock %}
diff --git a/kosten/templates/expenses/search.jinja b/kosten/templates/expenses/search.jinja
new file mode 100644
index 0000000..5cd294b
--- /dev/null
+++ b/kosten/templates/expenses/search.jinja
@@ -0,0 +1,25 @@
+{% extends "layout.jinja" %}
+
+{% block heading %}
+ Suchergebnisse
+{% endblock %}
+
+{% block content %}
+
+ {% set year = None %}
+
+ {% for exp in exps %}
+ {% if exp.year != year %}
+ {% if year != None %}</ul>{% endif %}
+ {% set year = exp.year %}
+ <h2>{{ year }}</h2>
+ <ul>
+ {% endif %}
+
+ <li>
+ <a href="{{ url_for(".edit", id = exp.id) }}">{{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur }}</a>
+ </li>
+
+ {% endfor %}
+
+{% endblock %}
diff --git a/kosten/templates/expenses/show.jinja b/kosten/templates/expenses/show.jinja
new file mode 100644
index 0000000..e1c21c8
--- /dev/null
+++ b/kosten/templates/expenses/show.jinja
@@ -0,0 +1,64 @@
+{% extends "layout.jinja" %}
+{% from "macros.jinja" import left_arrow, right_arrow, colorize %}
+
+{% set JSFunction = "showJS" %}
+{% set additionalJS = "highstock" %}
+
+{% block heading %}
+ {% if exps | length > 1 -%}
+ Aktuelle Kosten
+ {%- else -%}
+ Kosten für {{exps[0]|date}}
+ {% endif %}
+{% endblock %}
+
+{% block content %}
+ {% for e, p in zip(exps,pies) %}
+ {%+ if exps | length > 1 %}<h2>{{e|date}}</h2>{% endif %}
+ <div>
+ <div class="month_exp">
+ {% for c in e.catexps | sort(attribute="cat.name") %}
+ {% call(exp) detail(name=c.cat.name, sum=c.sum, set=c.all) -%}
+ <a href="{{ url_for(".edit", id = exp.id) }}">{{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur }}</a>
+ {%- endcall %}
+ {% endfor %}
+
+ {% call(exp) detail(name="Konstant", sum=e.constsum, set=e.consts) -%}
+ <a href="{{ url_for("consts.show", id = exp.id) }}">{{exp.monthly}} -- {{exp.description}}</a>
+ {%- endcall %}
+
+ {% call(exp) detail(name="In Summa", sum=e.sum, set=e.all, color="#ff2d2d") -%}
+ <a href="{{ url_for(".edit", id = exp.id) }}">{{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur}}</a>
+ {%- endcall %}
+ </div>
+ <div class="pie" data-pie='{{ p | tojson }}'></div>
+ </div>
+ {% endfor %}
+
+ {# Note: exps are given _reversed_, i.e. "exps | last" is
+ the _first_ on the timeline #}
+ {% set d = exps | last | prev_date | date %}
+ {{ left_arrow(url_for(".show_date_str", p = d), d) }}
+
+ {% set first = exps | first %}
+ {% if not first is last_date %}
+ {% set d = first | next_date | date %}
+ {{ right_arrow(url_for(".show_date_str", p = d), d) }}
+ {% endif %}
+{% endblock content %}
+
+{% macro detail(name, sum, set, color=None) %}
+ <div class="detail">
+ <img class="mark" src="{{ "images/closed.png" | static_url }}">
+ {% call colorize(fgcolor=color) -%}
+ <span class="heading">{{name}}:</span> <span class="sum">{{sum | eur}}</span><br>
+ {%- endcall %}
+ <div class="details">
+ <ul>
+ {% for exp in set %}
+ <li class="expense">{{ caller(exp) }}</li>
+ {% endfor %}
+ </ul>
+ </div>
+ </div>
+{% endmacro %}
diff --git a/kosten/templates/js.jinja b/kosten/templates/js.jinja
new file mode 100644
index 0000000..531c9e1
--- /dev/null
+++ b/kosten/templates/js.jinja
@@ -0,0 +1,25 @@
+{% set js_lib = {
+ "kosten" : "js/kosten.js",
+ "highstock" : "js/lib/highstock-4.2.2.js",
+ "jquery" : "js/lib/jquery-1.11.2.min.js",
+ }
+%}
+
+{% macro script(name) %}
+ {% if name in js_lib %}
+ <script type="text/javascript" src="{{ js_lib[name] | static_url }}"></script>
+ {% endif %}
+{% endmacro %}
+
+{% macro scripts(names) %}
+ {% if names is not string %}
+ {% for name in names %}
+ {{ script(name) }}
+ {% endfor %}
+ {% else %}
+ {{ script(names) }}
+ {% for name in varargs %}
+ {{ script(name) }}
+ {% endfor %}
+ {% endif %}
+{% endmacro %}
diff --git a/kosten/templates/layout.jinja b/kosten/templates/layout.jinja
new file mode 100644
index 0000000..b34cddb
--- /dev/null
+++ b/kosten/templates/layout.jinja
@@ -0,0 +1,81 @@
+{% from 'js.jinja' import scripts %}
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <link rel="shortcut icon" href="{{ "images/currency.png" | static_url }}" type="image/icon">
+ <title>{{ title or "Kostenverwaltung" }}</title>
+ {% block style %}
+ <link href="{{ "css/style.css" | static_url }}" rel="stylesheet" type="text/css">
+ {% endblock %}
+ </head>
+ {% if config['DEBUG'] %}<!-- {{ request.environ | safe }} -->{% endif %}
+ <body>
+ <div id="head-wrapper">
+ <div id="logo">
+ <img src="{{ "images/currency.png" | static_url }}">
+ <h1><a href="{{ url_for("index") }}">Kosten</a></h1>
+ {% if current_user.is_authenticated %}
+ <h2>»   {{ current_user.description | default('von ' ~ current_user.name, true) }}</h2>
+ {% endif %}
+ </div>
+
+ <div id="header">
+ <div id="menu">
+ {% block menu %}
+ {% from "menu.jinja" import menu with context %}
+ <ul>
+ {% for uri, page in menu %}
+ <li class="menu-item"><a href="{{ url_for(uri) }}">{{page}}</a></li>
+ {% endfor %}
+ {% if current_user.is_authenticated %}
+ <li class="search">
+ <img class="search" src="{{ "images/lupe.png" | static_url }}" alt="Search">
+ <form class="search" method="post" action="{{ url_for("expenses.search") }}">
+ <input type="search" value="" name="search" class="search">
+ <input type="submit" value="" class="search-submit">
+ </form>
+ </li>
+ {% endif %}
+ </ul>
+ {% endblock %}
+ </div>
+ </div>
+ </div>
+
+ <div id="page">
+ <div id="content">
+ {% with messages = get_flashed_messages(with_categories=true) %}
+ {% if messages %}
+ <ul id="messages">
+ {% for cat,msg in messages %}
+ <li class="msg-{{ cat }}">{{ msg }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% endwith %}
+ <h1 id="page_heading">{% block heading -%}{%- endblock %}</h1>
+ {% block content %}{% endblock %}
+ </div>
+ <div style="clear: both;"></div>
+ </div>
+ <div id="footer">
+ {% block footer %}
+ <p id="legal">
+ powered by <a href="https://palletsprojects.com/p/flask/">Flask</a> |
+ © 2010-2020. All Rights Reserved. René Neumann |
+ with the help of <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.
+ </p>
+ {% endblock %}
+ </div>
+ {% if not g.is_mobile %}
+ {% block js %}
+ {{ scripts("jquery", "kosten") }}
+ {% endblock %}
+ {% if additionalJS %}{{ scripts(additionalJS) }}{% endif %}
+ {% if JSFunction %}
+ <script type="text/javascript">{{ JSFunction }}()</script>
+ {% endif %}
+ {% endif %}
+ </body>
+</html>
diff --git a/kosten/templates/macros.jinja b/kosten/templates/macros.jinja
new file mode 100644
index 0000000..d7cd2fc
--- /dev/null
+++ b/kosten/templates/macros.jinja
@@ -0,0 +1,39 @@
+{# functions #}
+{% macro left_arrow(target,label) %}
+ <a id="left" href="{{target}}">
+ <div>
+ <img class="arrow" src="{{ "images/arrow_left.png" | static_url }}">
+ <span class="navdate">{{label}}</span>
+ </div>
+ </a>
+{% endmacro %}
+
+{% macro right_arrow(target,label) %}
+ <a id="right" href="{{target}}">
+ <div>
+ <span class="navdate">{{label}}</span>
+ <img class="arrow" src="{{ "images/arrow_right.png" | static_url }}">
+ </div>
+ </a>
+{% endmacro %}
+
+{% macro colorize(fgcolor=None, bgcolor=None, tag='span') -%}
+ {% if not fgcolor and not bgcolor %}
+ {{ caller() }}
+ {% else %}
+ {% set style = "" %}
+ {% if fgcolor: %}{% set style = style ~ " color: " ~ fgcolor %}{% endif %}
+ {% if bgcolor: %}{% set style = style ~ " background: " ~ bgcolor %}{% endif %}
+ <{{tag}} style="{{style}}">{{caller()}}</{{tag}}>
+ {% endif %}
+{% endmacro %}
+
+{% macro render_form(form) %}
+ <table>
+ {% for field in form if not field is hidden %}
+ <tr><th>{{ field.label }}</th><td>{{ field(**kwargs.get(field.short_name, {})) }}</td><td>{{ field.description }}</td>
+ <td>{% if field.errors %}<span class="error">{{ field.errors[0] }}</span>{% endif %}</td></tr>
+ {% endfor %}
+ </table>
+ {{ form.hidden_tag() }}
+{% endmacro %}
diff --git a/kosten/templates/menu.jinja b/kosten/templates/menu.jinja
new file mode 100644
index 0000000..df5b6a1
--- /dev/null
+++ b/kosten/templates/menu.jinja
@@ -0,0 +1,14 @@
+{% set menu = [
+ ("index", "Kosten"),
+ ("expenses.add", "Neu"),
+ ("consts.list", "Konstante Kosten"),
+ ("categories.manage", "Kategorien"),
+ ("stats.show", "Statistiken")
+ ]
+%}
+{% if current_user.is_authenticated %}
+ {% set menu = menu + [
+ ("user.cpw", "Passwort ändern"),
+ ("user.logout", "Logout")]
+ %}
+{% endif %}
diff --git a/kosten/templates/stats/const_dialog.jinja b/kosten/templates/stats/const_dialog.jinja
new file mode 100644
index 0000000..9f059b8
--- /dev/null
+++ b/kosten/templates/stats/const_dialog.jinja
@@ -0,0 +1,8 @@
+
+<ul class="arrow">
+ {% for c in consts -%}
+ <li><a href="{{ url_for("consts.show", id = c.id) }}">{{c.description}}</a>
+ ({{c.monthly | eur}})
+ </li>
+ {% endfor %}
+</ul>
diff --git a/kosten/templates/stats/show.jinja b/kosten/templates/stats/show.jinja
new file mode 100644
index 0000000..ac271ac
--- /dev/null
+++ b/kosten/templates/stats/show.jinja
@@ -0,0 +1,12 @@
+{% extends "layout.jinja" %}
+
+{% set JSFunction = "statJS" %}
+{% set additionalJS = ["highstock"] %}
+
+{% block heading %}
+ Statistiken
+{% endblock %}
+
+{% block content %}
+ <div class="stats" data-consts='{{ consts | tojson }}' data-expenses='{{ expenses | tojson }}'></div>
+{% endblock content %}
diff --git a/kosten/templates/user/cpw.jinja b/kosten/templates/user/cpw.jinja
new file mode 100644
index 0000000..74d65dc
--- /dev/null
+++ b/kosten/templates/user/cpw.jinja
@@ -0,0 +1,13 @@
+{% extends "layout.jinja" %}
+{% from "macros.jinja" import render_form %}
+
+{% block heading %}
+ Passwort ändern
+{% endblock %}
+
+{% block content %}
+ <form name="login" method="post">
+ {{ render_form(form, old = {'autofocus' : True}) }}
+ <input type="submit">
+ </form>
+{% endblock %}
diff --git a/kosten/templates/user/login.jinja b/kosten/templates/user/login.jinja
new file mode 100644
index 0000000..0b2813c
--- /dev/null
+++ b/kosten/templates/user/login.jinja
@@ -0,0 +1,13 @@
+{% extends "layout.jinja" %}
+{% from "macros.jinja" import render_form %}
+
+{% block heading %}
+ Login
+{% endblock %}
+
+{% block content %}
+ <form name="login" method="post">
+ {{ render_form(form, username = {'autofocus' : True}) }}
+ <input type="submit">
+ </form>
+{% endblock %}