{% extends 'pirati_cz.html' %}

{%block head%}
<script>
$(document).ready(function(){
    $("#check_all").on("change", function(){
        if( $(this).prop('checked') ){
            $(".people_form input[type='checkbox']").prop("checked", true);
        } else {
            $(".people_form input[type='checkbox']").prop("checked", false);
        }
    });
});
</script>
{%endblock%}
{%block body%}
<div class="row">
  <div class="medium-12 large-12 columns">
    <section class="o-section o-section--spaceBot">
      <div class="o-section-inner">
        <div class="o-section-block">
          <h2>Statistiky registrací dle měsíců a krajů</h2>
          <br/>
          <form action="#" method="POST">
          {%csrf_token%}
          <div class="medium-4 large-4 columns">
              <select name="dist" onChange="this.form.submit()">{% for d in distAvail%}<option value="{{d.0}}"{%if selDist == d.0%} selected="selected"{%endif%}>{{d.1}}</option>{%endfor%}</select>
          </div>
          <div class="medium-4 large-4 columns">
          </div>
          <div class="medium-4 large-4 columns">
          </div>
          </form>
          <br/>
          <br/>
          <br/>
          {% if objs|length > 0 %}
          <table class="table-list">
              <tr>
                  <th>Kraj</th>
                  <th>Rok, měsíc</th>
                  <th>Počet registrovaných</th>
              </tr>
              {% for obj in objs %}
              <tr>
                  <td>{{obj.district}}</td>
                  <td>{{obj.month|date:"Y-m"}}</td>
                  <td>{{obj.c}}</td>
              </tr>
              {% endfor %}
          </table>
          {%else%}
          <em>Žádné položky</em>
          {%endif%}
        </div>
      </div>
    </section>
  </div>
</div>

<div class="row">
  <div class="medium-12 large-12 columns">
    <section class="o-section o-section--spaceBot">
      <div class="o-section-inner">
      &nbsp;
      </div>
    </section>
  </div>
</div>


{%endblock%}
