Add invoices to user admin page
This commit is contained in:
parent
1d8b646491
commit
fec992dd72
|
@ -39,6 +39,9 @@ def render_user_template(user):
|
|||
audit_log = (AuditLogEntry.query
|
||||
.filter(AuditLogEntry.user_id == user.id)
|
||||
.order_by(AuditLogEntry.created.desc())).limit(15)
|
||||
invoices = (Invoice.query
|
||||
.filter(Invoice.user_id == user.id)
|
||||
.order_by(Invoice.created.desc())).all()
|
||||
rdns = dict()
|
||||
for log in audit_log:
|
||||
addr = str(log.ip_address)
|
||||
|
@ -94,7 +97,8 @@ def render_user_template(user):
|
|||
one_year=one_year, rdns=rdns,
|
||||
personal_tokens=personal_tokens,
|
||||
oauth_clients=oauth_clients,
|
||||
oauth_grants=oauth_grants)
|
||||
oauth_grants=oauth_grants,
|
||||
invoices=invoices)
|
||||
|
||||
@users.route("/users/~<username>")
|
||||
@adminrequired
|
||||
|
|
|
@ -413,5 +413,37 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Invoices</h3>
|
||||
<div class="event-list">
|
||||
{% for invoice in invoices %}
|
||||
<div class="event invoice">
|
||||
<h4>
|
||||
<small class="text-success" style="margin-left: 0">
|
||||
{{icon('check')}}
|
||||
</small>
|
||||
${{"{:.2f}".format(invoice.cents/100)}}
|
||||
<small>
|
||||
with {{invoice.source}}
|
||||
</small>
|
||||
<small>
|
||||
<a
|
||||
class="pull-right"
|
||||
href="{{url_for("billing.invoice_GET", invoice_id=invoice.id)}}"
|
||||
>Export as PDF</a>
|
||||
</small>
|
||||
</h4>
|
||||
<p>
|
||||
Paid {{invoice.created | date}}<br />
|
||||
Valid for service until {{invoice.valid_thru | date}}
|
||||
{% if invoice.comment %}
|
||||
<br />
|
||||
{{invoice.comment}}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue