Sith/eboutic/templates/eboutic/eboutic_main.jinja

48 lines
1.6 KiB
Plaintext
Raw Normal View History

{% extends "core/base.jinja" %}
{% macro add_product(id, content) %}
<form method="post" action="{{ url('eboutic:main') }}" class="inline" style="display:inline">
{% csrf_token %}
<input type="hidden" name="action" value="add_product">
<button type="submit" name="product_id" value="{{ id }}"> {{ content }} </button>
</form>
{% endmacro %}
{% macro del_product(id, content) %}
<form method="post" action="{{ url('eboutic:main') }}" class="inline" style="display:inline">
{% csrf_token %}
<input type="hidden" name="action" value="del_product">
<button type="submit" name="product_id" value="{{ id }}"> {{ content }} </button>
</form>
{% endmacro %}
{% block content %}
<h3>{% trans %}Eboutic{% endtrans %}</h3>
<div id="basket">
<p>{% trans %}Basket: {% endtrans %}</p>
<ul>
2016-07-26 17:39:19 +00:00
{% for i in basket.items.all()|sort(attribute='id') %}
<li>{{ del_product(i.product_id, '-') }} {{ i.quantity }}
{{ add_product(i.product_id, '+') }} {{ i.product_name }}: {{ "%0.2f"|format(i.product_unit_price*i.quantity) }} €</li>
{% endfor %}
</ul>
2016-07-26 17:39:19 +00:00
<p><strong>{% trans %}Total: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} €</strong></p>
<form method="post" action="{{ url('eboutic:command') }}">
{% csrf_token %}
<input type="submit" value="{% trans %}Proceed to command{% endtrans %}" />
</form>
</div>
<div>
<p><strong>{% trans %}Products: {% endtrans %}</strong>
{% for p in eboutic.products.all() %}
{{ add_product(p.id, p.name) }}
{% endfor %}
</p>
</div>
{% endblock %}