Beta businserivizio seta

This commit is contained in:
Leocraft1
2025-08-19 17:36:33 +02:00
parent 53b0e7b58f
commit f643f7ce41
9 changed files with 598 additions and 10 deletions

View File

@@ -0,0 +1,260 @@
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;
}
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(241, 120, 120) !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#corsie-nav ul{
justify-content: center;
}
nav#corsie-nav ul li a{
color: white;
text-decoration: underline;
}
nav#corsie-nav ul li{
margin-left: 8px;
margin-right: 7px;
}
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;
}
input{
height: 46.8px;
}
#searchBar {
padding: 10px;
font-size: 16px;
border-radius: 6px;
border: 1px solid var(--border-color);
width: 280px;
}
#stopCodeBar {
padding: 10px;
font-size: 16px;
border-radius: 6px;
border: 1px solid var(--border-color);
width: 280px;
}
img{
height:300px;
}
@media (max-width: 768px) {
.search-result {
display: block;
width: 95.5%;
}
table.image-table {
width: 100%;
}
table.image-table td {
display: block;
width: 100%;
}
table.image-table img {
margin-bottom: 10px;
}
.container {
flex-direction: column;
}
th,td {
font-size: 70%;
}
nav#corsie-nav ul li a{
font-size: 75%;
margin: 0;
}
table {
margin-top: 10px;
}
h2{
margin-bottom: 0;
}
h2.noreduction{
margin-bottom: 16px;
}
#searchBar {
width: 80%;
}
#stopCodeBar {
width: 80%;
}
hr{
margin-bottom:19px;
}
img{
width: 98%;
height: auto;
}
div.content-background {
max-width: 100%;
}
}
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,36 @@
<!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_menu/cercaorario/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 fermata "<span id="fermata-span"></span>"</h2>
<nav id="corsie-nav"></nav>
<div id="tabella-container">Caricamento dati...</div>
<p>Il ritardo viene espresso rispetto all'orario previsto. Quello indicato, se disponibile, è l'orario di arrivo in tempo reale.</p>
<p>E' possibile cliccare sul numero del mezzo per vedere la sua posizione sulla mappa.</p>
<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/fermata.js"></script>
</body>
</html>

View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="description" content="Cerca orari in tempo reale per le fermate di SETA a 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>
<ul>
<li><h1 class="warning">ATTENZIONE! Il servizio è ancora in fase di sviluppo. Ci scusiamo per eventuali malfunzionamenti.</h1></li>
</ul>
<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>
</nav>
</header>
<h1>Visualizzatore bus in servizio SETA Modena</h1>
<div 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>
<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/script.js"></script>
</body>
</html>

View File

@@ -0,0 +1,132 @@
const params = new URLSearchParams(window.location.search);
const nome = params.get('name');
const codice = params.get('code');
//Sets stop name
const fermata_span = document.getElementById('fermata-span');
fermata_span.textContent=nome;
//Set corsie per stazione o autostazione
const corsie_nav = document.getElementById('corsie-nav');
if(nome.includes("STAZIONE FS")){
corsie_nav.innerHTML = `
<ul>
<li>
<a href="/seta_menu/cercaorario/altrecorsie.html?location=STAZIONE FS">Altre corsie</a>
</li>
</ul>`;
}
if(nome.includes("MODENA AUTOSTAZIONE")){
corsie_nav.innerHTML = `
<ul>
<li>
<a href="/seta_menu/cercaorario/altrecorsie.html?location=MODENA AUTOSTAZIONE">Altre corsie</a>
</li>
</ul>`;
}
if(nome.includes("GARIBALDI")){
corsie_nav.innerHTML = `
<ul>
<li>
<a href="/seta_menu/cercaorario/altrecorsie.html?location=GARIBALDI">Altre corsie</a>
</li>
</ul>`;
}
const urlBackend = `https://setaapi.serverissimo.freeddns.org/arrivals/${codice}`;
//const urlBackend = `http://localhost:5001/arrivals/${codice}`;
function caricadati(){
fetch(urlBackend)
.then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json();
})
.then(data => {
item = data.arrival;
})
.then(data => {
const container = document.getElementById('tabella-container');
container.innerHTML = '';
if (element.error=="no arrivals scheduled in next 90 minutes") {
container.innerHTML = '<h3>Nessuna corsa programmata nei prossimi 90 minuti.</h3>';
return;
}
// 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">Orario (Rit/Ant)</th>
<th class="stato">Stato corsa</th>
<th class="veicolo">Veicolo</th>
<th class="location">Ora si trova a</th>
</tr>
`;
table.appendChild(thead);
// Corpo tabella
const tbody = document.createElement('tbody');
element.services.forEach(item => {
const tr = document.createElement('tr');
if(element.type=="planned"){
var stato="Prevista";
}else{
var stato="In tempo reale";
}if(element.next_stop==null){
var posizione="";
}else{
var posizione=element.next_stop;
}
if(element.delay==undefined){
tr.innerHTML = `
<td>${element.service}</td>
<td>${element.destination}</td>
<td>${element.arrival}</td>
<td>${stato}</td>
<td><a href="https://wimb.setaweb.it/qm/index.html?id=${element.busnum}" class="bianco">${element.busnum}</a></td>
<td>${posizione}</td>
`;
tbody.appendChild(tr);
}else{
if(element.delay>0){
tr.innerHTML = `
<td>${element.service}</td>
<td>${element.destination}</td>
<td>${element.arrival} (+${element.delay})</td>
<td>${stato}</td>
<td><a href="https://wimb.setaweb.it/qm/index.html?id=${element.busnum}" class="bianco">${element.busnum}</a></td>
<td>${posizione}</td>
`;
tbody.appendChild(tr);
}else{
tr.innerHTML = `
<td>${element.service}</td>
<td>${element.destination}</td>
<td>${element.arrival} (${element.delay})</td>
<td>${stato}</td>
<td><a href="https://wimb.setaweb.it/qm/index.html?id=${element.busnum}" class="bianco">${element.busnum}</a></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.';
});
}
caricadati();
setInterval(caricadati, 60000);

View File

@@ -0,0 +1,106 @@
const lineaSelect = document.getElementById('linea');
const modelloSelect = document.getElementById('modello');
let allresults = [];
//Reperire modelli e numeri linea
const urlRoutes = 'https://setaapi.serverissimo.freeddns.org/routenumberslist';
//const urlRoutes = 'http://localhost:5001/stoplist';
const urlModels = 'https://setaapi.serverissimo.freeddns.org/busmodels';
//const urlModels = 'http://localhost:5001/stoplist';
//Fetch routes and models and fill the select options
fetch(urlRoutes)
.then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json();
})
.then(data => {
allresults = data;
console.log(allresults);
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(route => {
const option = document.createElement('option');
option.value = route;
option.textContent = route;
modelloSelect.appendChild(option);
});
})
.catch(error => console.error('Errore nel caricamento dei dati:', error));
const urlList="https://setaapi.serverissimo.freeddns.org/busesinservice";
caricadati();
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="orario">Veicolo</th>
<th class="stato">Modello veicolo</th>
<th class="linea">Linea</th>
<th class="direzione">Direzione</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><a href="https://wimb.setaweb.it/qm/index.html?id=${element.vehicle_code}" class="bianco">${element.vehicle_code}</a></td>
<td>${element.model}</td>
<td>${element.linea}</td>
<td>${element.route_desc}</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.';
});
}

View File

@@ -45,7 +45,8 @@
<div style="height: 5px;"></div>
<h2>Servizi SETA Modena:</h2>
<div>
<a class="gbutton" href="cercaorario/index.html">Orario in tempo reale</a>
<a class="gbutton" href="cercaorario/index.html">Orari in tempo reale</a>
<a class="gbutton" href="businservizio/index.html">Lista autobus in servizio (BETA)</a>
</div>
</div>
<script src="/scripts/setasearch.js"></script>