StaffLDB-Minify #1
@ -7,24 +7,32 @@
|
|||||||
export let services: TrainServices[];
|
export let services: TrainServices[];
|
||||||
export let click: Function;
|
export let click: Function;
|
||||||
|
|
||||||
|
interface locationObject {
|
||||||
|
location: string,
|
||||||
|
via?: string,
|
||||||
|
}
|
||||||
|
|
||||||
function detail(event: any, rid: string, uid: string, tid: string) {
|
function detail(event: any, rid: string, uid: string, tid: string) {
|
||||||
const target = event.target;
|
const target = event.target;
|
||||||
click(rid, uid, tid);
|
click(rid, uid, tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function formatLocations(locations: ServiceLocation[]): Promise<string> {
|
async function formatLocations(locations: ServiceLocation[]): Promise<locationObject> {
|
||||||
let tiplocs: string[] = [];
|
let tiplocs: string[] = [];
|
||||||
for (const location of locations) {
|
for (const location of locations) {
|
||||||
tiplocs.push(location.tiploc);
|
tiplocs.push(location.tiploc);
|
||||||
}
|
}
|
||||||
let location = tiplocs.join(' & ');
|
let locationObj: locationObject = {
|
||||||
|
location: tiplocs.join(' & '),
|
||||||
|
};
|
||||||
if (locations[0]['via']) {
|
if (locations[0]['via']) {
|
||||||
location = `${location} ${locations[0]['via']}` // Maybe this should be converted to TIPLOC server-side?
|
locationObj.via = locations[0]['via'];
|
||||||
}
|
}
|
||||||
return location
|
return locationObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function classGenerator(service: TrainServices) { // This function needs updating next
|
async function classGenerator(service: TrainServices) {
|
||||||
|
// This function needs updating next
|
||||||
let otherArr: string[] = [];
|
let otherArr: string[] = [];
|
||||||
let arrArr: string[] = [];
|
let arrArr: string[] = [];
|
||||||
let depArr: string[] = [];
|
let depArr: string[] = [];
|
||||||
@ -106,10 +114,10 @@
|
|||||||
<th class="from">From</th>
|
<th class="from">From</th>
|
||||||
<th class="to">To</th>
|
<th class="to">To</th>
|
||||||
<th class="plat">Plat</th>
|
<th class="plat">Plat</th>
|
||||||
<th class="time">Sch</th>
|
<th class="time arrsch">Sch</th>
|
||||||
<th class="time">Exp</th>
|
<th class="time arrexp">Exp</th>
|
||||||
<th class="time">Sch</th>
|
<th class="time depsch">Sch</th>
|
||||||
<th class="time">Exp</th>
|
<th class="time depexp">Exp</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="other" colspan="4" />
|
<th class="other" colspan="4" />
|
||||||
@ -123,18 +131,22 @@
|
|||||||
on:keypress={(event) => detail(event, service.rid, service.uid, service.trainid)}
|
on:keypress={(event) => detail(event, service.rid, service.uid, service.trainid)}
|
||||||
>
|
>
|
||||||
{#await classGenerator(service) then classes}
|
{#await classGenerator(service) then classes}
|
||||||
|
<!-- HEADCODE -->
|
||||||
<td class="id {classes.other}">{service.trainid}</td>
|
<td class="id {classes.other}">{service.trainid}</td>
|
||||||
<td class="from {classes.other}">{#await formatLocations(service.origin) then origin}{origin}{/await}</td>
|
<!-- ORIGIN -->
|
||||||
<td class="to {classes.other}">{#await formatLocations(service.destination) then dest}{dest}{/await}</td>
|
<td class="loc from {classes.other}">{#await formatLocations(service.origin) then origin}{origin.location}{#if origin.via}<br><span class="via">{origin.via}</span>{/if}{/await}</td>
|
||||||
<td class="plat">{service.platform || '-'}</td>
|
<!-- DESTINATION -->
|
||||||
|
<td class="loc to {classes.other}">{#await formatLocations(service.destination) then dest}{dest.location}{#if dest.via}<br><span class="via">{dest.via}</span>{/if}{/await}</td>
|
||||||
|
<!-- PLATFORM -->
|
||||||
|
<td class="plat {classes.other} {classes.plat}">{service.platform || '-'}</td>
|
||||||
|
<!-- SCHEDULED ARR -->
|
||||||
<td class="time schTime {classes.other}">{fmtTime(service?.sta) || '-'}</td>
|
<td class="time schTime {classes.other}">{fmtTime(service?.sta) || '-'}</td>
|
||||||
<!-- All time need to be displayed appropriately -->
|
<!-- EXPECTED/ACTUAL ARR -->
|
||||||
<td class="time {classes.other} {classes.arr}">{fmtTime(service.eta) || fmtTime(service.ata) || '-'}</td>
|
<td class="time {classes.other} {classes.arr}">{fmtTime(service.eta) || fmtTime(service.ata) || '-'}</td>
|
||||||
<!-- All time need to be displayed appropriately -->
|
<!-- SCHEDULED DEP -->
|
||||||
<td class="time schTime {classes.other}">{fmtTime(service.std) || '-'}</td>
|
<td class="time schTime {classes.other}">{fmtTime(service.std) || '-'}</td>
|
||||||
<!-- All time need to be displayed appropriately -->
|
<!-- EXPECTED/ACTUAL DEP -->
|
||||||
<td class="time {classes.other} {classes.dep}">{fmtTime(service.etd) || fmtTime(service.atd) || '-'}</td>
|
<td class="time {classes.other} {classes.dep}">{fmtTime(service.etd) || fmtTime(service.atd) || '-'}</td>
|
||||||
<!-- All time need to be displayed appropriately -->
|
|
||||||
{/await}
|
{/await}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -222,7 +234,11 @@
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
.via {
|
||||||
|
font-size: 10px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
/* Handle small screens */
|
/* Handle small screens */
|
||||||
.smallScreen {
|
.smallScreen {
|
||||||
display: none;
|
display: none;
|
||||||
@ -279,21 +295,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Conditional Classes */
|
/* Conditional Classes */
|
||||||
.cancTxt {
|
.loc.canc, .id.canc, .canc {
|
||||||
color: grey !important;
|
color: grey;
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nonPass {
|
.nonPass {
|
||||||
opacity: 0.6;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.late {
|
.late {
|
||||||
animation: pulse-late 1.5s linear infinite;
|
animation: pulse-late 1.5s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
.canc {
|
.canc.time {
|
||||||
animation: pulse-cancel 1.5s linear infinite;
|
animation: pulse-cancel 1.5s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user