diff --git a/bus.json b/bus.json new file mode 100644 index 0000000..d7b4332 --- /dev/null +++ b/bus.json @@ -0,0 +1,51 @@ +[ + { + "matricola": "10108", + "compagnia": "START Romagna", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "https://ertpl.pages.dev/startravenna_bus/extraurbano/desimon.html#10108" + }, + { + "matricola": "10109", + "compagnia": "START Romagna", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "https://ertpl.pages.dev/startravenna_bus/extraurbano/desimon.html#10109" + }, + { + "matricola": "10110", + "compagnia": "START Romagna", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "https://ertpl.pages.dev/startravenna_bus/extraurbano/desimon.html#10110" + }, + { + "matricola": "10111", + "compagnia": "START Romagna", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "https://ertpl.pages.dev/startravenna_bus/extraurbano/desimon.html#10111" + }, + { + "matricola": "10112", + "compagnia": "START Romagna", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "https://ertpl.pages.dev/startravenna_bus/extraurbano/desimon.html#10112" + }, + { + "matricola": "10113", + "compagnia": "START Romagna", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "https://ertpl.pages.dev/startravenna_bus/extraurbano/desimon.html#10113" + }, + { + "matricola": "10114", + "compagnia": "START Romagna", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "https://ertpl.pages.dev/startravenna_bus/extraurbano/desimon.html#10114" + } +] diff --git a/cerca.html b/cerca.html new file mode 100644 index 0000000..480633b --- /dev/null +++ b/cerca.html @@ -0,0 +1,55 @@ + + + + + Cerca su ER-TPL + + + + + + + + +
+ +
+

Cerca una matricola

+

In questa pagina puoi cercare un veicolo in base alla sua matricola.
Inoltre, potrai cliccare sopra al bus per andare alla sua pagina apposita.

+ +
+ + + diff --git a/search.js b/search.js new file mode 100644 index 0000000..b499a4c --- /dev/null +++ b/search.js @@ -0,0 +1,44 @@ +const searchBar = document.getElementById('searchBar'); + const productsContainer = document.getElementById('bus-container'); + let allProducts = []; + + const url = 'bus.json'; // cambia con il tuo URL + + fetch(url) + .then(response => { + if (!response.ok) throw new Error("Errore nel caricamento dei dati."); + return response.json(); + }) + .then(data => { + allProducts = data; + //renderProducts(allProducts); + }) + .catch(error => console.error('Errore nel caricamento dei dati:', error)); + + searchBar.addEventListener('input', () => { + if (searchBar.value == '') { + productsContainer.innerHTML = ''; + return; + } + const searchTerm = searchBar.value.toLowerCase(); + const filtered = allProducts.filter(bus => + bus.matricola.toLowerCase().includes(searchTerm) + ); + renderProducts(filtered); + }); + + function renderProducts(products) { + productsContainer.innerHTML = ''; + products.forEach(bus => { + const div = document.createElement('div'); + div.className = 'product-card'; + div.innerHTML = ` + +

${bus.matricola}

+

${bus.compagnia} - ${bus.settore}

+

${bus.modello}

+
+ `; + productsContainer.appendChild(div); + }); + } \ No newline at end of file diff --git a/startravenna_bus/listamezzi.html b/startravenna_bus/listamezzi.html index 901cb3c..b7e7f68 100644 --- a/startravenna_bus/listamezzi.html +++ b/startravenna_bus/listamezzi.html @@ -27,8 +27,10 @@

Dismesso

Demolito

In altro deposito (FC, RN)

+

- +
+
@@ -1307,6 +1309,7 @@ -
Matricola Targa Mezzo Karsan e-ATAK
+ + \ No newline at end of file