Skip to content

Commit

Permalink
Displaying information on user page
Browse files Browse the repository at this point in the history
  • Loading branch information
Mstiekema committed Dec 12, 2023
1 parent 63ae47b commit cb1acb9
Showing 1 changed file with 63 additions and 8 deletions.
71 changes: 63 additions & 8 deletions admin_board_view/templates/user_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,68 @@
{% load static %}
{% block body %}
<main class="container mt-3">
<h1>Welcome {{ user }}</h1>
<p>
You are not allowed to view this page as a non admin. Please logout and try again:
</p>
<form action="{% url 'oidc_logout' %}" method="post">
{% csrf_token %}
<button class="btn btn-primary" type="submit">Logout</button>
</form>
<h1>Welcome {{ user_info.name }}</h1>
<h5 class="mb-2">
Current balance: <b>{{ user_info.euro_balance }}</b>
</h5>
<hr/>
<div class="row row-cols-2">
<div class="col">
<div class="card">
<h5 class="card-header">Product sales</h5>
<div class="card-body">
<table class="table table-striped table-hover text-center align-middle">
<thead>
<tr>
<th>Date</th>
<th>Sum</th>
<th>Products</th>
</tr>
</thead>
<tbody>
{% for transaction in sales %}
<tr id="{{ transaction.key.id }}">
<td>{{ transaction.key.date }}</td>
<td>€{{ transaction.key.transaction_sum }}</td>
<td>
{% for product in transaction.values %}
{{ product.amount }}x {{ product.product_id.name }}<br/>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include "pagination_footer.html" with page=sales page_name='sales' %}
</div>
</div>
</div>
<div class="col">
<div class="card">
<h5 class="card-header">Top ups</h5>
<div class="card-body">
<table class="table table-striped table-hover text-center align-middle">
<thead>
<tr>
<th>Date</th>
<th>Sum</th>
<th>Type</th>
</tr>
</thead>
<tbody>
{% for top_up in top_ups.object_list %}
<tr>
<td>{{ top_up.date }}</td>
<td>€{{ top_up.transaction_sum }}</td>
<td>{% if top_up.type == 1 %}Pin{% elif top_up.type == 3 %}Mollie{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include "pagination_footer.html" with page=top_ups page_name='top_ups' %}
</div>
</div>
</div>
</div>
</main>
{% endblock %}

0 comments on commit cb1acb9

Please sign in to comment.