Spostamento servizi seta

This commit is contained in:
Leocraft1
2025-11-02 14:30:43 +01:00
parent 8fea308e79
commit 9f6f009d1c
32 changed files with 131 additions and 131 deletions

View File

@@ -0,0 +1,249 @@
body {
background-color: #282828;
text-align: center;
color: white;
font-family: Titillium Web;
}
.search-result {
border: 2px solid white;
border-radius: 8px;
width: 20vw;
margin: auto;
margin-left: 5px;
margin-right: 5px;
margin-top: 10px;
cursor: pointer;
display: inline-block;
}
h3{
font-size: 20px;
}
table {
border-collapse: collapse;
border-radius: 8px;
min-width: 85%;
max-width: 100%;
margin: auto;
margin-top: 18px;
}
td.uguale{
width: 50%;
}
th {
background-color: rgb(204, 132, 0);
}
th,td {
border: 2px solid #444;
padding: .7vw;
padding-top: .6vw;
padding-bottom: .6vw;
text-align: left;
}
.bus-card-red {
background-color: rgb(55,0,0) !important;
}
.bus-card-yellow {
background-color: rgb(65, 65, 0) !important;
}
.bus-card-green {
background-color: rgb(0, 55, 0) !important;
}
hr{
margin-top:19px;
}
h1.warning {
color:red;
font-size: 16px;
}
h1.yellow-warning {
color:rgb(255, 205, 0);
font-size: 16px;
}
header {
font-size: 67%;
background-color: #333;
height: auto;
padding: 0px 0px;
align-items: start;
width: 100%;
border-radius: 10px;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
justify-content: left;
}
nav {
text-align: center;
flex-shrink: 0;
}
nav ul li {
margin-left: 20px;
margin-right: 20px;
}
nav ul li a {
color: #fff;
text-decoration: none;
font-size: 16px;
}
nav ul li a:hover {
text-decoration: underline;
}
a {
color: orange;
}
a.bianco{
color: white;
text-decoration: none;
}
a.biancosott{
color: white;
}
a.link-cell {
display: block;
width: 100%;
height: 100%;
color: white;
}
div.content-background {
background-color: #333;
max-width: 85%;
margin: auto;
border-radius: 8px;
padding-top: 16px;
padding-bottom: 16px;
}
div.content-background h3{
margin-top: 0;
margin-bottom: 16px;
}
div.select-container {
display: flex;
justify-content: center;
gap: 4px;
padding-left: 32px;
padding-right: 32px;
}
div.content-background select {
flex: 1 1 0;
width: 100%;
min-width: 0;
box-sizing: border-box;
}
select,input{
height: 50px;
width: auto;
background-color: #333;
color: white;
border-radius: 8px;
border: 2px solid rgb(100, 100, 100);
padding-left: 8px;
padding-right: 0px;
padding-top: 0px;
padding-bottom: 0px;
}
@media (max-width: 768px) {
p.scaled{
font-size: 2vw;
}
table {
margin-top: 10px;
min-width: 100%;
}
div.content-background {
max-width: 100%;
}
.search-result {
display: block;
width: 96.5%;
}
.container {
flex-direction: column;
}
th,td {
font-size: 2vw;
}
nav#corsie-nav ul li a{
font-size: 90%;
margin: 0;
}
table {
width: 100%;
}
h2{
margin-bottom: 8px;
}
h2.noreduction{
margin-bottom: 16px;
}
hr{
margin-bottom:19px;
}
img{
width: 98%;
height: auto;
}
nav ul:last-child li {
margin-right: 20px;
}
nav ul li {
margin-right: 8px;
}
}
@media (max-width: 512px) {
p.scaled{
font-size: 3vw;
}
th,td {
font-size: 3vw;
}
table{
margin-top:10px;
}
h2{
margin-bottom: 0;
}
h2.noreduction{
margin-bottom: 16px;
}
}
footer {
position: relative;
bottom: 0;
left: 0;
width: 100%;
}
div.search-result div{
margin-left: 10px;
margin-right: 10px;
}
p.space{
width: 20px;
}

View File

@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="description" content="Monitor bus in servizio SETA bacino di Modena.">
<meta name="keywords" content="seta, modena, seta-modena, orari, in, tempo, reale, autobus, fermate, orario, palina">
<meta name="author" content="ER-TPL Team">
<title>SETA Modena - Bus in servizio</title>
<link rel="stylesheet" href="css/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="https://www.setaweb.it/images/favicon/android-icon-192x192.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700&display=swap" rel="stylesheet">
</head>
<body>
<header>
<nav id="nav-inservizio" style="display: flex;">
<ul>
<li><a href="/index.html"><h1 style="font-size: 100%;font-weight: 500;">Home</h1></a></li>
<li><a href="/service/newui.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=""><h1 style="font-size: 100%;font-weight: 500;">Aggiorna</h1></a></li>
</ul>
</nav>
</header>
<h1>Visualizzatore bus in servizio SETA Modena</h1>
<div id="content-background" class="content-background">
<h3>Ordina per:</h3>
<div class="select-container">
<select id="linea" autocomplete="off">
<option value="ph" disabled selected hidden style="color: gray;">Linea:</option>
</select>
<select id="modello" autocomplete="off">
<option value="ph" disabled selected hidden style="color: gray;">Modello:</option>
</select>
</div>
</div>
<p class="scaled">E' possibile cliccare sul numero del mezzo per ulteriori informazioni.</p>
<div id="tabella-container"><div style="height: 12px;"></div>Caricamento dati...</div>
<footer>
<div>
<p>Copyright (C) 2025 ER-TPL Team - <a href="https://ertpl.pages.dev" target="_blank">ertpl.pages.dev</a> - code by Il Dani & SetaModenaFanpage <a href="https://github.com/Leocraft1/SetaAPI" target="_blank">Codice Sorgente</a> - I loghi SETA Spa sono marchi registrati e sono inseriti in questo sito solo a scopo di illustrazione.</p>
</div>
</footer>
<script src="js/script.js"></script>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SETA Modena - Orario fermate</title>
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="https://www.setaweb.it/images/favicon/android-icon-192x192.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700&display=swap" rel="stylesheet">
</head>
<body>
<header>
<nav style="display: flex;">
<ul>
<li><a href="/seta_servizi/businservizio/index.html"><h1 style="font-size: 100%;font-weight: 500;">Torna indietro</h1></a></li>
</ul>
<ul style="flex:1;justify-content: right;">
<li><a href=""><h1 style="font-size: 100%;font-weight: 500;">Aggiorna</h1></a></li>
</ul>
</nav>
</header>
<h2>Informazioni veicolo numero: <span id="numero-span"></span></h2>
<div id="tabella-container">Caricamento dati...</div>
<footer>
<div>
<p>Copyright (C) 2025 ER-TPL Team - <a href="https://ertpl.pages.dev" target="_blank">ertpl.pages.dev</a> - code by Il Dani & SetaModenaFanpage <a href="https://github.com/Leocraft1/SetaAPI" target="_blank">Codice Sorgente</a> - I loghi SETA Spa sono marchi registrati e sono inseriti in questo sito solo a scopo di illustrazione.</p>
</div>
</footer>
<script src="js/infoveicolo.js"></script>
</body>
</html>

View File

@@ -0,0 +1,202 @@
const params = new URLSearchParams(window.location.search);
const id = params.get('id');
//Sets stop name
const numero_span = document.getElementById('numero-span');
numero_span.textContent=id;
const urlBackend = `https://setaapi.serverissimo.freeddns.org/vehicleinfo/${id}`;
//const urlBackend = `http://localhost:5001/vehicleinfo/${id}`;
function caricadati(){
var item=[];
fetch(urlBackend)
.then(response => {
if (!response.ok) throw new Error("Errore di risposta nel caricamento dei dati, probabilmente il server API è offline.");
return response.json();
})
.then(data => {
item = data;
})
.then(data => {
const container = document.getElementById('tabella-container');
container.innerHTML = '';
// Creo tabella
const table = document.createElement('table');
// Intestazione
const thead = document.createElement('thead');
thead.innerHTML = `
<tr>
<th class="linea" colspan="2" style="text-align:center;">Informazioni veicolo:</th>
</tr>
`;
table.appendChild(thead);
// Corpo tabella
const tbody = document.createElement('tbody');
item.features.forEach(element => {
const bus = element.properties;
var tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td class="uguale">Linea:</td>
<td class="uguale">${bus.linea}</td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Direzione:</td>
<td>${bus.route_desc}</td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Tipo linea:</td>
<td>${bus.service_tag}</td>
</tr>
`;
tbody.appendChild(tr);
//Ritardo col +
if(bus.delay>0){
bus.delay="+"+bus.delay;
}
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Ritardo/Anticipo: (+/-)</td>
<td>${bus.delay}</td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Numero mezzo:</td>
<td>${bus.vehicle_code}</td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Modello:</td>
<td>${bus.model}</td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Targa:</td>
<td>${bus.plate_num}</td>
</tr>
`;
tbody.appendChild(tr);
//Si o no pedana
if(bus.pedana==1){
bus.pedana="Sì";
}else{
bus.pedana="No";
}
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Pedana?:</td>
<td>${bus.pedana}</td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Ora si trova a:</td>
<td><a href="/seta_servizi/cercaorario/fermata.html?code=${bus.waypoint_code}&name=${bus.next_stop}" class="bianco">${bus.next_stop}</a></td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Codice percorso:</td>
<td><a href="/seta_modena/servizi/percorsi/percorso.html?routecode=${bus.route_code}" class="bianco">${bus.route_code}</a></td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Codice corsa:</td>
<td><a href="/seta_modena/servizi/percorsi/prossimefermate.html?journeycode=${bus.journey_code}" class="bianco">${bus.journey_code}</a></td>
</tr>
`;
tbody.appendChild(tr);
//Colore sfondo conta passeggeri
if(bus.num_passeggeri<=bus.posti_totali/4){
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td class="bus-card-green">Numero passeggeri a bordo:</td>
<td class="bus-card-green">${bus.num_passeggeri}</td>
</tr>
`;
}else if(bus.num_passeggeri<=bus.posti_totali/1.8){
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td class="bus-card-yellow">Numero passeggeri a bordo:</td>
<td class="bus-card-yellow">${bus.num_passeggeri}</td>
</tr>
`;
}else{
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td class="bus-card-red">Numero passeggeri a bordo:</td>
<td class="bus-card-red">${bus.num_passeggeri}</td>
</tr>
`;
}if(bus.num_passeggeri==null){
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Numero passeggeri a bordo:</td>
<td>Non disponibile</td>
</tr>
`;
}
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Numero posti totali (in piedi + sedili):</td>
<td>${bus.posti_totali}</td>
</tr>
`;
tbody.appendChild(tr);
tr = document.createElement('tr');
tr.innerHTML = `
<tr>
<td>Posizione:</td>
<td><a href="https://wimb.setaweb.it/qm/index.html?id=${bus.vehicle_code}">GPS</a></td>
</tr>
`;
tbody.appendChild(tr);
});
table.appendChild(tbody);
container.appendChild(table);
})
.catch(err => {
console.error('Errore nel caricamento dati:', err);
document.getElementById('tabella-container').textContent = "Errore nella sintassi dei dati ricevuti.";
});
}
caricadati();
setInterval(caricadati, 60000);

View File

@@ -0,0 +1,382 @@
const lineaSelect = document.getElementById('linea');
const modelloSelect = document.getElementById('modello');
const contentBackground = document.getElementById('content-background');
let allresults = [];
const urlList="https://setaapi.serverissimo.freeddns.org/busesinservice";
//const urlList="http://localhost:5001/busesinservice";
//Reperire modelli e numeri linea
const urlRoutes = 'https://setaapi.serverissimo.freeddns.org/routenumberslist';
//const urlRoutes = 'http://localhost:5001/routenumberslist';
const urlModels = 'https://setaapi.serverissimo.freeddns.org/busmodels';
//const urlModels = 'http://localhost:5001/stoplist';
//Fetch routes and models and fill the selects
fetch(urlRoutes)
.then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json();
})
.then(data => {
allresults = data;
allresults.forEach(route => {
const option = document.createElement('option');
option.value = route;
option.textContent = route;
lineaSelect.appendChild(option);
});
})
.catch(error => {console.error('Errore nel caricamento dei dati:', error)});
fetch(urlModels)
.then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json();
})
.then(data => {
allresults = data;
allresults.forEach(model => {
const option = document.createElement('option');
if(
model!="CAM New Busotto"&&
model!="Iveco Cityclass CNG"&&
model!="Irisbus Cityclass CNG ex Pavia"&&
model!="Mercedes Integro O550 (Giallo)"
){
option.value = modelsDictionary(model);
option.textContent = model;
modelloSelect.appendChild(option);
}
});
})
.catch(error => {console.error('Errore nel caricamento dei dati:', error)});
function modelsDictionary(model){
return model;
//Non serve piu! :D
/*
if(model=="Irisbus Citelis CNG EEV"){
return "Irisbus Citelis CNG";
}
if(model=="Irisbus Crossway"){
return "Irisbus Crossway";
}
if(model=="Irisbus Crossway ex Esercito Tedesco"){
return "Irisbus Crossway Esercito";
}
if(model=="Iveco Urbanway Mild Hybrid 2022"){
return "Iveco Urbanway Mild Hybrid CNG";
}
if(model=="MenariniBus Citymood LNG"){
return "Menarinibus Citymood LNG";
}
if(model=="MenariniBus Citymood CNG"){
return "Menarinibus Citymood CNG";
}
if(model=="Iveco Crossway LE 12 CNG"){
return "Iveco Crossway LE CNG";
}
if(model=="Iveco Crossway LE"){
return "Iveco Crossway LE Diesel";
}
if(model=="Iveco Crossway Line"){
return "Iveco Crossway Line";
}
if(model=="Mercedes Integro O550"||model=="Mercedes Integro O550 (Giallo)"){
return "Mercedes Integro";
}
if(model=="Scania Irizar i4 LNG"){
return "Irizar i4 LNG";
}
if(model=="Solaris Urbino 12 III CNG"){
return "Solaris Urbino 12 CNG";
}
if(model=="Iveco Crossway Line 12 CNG"){
return "Iveco Crossway Line CNG";
}
if(model=="MAN Lion's Regio"){
return "MAN Lion's Regio";
}
if(model=="Setra S415 LE 2p ex Bolzano"){
return "Setra ex Bolzano (2 porte)";
}
if(model=="Setra S415 LE 3p ex Bolzano"){
return "Setra ex Bolzano (3 porte)";
}
if(model=="Iveco Crossway LE 14"){
return "Iveco Crossway LE 14m";
}
if(model=="MAN Lion's City 19 CNG"){
return "New MAN Lion's City 19G";
}
if(model=="Solaris Trollino 12 IV"){
return "Solaris Trollino 12";
}
if(model=="Irisbus Cityclass CNG ATCM"){
return "Irisbus Cityclass CNG ATCM";
}
if(model=="Mercedes Citaro O530N CNG"){
return model;
}
if(model=="Iveco Crossway LE 14"){
return "Iveco Crossway LE 14m";
}
if(model=="Iveco Crossway LE 14"){
return "Iveco Crossway LE 14m";
}
if(model=="Iveco Crossway LE 14"){
return "Iveco Crossway LE 14m";
}
if(model=="Iveco Crossway LE 14"){
return "Iveco Crossway LE 14m";
}
*/
}
caricadati();
var refreshGeneraleID=setInterval(caricadati, 60000);
function caricadati(){
fetch(urlList)
.then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json();
})
.then(data => {
item = data.features;
})
.then(data => {
const container = document.getElementById('tabella-container');
container.innerHTML = '';
// Creo tabella
const table = document.createElement('table');
// Intestazione
const thead = document.createElement('thead');
thead.innerHTML = `
<tr>
<th class="linea">Linea</th>
<th class="direzione">Direzione</th>
<th class="orario">Veicolo</th>
<th class="stato">Modello veicolo</th>
<th class="veicolo">Ora si trova a</th>
</tr>
`;
table.appendChild(thead);
// Corpo tabella
const tbody = document.createElement('tbody');
item.forEach(item => {
const element = item.properties;
const tr = document.createElement('tr');
if(element.next_stop==null){
var posizione="";
}else{
var posizione=element.next_stop;
}
tr.innerHTML = `
<td>${element.linea}</td>
<td>${element.route_desc}</td>
<td><a href="infoveicolo.html?id=${element.vehicle_code}" class="bianco">${element.vehicle_code}</a></td>
<td>${element.model}</td>
<td>${posizione}</td>
`;
tbody.appendChild(tr);
});
table.appendChild(tbody);
container.appendChild(table);
})
.catch(err => {
console.error('Errore nel caricamento dati:', err);
document.getElementById('tabella-container').textContent = 'Errore nel caricamento dati.';
});
}
//FILTRI
var intervalFiltrati = 0;
//Filtro per linea
lineaSelect.addEventListener('change', function(event) {
if(intervalFiltrati!=undefined){
//alert("Non è possibile usare due filtri allo stesso momento")
clearInterval(intervalFiltrati);
}
const selectedOption = event.target.value;
caricaFiltratiLinea(selectedOption);
intervalFiltrati = setInterval(function dummyFunc(){caricaFiltratiLinea(selectedOption);}, 60000);
clearInterval(refreshGeneraleID);
if(document.getElementById("reimposta-filtro")==undefined){
const reimpostaFiltro = document.createElement('p');
reimpostaFiltro.setAttribute("style","margin-bottom: 0; font-size: 14px;");
reimpostaFiltro.setAttribute("id","reimposta-filtro");
reimpostaFiltro.innerHTML = `
<a href="" class="biancosott">Reimposta il filtro</a>
`;
contentBackground.appendChild(reimpostaFiltro);
}
});
//Filtro per modello
modelloSelect.addEventListener('change', function(event) {
if(intervalFiltrati!=undefined){
//alert("Non è possibile usare due filtri allo stesso momento")
clearInterval(intervalFiltrati);
}
const selectedOption = event.target.value;
caricaFiltratiModello(selectedOption);
intervalFiltrati = setInterval(function dummyFunc(){caricaFiltratiModello(selectedOption);}, 60000);
clearInterval(refreshGeneraleID);
if(document.getElementById("reimposta-filtro")==undefined){
const reimpostaFiltro = document.createElement('p');
reimpostaFiltro.setAttribute("style","margin-bottom: 0; font-size: 14px;");
reimpostaFiltro.setAttribute("id","reimposta-filtro");
reimpostaFiltro.innerHTML = `
<a href="" class="biancosott">Reimposta il filtro</a>
`;
contentBackground.appendChild(reimpostaFiltro);
}
});
function reloadFiltratiLinea(){
caricaFiltratiLinea(lineaSelect.value);
}
function caricaFiltratiLinea(selectedOption){
const container = document.getElementById('tabella-container');
container.innerHTML = 'Caricamento dati...';
fetch(urlList)
.then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json();
})
.then(data=>{
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="/service/newui.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
const table = document.createElement('table');
// Intestazione
const thead = document.createElement('thead');
thead.innerHTML = `
<tr>
<th class="linea">Linea</th>
<th class="direzione">Direzione</th>
<th class="orario">Veicolo</th>
<th class="stato">Modello veicolo</th>
<th class="veicolo">Ora si trova a</th>
</tr>
`;
table.appendChild(thead);
data.features.forEach(elements => {
// Extract only the numeric part
const number = elements.properties.linea.match(/\d+/g);
if(number==selectedOption){
const tbody = document.createElement('tbody');
const element = elements.properties;
const tr = document.createElement('tr');
if(element.next_stop==null){
var posizione="";
}else{
var posizione=element.next_stop;
}
tr.innerHTML = `
<td>${element.linea}</td>
<td>${element.route_desc}</td>
<td><a href="infoveicolo.html?id=${element.vehicle_code}" class="bianco">${element.vehicle_code}</a></td>
<td>${element.model}</td>
<td>${posizione}</td>
`;
tbody.appendChild(tr);
table.appendChild(tbody);
container.appendChild(table);
console.log("Ricarico");
}else{
container.appendChild(table);
}
});
});
}
function caricaFiltratiModello(selectedOption){
const container = document.getElementById('tabella-container');
container.innerHTML = 'Caricamento dati...';
fetch(urlList)
.then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json();
})
.then(data=>{
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="/service/newui.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:reloadFiltratiModello();"><h1 style="font-size: 16px;font-weight: 500;">Aggiorna</h1></a></li>
</ul>
`;
// Creo tabella
const table = document.createElement('table');
// Intestazione
const thead = document.createElement('thead');
thead.innerHTML = `
<tr>
<th class="linea">Linea</th>
<th class="direzione">Direzione</th>
<th class="orario">Veicolo</th>
<th class="stato">Modello veicolo</th>
<th class="veicolo">Ora si trova a</th>
</tr>
`;
table.appendChild(thead);
data.features.forEach(elements => {
if(elements.properties.model==selectedOption){
const tbody = document.createElement('tbody');
const element = elements.properties;
const tr = document.createElement('tr');
if(element.next_stop==null){
var posizione="";
}else{
var posizione=element.next_stop;
}
tr.innerHTML = `
<td>${element.linea}</td>
<td>${element.route_desc}</td>
<td><a href="infoveicolo.html?id=${element.vehicle_code}" class="bianco">${element.vehicle_code}</a></td>
<td>${element.model}</td>
<td>${posizione}</td>
`;
tbody.appendChild(tr);
table.appendChild(tbody);
container.appendChild(table);
console.log("Ricarico");
}else{
container.appendChild(table);
}
});
});
}
function reloadFiltratiModello(){
caricaFiltratiModello(modelloSelect.value);
}