diff options
-rwxr-xr-x | lib/Travelynx.pm | 10 | ||||
-rw-r--r-- | templates/_checked_in.html.ep | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 3f8025a..569b65f 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -1272,8 +1272,18 @@ sub startup { arr_ds100 => $in_transit->{arr_ds100}, arr_name => $in_transit->{arr_name}, route_after => \@route_after, + messages => $in_transit->{messages} + ? [ split( qr{[|]}, $in_transit->{messages} ) ] + : undef, }; + my @parsed_messages; + for my $message ( @{ $ret->{messages} // [] } ) { + my ( $ts, $msg ) = split( qr{:}, $message ); + push( @parsed_messages, [ epoch_to_dt($ts), $msg ] ); + } + $ret->{messages} = [ reverse @parsed_messages ]; + $ret->{departure_countdown} = $ret->{real_departure}->epoch - $now->epoch; if ( $in_transit->{real_arr_ts} ) { diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep index 3f47d71..9f2d1e2 100644 --- a/templates/_checked_in.html.ep +++ b/templates/_checked_in.html.ep @@ -57,6 +57,17 @@ <div class="determinate white" style="width: <%= sprintf('%.2f', 100 * ($journey->{journey_completion} // 0)); %>%;"></div> </div> </p> + % if (@{$journey->{messages} // []} > 0 and $journey->{messages}[0]) { + <p style="margin-bottom: 2ex;"> + <ul> + % for my $message (reverse @{$journey->{messages} // []}) { + % if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) { + <li> <i class="material-icons tiny">warning</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li> + % } + % } + </ul> + </p> + % } % if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) { <p> Der automatische Checkout erfolgt in wenigen Minuten. Zum Umsteigen: |