{% extends "layout.html" %} {% set active_page = "orders" -%} {% set order_items = order.group_by_user() -%} {% set courier_or_admin = not current_user.is_anonymous() and (current_user.is_admin() or current_user.id == order.courier_id) -%} {% import "utils.html" as util %} {% block container %}

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

courier: {{ order.courier.username }} {% if order.courier == None and not current_user.is_anonymous() %}
{% endif %}
location: {% if order.location %} {{ order.location_name }} {% else %} {{ order.location_name }} {% endif %}
{% if order.location.telephone != None %} telephone: {{ order.location.telephone }}
{% endif %} start: {{ order.starttime.strftime("%d/%m/%Y %H:%M") }}
{% if order.stoptime %} closing time: {{ order.stoptime.strftime("%H:%M") }} ({{ order.stoptime|countdown }}) {% else %}open{% endif %}
total price: {{ total_price|euro }} {% if courier_or_admin %}- remaining debts: {{ debts|euro }}{% endif %}
{% if form -%}

Order:

Choose for me {{ form.csrf_token }}
{{ form.dish_id.label(class='control-label') }}
{{ form.dish_id(class='form-control select') }} {{ util.render_form_field_errors(form.dish_id) }}
{{ form.comment.label(class='control-label') }}
{{ form.comment(class='form-control', placeholder='Fill in comment, when applicable') }} {{ util.render_form_field_errors(form.comment) }}
{% 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

{% if courier_or_admin %}{% endif %} {% for item in order.items -%} {% if courier_or_admin %} {% endif %} {%- endfor %}
NameItemPricePaid?Delete
{{ item.get_name() }} {{ item.dish_name }}{{ "*" if item.comment }} {{ item.price|euro }}{% if not item.paid %}
{% else %} {% endif %}
{% if item.can_delete(order.id, current_user.id, session.get('anon_name', '')) -%}
{%- endif %}

Ordered dishes: {{ order.items.count() }}

{% for key, value in order.group_by_dish().items() -%}
{{ key }}: {{ value["count"] }} {% if value["comments"]|any -%}
    {% for comment in value["comments"] -%}
  • {% if comment %}{{ comment }} {% else %}No comment {% endif %}
  • {% endfor %}
{%- endif %}
{%- endfor %}

Debts

{% if courier_or_admin %}{% endif %} {% for key, value in order_items.items() -%} {% if courier_or_admin %}{% endif %} {%- endfor %}
NameTotalTo payPaid?
{{ key }} {{ value["total"]|euro }} {{ value["to_pay"]|euro }}{% if not value["to_pay"] == 0 %}
{% else %} {% endif %}
{% endblock %} {% block styles %} {{ super() }} {% endblock %} {% block scripts %} {{ super() }} {% endblock %}