- add billing pages without function
only the blank html pages were added and the path was set in views.py the actual email functionality has to be added
This commit is contained in:
@@ -1,10 +1,34 @@
|
||||
{% extends "base.html"%}
|
||||
{% set title = "Konsumatverwaltung" %}
|
||||
{% set title = "Rechnungen versenden" %}
|
||||
{% block content %}
|
||||
<h3>TODO: </h3>
|
||||
<ul>
|
||||
<li>everything</li>
|
||||
<li>implement paying</li>
|
||||
</ul>
|
||||
{% if success %}
|
||||
<p>{{ success }}</p>
|
||||
{% endif %}
|
||||
<h1>Abrechnung</h1>
|
||||
|
||||
<form name="billing" method="post" action="/billing">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Geschwärzt</th>
|
||||
<th>Schulden</th>
|
||||
<th>Bezahlt</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td>{{user.longname}}</td>
|
||||
<td>{% if user.isblack %} ☑ {% else %} ☐ {% endif %}</td>
|
||||
<td>{{dept}} € </td>
|
||||
<td> <input type="number" name="{{user.name}}_payed" step="any" required value="0" /> € </td>
|
||||
<td>Einzelne Rechnung <a href="/billing/send_personal_bill/{{user.name}}">versenden</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<input type="submit" value="Änderungen übernehmen">
|
||||
</form>
|
||||
<p>An alle User Rechnungen <a href="/billing/send_all_bills"> versenden</a>.</p>
|
||||
{% endblock %}
|
||||
23
app/templates/billing_mass_mail.html
Normal file
23
app/templates/billing_mass_mail.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html"%}
|
||||
{% set title = "An alle User Rechnung versenden" %}
|
||||
{% block content %}
|
||||
<h3>TODO: </h3>
|
||||
<ul>
|
||||
<li>actual send emails</li>
|
||||
<li>save default text somewhere and make it configureable</li>
|
||||
<li>parse wildcards</li>
|
||||
</ul>
|
||||
{% if success %}
|
||||
<p>{{ success }}</p>
|
||||
{% endif %}
|
||||
<h1>Rechnung an alle verschicken</h1>
|
||||
<form name="billing" method="post" action="/billing/send_all_bills">
|
||||
<textarea cols="80" rows="20">
|
||||
Hallo %%longname%%
|
||||
du hast zurzeit viele Schulden.
|
||||
%%if_is_black%%Weil du zu hohe Schulden hast, bist du geschwärzt%%endif%%
|
||||
</textarea>
|
||||
|
||||
<input type="submit" value="Email versenden">
|
||||
</form>
|
||||
{% endblock %}
|
||||
23
app/templates/billing_personal.html
Normal file
23
app/templates/billing_personal.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html"%}
|
||||
{% set title = "Persönliche Rechnung versenden" %}
|
||||
{% block content %}
|
||||
<h3>TODO: </h3>
|
||||
<ul>
|
||||
<li>actual send emails</li>
|
||||
<li>save default text somewhere and make it configureable</li>
|
||||
</ul>
|
||||
{% if success %}
|
||||
<p>{{ success }}</p>
|
||||
{% endif %}
|
||||
<h1>Rechnung an {{user_to_bill.longname}} verschicken</h1>
|
||||
<form name="billing" method="post" action="/billing/send_personal_bill/{{user_to_bill.name}}">
|
||||
<textarea cols="80" rows="20">
|
||||
Hallo {{user_to_bill.longname}}
|
||||
du hast zurzeit viele Schulden.
|
||||
{% if user_to_bill.isblack %}Weil du zu hohe Schulden hast, bist du geschwärzt{% endif %}
|
||||
</textarea>
|
||||
|
||||
<input type="submit" value="Email versenden">
|
||||
</form>
|
||||
<p>An alle User Rechnungen <a href="/billing/send_all_bills"> versenden</a>.</p>
|
||||
{% endblock %}
|
||||
29
app/views.py
29
app/views.py
@@ -222,10 +222,35 @@ def consume():
|
||||
def personal():
|
||||
return render_template('personal.html', user=get_user_by_name(session.get('name')))
|
||||
|
||||
@app.route('/billing')
|
||||
@app.route('/billing', methods=['POST', 'GET'])
|
||||
@requires_baron
|
||||
def billing():
|
||||
return render_template('billing.html', user=get_user_by_name(session.get('name')))
|
||||
users = get_users()
|
||||
if request.method == 'POST':
|
||||
return render_template('billing.html', users=users, success="Not Implemented", dept=0, user=get_user_by_name(session.get('name')))
|
||||
if request.method == 'GET':
|
||||
return render_template('billing.html', users=users, dept=0, user=get_user_by_name(session.get('name')))
|
||||
|
||||
|
||||
@app.route('/billing/send_personal_bill/<name>', methods=['GET','POST'])
|
||||
@requires_baron
|
||||
def send_personal_bill(name=None):
|
||||
if request.method == 'POST':
|
||||
return "To be implemented"
|
||||
#return redirect('/billing')
|
||||
|
||||
if request.method == 'GET':
|
||||
return render_template('billing_personal.html', user_to_bill=get_user_by_name(name) ,user=get_user_by_name(session.get('name')))
|
||||
|
||||
|
||||
@app.route('/billing/send_all_bills', methods=['GET','POST'])
|
||||
@requires_baron
|
||||
def send_mass_mail(name=None):
|
||||
if request.method == 'POST':
|
||||
return "To be implemented"
|
||||
if request.method == 'GET':
|
||||
return render_template('billing_mass_mail.html', user=get_user_by_name(session.get('name')))
|
||||
|
||||
|
||||
#migrate the db to hashed passwords
|
||||
#@app.route('/hashdb')
|
||||
|
||||
Reference in New Issue
Block a user