byceps/byceps

View on GitHub
byceps/blueprints/admin/shop/order/templates/admin/shop/order/_order_list.html

Summary

Maintainability
Test Coverage
{%- from 'macros/admin/shop/order.html' import render_order_invoiced_tag, render_order_link, render_order_payment_state, render_order_overdue_tag %}
{%- from 'macros/admin/user.html' import render_user_microcard %}
{%- from 'macros/icons.html' import render_icon %}


{%- if orders %}
<table class="itemlist is-vcentered is-wide">
  <thead>
    <tr>
      <th>{{ _('Order number') }}<br>{{ _('Date') }}</th>
      <th>{{ _('Orderer') }}</th>
      <th class="number">{{ _('Amount') }}</th>
      <th></th>
      <th>{{ _('Status') }}</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    {%- for order in orders %}
    <tr>
      <td class="nowrap"><strong>{{ render_order_link(order) }}</strong><br>{{ order.created_at|datetimeformat|dim }}</td>
      <td>{{ render_user_microcard(order.placed_by, full_name='%s %s'|format(order.first_name, order.last_name)) }}</td>
      <td class="number">{{ order.total_amount|moneyformat }}</td>
      <td>
        {%- if order.is_processing_required %}
          {%- if order.is_processed %}
            {{- render_icon('shipping', title=_('shipped')) -}}
          {%- else -%}
            {%- filter dim %}
              {{- render_icon('shipping', title=_('shipping required')) -}}
            {%- endfilter %}
          {%- endif -%}
        {%- endif -%}
      </td>
      <td class="nowrap">
        {{ render_order_payment_state(order.payment_state) }}
        {{ render_order_invoiced_tag(order) }}
        {{ render_order_overdue_tag(order) }}
      </td>
      <td>
        {%- if order.is_open and has_current_user_permission('shop_order.mark_as_paid') %}
        <a class="button is-compact" href="{{ url_for('shop_order_admin.mark_as_paid_form', order_id=order.id) }}" title="{{ _('Mark order as paid') }}">{{ render_icon('payment') }}</a>
        {%- endif %}
      </td>
    </tr>
    {%- endfor %}
    <tr>
  </tbody>
</table>
{%- else %}
<div class="box">
  <div class="dimmed-box centered">{{ _('none') }}</div>
</div>
{%- endif %}