list.html.j2 3.31 KB
Newer Older
Nicolas Joyard's avatar
Nicolas Joyard committed
1 2
{% extends "_base.html.j2" %}

3 4 5 6
{% block header %}
  <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='bootstrap-sortable.css') }}">
{% endblock %}

Nicolas Joyard's avatar
Nicolas Joyard committed
7 8 9
{% block content %}
  <section class="panel panel-default">
    <header class="panel-heading">
10
      <b>Liste des {{ parlementaires|length }} parlementaires</b>
Nicolas Joyard's avatar
Nicolas Joyard committed
11 12
    </header>

13 14 15 16 17 18 19 20
    <article class="panel-body">
      <div class="input-group">
        <span class="input-group-addon" id="search-header">Filtrer les parlementaires</span>
        <input type="search" autocomplete="off" class="form-control" id="search" placeholder="Nom, groupe, circonscription..." aria-describedby="search-header">
      </div>
    </article>

    <table class="table table-condensed table-striped sortable searchable">
21
      <thead>
Nicolas Joyard's avatar
Nicolas Joyard committed
22
        <tr>
23
          <th colspan="2" data-defaultsort="asc" data-mainsort="1">Parlementaire</th>
24
          <th class="col-center">Groupe</th>
25
          <th>Circonscription</th>
26 27
          <th class="col-center">Etape</th>
          <th></th>
Nicolas Joyard's avatar
Nicolas Joyard committed
28
        </tr>
29 30 31
      </thead>
      <tbody>
        {% for parl in parlementaires %}
Nicolas Joyard's avatar
Nicolas Joyard committed
32

33
          <tr>
34
            <td class="col-center">
35
              <img class="chamber-icon" src="{{ url_for('static', filename=parl.chambre|lower+'.png') }}">
36
              <span class="search-vector">{{ parl.nom }} {{ parl.prenom }} {{ parl.nom_circo }} {{ parl.num_deptmt }} {{ parl.groupe.sigle }} {{ parl.groupe.nom }}</span>
37 38
            </td>
            <td data-value="{{ parl.nom }} {{ parl.prenom }}">{{ parl.prenom }} {{ parl.nom }}</td>
39
            <td class="col-center">{{ parl.groupe|label_groupe }}</td>
40
            <td data-value="{{ parl.num_deptmt }} {{ parl.num_circo }}">{{ parl.nom_circo }} n°{{ parl.num_circo }}</td>
41 42 43 44 45 46 47 48 49 50
            <td class="col-center">
              <span class="label" style="background-color: {{ parl.etape.couleur }};">{{ parl.etape.label }}</span>
            </td>
            <td class="col-right">
              {% if parl.etape.ordre == 10 %}
                <a class="btn btn-primary btn-sm" href="{{ url_for('parlementaire', id=parl.id) }}" role="button">Envoyer la demande</a>
              {% else %}
                <a class="btn btn-default btn-sm" href="{{ url_for('parlementaire', id=parl.id) }}" role="button">Informations</a>
              {% endif %}
            </td>
51
          </tr>
Nicolas Joyard's avatar
Nicolas Joyard committed
52

53
        {% else %}
Nicolas Joyard's avatar
Nicolas Joyard committed
54

55
          <tr>
56
            <td class="warning" colspan="6">
57 58 59 60 61 62
              <em>Aucun parlementaire trouvé :(</em>
            </td>
          </tr>

        {% endfor %}
      </tbody>
Nicolas Joyard's avatar
Nicolas Joyard committed
63 64 65
    </table>
  </section>
{% endblock %}
66 67

{% block scripts %}
Nicolas Joyard's avatar
Nicolas Joyard committed
68
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
69 70
  <script src="{{ url_for('static', filename='moment.min.js') }}"></script>
  <script src="{{ url_for('static', filename='bootstrap-sortable.js') }}"></script>
71 72 73 74 75 76 77 78 79 80 81 82 83 84

  <script>
    $(document).ready(function () {
      (function ($) {
        $('#search').keyup(function () {
          var rex = new RegExp($(this).val(), 'i');
          $('.searchable tbody tr').hide();
          $('.searchable tbody tr').filter(function () {
            return rex.test($(this).find('.search-vector').text());
          }).show();
        });
      }(jQuery));
    });
  </script>
85
{% endblock %}