Add note when train is planned cancelled

This commit is contained in:
Fred Boniface 2024-02-05 20:10:11 +00:00
parent f5760acd47
commit b9f5f3dc1d
1 changed files with 46 additions and 41 deletions

View File

@ -38,7 +38,7 @@
<span class="header" <span class="header"
><StylesToc toc={service?.operator || ''} /> ><StylesToc toc={service?.operator || ''} />
{service?.stops[0]['publicDeparture'] || service?.stops[0]['wttDeparture']} {service?.stops[0]['publicDeparture'] || service?.stops[0]['wttDeparture']}
{service?.stops[0]['tiploc']} to {service?.stops[service['stops'].length - 1]['tiploc']}{#if (service?.vstp)}VSTP{/if}</span {service?.stops[0]['tiploc']} to {service?.stops[service['stops'].length - 1]['tiploc']}{#if service?.vstp}VSTP{/if}</span
> >
<span id="container-arrow" class:isExpanded>V</span> <span id="container-arrow" class:isExpanded>V</span>
</div> </div>
@ -47,49 +47,54 @@
{#await getTrainByUID(service.trainUid)} {#await getTrainByUID(service.trainUid)}
<LoadingText /> <LoadingText />
{:then serviceDetail} {:then serviceDetail}
<div class="detailOperator"><StylesToc toc={service?.operator || ''} full={true} /></div> {#if serviceDetail.stpIndicator === 'C'}
{#if serviceDetail.pis} This has been removed from the timetable for today<br />
<p class="pis">PIS: <PisHandler pisObject={serviceDetail.pis} /></p> It is likely another service is running in its place
{/if} {:else}
<p class="svc-detail"> <div class="detailOperator"><StylesToc toc={service?.operator || ''} full={true} /></div>
Planned Type: {parseInt(serviceDetail.planSpeed) || '--'}mph {serviceDetail.powerType || 'Non-Rail vehicle'} {#if serviceDetail.pis}
</p> <p class="pis">PIS: <PisHandler pisObject={serviceDetail.pis} /></p>
<p class="svc-detail"> {/if}
Days Run: {serviceDetail?.daysRun.join(', ').toUpperCase() || 'Unknown'} <p class="svc-detail">
</p> Planned Type: {parseInt(serviceDetail.planSpeed) || '--'}mph {serviceDetail.powerType || 'Non-Rail vehicle'}
<p class="svc-detail validity"> </p>
Valid From: {new Date(serviceDetail.scheduleStartDate).toLocaleDateString('en-GB', { <p class="svc-detail">
timeZone: 'UTC' Days Run: {serviceDetail?.daysRun.join(', ').toUpperCase() || 'Unknown'}
})} - {new Date(serviceDetail.scheduleEndDate).toLocaleDateString('en-GB', { </p>
timeZone: 'UTC' <p class="svc-detail validity">
})} Valid From: {new Date(serviceDetail.scheduleStartDate).toLocaleDateString('en-GB', {
</p> timeZone: 'UTC'
<table> })} - {new Date(serviceDetail.scheduleEndDate).toLocaleDateString('en-GB', {
<tr> timeZone: 'UTC'
<th>Location</th> })}
<th>Sch Arr.</th> </p>
<th>Sch Dep.</th> <table>
</tr> <tr>
{#if serviceDetail.stops[0]['publicDeparture']} <th>Location</th>
{#each serviceDetail.stops as stop} <th>Sch Arr.</th>
{#if stop.publicArrival || stop.publicDeparture} <th>Sch Dep.</th>
</tr>
{#if serviceDetail.stops[0]['publicDeparture']}
{#each serviceDetail.stops as stop}
{#if stop.publicArrival || stop.publicDeparture}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.publicArrival || '-'}</td>
<td>{stop.publicDeparture || '-'}</td>
</tr>
{/if}
{/each}
{:else}
{#each serviceDetail.stops as stop}
<tr> <tr>
<td>{stop.tiploc}</td> <td>{stop.tiploc}</td>
<td>{stop.publicArrival || '-'}</td> <td>{stop.wttArrival || '-'}</td>
<td>{stop.publicDeparture || '-'}</td> <td>{stop.wttDeparture || '-'}</td>
</tr> </tr>
{/if} {/each}
{/each} {/if}
{:else} </table>
{#each serviceDetail.stops as stop} {/if}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.wttArrival || '-'}</td>
<td>{stop.wttDeparture || '-'}</td>
</tr>
{/each}
{/if}
</table>
{:catch} {:catch}
<p>Unable to fetch train data</p> <p>Unable to fetch train data</p>
{/await} {/await}