mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-10-02 17:50:49 +00:00
First implementation of a new search filter for Ravenna. Hidden.
This commit is contained in:
@@ -26,6 +26,11 @@ function populateSearchResults(results, selectedOption) {
|
||||
});
|
||||
}
|
||||
|
||||
function getFermatadaBreve(codbreve){
|
||||
const middle = String(codbreve).padStart(4, "0");
|
||||
return `7${middle}0`;
|
||||
}
|
||||
|
||||
function filterOptions(query, data) {
|
||||
const q = query.toLowerCase();
|
||||
return data.filter(item =>
|
||||
@@ -46,10 +51,27 @@ searchBar.addEventListener('input', function() {
|
||||
populateSearchResults(filteredOptions, currentSelectedOption);
|
||||
});
|
||||
|
||||
searchBar.addEventListener('input', function() {
|
||||
const query = searchBar.value;
|
||||
let filteredOptions;
|
||||
|
||||
if (currentSelectedOption !== "ra") {
|
||||
filteredOptions = filterOptions(query, allOptions);
|
||||
} else {
|
||||
//placeholder: qui metteremo il filtro dettagliato per "ra"
|
||||
filteredOptions = filterOptions(query, allOptions);
|
||||
//TODO: implementare filtro "ra" custom
|
||||
}
|
||||
|
||||
populateSearchResults(filteredOptions, currentSelectedOption);
|
||||
});
|
||||
|
||||
|
||||
document.getElementById('bacino').addEventListener('change', function(event) {
|
||||
const selectedOption = event.target.value;
|
||||
currentSelectedOption = selectedOption;
|
||||
|
||||
const radiobuttons = document.getElementById('radios');
|
||||
const ricerca = document.getElementById('ricerca');
|
||||
ricerca.removeAttribute('style');
|
||||
|
||||
@@ -57,10 +79,14 @@ document.getElementById('bacino').addEventListener('change', function(event) {
|
||||
|
||||
if(selectedOption == "n"){
|
||||
ricerca.setAttribute("style", "display: none;");
|
||||
radiobuttons.setAttribute("style", "display: none;");
|
||||
allOptions = [];
|
||||
document.getElementById('searchResults').innerHTML = '';
|
||||
return;
|
||||
}
|
||||
else if(selectedOption == "ra"){
|
||||
radiobuttons.removeAttribute('style')
|
||||
}
|
||||
|
||||
if(selectedOption != "n"){
|
||||
const resultsContainer = document.getElementById('searchResults');
|
||||
|
Reference in New Issue
Block a user