From 1675f5a5454e5d6747053c4a56fac98399d61a1d Mon Sep 17 00:00:00 2001 From: Florian Hartmann Date: Thu, 5 Mar 2020 11:06:09 +0100 Subject: [PATCH] use base template for main page --- financeplanner/admin.py | 2 +- .../templates/financeplanner/base.html | 2 +- .../templates/financeplanner/index.html | 351 +++++++++--------- 3 files changed, 172 insertions(+), 183 deletions(-) diff --git a/financeplanner/admin.py b/financeplanner/admin.py index fa5972a..93a2a41 100644 --- a/financeplanner/admin.py +++ b/financeplanner/admin.py @@ -6,7 +6,7 @@ from financeplanner.utils import format_price class AdminSite(admin.AdminSite): - index_title = "FloPlanner" + index_title = "FinancePlanner" site_title = "Admin Panel" site_header = "Admin Panel" site_url = reverse_lazy("finance:index") diff --git a/financeplanner/templates/financeplanner/base.html b/financeplanner/templates/financeplanner/base.html index 2762d2a..229f872 100644 --- a/financeplanner/templates/financeplanner/base.html +++ b/financeplanner/templates/financeplanner/base.html @@ -9,7 +9,7 @@ -

FloPlanner

+

📊 FinancePlanner 💰

{% block navi %}{% endblock %} diff --git a/financeplanner/templates/financeplanner/index.html b/financeplanner/templates/financeplanner/index.html index 63e5a78..a5c3403 100644 --- a/financeplanner/templates/financeplanner/index.html +++ b/financeplanner/templates/financeplanner/index.html @@ -1,209 +1,198 @@ -{% load static %} +{% extends "financeplanner/base.html" %} + {% load custom_tags %} - - - - - FinancePlanner - - - - -

📊 FinancePlanner

- -

+{% block navi %} Admin Panel - Logout -

+{% endblock %} -
- {% if daily_stats %} -
-
-
- {% for stat in daily_stats %} - {% if stat.percentage is None %} -
-
- {% else %} -
-
- {% endif %} - {% endfor %} -
- {% else %} -

No enough data from {{ start|date:"d.m.y" }} til {{ end|date:"d.m.y" }} to show a graph.

- {% endif %} -
+{% block content %} +
+ {% if daily_stats %} +
-
+
+ {% for stat in daily_stats %} + {% if stat.percentage is None %} +
+
+ {% else %} +
+
+ {% endif %} + {% endfor %} +
+ {% else %} +

No enough data from {{ start|date:"d.m.y" }} til {{ end|date:"d.m.y" }} to show a graph.

+ {% endif %} +
-
-

Analysis

-

current average amounts per month:

- - - - - - - - - - - - - - - -
income{{ avg_monthly_income|euro }}
expenses{{ avg_monthly_expenses|euro }}
result{{ avg_monthly_result|euro }}
- -

average irregular expenses based on the last half-a-year:

- - - - - - - - - - - - - - - -
monthly{{ avg_monthly_irregular_expenses|euro }}
weekly{{ avg_weekly_irregular_expenses|euro }}
daily{{ avg_daily_irregular_expenses|euro }}
- -

monthly result after irregular expenses: {{ avg_monthly_result_complete|euro }}

-
- -
-

Relevant Balances

- {% if balances %} +
+

Analysis

+

current average amounts per month:

- - - - - - - {% for balance in balances %} - - - - - {% endfor %} + + + + + + + + + + + +
dateamount
{{ balance.date|date:"d.m.y" }}{{ balance.amount|euro }}
income{{ avg_monthly_income|euro }}
expenses{{ avg_monthly_expenses|euro }}
result{{ avg_monthly_result|euro }}
- {% else %} -

-

- {% endif %} -
-
-

Relevant Stored Transactions

- {% if transactions %} +

average irregular expenses based on the last half-a-year:

- - - - - - - - - - {% for transaction in transactions %} - - - - - - - - {% endfor %} + + + + + + + + + + + +
subjectamountbooking daterecurring monthsnot recurring after
{{ transaction.subject }}{{ transaction.amount|euro }}{{ transaction.booking_date|date:"d.m.y" }}{{ transaction.recurring_months }}{{ transaction.not_recurring_after|date:"d.m.y" }}
monthly{{ avg_monthly_irregular_expenses|euro }}
weekly{{ avg_weekly_irregular_expenses|euro }}
daily{{ avg_daily_irregular_expenses|euro }}
- {% else %} -

-

- {% endif %} -
-
-

Calculated Actual Transactions

- {% if actual_transactions %} - - - - - - - - - - {% for trans in actual_transactions %} +

monthly result after irregular expenses: {{ avg_monthly_result_complete|euro }}

+ + +
+

Relevant Balances

+ {% if balances %} +
datesubjectamount
+ - - - + + - {% endfor %} - -
{{ trans.date|date:"d.m.y" }}{{ trans.subject }}{{ trans.amount|euro }}dateamount
- {% else %} -

-

- {% endif %} -
+ + + {% for balance in balances %} + + {{ balance.date|date:"d.m.y" }} + {{ balance.amount|euro }} + + {% endfor %} + + + {% else %} +

-

+ {% endif %} +
- + function showGraphBarDate(dateStr) { + datePanel.innerText = dateStr; + } - - + function clearGraphBarDate() { + datePanel.innerText = '-'; + } + + graph.addEventListener('mousedown', (event) => startDragScroll(event)); + graph.addEventListener('mouseleave', () => stopDragScroll()); + graph.addEventListener('mouseup', () => stopDragScroll()); + graph.addEventListener('mousemove', (event) => doDragScroll(event)); + +{% endblock %}