{% extends "base_title.html" %}
{% load static %}

{% block realcontent %}
  <h2>État des inscriptions BdA</h2>
  <table class="table table-striped etat-bda">
    <thead>
      <tr>
	<th data-sort="string">Titre</th>
	<th data-sort="int">Date</th>
	<th data-sort="string">Lieu</th>
	<th data-sort="int">Places</th>
	<th data-sort="int">Demandes</th>
	<th data-sort="float">Ratio</th>
    </tr> 
    </thead>
    <tbody>
      {% for spectacle in spectacles %}
      <tr>
	<td>{{ spectacle.title }}</td>
	<td data-sort-value="{{ spectacle.timestamp }}">{{ spectacle.date }}</td>
	<td data-sort-value="{{ spectacle.location }}">{{ spectacle.location }}</td>
	<td data-sort-value="{{ spectacle.slots }}">{{ spectacle.slots }} places</td>
	<td data-sort-value="{{ spectacle.total }}">{{ spectacle.total }} demandes</td>
	<td data-sort-value="{{ spectacle.ratio |stringformat:".3f" }}"
            class={% if spectacle.ratio < 1.0 %} 
					     "greenratio" 
                     {% else %}
	                 {% if spectacle.ratio < 2.5 %} 
                              "orangeratio" 
                         {% else %} 
				"redratio" 
			{% endif %}
		{% endif %}>
			{{ spectacle.ratio |floatformat  }}
       </td>
     </tr>
                {% endfor %}
    </tbody>					     
    </table>
    <span class="bda-prix">
      Total&nbsp;: {{ total }} place{{ total|pluralize }} demandée{{ total|pluralize }}
      sur {{ proposed }} place{{ proposed|pluralize }} proposée{{ proposed|pluralize }}
    </span>
  <script type="text/javascript">
    $(function(){
    $("table.etat-bda").stupidtable();
    });
  </script>
{% endblock %}
