A-Z browsing

This commit is contained in:
Claude Brisson
2024-02-28 11:37:49 +01:00
parent 57192f166b
commit a13fea13de
4 changed files with 40 additions and 10 deletions

View File

@@ -21,19 +21,19 @@ function searchResultShown() {
function search(needle) {
needle = needle.trim();
if (needle && needle.length > 2) {
if (needle && (needle === '*' || needle.length > 2)) {
let form = $('#player-form')[0];
let search = {
needle: needle,
aga: form.val('aga'),
// aga: form.val('aga'),
egf: form.val('egf'),
ffg: form.val('ffg'),
}
let country = form.val('countryFilter');
if (country) search.countryFilter = country;
let searchFormState = {
countryFilter: country ? true : false,
aga: search.aga,
countryFilter: !!country,
// aga: search.aga,
egf: search.egf,
ffg: search.ffg
};
@@ -92,7 +92,7 @@ function addPlayers() {
let status = form.val('final') || false;
form.reset();
// initial search checkboxes position
['countryFilter', 'aga', 'egf', 'ffg'].forEach(id => {
['countryFilter', /* 'aga', */ 'egf', 'ffg'].forEach(id => {
let value = store(id);
let ctl = $(`#${id}`);
if (value !== null && typeof(value) !== 'undefined' && ctl.length) {
@@ -253,7 +253,7 @@ onLoad(() => {
});
let searchFormState = store('searchFormState')
if (searchFormState) {
for (let id of ["countryFilter", "aga", "egf", "ffg"]) {
for (let id of ["countryFilter", /* "aga", */ "egf", "ffg"]) {
let ctl = $(`#${id}`);
if (ctl.length) {
ctl[0].checked = searchFormState[id];
@@ -410,4 +410,7 @@ onLoad(() => {
}));
bulkUpdate(players);
});
$('#browse-players').on('click', e => {
search('*');
});
});

View File

@@ -84,12 +84,13 @@
</div>
</div>
#end
<div class="ten wide field">
<div class="eight wide field">
<div class="ui icon input">
<input id="needle" name="needle" type="text" placeholder="Search...">
<i id="clear-search" class="clickable close icon"></i>
</div>
</div>
#* Disabled
<div class="two wide field">
<div class="toggle">
<input id="aga" name="aga" type="checkbox" value="true"/>
@@ -99,6 +100,7 @@
<label>AGA</label>
</div>
</div>
*#
<div class="two wide field">
<div class="toggle">
<input id="egf" name="egf" type="checkbox" checked value="true"/>
@@ -117,6 +119,11 @@
<label>FFG</label>
</div>
</div>
<div class="two wide field">
<button id="browse-players" type="button" class="ui basic icon button">
<i class="sort alphabet down icon"></i>
</button>
</div>
<div id="search-result"></div>
</div>
<div class="two stackable fields">