Pulsante aggiorna bus in servizio seta

This commit is contained in:
Leocraft1
2025-08-25 11:14:23 +02:00
parent 53f782d715
commit 37c752ada5
3 changed files with 622 additions and 606 deletions

View File

@@ -20,8 +20,7 @@
<li><h1 class="warning">ATTENZIONE! Il servizio è ancora in fase di sviluppo. Ci scusiamo per eventuali malfunzionamenti.</h1></li> <li><h1 class="warning">ATTENZIONE! Il servizio è ancora in fase di sviluppo. Ci scusiamo per eventuali malfunzionamenti.</h1></li>
</ul> </ul>
</nav> </nav>
<nav style="display: flex;"> <nav id="nav-inservizio" style="display: flex;">
<ul> <ul>
<li><a href="/index.html"><h1 style="font-size: 100%;font-weight: 500;">Home</h1></a></li> <li><a href="/index.html"><h1 style="font-size: 100%;font-weight: 500;">Home</h1></a></li>
<li><a href="/seta_menu/seta.html"><h1 style="font-size: 100%;font-weight: 500;">SETA Modena</h1></a></li> <li><a href="/seta_menu/seta.html"><h1 style="font-size: 100%;font-weight: 500;">SETA Modena</h1></a></li>

View File

@@ -108,9 +108,12 @@ function caricadati(){
//FILTRI //FILTRI
//Filtro per linea //Filtro per linea
lineaSelect.addEventListener('change', function(event) { lineaSelect.addEventListener('change', function(event) {
const eventConst=event; if(intervalFiltrati!=undefined){
caricaFiltratiLinea(eventConst); clearInterval(intervalFiltrati);
setInterval(function dummyFunc(){caricaFiltratiLinea(eventConst);}, 60000); }
const selectedOption = event.target.value;
caricaFiltratiLinea(selectedOption);
var intervalFiltrati = setInterval(function dummyFunc(){caricaFiltratiLinea(selectedOption);}, 60000);
clearInterval(refreshGeneraleID); clearInterval(refreshGeneraleID);
if(document.getElementById("reimposta-filtro")==undefined){ if(document.getElementById("reimposta-filtro")==undefined){
const reimpostaFiltro = document.createElement('p'); const reimpostaFiltro = document.createElement('p');
@@ -123,18 +126,31 @@ lineaSelect.addEventListener('change', function(event) {
} }
}); });
function caricaFiltratiLinea(event){ function reloadFiltratiLinea(){
caricaFiltratiLinea(lineaSelect.value);
}
function caricaFiltratiLinea(selectedOption){
const container = document.getElementById('tabella-container');
container.innerHTML = 'Caricamento dati...';
fetch(urlList) fetch(urlList)
.then(response => { .then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati."); if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json(); return response.json();
}) })
.then(data=>{ .then(data=>{
const selectedOption = event.target.value;
currentSelectedOption = selectedOption;
const container = document.getElementById('tabella-container');
container.innerHTML = ''; container.innerHTML = '';
//Sostituisco il pulsante aggiorna tutti col pulsante aggiorna filtrati
const aggiornaNav = document.getElementById('nav-inservizio');
aggiornaNav.innerHTML = `
<ul>
<li><a href="/index.html"><h1 style="font-size: 100%;font-weight: 500;">Home</h1></a></li>
<li><a href="/seta_menu/seta.html"><h1 style="font-size: 100%;font-weight: 500;">SETA Modena</h1></a></li>
</ul>
<ul style="flex:1;justify-content: right;">
<li><a href="javascript:reloadFiltratiLinea();"><h1 style="font-size: 16px;font-weight: 500;">Aggiorna</h1></a></li>
</ul>
`;
// Creo tabella // Creo tabella
const table = document.createElement('table'); const table = document.createElement('table');
@@ -173,6 +189,7 @@ function caricaFiltratiLinea(event){
table.appendChild(tbody); table.appendChild(tbody);
container.appendChild(table); container.appendChild(table);
console.log("Ricarico");
}else{ }else{
container.appendChild(table); container.appendChild(table);
} }

File diff suppressed because it is too large Load Diff