Add filters to members page

This commit is contained in:
William Bouzourène 2025-01-22 13:13:16 +01:00
parent 3d02804c3f
commit ff91f0ddca
2 changed files with 238 additions and 31 deletions

View file

@ -18,13 +18,130 @@
<hr>
</div>
<div class="my-3 text-end">
{% if MembersPage %}
<div class="btn-group">
<a class="btn btn-primary" href="/members/add">
<i class="bi-plus-lg"></i>
Ajouter
</a>
<a class="btn btn-primary" href="javascript:;">
<i class="bi-filetype-csv"></i>
Exporter
</a>
</div>
{% else %}
<div class="btn-group">
<a class="btn btn-primary" href="/contacts/add">
<i class="bi-plus-lg"></i>
Ajouter
</a>
<a class="btn btn-primary" href="javascript:;">
<i class="bi-filetype-csv"></i>
Exporter
</a>
</div>
{% endif %}
</div>
<form id="filters" method="get" class="my-3">
<div class="row">
<div class="col-6 col-lg-3 mb-2">
<label
for="archive"
class="form-label"
>
Section
</label>
<select
class="form-select"
id="section"
name="se"
>
<option value="0">Toutes</option>
{% for Section in Sections %}
<option
value="{{ Section.ID }}"
{% if Section.ID == FilterSection %}
selected
{% endif %}
>
{{ Section.Name }}
</option>
{% endfor %}
</select>
</div>
<div class="col-6 col-lg-3 mb-2">
<label
for="archive"
class="form-label"
>
Status
</label>
<select
class="form-select"
id="archive"
name="a"
>
{% if PermShow %}
<option value="0">
Actif
</option>
{% endif %}
{% if PermShowArchived %}
<option
value="1"
{% if FilterArchive == "1" %}
selected
{% endif %}
>
Archivé
</option>
{% endif %}
</select>
</div>
<div class="col-lg-6 mb-2">
<label
for="search"
class="form-label"
>
Recherche
</label>
<div class="input-group">
<input
type="text"
class="form-control"
id="search"
name="s"
value="{{ FilterSearch }}"
>
<button
class="btn btn-outline-success"
type="submit"
>
<i class="bi-search"></i>
</button>
</div>
</div>
</div>
</form>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Nom</th>
<th>Lieu</th>
<th>Section</th>
<th class="w-25">Nom</th>
<th class="w-50 d-none d-sm-table-cell">Adresse</th>
<th class="w-25">Section</th>
</tr>
</thead>
<tbody>
@ -41,7 +158,11 @@
</a>
{% endif %}
</td>
<td>
<td class="d-none d-sm-table-cell">
{{ Person.Address1 }}
{% if Person.Address1 and (Person.PostalCode or Person.City) %}
&ndash;
{% endif %}
{{ Person.PostalCode }} {{ Person.City }}
</td>
<td>
@ -55,7 +176,7 @@
</table>
</div>
<nav aria-label="Page navigation example">
<nav class="mt-3 mb-5">
<ul class="pagination justify-content-center">
{% if Page <= 1 %}
@ -124,18 +245,15 @@
</ul>
</nav>
<div class="mt-3">
{% if MembersPage %}
<a class="btn btn-md btn-primary" href="/members/add">
<i class="bi-plus-lg"></i>
Ajouter
</a>
{% else %}
<a class="btn btn-md btn-primary" href="/contacts/add">
<i class="bi-plus-lg"></i>
Ajouter
</a>
{% endif %}
</div>
</div>
{% endblock %}
{% block javascript %}
<script>
$(document).ready(function() {
$("#filters select").on("change", function() {
$("#filters").submit();
});
});
</script>
{% endblock %}