Oops
There was an error with your request
diff --git a/static/js/public-board.js b/static/js/public-board.js index 3795cba..eef65d8 100644 --- a/static/js/public-board.js +++ b/static/js/public-board.js @@ -71,6 +71,9 @@ async function buildPage(data) { if (data.GetStationBoardResult.ferryServices) { displayFerry(data.GetStationBoardResult.ferryServices) } + if (data.GetStationBoardResult.busServices) { + displayBus(data.GetStationBoardResult.busServices) + } } async function displayNoTrains() { @@ -97,6 +100,13 @@ async function displayFerry(ferrySvc) { } } +async function displayBus(busSvc) { + log(JSON.stringify(busSvc)) + for(var i = 0; i < busSvc.service.length; i++) { + displayBusService(busSvc.service[i]) + } +} + async function displayService(svc) { var table = document.getElementById("output"); @@ -169,4 +179,41 @@ async function displayFerryService(svc) { table.insertAdjacentHTML("beforeend", delayRow); } document.getElementById("ferry").style = "display:block" +} + +async function displayBusService(svc) { + var table = document.getElementById("bus"); + log(JSON.stringify(svc)) + // Determine Time Message + var sta = await parseTime(svc.sta); + var eta = await parseTime(svc.eta); + var std = await parseTime(svc.std); + var etd = await parseTime(svc.etd); + // Determine Platform Message + var plt = ""; + // Define Table Row + var row = ` +${svc.origin.location.locationName} | +${svc.destination.location.locationName} | +${plt} | +${sta.data} | +${eta.data} | +${std.data} | +${etd.data} | +
${svc.cancelReason}
` + table.insertAdjacentHTML("beforeend", cancelRow); + } + if (svc.delayReason) { + var delayRow = `${svc.delayReason}
` + table.insertAdjacentHTML("beforeend", delayRow); + } + document.getElementById("bus").style = "display:block" } \ No newline at end of file