{% extends "layout.html" %} {% set active_page = "orders" -%} {% if current_user.is_anonymous() %} {% set my_items = order.for_user(anon=session.get("anon_name", "")) %} {% else %} {% set my_items = order.for_user(user=current_user) %} {% endif %} {% 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.location %} {{ order.location_name }} {% else %} {{ order.location_name }} {% endif %}

Order information

Location
{% if order.location %} {{ order.location_name }} {% else %} {{ order.location_name }} {% endif %}
Delivery at
Zeuskelder TODO
Courier
{% if order.courier == None %} {% if not current_user.is_anonymous() %}
{% else %}No-one{% endif %} {% else %} {{ order.courier.username }} {% endif %}


Opens
{{ order.starttime.strftime("%d/%m/%Y %H:%M") }}
Closes
{% if order.stoptime %} {{ order.stoptime.strftime("%H:%M") }} ({{ order.stoptime|countdown }}) {% else %} Never {% endif %}
{% if order.can_close(current_user.id) -%}
{% endif %} {% if courier_or_admin %} Edit {%- endif %}
{% if form %}

Add item to order

{{ form.csrf_token }}
{{ form.dish_id.label }}
{{ form.dish_id(class='form-control select') }} {{ util.render_form_field_errors(form.dish_id) }}
{% if dish and dish.choices %} {% for (choice_type, choice) in dish.choices %}

{% endfor %} {% endif %}
{{ form.comment.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.user_name.label(class='control-label') }} {{ form.user_name(class='form-control', placeholder='Fill in your name...') }} {{ util.render_form_field_errors(form.user_name) }}
{% endif %}
Random {{ form.submit_button(class='btn btn-primary') }} {% if not dish %}
If the chosen dish has options, they will be shown when you press submit, before adding the item to the order.
{% endif %}

Add from history

{% endif %}

My items

{% if my_items %} {% else %}
(None)
{% endif %}

Ordered dishes

{% for dish_name, dish_order_items in order.group_by_dish() -%} {% set has_comments = dish_order_items | map(attribute="comment") | any -%}

{{ dish_order_items | length }} × {{ dish_name }}

{% if has_comments -%}
    {% for item in dish_order_items -%}
  • {% if item["comment"] %}{{ item["comment"] }} {% else %}No comment {% endif %} for {{ item.for_name }}
  • {% endfor %}
{% else %} for {{ dish_order_items | map(attribute="for_name") | join(", ") }} {%- endif %}

{%- endfor %}

Ordering at {{ order.location_name }}

{% if order.location.telephone %}
Telephone
{{ order.location.telephone }}
{% endif %} {% if order.location.website %}
Website
{{ order.location.website }}
{% endif %} {% if order.location.address or order.location.osm %}
Location
{% if order.location.osm %} {{ order.location.address or "View on OSM" }} {% else %} {{ order.location.address }} {% endif %}
{% endif %}
TODO Only show options that allow you to order

Items per person

{% for user_name, order_items in order.group_by_user() -%} {%- endfor %}
TotalNameItems
{% set paid = order_items | map(attribute="paid") | all %} {{ order_items | map(attribute="price") | sum | euro }} {% if paid %}paid{% endif %} {{ user_name }}
    {% for item in order_items %}
  • {% if item.can_delete(order.id, current_user.id, session.get('anon_name', '')) -%}
    {% else %} {%- endif %}
    {{ item.price|euro }}
    {{ item.dish_name }}{{ "; " + item.comment if item.comment }}
  • {% endfor %}
{% endblock %} {% block styles %} {{ super() }} {% endblock %} {% block scripts %} {{ super() }} {% endblock %}