From e15824381e67688b7cb37bda175676d628eb056c Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 22 Jan 2023 10:38:30 +0000 Subject: [PATCH] Frontend: Add support for multiple Origin/Dest Signed-off-by: Fred Boniface --- UpNext.md | 2 +- static/js/boards.js | 10 ++++++++-- static/js/public-board.js | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/UpNext.md b/UpNext.md index 15a7839..9e22ab1 100644 --- a/UpNext.md +++ b/UpNext.md @@ -6,7 +6,7 @@ * Still need SVG Fallback option for alert icon on board.html * Alerts box should not be clickable, bar should be. * Issue page: Submit using API. -* Support multiple service origins/destinations: +* UNDER TEST:: Support multiple service origins/destinations: - Where there are multiples an array is returned for trainServices.service * Enable text search for `locationName` on find-code page. diff --git a/static/js/boards.js b/static/js/boards.js index 578e6cc..58c1ba5 100644 --- a/static/js/boards.js +++ b/static/js/boards.js @@ -67,8 +67,14 @@ async function parseTime(string){ } // Sometimes the origin or destination names are undefined, need to catch that -async function parseName() { - return; +async function parseName(location) { + if (Array.isArray(location)) { + var name = `${location[0]['locationName']} & ${location[1]['locationName']}` + return name; + } + else { + return location.locationName; + } } // Display Alert Messages diff --git a/static/js/public-board.js b/static/js/public-board.js index 5a0fa63..f028423 100644 --- a/static/js/public-board.js +++ b/static/js/public-board.js @@ -171,8 +171,8 @@ async function displayFerryService(svc) { var row = ` - - + +
${svc.origin.location.locationName}${svc.destination.location.locationName}${parseName(svc.origin.location.locationName)}${parseName(svc.destination.location.locationName)} ${plt} ${sta.data} ${eta.data}