Frontend: Add support for multiple Origin/Dest
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
e8c6d3bfc5
commit
e15824381e
@ -6,7 +6,7 @@
|
|||||||
* Still need SVG Fallback option for alert icon on board.html
|
* Still need SVG Fallback option for alert icon on board.html
|
||||||
* Alerts box should not be clickable, bar should be.
|
* Alerts box should not be clickable, bar should be.
|
||||||
* Issue page: Submit using API.
|
* 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
|
- Where there are multiples an array is returned for trainServices.service
|
||||||
* Enable text search for `locationName` on find-code page.
|
* Enable text search for `locationName` on find-code page.
|
||||||
|
|
||||||
|
@ -67,8 +67,14 @@ async function parseTime(string){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sometimes the origin or destination names are undefined, need to catch that
|
// Sometimes the origin or destination names are undefined, need to catch that
|
||||||
async function parseName() {
|
async function parseName(location) {
|
||||||
return;
|
if (Array.isArray(location)) {
|
||||||
|
var name = `${location[0]['locationName']} & ${location[1]['locationName']}`
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return location.locationName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display Alert Messages
|
// Display Alert Messages
|
||||||
|
@ -171,8 +171,8 @@ async function displayFerryService(svc) {
|
|||||||
var row = `
|
var row = `
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name name-item">${svc.origin.location.locationName}</td>
|
<td class="name name-item">${parseName(svc.origin.location.locationName)}</td>
|
||||||
<td class="name name-item">${svc.destination.location.locationName}</td>
|
<td class="name name-item">${parseName(svc.destination.location.locationName)}</td>
|
||||||
<td class="plat}">${plt}</td>
|
<td class="plat}">${plt}</td>
|
||||||
<td class="time">${sta.data}</td>
|
<td class="time">${sta.data}</td>
|
||||||
<td class="time ${eta.changed}">${eta.data}</td>
|
<td class="time ${eta.changed}">${eta.data}</td>
|
||||||
|
Reference in New Issue
Block a user