2016-07-21 23:19:50 +00:00
|
|
|
{% extends "core/base.jinja" %}
|
|
|
|
|
2016-08-18 17:52:20 +00:00
|
|
|
{% block title %}
|
|
|
|
{% trans %}Eboutic{% endtrans %}
|
|
|
|
{% endblock %}
|
|
|
|
|
2016-10-19 19:30:41 +00:00
|
|
|
{% macro add_product(id, content, class="") %}
|
|
|
|
<form method="post" action="{{ url('eboutic:main') }}" class="inline {{ class }}">
|
2016-07-21 23:19:50 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="action" value="add_product">
|
2016-10-19 19:30:41 +00:00
|
|
|
<button type="submit" name="product_id" value="{{ id }}"> {{ content|safe }} </button>
|
2016-07-21 23:19:50 +00:00
|
|
|
</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>
|
2016-07-21 23:19:50 +00:00
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
2019-10-18 19:41:39 +00:00
|
|
|
<p>
|
|
|
|
<strong>{% trans %}Basket amount: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} €</strong>
|
2019-10-24 12:40:26 +00:00
|
|
|
|
|
|
|
{% if customer_amount != None %}
|
2019-10-18 19:41:39 +00:00
|
|
|
<br>
|
|
|
|
{% trans %}Current account amount: {% endtrans %}<strong>{{ "%0.2f"|format(customer_amount) }} €</strong>
|
|
|
|
<br>
|
|
|
|
{% trans %}Remaining account amount: {% endtrans %}<strong>{{ "%0.2f"|format(customer_amount - basket.get_total()) }} €</strong>
|
2019-10-24 12:40:26 +00:00
|
|
|
{% endif %}
|
2019-10-18 19:41:39 +00:00
|
|
|
</p>
|
|
|
|
|
2016-07-21 23:19:50 +00:00
|
|
|
<form method="post" action="{{ url('eboutic:command') }}">
|
|
|
|
{% csrf_token %}
|
2019-10-18 19:41:39 +00:00
|
|
|
<p>
|
2016-07-21 23:19:50 +00:00
|
|
|
<input type="submit" value="{% trans %}Proceed to command{% endtrans %}" />
|
2019-10-18 19:41:39 +00:00
|
|
|
</p>
|
2016-07-21 23:19:50 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div>
|
2016-08-18 17:52:20 +00:00
|
|
|
{% for t in categories %}
|
|
|
|
{% if eboutic.products.filter(product_type=t).exists() %}
|
|
|
|
<h5>{{ t }}</h5>
|
2017-10-22 19:10:02 +00:00
|
|
|
{% if t.comment %}
|
|
|
|
<p>{{ t.comment }}</p>
|
|
|
|
{% endif %}
|
|
|
|
<br />
|
2016-08-18 17:52:20 +00:00
|
|
|
{% for p in eboutic.products.filter(product_type=t).all() %}
|
2016-10-19 19:30:41 +00:00
|
|
|
{% set file = None %}
|
|
|
|
{% if p.icon %}
|
|
|
|
{% set file = p.icon.url %}
|
|
|
|
{% else %}
|
|
|
|
{% set file = static('core/img/na.gif') %}
|
|
|
|
{% endif %}
|
|
|
|
{% set prod = '<strong>%s</strong><hr><img src="%s" /><span>%s €</span>' % (p.name, file, p.selling_price) %}
|
|
|
|
{{ add_product(p.id, prod, "form_button") }}
|
2016-08-18 17:52:20 +00:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2016-07-21 23:19:50 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
|