{% if (delivery.status == delivery.OPEN or delivery.status == delivery.ADJUSTMENT) and delivery.has_products %}
    <a class="button" href="{{ url_for('place_order', id=delivery.id) }}">
    {% if delivery.status == delivery.ADJUSTMENT %}
        Ajuster ma commande
    {% elif delivery.status == delivery.OPEN %}
        {% if request.user.email in delivery.orders %}Gérer ma commande{% else %}Commander{% endif %}
    {% endif %}
    </a>
{% endif %}
{% if request.user.email in delivery.orders %}
    <span class="flag" title="Mes paiements"><i class="icon-wallet"></i>&nbsp;{{ delivery.total_for(request.user) }} €</span>
{% endif %}
