From 24c9fae040a071269760ebfd5615c04b4825f115 Mon Sep 17 00:00:00 2001 From: Sunpy Date: Fri, 26 Apr 2019 05:22:43 +0100 Subject: [PATCH] Bills display --- routes.py | 29 +++++++++++++++++++ templates/layout/includes/side_nav.html | 38 ++++++------------------- templates/pages/bill.html | 11 ------- templates/pages/bills.html | 36 +++++++++++++++++++++++ templates/pages/kvittering.html | 10 ------- templates/pages/receipts.html | 11 +++++++ templates/pages/regninger.html | 8 ------ templates/pages/testing.html | 8 ------ templates/pages/warranties.html | 11 +++++++ 9 files changed, 95 insertions(+), 67 deletions(-) delete mode 100644 templates/pages/bill.html create mode 100644 templates/pages/bills.html delete mode 100644 templates/pages/kvittering.html create mode 100644 templates/pages/receipts.html delete mode 100644 templates/pages/regninger.html delete mode 100644 templates/pages/testing.html create mode 100644 templates/pages/warranties.html diff --git a/routes.py b/routes.py index c8c3fec..1ab3671 100644 --- a/routes.py +++ b/routes.py @@ -19,6 +19,35 @@ logged_in_users = [] def dashboard(): return render_template("pages/dashboard.html") +@glob.app.route("/bills") +@flask_login.login_required +def bills(): + conn = glob.get_sql_connection() + cur = conn.cursor() + + cur.execute(""" + SELECT Betaletil, Regningfor, Regningsum, KID, Betalingsfrist, Betalt + FROM Regninger + WHERE BrukerID = %s + """, (flask_login.current_user.id,)) + + data = [] + for row in cur: + data.append(row) + + cur.close() + return render_template("pages/bills.html", data=data) + +@glob.app.route("/warranties") +@flask_login.login_required +def warranties(): + return "AAAA" + +@glob.app.route("/receipts") +@flask_login.login_required +def receipts(): + return "AAAA" + @glob.app.route("/login", methods = ["GET", "POST"]) def login(): if flask_login.current_user.is_authenticated: diff --git a/templates/layout/includes/side_nav.html b/templates/layout/includes/side_nav.html index 44da047..f6a3c14 100644 --- a/templates/layout/includes/side_nav.html +++ b/templates/layout/includes/side_nav.html @@ -104,52 +104,30 @@
- - Dashboard - + + Dashboard -
-

Title card

+

Economical

- - Bills - + + Bills -
- Receipt + Receipts diff --git a/templates/pages/bill.html b/templates/pages/bill.html deleted file mode 100644 index ea43231..0000000 --- a/templates/pages/bill.html +++ /dev/null @@ -1,11 +0,0 @@ -{% set title = "bill:)" %} - -{% extends "layout/bootstrap.html" %} - -{% block content %} -

lotsa bills

-

many bills

- - - -{% endblock %} \ No newline at end of file diff --git a/templates/pages/bills.html b/templates/pages/bills.html new file mode 100644 index 0000000..5f43645 --- /dev/null +++ b/templates/pages/bills.html @@ -0,0 +1,36 @@ +{% set title = "Bills" %} + +{% extends "layout/dash.html" %} + +{% block content %} + +
+ + + + + + + + + + + + + +{% for row in data %} + + + + + + + + +{% endfor %} + +
Payment toDescriptionSumKIDDate DuePayment status
{{ row[0] }}{{ row[1] }}{{ row[2] }}{{ row[3] }}{{ row[4] }}{{ row[5] }}
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/templates/pages/kvittering.html b/templates/pages/kvittering.html deleted file mode 100644 index 5743bef..0000000 --- a/templates/pages/kvittering.html +++ /dev/null @@ -1,10 +0,0 @@ -{% set title = "Kvitteringer" %} - -{% extends "layout/bootstrap.html" %} - -{% block content %} - -

Tester siden!

-

KVITTERINGER FOR FAEN!

- -{% endblock %} \ No newline at end of file diff --git a/templates/pages/receipts.html b/templates/pages/receipts.html new file mode 100644 index 0000000..85b6cd8 --- /dev/null +++ b/templates/pages/receipts.html @@ -0,0 +1,11 @@ +{% set title = "Dashboard" %} + +{% extends "layout/dash.html" %} + +{% block content %} + +
+{% include "modules/calendar.html" %} +
+ +{% endblock %} \ No newline at end of file diff --git a/templates/pages/regninger.html b/templates/pages/regninger.html deleted file mode 100644 index 87e0e34..0000000 --- a/templates/pages/regninger.html +++ /dev/null @@ -1,8 +0,0 @@ -{% set title = "Regninger" %} - -{% extends "layout/bootstrap.html" %} - -{% block content %} -

Regninger :D

-

test

-{% endblock %} \ No newline at end of file diff --git a/templates/pages/testing.html b/templates/pages/testing.html deleted file mode 100644 index 91a7ad0..0000000 --- a/templates/pages/testing.html +++ /dev/null @@ -1,8 +0,0 @@ -{% set title = "testing" %} - -{% extends "layout/bootstrap.html" %} - -{% block content %} -

testing

-

tester dette

-{% endblock %} \ No newline at end of file diff --git a/templates/pages/warranties.html b/templates/pages/warranties.html new file mode 100644 index 0000000..85b6cd8 --- /dev/null +++ b/templates/pages/warranties.html @@ -0,0 +1,11 @@ +{% set title = "Dashboard" %} + +{% extends "layout/dash.html" %} + +{% block content %} + +
+{% include "modules/calendar.html" %} +
+ +{% endblock %} \ No newline at end of file