{% extends "pbp_store/admin_base.html" %}
{% load url from future %}
{% load catalog_filters %}

{% block body %}
<h2>Subscriptions</h2>

<ul class="nav nav-pills">
  <li {% if status == 'init' %} class="active" {% endif %}>
    <a href="?status=init">Initialized</a>
  </li>
  <li {% if status == 'submitted' %} class="active" {% endif %}><a href="?status=submitted">Submitted</a></li>
  <li {% if status == 'processed' %} class="active" {% endif %}><a href="?status=processed">Processed</a></li>
  <li {% if status == 'shipped' %} class="active" {% endif %}><a href="?status=shipped">Shipped</a></li>
  <li {% if status == 'cancelled' %} class="active" {% endif %}><a href="?status=cancelled">Cancelled</a></li>
  <li {% if status == 'all' %} class="active" {% endif %}><a href="?status=all">All</a></li>
</ul>

<table class="table table-striped table-bordered">
    <thead>
    <tr>
        <th>Purchaser</th>
        <th>Subscription</th>
        <th>Order</th>
        <th>Duration (Months)</th>
        <th>Date Purchased</th>
        <th>Activity</th>
    </tr>
    </thead>
    <tbody>
    {% for item in order_items %}
    <tr>
        <td>{{item.order.user.username}}</td>
        <td>{{item.product.title}}</td>
        <td><a href="{{item.order.get_absolute_url}}">{{item.order}}</a></td>
        <td>{{item.product.child.duration}}</td>
        <td>{{item.order.date}}</td>
        <td>[<a href="{% url 'subscription_detail' item.order.pk%}">View</a>]</td>
    </tr>
    {% empty %}
    <tr><td colspan="6">No subscriptions.</td></tr>
    {% endfor %}
    </tbody>
</table>

{% endblock body %}
