Start reworking the members and contacts search
This commit is contained in:
parent
5882fe49d2
commit
7a65aa43b1
1 changed files with 97 additions and 80 deletions
|
|
@ -44,97 +44,83 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="filters" method="get" class="my-3">
|
<div class="row">
|
||||||
<input type="hidden" name="p" value="{{ Pagination.CurrentPage }}">
|
<div class="col-sm-6 col-lg-3 mb-2">
|
||||||
|
|
||||||
<div class="row">
|
<label for="section" class="form-label">
|
||||||
<div class="col-6 col-lg-3 mb-2">
|
Section
|
||||||
|
</label>
|
||||||
<label
|
<select class="form-select" id="section" data-search-field="section" data-search-advanced="false" name="section">
|
||||||
for="archive"
|
<option value="0">Choisir...</option>
|
||||||
class="form-label"
|
{% for Section in Sections %}
|
||||||
>
|
<option value="{{ Section.ID }}"
|
||||||
Section
|
{% if Section.ID == FilterSection %}
|
||||||
</label>
|
selected
|
||||||
<select
|
{% endif %}
|
||||||
class="form-select"
|
>
|
||||||
id="section"
|
{{ Section.Name }}
|
||||||
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
|
|
||||||
</option>
|
</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
|
<option
|
||||||
value="1"
|
value="1"
|
||||||
|
|
||||||
{% if FilterArchive == "1" %}
|
{% if FilterArchive == "1" %}
|
||||||
selected
|
selected
|
||||||
{% endif %}
|
{% endif %}
|
||||||
>
|
>
|
||||||
Archivé
|
Archivé
|
||||||
</option>
|
</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</select>
|
</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>
|
||||||
|
<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>
|
</form>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|
@ -265,9 +251,40 @@
|
||||||
{% block javascript %}
|
{% block javascript %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#filters select").on("change", function() {
|
$("#search").on("click", function() {
|
||||||
$("#filters").submit();
|
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>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue