{% extends 'admin/master.html' %}
{% block body %}
  <div style="float: right">
    <a type="button" class="btn btn-default" href="{{ url_for('statsview.top_tokens', days=1) }}">last day</a>
    <a type="button" class="btn btn-default" href="{{ url_for('statsview.top_tokens', days=7) }}">last week</a>
    <a type="button" class="btn btn-default" href="{{ url_for('statsview.top_tokens', days=30) }}">last month</a>
  </div>
  <h1>Top Tokens -- {{ days }} days</h1>

    <h2>Non commercial supporters</h2>
    <p>
       Supporters in good standing are not listed here.
    </p>
    {{ supporter_list(non_commercial) }}

    <h2>Commercial supporters</h2>
    {{ supporter_list(commercial) }}

{% endblock %}

{% macro supporter_list(supporters) -%}
  {% if supporters %}
    <table class="table table-striped table-condensed">
      <thead>
      <tr>
        <th>Token</th>
        <th>Supporter</th>
        <th>Name</th>
        <th>Email</th>
        <th>Count</th>
      </tr>
      </thead>
      {% for row in supporters %}
        <tr>
          <td><a href="{{ url_for('supportersview.details', supporter_id=row.id) }}">{{ row.musicbrainz_id }}</a></td>
          <td>{{ row.contact_name }}</td>
          <td>{{ row.contact_email }}</td>
          <td><code class="text-muted">{{ row.token }}</code></td>
          <td>{{ row.count }}</td>
        </tr>
      {% endfor %}
    </table>
  {% else %}
    None!
  {% endif %}
{% endmacro %}
