1
0
Fork 0
forked from s3lph/matemat
matemat/templates/productlist.html

85 lines
3.1 KiB
HTML
Raw Normal View History

{% extends "base.html" %}
{% block header %}
{# Show the username. #}
<h1>Welcome, {{ authuser.name }}</h1>
{{ super() }}
{% endblock %}
{% block main %}
{# Show the users current balance #}
Your balance: {{ authuser.balance|chf }}
<br/>
2021-04-07 02:41:53 +02:00
{# Logout link #}
2020-02-03 20:44:58 +01:00
<div class="thumblist-item">
2021-04-07 02:41:53 +02:00
<a href="/logout">Logout</a>
2020-02-03 20:44:58 +01:00
</div>
2021-04-07 02:41:53 +02:00
{# Links to deposit two common amounts of cash. TODO: Will be replaced by a nicer UI later (#20) #}
<div id="depositlist">
<div class="thumblist-item">
<a href="/deposit?n=100">Deposit CHF 1</a>
</div>
<div class="thumblist-item">
<a href="/deposit?n=1000">Deposit CHF 10</a>
</div>
</div>
<div id="deposit-wrapper">
<div id="deposit-input">
<div id="deposit-output">
<span id="deposit-title"></span>
<span id="deposit-amount">0.00</span>
</div>
{% for i in [('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('del', '✗'), ('0', '0'), ('ok', '✓')] %}
<div class="numpad" id="numpad-{{ i.0 }}" onclick="deposit_key('{{ i.0 }}');">{{ i.1 }}</div>
{% endfor %}
<div id="transfer-userlist">
<div id="scroll-up" onclick="scrollUserlist(-130);"></div>
<ul id="transfer-userlist-list">
{% for user in (users if user != authuser) %}
<li onclick="set_transfer_user(this, {{ user.id }})">{{ user.name }}</li>
{% endfor %}
</ul>
<div id="scroll-down" onclick="scrollUserlist(+130);"></div>
</div>
</div>
2020-02-03 20:44:58 +01:00
</div>
2021-04-07 02:41:53 +02:00
<script src="/static/js/depositlist.js"></script>
2020-02-03 20:44:58 +01:00
<br/>
{% for product in products %}
{# Show an item per product, consisting of the name, image, price and stock, triggering a purchase on click #}
<div class="thumblist-item">
2021-04-07 09:36:18 +02:00
{% if product.custom_price %}
<a onclick="setup_custom_price({{ product.id }}, '{{ product.name}}');">
{% else %}
<a href="/buy?pid={{ product.id }}">
2021-04-07 09:36:18 +02:00
{% endif %}
<span class="thumblist-title">{{ product.name }}</span>
2021-04-07 09:36:18 +02:00
{% if product.custom_price %}
<span class="thumblist-detail">Custom Price</span><br/>
{% else %}
<span class="thumblist-detail">Price:
{% if authuser.is_member %}
{{ product.price_member|chf }}
{% else %}
{{ product.price_non_member|chf }}
{% endif %}
2020-02-03 20:44:58 +01:00
</span><br/>
2021-04-07 09:36:18 +02:00
{% endif %}
<div class="imgcontainer">
<img src="/static/upload/thumbnails/products/{{ product.id }}.png" alt="Picture of {{ product.name }}" draggable="false"/>
2021-04-07 01:25:45 +02:00
{% set pstock = stock.get_stock(product) %}
{% if pstock is not none %}
<span class="thumblist-stock">{{ pstock }}</span>
{% endif %}
</div>
</a>
</div>
{% endfor %}
<br/>
{{ super() }}
{% endblock %}