{% from 'macros/misc.html' import render_tag %}


{% macro render_order_link(order) -%}
  <a href="{{ url_for('shop_order_admin.view', order_id=order.id) }}">{{ order.order_number }}</a>
{%- endmacro %}


{% macro render_order_payment_method(payment_method) %}
  {%- set name = payment_method.name %}
  {%- if name == 'bank_transfer' -%}
    Überweisung
  {%- elif name == 'cash' -%}
    Barzahlung
  {%- elif name == 'direct_debit' -%}
    Lastschrift
  {%- else -%}
    ?
  {%- endif -%}
{%- endmacro %}


{% macro render_order_payment_state(payment_state) %}
  {%- set state_name = payment_state.name %}
  {%- if state_name == 'paid' -%}
    {{ render_tag('bezahlt', icon='success', class='order-paid') }}
  {%- elif state_name in ['canceled', 'canceled_after_paid'] -%}
    {{ render_tag('storniert', icon='disabled', class='order-canceled') }}
  {%- else -%}
    {{ render_tag('offen', icon='pending', class='order-open') }}
  {%- endif -%}
{%- endmacro %}

{% from 'macros/misc.html' import render_tag %}


{% macro render_order_link(order) -%}
  <a href="{{ url_for('shop_order_admin.view', order_id=order.id) }}">{{ order.order_number }}</a>
{%- endmacro %}


{% macro render_order_payment_method(payment_method) %}
  {%- set name = payment_method.name %}
  {%- if name == 'bank_transfer' -%}
    Überweisung
  {%- elif name == 'cash' -%}
    Barzahlung
  {%- elif name == 'direct_debit' -%}
    Lastschrift
  {%- else -%}
    ?
  {%- endif -%}
{%- endmacro %}


{% macro render_order_payment_state(payment_state) %}
  {%- set state_name = payment_state.name %}
  {%- if state_name == 'paid' -%}
    {{ render_tag('bezahlt', icon='success', class='order-paid') }}
  {%- elif state_name == 'canceled' -%}
    {{ render_tag('storniert (v. B.)', icon='disabled', class='order-canceled', title='storniert vor Bezahlung') }}
  {%- elif state_name == 'canceled_after_paid' -%}
    {{ render_tag('storniert (n. B.)', icon='disabled', class='order-canceled', title='storniert nach Bezahlung') }}
  {%- else -%}
    {{ render_tag('offen', icon='pending', class='order-open') }}
  {%- endif -%}
{%- endmacro %}

Extend 'cancel' tag to display if order was canceled before or after being paid
Extend 'cancel' tag to display if order was canceled before or after being paid
