{% extends 'admin/master.html' %}
{% block body %}
  <h1>Supporters</h1>

  <h2>Commercial supporters</h2>
  {% if supporters %}
    <table class="table table-striped">
      <thead>
      <tr>
        <th>Organization (MusicBrainz ID)</th>
        <th>State</th>
        <th>Contact name</th>
        <th>Contact email</th>
        <th>Standing</th>
        <th>Tier</th>
        <th>Featured</th>
        <th>{# Buttons #}</th>
      </tr>
      </thead>
      {% for supporter in supporters %}
        <tr>
          <td>
            <a href="{{ url_for('supportersview.details', supporter_id=supporter.id) }}">
              <strong>{{ supporter.org_name }}</strong>
              ({{ supporter.musicbrainz_id }})
            </a>
          </td>
          <td>
            {% if supporter.state == 'active' %}
              <span class="label label-success">Active</span>
            {% elif supporter.state == 'pending' %}
              <span class="label label-warning">Pending</span>
            {% elif supporter.state == 'waiting' %}
              <span class="label label-warning">Waiting</span>
            {% else %}
              <span class="label label-important">Rejected</span>
            {% endif %}
          </td>
          <td>{{ supporter.contact_name }}</td>
          <td>{{ supporter.contact_email }}</td>
          <td>
            {% if supporter.good_standing %}
              <span class="label label-success">Good standing</span>
            {% else %}
              <span class="label label-important">Bad standing</span>
            {% endif %}
          </td>
          <td>{{ supporter.tier }}</td>
          <td>
            {% if supporter.featured %}
              <span class="label label-success">Featured</span>
            {% else %}
              <span class="label label-default">Not featured</span>
            {% endif %}
          </td>
          <td>
            <a href="{{ url_for('supportersview.edit', supporter_id=supporter.id) }}"
               class="btn btn-xs btn-primary" role="button">Edit</a>
          </td>
        </tr>
      {% endfor %}
    </table>

    {% if count > limit %}
      <ul class="pager">
        {% if page > 1 %}
          <li class="previous"><a href="{{ url_for('commercialsupportersview.index', page=page-1) }}">&larr; Previous</a></li>
        {% endif %}
        {% if page-1 < count//limit %}
          <li class="next"><a href="{{ url_for('commercialsupportersview.index', page=page+1) }}">Next &rarr;</a></li>
        {% endif %}
      </ul>
    {% endif %}
  {% else %}
    None!
  {% endif %}
{% endblock %}
