diff --git a/src/lib/ldb/public-ldb.svelte b/src/lib/ldb/public-ldb.svelte
index 1267daa..ac16b9b 100644
--- a/src/lib/ldb/public-ldb.svelte
+++ b/src/lib/ldb/public-ldb.svelte
@@ -104,7 +104,6 @@
}
async function loadService(sid) {
- console.log(`Loading: ${sid}`);
for (const service of services) {
if (service.serviceID == sid) {
serviceDetail = service
@@ -112,6 +111,14 @@
}
}
+ async function loadBusService(sid) {
+ for (const service of busServices) {
+ if (service.serviceID == sid) {
+ serviceDetail = service
+ }
+ }
+ }
+
async function closeService() {
serviceDetail = null;
}
@@ -141,7 +148,7 @@
{#each services as service}
-
+ |
{#if Array.isArray(service.origin?.location)}
{service.origin.location[0]['locationName'] +
" & " +
@@ -150,7 +157,7 @@
{service.origin?.location?.locationName || ''}
{/if}
|
-
+ |
{#if Array.isArray(service.destination?.location)}
{service.destination.location[0]['locationName'] +
" & " +
@@ -200,8 +207,8 @@
|
{#each busServices as service}
- {service.origin?.location?.locationName || ''} |
- {service.destination?.location?.locationName || ''} |
+ {service.origin?.location?.locationName || ''} |
+ {service.destination?.location?.locationName || ''} |
{parseTime(service.sta).data} |
{parseTime(service.eta).data} |
{parseTime(service.std).data} |
@@ -272,13 +279,21 @@
Exp |
{#if serviceDetail?.previousCallingPoints?.callingPointList?.callingPoint}
- {#each serviceDetail.previousCallingPoints.callingPointList.callingPoint as prevPoint}
+ {#if Array.isArray(serviceDetail?.previousCallingPoints?.callingPointList?.callingPoint)}
+ {#each serviceDetail.previousCallingPoints.callingPointList.callingPoint as prevPoint}
+
+ {prevPoint.locationName} |
+ {prevPoint.st} |
+ {parseTime(prevPoint.at || prevPoint.et).data} |
+
+ {/each}
+ {:else}
- {prevPoint.locationName} |
- {prevPoint.st} |
- {parseTime(prevPoint.at || prevPoint.et).data} |
+ {serviceDetail.previousCallingPoints.callingPointList.callingPoint.locationName} |
+ {serviceDetail.previousCallingPoints.callingPointList.callingPoint.st} |
+ {parseTime(serviceDetail.previousCallingPoints.callingPointList.callingPoint.at || serviceDetail.previousCallingPoints.callingPointList.callingPoint.et).data} |
- {/each}
+ {/if}
{/if}
{title} |
@@ -286,13 +301,21 @@
{parseTime(serviceDetail.etd || serviceDetail.eta).data} |
{#if serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint}
- {#each serviceDetail.subsequentCallingPoints.callingPointList.callingPoint as nextPoint}
+ {#if Array.isArray(serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint)}
+ {#each serviceDetail.subsequentCallingPoints.callingPointList.callingPoint as nextPoint}
+
+ {nextPoint.locationName} |
+ {nextPoint.st} |
+ {parseTime(nextPoint.et).data} |
+
+ {/each}
+ {:else}
- {nextPoint.locationName} |
- {nextPoint.st} |
- {parseTime(nextPoint.et).data} |
+ {serviceDetail.subsequentCallingPoints.callingPointList.callingPoint.locationName} |
+ {serviceDetail.subsequentCallingPoints.callingPointList.callingPoint.st} |
+ {parseTime(serviceDetail.subsequentCallingPoints.callingPointList.callingPoint.et).data} |
- {/each}
+ {/if}
{/if}