Update start-fermatebus.
This commit is contained in:
parent
2f99dfd532
commit
09c037a89a
|
@ -52,6 +52,7 @@
|
||||||
<div class="riga">
|
<div class="riga">
|
||||||
<h2 class="piccolospazio">Ravenna:</h2>
|
<h2 class="piccolospazio">Ravenna:</h2>
|
||||||
<p class="piccolospazio">
|
<p class="piccolospazio">
|
||||||
|
Ora è possibile visualizzare gli orari fermata in <a class="novita" href="/start_menu/servizi/start-fermatebus/index.html">visualizzatore fermate</a>.<br>
|
||||||
Aggiunti <a class="novita" href="/startravenna_bus/suburbano/manlc19g.html">MAN Lion's City 19G</a>.<br>
|
Aggiunti <a class="novita" href="/startravenna_bus/suburbano/manlc19g.html">MAN Lion's City 19G</a>.<br>
|
||||||
Aggiunti servizi Start.
|
Aggiunti servizi Start.
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<h2>Informazioni fermata</h2>
|
<h2>Informazioni fermata <span id="fermata-span"></span></h2>
|
||||||
<div id="tabella-container">Caricamento dati...</div>
|
<div id="tabella-container">Caricamento dati...</div>
|
||||||
<footer>
|
<footer>
|
||||||
<p>Copyright (C) 2025 ER-TPL Team - <a href="https://ertpl.pages.dev" target="_blank">ertpl.pages.dev</a> - code by Il Dani <a href="https://git.vichingo455.freeddns.org/daniele/start-fermatebus" target="_blank">Codice Sorgente</a><br>
|
<p>Copyright (C) 2025 ER-TPL Team - <a href="https://ertpl.pages.dev" target="_blank">ertpl.pages.dev</a> - code by Il Dani <a href="https://git.vichingo455.freeddns.org/daniele/start-fermatebus" target="_blank">Codice Sorgente</a><br>
|
||||||
|
|
|
@ -2,15 +2,15 @@ const params = new URLSearchParams(window.location.search);
|
||||||
const palina = params.get('palina');
|
const palina = params.get('palina');
|
||||||
const targetID = params.get('targetID');
|
const targetID = params.get('targetID');
|
||||||
const selectedOption = params.get('selectedOption');
|
const selectedOption = params.get('selectedOption');
|
||||||
console.log(palina, targetID, selectedOption);
|
|
||||||
|
|
||||||
// Esempio URL backend che ritorna JSON { linea, destinazione, veicolo, soppressa }
|
|
||||||
const urlBackend = `https://api.vichingo455.freeddns.org/start-fermatebus.json/?param=${targetID}¶m2=${selectedOption}&palina=${palina}`;
|
const urlBackend = `https://api.vichingo455.freeddns.org/start-fermatebus.json/?param=${targetID}¶m2=${selectedOption}&palina=${palina}`;
|
||||||
|
//const urlBackend = `http://localhost:3005/?param=${targetID}¶m2=${selectedOption}&palina=${palina}`;
|
||||||
function caricadati(){
|
function caricadati(){
|
||||||
fetch(urlBackend)
|
fetch(urlBackend)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
const fermata_span = document.getElementById('fermata-span');
|
||||||
|
fermata_span.innerHTML = `"${data[0].fermata}"`;
|
||||||
const container = document.getElementById('tabella-container');
|
const container = document.getElementById('tabella-container');
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@ function caricadati(){
|
||||||
<tr>
|
<tr>
|
||||||
<th>Linea</th>
|
<th>Linea</th>
|
||||||
<th>Destinazione</th>
|
<th>Destinazione</th>
|
||||||
|
<th>Orario</th>
|
||||||
|
<th>Stato attuale</th>
|
||||||
<th>Veicolo</th>
|
<th>Veicolo</th>
|
||||||
<th>Soppressa</th>
|
<th>Soppressa</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -36,7 +38,7 @@ function caricadati(){
|
||||||
|
|
||||||
// Corpo tabella
|
// Corpo tabella
|
||||||
const tbody = document.createElement('tbody');
|
const tbody = document.createElement('tbody');
|
||||||
data.forEach(item => {
|
data.slice(1).forEach(item => {
|
||||||
const tr = document.createElement('tr');
|
const tr = document.createElement('tr');
|
||||||
if (item.soppressa) {
|
if (item.soppressa) {
|
||||||
tr.classList.add('bus-card-red');
|
tr.classList.add('bus-card-red');
|
||||||
|
@ -44,6 +46,8 @@ function caricadati(){
|
||||||
tr.innerHTML = `
|
tr.innerHTML = `
|
||||||
<td>${item.linea}</td>
|
<td>${item.linea}</td>
|
||||||
<td>${item.destinazione}</td>
|
<td>${item.destinazione}</td>
|
||||||
|
<td>${item.orario}</td>
|
||||||
|
<td>${item.stato}</td>
|
||||||
<td>${item.mezzo}</td>
|
<td>${item.mezzo}</td>
|
||||||
<td>${item.soppressa ? 'Sì' : 'No'}</td>
|
<td>${item.soppressa ? 'Sì' : 'No'}</td>
|
||||||
`;
|
`;
|
||||||
|
|
Loading…
Reference in New Issue