{% load plugin_extras %}
{% with lectronz_order=order.metadata.lectronz_order %}
{% if lectronz_order.synced %} {% if lectronz_order.fulfilled %}
Sales Order has been successfully fulfilled on {{ lectronz_order.fulfilled }}.
{% else %}
Sales Order has been synchronized with the Lectronz API on {{ lectronz_order.synced }}.
{% endif %} {% else %}
Sales Order has not been synchronized with the Lectronz API.
{% endif %} {% if lectronz_order.id %} Download Invoice {% endif %}
{% if not order.total_price.amount|lectronz_float_eq:lectronz_order.total %}
Warning: Sales Order Total doesn't match Order Total from the Lectronz API ({{ order.total_price.amount|floatformat:2 }} ≠ {{ lectronz_order.total|floatformat:2 }})
{% endif %} {% if not order.customer_reference|lectronz_valid_customer_reference %}
Error: Invalid Customer Reference '{{ order.customer_reference }}' (has to match "^#?\d+$")
{% endif %}
{% for message in lectronz_order.sync_errors %}
Error: {{ message }}
{% endfor %}
{% endwith %}