New service
This commit is contained in:
parent
0c2886591f
commit
f9d0ddc88a
|
@ -0,0 +1,98 @@
|
|||
body {
|
||||
background-color: #282828;
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-family: Helvetica;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
border: 2px solid white;
|
||||
border-radius: 8px;
|
||||
width: 15%;
|
||||
margin: auto;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
margin-top: 10px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-radius: 8px;
|
||||
width: 85%;
|
||||
margin: auto;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: lightslategray;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
border: 2px solid #444;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: dimgray;
|
||||
}
|
||||
|
||||
.bus-card-red {
|
||||
background-color: rgb(241, 120, 120) !important;
|
||||
}
|
||||
|
||||
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.index {
|
||||
display: flex;
|
||||
min-height: 51px;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.search-result {
|
||||
display: block;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>START Romagna - Informazioni fermata</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="shortcut icon" href="img/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="index.html"><p>Home</p></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<h2>Informazioni fermata</h2>
|
||||
<div id="tabella-container">Caricamento dati...</div>
|
||||
<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>
|
||||
Start Romagna, Start e il logo Start Romagna sono marchi registrati e protetti da copyright da Start Romagna SpA. Vengono usati in questa pagina solo per riferimento.</p>
|
||||
</footer>
|
||||
<script src="js/fermata.js"></script>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>START Romagna - Visualizza fermata</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="shortcut icon" href="img/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Visualizzatore fermate START Romagna</h1>
|
||||
<label for="bacino">Bacino:</label>
|
||||
<select id="bacino">
|
||||
<option value="" selected>--Scegli un'opzione--</option>
|
||||
<option value="ra">Ravenna</option>
|
||||
<option value="rn">Rimini</option>
|
||||
<option value="fc">Forlì-Cesena</option>
|
||||
</select>
|
||||
<div>
|
||||
<label for="searchBar">Cerca fermata:</label>
|
||||
<input type="text" id="searchBar" placeholder="Cerca una fermata...">
|
||||
</div>
|
||||
<div id="searchResults"></div>
|
||||
<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>
|
||||
Start Romagna, Start e il logo Start Romagna sono marchi registrati e protetti da copyright da Start Romagna SpA. Vengono usati in questa pagina solo per riferimento.</p>
|
||||
</footer>
|
||||
<script src="js/cercafermata.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,75 @@
|
|||
function loadJSON(file, callback) {
|
||||
fetch(file)
|
||||
.then(response => response.json())
|
||||
.then(data => callback(data))
|
||||
.catch(error => console.error('Errore nel caricare il file JSON:', error));
|
||||
}
|
||||
|
||||
function populateSearchResults(results, selectedOption) {
|
||||
const searchResultsContainer = document.getElementById('searchResults');
|
||||
searchResultsContainer.innerHTML = '';
|
||||
|
||||
if (results.length === 0) {
|
||||
searchResultsContainer.innerHTML = '<p>Nessun risultato trovato</p>';
|
||||
return;
|
||||
}
|
||||
|
||||
results.forEach(item => {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'search-result';
|
||||
div.innerHTML = `
|
||||
<div>
|
||||
<h3>${item.nome}</h3>
|
||||
<p>Palina: ${item.palina}, Target ID: ${item.targetID}</p>
|
||||
</div>
|
||||
`;
|
||||
|
||||
div.addEventListener('click', () => {
|
||||
const url = `fermata.html?palina=${encodeURIComponent(item.palina)}&targetID=${encodeURIComponent(item.targetID)}&selectedOption=${encodeURIComponent(selectedOption)}`;
|
||||
window.location.href = url;
|
||||
});
|
||||
|
||||
searchResultsContainer.appendChild(div);
|
||||
});
|
||||
}
|
||||
|
||||
function filterOptions(query, data) {
|
||||
return data.filter(item => item.nome.toLowerCase().includes(query.toLowerCase()));
|
||||
}
|
||||
|
||||
let allOptions = [];
|
||||
let currentSelectedOption = '';
|
||||
|
||||
const searchBar = document.getElementById('searchBar');
|
||||
searchBar.addEventListener('input', function() {
|
||||
const query = searchBar.value;
|
||||
const filteredOptions = filterOptions(query, allOptions);
|
||||
populateSearchResults(filteredOptions, currentSelectedOption);
|
||||
});
|
||||
|
||||
document.getElementById('bacino').addEventListener('change', function(event) {
|
||||
const selectedOption = event.target.value;
|
||||
currentSelectedOption = selectedOption;
|
||||
|
||||
let file = '';
|
||||
switch (selectedOption) {
|
||||
case 'ra':
|
||||
file = 'js/fermate-ra.json';
|
||||
break;
|
||||
case 'rn':
|
||||
file = 'js/fermate-rn.json';
|
||||
break;
|
||||
case 'fc':
|
||||
file = 'js/fermate-fc.json';
|
||||
break;
|
||||
default:
|
||||
allOptions = [];
|
||||
document.getElementById('searchResults').innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
loadJSON(file, (data) => {
|
||||
allOptions = data;
|
||||
populateSearchResults(allOptions, currentSelectedOption);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,58 @@
|
|||
const params = new URLSearchParams(window.location.search);
|
||||
const palina = params.get('palina');
|
||||
const targetID = params.get('targetID');
|
||||
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}`;
|
||||
|
||||
fetch(urlBackend)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const container = document.getElementById('tabella-container');
|
||||
container.innerHTML = '';
|
||||
|
||||
if (!data || data.length === 0) {
|
||||
container.textContent = 'Nessun dato trovato.';
|
||||
return;
|
||||
}
|
||||
|
||||
// Creo tabella
|
||||
const table = document.createElement('table');
|
||||
|
||||
// Intestazione
|
||||
const thead = document.createElement('thead');
|
||||
thead.innerHTML = `
|
||||
<tr>
|
||||
<th>Linea</th>
|
||||
<th>Destinazione</th>
|
||||
<th>Veicolo</th>
|
||||
<th>Soppressa</th>
|
||||
</tr>
|
||||
`;
|
||||
table.appendChild(thead);
|
||||
|
||||
// Corpo tabella
|
||||
const tbody = document.createElement('tbody');
|
||||
data.forEach(item => {
|
||||
const tr = document.createElement('tr');
|
||||
if (item.soppressa) {
|
||||
tr.classList.add('bus-card-red');
|
||||
}
|
||||
tr.innerHTML = `
|
||||
<td>${item.linea}</td>
|
||||
<td>${item.destinazione}</td>
|
||||
<td>${item.mezzo}</td>
|
||||
<td>${item.soppressa ? 'Sì' : 'No'}</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.';
|
||||
});
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -34,6 +34,7 @@
|
|||
<div style="height: 35px;"></div>
|
||||
<div class="verticale">
|
||||
<a class="gbutton" href="/startravenna_bus/listamezzi.html">Lista mezzi</a>
|
||||
<a class="gbutton" href="/start_menu/servizi/start-fermatebus/">Visualizzatore fermate</a>
|
||||
<a class="gbutton" href="/start_menu/servizi/start-livebus/">Autobus in tempo reale</a>
|
||||
<a class="gbutton" href="/start_menu/servizi/start-corsesopp/">Corse non garantite</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue