Update train detail to include Schedule Start/End date

This commit is contained in:
Fred Boniface 2023-07-02 20:05:42 +01:00
parent 19f84501aa
commit f096544ded
1 changed files with 41 additions and 37 deletions

View File

@ -15,41 +15,42 @@
<span class="header">{service.operator || "GW"}: {service.stops[0]['publicDeparture'] || service.stops[0]['wttDeparture']} {service.stops[0]['tiploc']} to {service.stops[service['stops'].length -1]['tiploc']}</span> <span class="header">{service.operator || "GW"}: {service.stops[0]['publicDeparture'] || service.stops[0]['wttDeparture']} {service.stops[0]['tiploc']} to {service.stops[service['stops'].length -1]['tiploc']}</span>
<span id="container-arrow" class:isExpanded>V</span> <span id="container-arrow" class:isExpanded>V</span>
</div> </div>
{#if isExpanded} {#if isExpanded}
<div class="container-detail" in:fly out:fly> <div class="container-detail" in:fly={{ y: -20, duration: 200}}>
{#if service.pis} {#if service.pis}
<p class="pis">PIS: {service.pis}</p> <p class="pis">PIS: {service.pis}</p>
{/if} {/if}
<p class="svc-detail">Planned Type: {parseInt(service.planSpeed) || 68 }mph {service.powerType || "Bus" }</p> <p class="svc-detail">Planned Type: {parseInt(service.planSpeed) || 68 }mph {service.powerType || "Bus" }</p>
<p class="svc-detail">Days Run: {service.daysRun.join(", ").toUpperCase()}</p> <p class="svc-detail">Days Run: {service.daysRun.join(", ").toUpperCase()}</p>
<table> <p class="svc-detail validity">Valid From: {new Date(service.scheduleStartDate).toLocaleDateString('en-GB')} - {new Date(service.scheduleEndDate).toLocaleDateString('en-GB')}</p>
<tr> <table>
<th>Location</th> <tr>
<th>Sch Arr.</th> <th>Location</th>
<th>Sch Dep.</th> <th>Sch Arr.</th>
</tr> <th>Sch Dep.</th>
{#if service.stops[0]['publicDeparture']} </tr>
{#each service.stops as stop} {#if service.stops[0]['publicDeparture']}
{#if stop.publicArrival || stop.publicDeparture} {#each service.stops as stop}
<tr> {#if stop.publicArrival || stop.publicDeparture}
<td>{stop.tiploc}</td> <tr>
<td>{stop.publicArrival || '-'}</td>
<td>{stop.publicDeparture || '-'}</td>
</tr>
{/if}
{/each}
{:else}
{#each service.stops as stop}
<tr>
<td>{stop.tiploc}</td> <td>{stop.tiploc}</td>
<td>{stop.wttArrival || '-'}</td> <td>{stop.publicArrival || '-'}</td>
<td>{stop.wttDeparture || '-'}</td> <td>{stop.publicDeparture || '-'}</td>
</tr> </tr>
{/each} {/if}
{/if} {/each}
</table> {:else}
</div> {#each service.stops as stop}
{/if} <tr>
<td>{stop.tiploc}</td>
<td>{stop.wttArrival || '-'}</td>
<td>{stop.wttDeparture || '-'}</td>
</tr>
{/each}
{/if}
</table>
</div>
{/if}
</div> </div>
<style> <style>
@ -59,16 +60,16 @@
margin-bottom: 20px; margin-bottom: 20px;
width: 95%; width: 95%;
max-width: 600px; max-width: 600px;
min-width: 300px;
height: auto; height: auto;
background-color: var(--overlay-color); background-color: var(--overlay-color);
border-radius: 10px; border-radius: 10px;
transition-duration: 500ms; overflow: hidden;
transition: height 500ms ease-in-out;
} }
.container-header { .container-header {
text-align: left; text-align: left;
padding-left: 10px; padding-left: 10px;
font-size: 18px; font-size: 14px;
font-weight: 600; font-weight: 600;
padding-top: 10px; padding-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;
@ -82,7 +83,7 @@
position: absolute; position: absolute;
right: 16px; right: 16px;
top: 13px; top: 13px;
transition-duration: 500ms; transition-duration: 300ms;
z-index: 2; z-index: 2;
} }
.isExpanded { .isExpanded {
@ -100,6 +101,9 @@
margin-bottom: 2px; margin-bottom: 2px;
color: white; color: white;
} }
.validity {
font-size: 14px;
}
table { table {
margin: auto; margin: auto;
padding-top: 10px; padding-top: 10px;