Bills display

This commit is contained in:
Emily 2019-04-26 05:22:43 +01:00
parent 04cb34bd92
commit 24c9fae040
9 changed files with 95 additions and 67 deletions

View File

@ -19,6 +19,35 @@ logged_in_users = []
def dashboard(): def dashboard():
return render_template("pages/dashboard.html") 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"]) @glob.app.route("/login", methods = ["GET", "POST"])
def login(): def login():
if flask_login.current_user.is_authenticated: if flask_login.current_user.is_authenticated:

View File

@ -104,52 +104,30 @@
<div class="p-2"> <!-- Padding --> <div class="p-2"> <!-- Padding -->
<div class="flex-column"> <div class="flex-column">
<div> <!-- Collection --> <div> <!-- Collection -->
<a class="item" href="{{ url_for('dashboard') }}">
<i class="far fa-calendar-alt"></i><span>Dashboard</span>
</a>
</div>
<div>
<h4>Economical</h4>
</div>
<div>
<a class="item" href="{{ url_for('bills') }}">
<i class="fas fa-money-check-alt"></i><span>Bills</span>
</a>
</div>
<div>
<a class="item" onclick="toggleCategory(this)"> <a class="item" onclick="toggleCategory(this)">
<i class="fa fa-chart-bar"></i><span>Dashboard</span> <i class="far fa-list-alt"></i><span>Receipts</span>
<i class="fas fa-chevron-right"></i> <i class="fas fa-chevron-right"></i>
</a> </a>
<div class="downtab hidden"> <div class="downtab hidden">
<div class="flex-column"> <div class="flex-column">
<div class="page"> <div class="page">
<a href="#dash-test">Test</a> <a href="{{ url_for('receipts') }}">Receipts</a>
</div> </div>
<div class="page"> <div class="page">
<a href="#dash-demo">Demo</a> <a href="{{ url_for('warranties') }}">Warranties</a>
</div>
</div>
</div>
</div>
<div>
<h4>Title card</h4>
</div>
<div>
<a class="item" onclick="toggleCategory(this)">
<i class="fa fa-chart-bar"></i><span>Bills</span>
<i class="fas fa-chevron-right"></i>
</a>
<div class="downtab hidden">
<div class="flex-column">
<div class="page">
<a href="#bills-bills">Bills</a>
</div>
<div class="page">
<a href="#bills-log">Log</a>
</div>
</div>
</div>
</div>
<div>
<a class="item" onclick="toggleCategory(this)">
<i class="fa fa-chart-bar"></i><span>Receipt</span>
<i class="fas fa-chevron-right"></i>
</a>
<div class="downtab hidden">
<div class="flex-column">
<div class="page">
<a href="#recieps-recieps">Receipt</a>
</div>
<div class="page">
<a href="#recieps-log">Log</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,11 +0,0 @@
{% set title = "bill:)" %}
{% extends "layout/bootstrap.html" %}
{% block content %}
<p>lotsa bills</p>
<p>many bills</p>
<i class="fas fa-user"></i> <!-- uses solid style -->
<i class="far fa-user"></i> <!-- uses regular style -->
<i class="fab fa-github-square"></i> <!-- uses brands style -->
{% endblock %}

View File

@ -0,0 +1,36 @@
{% set title = "Bills" %}
{% extends "layout/dash.html" %}
{% block content %}
<div class="container module">
<table class="table">
<thead class="thead-light">
<tr>
<th scope="col">Payment to</th>
<th scope="col">Description</th>
<th scope="col">Sum</th>
<th scope="col">KID</th>
<th scope="col">Date Due</th>
<th scope="col">Payment status</th>
</tr>
</thead>
<tbody>
{% for row in data %}
<tr>
<th>{{ row[0] }}</th>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[3] }}</td>
<td>{{ row[4] }}</td>
<td>{{ row[5] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View File

@ -1,10 +0,0 @@
{% set title = "Kvitteringer" %}
{% extends "layout/bootstrap.html" %}
{% block content %}
<p>Tester siden!</p>
<p>KVITTERINGER FOR FAEN!</p>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% set title = "Dashboard" %}
{% extends "layout/dash.html" %}
{% block content %}
<div class="container module">
{% include "modules/calendar.html" %}
</div>
{% endblock %}

View File

@ -1,8 +0,0 @@
{% set title = "Regninger" %}
{% extends "layout/bootstrap.html" %}
{% block content %}
<p>Regninger :D</p>
<p>test</p>
{% endblock %}

View File

@ -1,8 +0,0 @@
{% set title = "testing" %}
{% extends "layout/bootstrap.html" %}
{% block content %}
<p>testing</p>
<p>tester dette</p>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% set title = "Dashboard" %}
{% extends "layout/dash.html" %}
{% block content %}
<div class="container module">
{% include "modules/calendar.html" %}
</div>
{% endblock %}