drinks-manager/app/templates/order.html

74 lines
3 KiB
HTML
Raw Permalink Normal View History

{% extends "baselayout.html" %}
{% load i18n %}
{% load l10n %}
{% block title %}
{% translate "Drinks - Order" %}
{% endblock %}
{% block content %}
2023-02-17 22:01:09 +01:00
<div class="flex flex-column flex-center">
{% if drink and drink.available > 0 and not drink.deleted %}
{% if user.balance > 0 or user.allow_order_with_negative_balance %}
2025-09-07 22:32:38 +02:00
<h1 class="formheading">{% translate "Order" %}</h1>
2023-02-17 22:01:09 +01:00
<form id="orderform" class="flex flex-column flex-center appform gap-1rem">
{% csrf_token %}
<div class="forminfo">
2025-09-07 22:32:38 +02:00
<span>{% translate "Drink" %}</span>
2023-02-17 22:01:09 +01:00
<span>{{ drink.product_name }}</span>
</div>
<div class="forminfo">
2025-09-07 22:32:38 +02:00
<span>{% translate "Price per Item" %} ({{ currency_suffix }})</span>
2023-02-17 22:01:09 +01:00
<span id="priceperdrink" data-drink-price="{% localize off %}{{ drink.price }}{% endlocalize %}">
{{ drink.price }}
</span>
</div>
{% if not drink.do_not_count %}
<div class="forminfo">
2025-09-07 22:32:38 +02:00
<span>{% translate "Available" %}</span>
2023-02-17 22:01:09 +01:00
<span>{{ drink.available }}</span>
</div>
{% endif %}
<div class="forminfo">
2025-09-07 22:32:38 +02:00
<span>{% translate "Sum" %} ({{ currency_suffix }})</span>
2023-02-17 22:01:09 +01:00
<span id="ordercalculatedsum">{{ drink.price }}</span>
</div>
<div class="flex forminput">
2025-09-07 22:32:38 +02:00
<span>{% translate "Count" %}</span>
2023-02-17 22:01:09 +01:00
<span class="flex flex-row customnumberinput">
<button type="button" class="customnumberinput-minus" id="numberofdrinks-btn-minus">-</button>
{% if drink.do_not_count %}
<input type="number" class="customnumberinput-field" name="numberofdrinks" id="numberofdrinks"
min="1" max="100" value="1">
{% else %}
<input type="number" class="customnumberinput-field" name="numberofdrinks" id="numberofdrinks"
max="{{ drink.available }}" min="1" max="100" value="1">
{% endif %}
2023-02-17 22:01:09 +01:00
<button type="button" class="customnumberinput-plus" id="numberofdrinks-btn-plus">+</button>
</span>
</div>
<input type="hidden" name="drinkid" id="drinkid" value="{{ drink.id }}">
<div class="buttons">
<a href="/" class="button">{% translate "cancel" %}</a>
<input type="submit" id="ordersubmitbtn" class="button" value='{% translate "order" %}'>
</div>
</form>
2025-09-07 22:32:38 +02:00
<div id="statusinfo"></div>
2023-02-17 22:01:09 +01:00
<script src="/static/js/order.js"></script>
<script src="/static/js/custom_number_input.js"></script>
{% else %}
2025-09-07 22:32:38 +02:00
<div class="flex flex-center flex-column">
2023-02-17 22:01:09 +01:00
<p>{% translate "Your balance is too low to order a drink." %}</p>
2025-09-07 22:32:38 +02:00
<a href="/" class="button">{% translate "back" %}</a>
2023-02-17 22:01:09 +01:00
</div>
{% endif %}
{% else %}
<div class="flex flex-center">
<p>{% translate "This drink is not available." %}</p>
<a href="/">{% translate "back" %}</a>
</div>
2023-02-17 22:01:09 +01:00
{% endif %}
<script src="/static/js/autoreload.js"></script>
2023-02-17 22:01:09 +01:00
</div>
{% endblock %}