{% extends "layout.html" %} {% set active_page = "orders" -%} {% import "utils.html" as util %} {% block container %}

Order {{ order.id }} {% if order.can_close(current_user.id) -%} Close
Edit {%- endif %}

courier: {{ order.courrier.username }} {% if order.courrier == None and not current_user.is_anonymous() %} Volunteer {% endif %}
location: {{ order.location.name }}
{% if order.location.telephone != None %} telephone: {{ order.location.telephone }}
{% endif %} status: {% if order.stoptime %}{{ order.stoptime|countdown }}{% else %}open{% endif %}
total price: {{ total_price|euro }}
{% if form -%}

Order:

{{ form.csrf_token }}
{{ form.product_id.label(class='control-label') }}
{{ form.product_id(class='form-control select') }} {{ util.render_form_field_errors(form.product_id) }}
{% if current_user.is_anonymous() %}
{{ form.name.label(class='control-label') }} {{ form.name(class='form-control', placeholder='Fill in your name...') }} {{ util.render_form_field_errors(form.name) }}
{% endif %}
{{ form.submit_button(class='btn btn-primary') }}
{%- endif %}

Items

{% for item in order.items %} {{ item.get_name() }} - {{ item.product.name }} - {{ item.product.price|euro }} {% if item.can_delete(order.id, current_user.id, session.get('anon_name', '')) -%}{%- endif %}
{% endfor %}

Ordered products:

{% for key, value in order.group_by_product().items() %} {{ key }} - {{ value }}
{% endfor %}

Debts

{% for key, value in order.group_by_user_pay().items() %} {{ key }} - {{ value|euro }}
{% endfor %}
{% endblock %} {% block styles %} {{ super() }} {% endblock %} {% block scripts %} {{ super() }} {% endblock %}