Run formatter
This commit is contained in:
parent
8a7c78219f
commit
b6dca2df78
@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export let service;
|
export let service;
|
||||||
|
|
||||||
import Reason from "$lib/raw-fetchers/reason.svelte";
|
import Reason from '$lib/raw-fetchers/reason.svelte';
|
||||||
|
|
||||||
function parseTimes(service) {
|
function parseTimes(service) {
|
||||||
const sta = new Date(service.sta),
|
const sta = new Date(service.sta),
|
||||||
@ -111,7 +111,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="8"> Loading... </td>
|
<td colspan="8"> Loading... </td>
|
||||||
</tr>
|
</tr>
|
||||||
{:then serviceStats}
|
{:then serviceStats}
|
||||||
<tr class="{serviceStats.isCancelled && 'can-dat'} {serviceStats.isNonPublic && 'ecs'}">
|
<tr class="{serviceStats.isCancelled && 'can-dat'} {serviceStats.isNonPublic && 'ecs'}">
|
||||||
<td class="id id-data data" on:click={showDetails(service.rid, service.uid, service.trainid)} on:keypress={showDetails(service.rid, service.uid, service.trainid)}
|
<td class="id id-data data" on:click={showDetails(service.rid, service.uid, service.trainid)} on:keypress={showDetails(service.rid, service.uid, service.trainid)}
|
||||||
>{service.trainid}</td
|
>{service.trainid}</td
|
||||||
@ -129,13 +129,13 @@
|
|||||||
<td class="plat plat-data data {serviceStats.platformHidden && 'hidden'}">{serviceStats.platform.number || '-'}</td>
|
<td class="plat plat-data data {serviceStats.platformHidden && 'hidden'}">{serviceStats.platform.number || '-'}</td>
|
||||||
<td class="time time-data data">{serviceStats.schArr}</td>
|
<td class="time time-data data">{serviceStats.schArr}</td>
|
||||||
<td
|
<td
|
||||||
class="time time-data data {serviceStats.canArr && 'can-time'} {serviceStats.isArrDelayed && 'late'} {serviceStats.isEarlyArr && 'early'} {serviceStats.isLateArr &&
|
class="time time-data data {serviceStats.canArr && 'can-time'} {serviceStats.isArrDelayed && 'late'} {serviceStats.isEarlyArr && 'early'} {serviceStats.isLateArr && 'late'}"
|
||||||
'late'}">{serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr}</td
|
>{serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr}</td
|
||||||
>
|
>
|
||||||
<td class="time time-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.schDep}</td>
|
<td class="time time-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.schDep}</td>
|
||||||
<td
|
<td
|
||||||
class="time time-data data {serviceStats.canDep && 'can-time'} {serviceStats.isDepDelayed && 'late'} {serviceStats.isEarlyDep && 'early'} {serviceStats.isLateDep &&
|
class="time time-data data {serviceStats.canDep && 'can-time'} {serviceStats.isDepDelayed && 'late'} {serviceStats.isEarlyDep && 'early'} {serviceStats.isLateDep && 'late'}"
|
||||||
'late'}">{serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep}</td
|
>{serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep}</td
|
||||||
>
|
>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="text-row">
|
<tr class="text-row">
|
||||||
|
@ -93,7 +93,6 @@
|
|||||||
}
|
}
|
||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<OverlayIsland>
|
<OverlayIsland>
|
||||||
@ -111,14 +110,18 @@
|
|||||||
</p>
|
</p>
|
||||||
<table id="detailTable">
|
<table id="detailTable">
|
||||||
{#if train.GetServiceDetailsResult.delayReason}
|
{#if train.GetServiceDetailsResult.delayReason}
|
||||||
<tr><td colspan="7" class="late">
|
<tr
|
||||||
|
><td colspan="7" class="late">
|
||||||
<Reason type="delay" code={train.GetServiceDetailsResult.delayReason} />
|
<Reason type="delay" code={train.GetServiceDetailsResult.delayReason} />
|
||||||
</td></tr>
|
</td></tr
|
||||||
|
>
|
||||||
{/if}
|
{/if}
|
||||||
{#if train.GetServiceDetailsResult.cancelReason}
|
{#if train.GetServiceDetailsResult.cancelReason}
|
||||||
<tr><td colspan="7" class="canc">
|
<tr
|
||||||
|
><td colspan="7" class="canc">
|
||||||
<Reason type="cancel" code={train.GetServiceDetailsResult.cancelReason} />
|
<Reason type="cancel" code={train.GetServiceDetailsResult.cancelReason} />
|
||||||
</td></tr>
|
</td></tr
|
||||||
|
>
|
||||||
{/if}
|
{/if}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2" />
|
<th colspan="2" />
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { uuid } from '$lib/stores/uuid';
|
||||||
import { uuid } from "$lib/stores/uuid";
|
|
||||||
|
|
||||||
export let code = '';
|
export let code = '';
|
||||||
export let type = '';
|
export let type = '';
|
||||||
|
|
||||||
async function getDelay(code = '') {
|
async function getDelay(code = '') {
|
||||||
console.log(`Fetching delay reason ${code}`)
|
console.log(`Fetching delay reason ${code}`);
|
||||||
const data = await getReason(code);
|
const data = await getReason(code);
|
||||||
return data[0].lateReason || 'This train has been delayed';
|
return data[0].lateReason || 'This train has been delayed';
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCancel(code = '') {
|
async function getCancel(code = '') {
|
||||||
console.log(`Fetching cancel reason ${code}`)
|
console.log(`Fetching cancel reason ${code}`);
|
||||||
const data = await getReason(code);
|
const data = await getReason(code);
|
||||||
return data[0].cancReason || 'This train has been cancelled';
|
return data[0].cancReason || 'This train has been cancelled';
|
||||||
}
|
}
|
||||||
@ -28,10 +27,9 @@
|
|||||||
const res = await fetch(url, options);
|
const res = await fetch(url, options);
|
||||||
return await res.json();
|
return await res.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if type === "cancel"}
|
{#if type === 'cancel'}
|
||||||
{#await getCancel(code)}
|
{#await getCancel(code)}
|
||||||
This train has been cancelled
|
This train has been cancelled
|
||||||
{:then reason}
|
{:then reason}
|
||||||
@ -39,7 +37,7 @@
|
|||||||
{:catch}
|
{:catch}
|
||||||
This train has been cancelled
|
This train has been cancelled
|
||||||
{/await}
|
{/await}
|
||||||
{:else if type === "delay"}
|
{:else if type === 'delay'}
|
||||||
{#await getDelay(code)}
|
{#await getDelay(code)}
|
||||||
This train has been delayed
|
This train has been delayed
|
||||||
{:then reason}
|
{:then reason}
|
||||||
|
Loading…
Reference in New Issue
Block a user