Merge new search (members + contacts) into main branch #3
1 changed files with 97 additions and 80 deletions
|
|
@ -44,97 +44,83 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
<form id="filters" method="get" class="my-3">
|
||||
<input type="hidden" name="p" value="{{ Pagination.CurrentPage }}">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-lg-3 mb-2">
|
||||
|
||||
<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">Choisir...</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
|
||||
<label for="section" class="form-label">
|
||||
Section
|
||||
</label>
|
||||
<select class="form-select" id="section" data-search-field="section" data-search-advanced="false" name="section">
|
||||
<option value="0">Choisir...</option>
|
||||
{% for Section in Sections %}
|
||||
<option value="{{ Section.ID }}"
|
||||
{% if Section.ID == FilterSection %}
|
||||
selected
|
||||
{% endif %}
|
||||
>
|
||||
{{ Section.Name }}
|
||||
</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
{% if PermShowArchived %}
|
||||
</div>
|
||||
<div class="col-sm-6 col-lg-3 mb-2">
|
||||
|
||||
<label for="archive" class="form-label">
|
||||
Status
|
||||
</label>
|
||||
<select class="form-select" id="archive" data-search-field="archive" data-search-advanced="false" name="archive">
|
||||
{% if PermShow %}
|
||||
<option value="0">Actif</option>
|
||||
{% endif %}
|
||||
|
||||
{% if PermShowArchived %}
|
||||
<option
|
||||
value="1"
|
||||
|
||||
{% if FilterArchive == "1" %}
|
||||
selected
|
||||
{% endif %}
|
||||
>
|
||||
Archivé
|
||||
</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
{% 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>
|
||||
<div class="col-sm-6 col-lg-3 mb-2">
|
||||
|
||||
<label for="last_name" class="form-label">
|
||||
Nom de famille
|
||||
</label>
|
||||
<input type="text" class="form-control" id="last_name" data-search-field="last_name" data-search-advanced="false" name="last_name">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6 col-lg-3 mb-2">
|
||||
|
||||
<label for="first_name" class="form-label">
|
||||
Prénom
|
||||
</label>
|
||||
<input type="text" class="form-control" id="first_name" data-search-field="first_name" data-search-advanced="true" name="first_name">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-2">
|
||||
<div class="col-6">
|
||||
<button class="btn btn-outline-primary btn-sm" id="advanced" data-state="false" type="button">
|
||||
<i class="bi-chevron-double-down me-1"></i> Avancé
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-6 text-end">
|
||||
<button class="btn btn-outline-success btn-sm" id="search" type="button">
|
||||
<i class="bi-search me-1"></i> Recherche
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="filters" method="get" class="my-3">
|
||||
<input type="hidden" name="p" value="{{ Pagination.CurrentPage }}">
|
||||
<input type="hidden" name="s">
|
||||
</form>
|
||||
|
||||
<div class="table-responsive">
|
||||
|
|
@ -265,9 +251,40 @@
|
|||
{% block javascript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#filters select").on("change", function() {
|
||||
$("#filters").submit();
|
||||
$("#search").on("click", function() {
|
||||
search();
|
||||
});
|
||||
|
||||
$("#advanced").on("click", function() {
|
||||
var state = $(this).data("state");
|
||||
$(this).data("state", !state);
|
||||
|
||||
if (state) {
|
||||
$(this).find("i").removeClass("bi-chevron-double-up");
|
||||
$(this).find("i").addClass("bi-chevron-double-down");
|
||||
} else {
|
||||
$(this).find("i").removeClass("bi-chevron-double-down");
|
||||
$(this).find("i").addClass("bi-chevron-double-up");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function search() {
|
||||
var advancedSearch = $("#advanced").data("state");
|
||||
var searchData = {};
|
||||
|
||||
$("[data-search-field]").each(function() {
|
||||
var advancedField = $(this).data("search-advanced");
|
||||
if (!advancedSearch && advancedField) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index = $(this).data("search-field");
|
||||
var value = $(this).val();
|
||||
searchData[index] = value;
|
||||
});
|
||||
|
||||
console.log(searchData);
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue