Add cancellation logic to staff departures

This commit is contained in:
Fred Boniface 2023-07-05 09:50:37 +01:00
parent 329eaa85d1
commit 9dae8671ff

View File

@ -53,43 +53,8 @@
} }
} }
function parseTime(string = ""){ function parseTime(sch, act){
let output return
let change
switch (string) {
case 'Delayed':
output = 'LATE'
change = "changed"
break
case 'Cancelled':
output = 'CANC'
change = "cancelled"
break
case 'On time':
output = 'RT'
change = ""
break
case '':
output = '-'
change = ""
break
case undefined:
output = '-'
change = ""
break
case 'No report':
output = '-'
change = ""
break
case 'undefined':
output = false
change = ""
break
default:
output = string
change = "changed"
}
return {data: output, changed: change}
} }
function parseDateTime(input) { function parseDateTime(input) {
@ -129,9 +94,13 @@
<th class="to to-data data">{service.destination.location.tiploc}</th> <th class="to to-data data">{service.destination.location.tiploc}</th>
<th class="plat plat-data data">{service.platform || '-'}</th> <th class="plat plat-data data">{service.platform || '-'}</th>
<th class="time time-data data">{parseDateTime(service.sta)}</th> <th class="time time-data data">{parseDateTime(service.sta)}</th>
<th class="time time-data data">{'-'}</th> <th class="time time-data data">{parseDateTime(service.ata || service.eta)}</th>
<th class="time time-data data">{parseDateTime(service.std)}</th> <th class="time time-data data">{parseDateTime(service.std)}</th>
<th class="time time-data data">{'-'}</th> {#if service.isCancelled}
<th class="time time-data data can-time">CAN</th>
{:else}
<th class="time time-data data">{parseDateTime(service.atd || service.etd)}</th>
{/if}
</tr> </tr>
<tr class="text-row"> <tr class="text-row">
<td colspan="8" class="text-data"> <td colspan="8" class="text-data">
@ -175,4 +144,34 @@
text-align: left; text-align: left;
color: cyan; color: cyan;
} }
.can-time {
animation: pulse-cancel 1.5s linear infinite;
}
.early-time {
animation: pulse-early 1.5s linear infinite;
}
.late-time {
animation: pulse-late 1.5s linear infinite;
}
@keyframes pulse-late {
50% {
color: var(--main-warning-color);
}
}
@keyframes pulse-cancel {
50% {
color: var(--main-alert-color);
}
}
@keyframes pulse-early {
50% {
color: rgb(136, 164, 255);
}
}
</style> </style>