byceps/byceps

View on GitHub
byceps/blueprints/admin/shop/article/templates/admin/shop/article/view_orders.html

Summary

Maintainability
Test Coverage
{% extends 'layout/admin/shop/article.html' %}
{% from 'macros/admin/shop/order.html' import render_order_link, render_order_payment_state %}
{% from 'macros/admin/user.html' import render_user_microcard %}
{% set current_page_shop = shop %}
{% set current_tab = 'orders' %}
{% set page_title = [article.name, _('Orders')] %}

{% block body %}

  <h1 class="title">{{ _('Orders') }}</h1>

  <div class="row row--space-between mb mt">
    <div>
      <div class="data-label">{{ _('Quantity ordered') }}</div>
      <div class="data-value"><strong>{{ quantity_total }}</strong> {{ _('pieces in total') }}</div>
    </div>
    <div>
      <div class="data-label">{{ _('As at') }}</div>
      <div class="data-value">{{ now|datetimeformat }}</div>
    </div>
  </div>

  {%- if orders_with_quantities %}
  <table class="itemlist is-vcentered is-wide">
    <thead>
      <tr>
        <th>{{ _('Order number') }}<br>{{ _('Date') }}</th>
        <th>{{ _('Orderer') }}</th>
        <th>{{ _('Status') }}</th>
        <th class="number">{{ _('Quantity') }}</th>
      </tr>
    </thead>
    <tbody>
    {%- for order, quantity in orders_with_quantities|sort(attribute='0.order_number', reverse=True) %}
      <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>{{ render_order_payment_state(order.payment_state) }}</td>
        <td class="bignumber number">{{ quantity }}</td>
      </tr>
    {%- endfor %}
    </tbody>
  </table>
  {%- else %}
  <div class="box">
    <div class="dimmed-box centered">{{ _('This article has not been ordered yet.') }}</div>
  </div>
  {%- endif %}

{%- endblock %}