Pesa bulk search and urbino bulk search now work sucessfully, may add more bulk search types and replace icons
This commit is contained in:
@ -23,8 +23,11 @@
|
||||
<label for="bus-id">Enter TAK:</label>
|
||||
<input type="text" id="bus-id" name="bus-id">
|
||||
<button type="submit">Search</button>
|
||||
<!-- <button type="click" id="elektrolino">Electric bus search</button>
|
||||
<button type="press" id="pesa">Pesa twist search</button> -->
|
||||
</form>
|
||||
<form id="bulk-search">
|
||||
<p>Bulk searches:</p>
|
||||
<button type="click" id="electricbusSearch">Urbino Electric</button>
|
||||
<button type="press" id="pesaSearch">Pesa Twist</button>
|
||||
</form>
|
||||
<form id="recievedData">
|
||||
<p id="type">Type: UNFETCHED</p>
|
||||
@ -63,12 +66,16 @@
|
||||
var tak = document.getElementById('bus-id').value.trim();
|
||||
socket.emit('takSearch', tak);
|
||||
});
|
||||
/*document.getElementById('elektrolino').addEventListener('click', function () {
|
||||
socket.emit('elektrolino');
|
||||
document.getElementById('bulk-search').addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
document.getElementById('electricbusSearch').addEventListener('click', function () {
|
||||
socket.emit('electricBusBulkSearch');
|
||||
});
|
||||
document.getElementById('pesaSearch').addEventListener('click', function () {
|
||||
console.log("bruh");
|
||||
socket.emit('pesaTramBulkSearch');
|
||||
});
|
||||
document.getElementById('pesa').addEventListener('press', function () {
|
||||
socket.emit('pesa');
|
||||
});*/
|
||||
|
||||
oldMarker = "1";
|
||||
socket.on('takResults', (typeR, lineR, latR, longR, takR, latlongR, vehicleTypeR) => {
|
||||
|
32
main.js
32
main.js
@ -75,7 +75,35 @@ io.on('connection', (socket) => {
|
||||
startRequestModeFetch();
|
||||
fetchDataFromLocalFile(tak, socket);
|
||||
} catch (error) {
|
||||
console.error("Error processing takSearch:", error);
|
||||
var caughtError = "Error processing takSearch:", error;
|
||||
console.error(caughtError);
|
||||
writeToLog('errors_log.txt', caughtError);
|
||||
}
|
||||
});
|
||||
socket.on('electricBusBulkSearch', async () => {
|
||||
console.log("Running bulk electric bus search!");
|
||||
saveRequestLogs(socket, "ElectricBusBulkSearch");
|
||||
try {
|
||||
electricBusTakArray.forEach((takToSearch) => {
|
||||
fetchDataFromLocalFile(takToSearch, socket);
|
||||
});
|
||||
} catch (error) {
|
||||
var caughtError = "Error processing electricBusBulkSearch:", error;
|
||||
console.error(caughtError);
|
||||
writeToLog('errors_log.txt', caughtError);
|
||||
}
|
||||
});
|
||||
socket.on('pesaTramBulkSearch', async () => {
|
||||
console.log("Running bulk pesa tram search!");
|
||||
saveRequestLogs(socket, "PesaTramBulkSearch");
|
||||
try {
|
||||
pesaTramTakArray.forEach((takToSearch) => {
|
||||
fetchDataFromLocalFile(takToSearch, socket);
|
||||
});
|
||||
} catch (error) {
|
||||
var caughtError = "Error processing pesaTramBulkSearch: ", error;
|
||||
console.error(caughtError);
|
||||
writeToLog('errors_log.txt', caughtError);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -194,7 +222,7 @@ async function fetchDataFromLocalFile(takInput, socket) {
|
||||
if (tak === takInput) {
|
||||
if (transportTypeDecoded === "TRAM") {
|
||||
if (cafTramTakArray.includes(tak)) {
|
||||
vehicleType = "CAF Urbos AXL (Spain) (Overhead 600V, Motor 264 kW) 70km/h TOP";
|
||||
vehicleType = "CAF Urbos AXL";
|
||||
} else if (pesaTramTakArray.includes(tak)) {
|
||||
vehicleType = "PESA Twist 147N";
|
||||
} else if (kt6tmTramArray.includes(tak)) {
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -10,7 +10,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"axios": "^1.6.8",
|
||||
"express": "^4.19.2",
|
||||
"express": "^4.21.1",
|
||||
"socket.io": "^4.7.5"
|
||||
}
|
||||
},
|
||||
|
@ -18,7 +18,7 @@
|
||||
"homepage": "https://github.com/eetnaviation/tlt-bus-map#readme",
|
||||
"dependencies": {
|
||||
"axios": "^1.6.8",
|
||||
"express": "^4.19.2",
|
||||
"express": "^4.21.1",
|
||||
"socket.io": "^4.7.5"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user