travelynx/templates/departures.html.ep
Daniel Friesel 35338125bc
departure board: move get_connecting_trains call to controller
this is in preparation for turning it into a promise
2022-07-26 13:19:29 +02:00

113 lines
3.2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="row">
<div class="col s12 center-align">
<b><%= $station %></b>
% for my $related_station (sort { $a->{name} cmp $b->{name} } @{$related_stations}) {
<br/><%= $related_station->{name} %>
% }
</div>
</div>
% my $status = $self->get_user_status;
% my $have_connections = 0;
% if ($status->{checked_in}) {
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<span class="card-title">Aktuell eingecheckt</span>
<p>In <%= $status->{train_type} %> <%= $status->{train_no} %>
ab <%= $status->{dep_name} %></p>
</div>
<div class="card-action">
<a class="action-checkout" data-station="<%= $eva %>" data-force="1">
Hier auschecken
</a>
</div>
</div>
</div>
</div>
% }
% elsif ($status->{cancellation} and $station eq $status->{cancellation}{dep_name}) {
<div class="row">
<div class="col s12">
%= include '_cancelled_departure', journey => $status->{cancellation};
</div>
</div>
% }
% elsif ($status->{timestamp_delta} < 180) {
<div class="row">
<div class="col s12">
%= include '_checked_out', journey => $status;
</div>
</div>
% }
% elsif (not param('train') and my @connections = @{stash('connections') // []}) {
% $have_connections = 1;
<div class="row">
<div class="col s12">
<p>Häufig genutzte Verbindungen Zug auswählen zum Einchecken mit Zielwahl</p>
%= include '_connections', connections => \@connections, checkin_from => $eva;
</div>
</div>
% }
<div class="row">
<div class="col s12">
<p>
% if ($have_connections) {
Alle Abfahrten
% }
% if (@{$results}) {
Zug auswählen zum Einchecken.
% }
% else {
Keine Abfahrten gefunden. Ein Checkin ist frühestens 30 Minuten vor
und maximal 120 Minuten nach Abfahrt möglich.
% }
</p>
<table class="striped">
<tbody>
% my $orientation_bar_shown = param('train');
% my $now_epoch = now()->epoch;
% for my $result (@{$results}) {
% my $td_class = '';
% my $link_class = 'action-checkin';
% if ($result->departure_is_cancelled) {
% $td_class = "cancelled";
% $link_class = 'action-cancelled-from';
% }
% if (not $orientation_bar_shown and $result->departure->epoch < $now_epoch) {
% $orientation_bar_shown = 1;
<tr>
<td>
</td>
<td>
— Anfragezeitpunkt —
</td>
<td>
</td>
</tr>
% }
<tr class="<%= $link_class %>" data-station="<%= $result->station_uic %>" data-train="<%= $result->train_id %>" data-tr="3">
<td>
<a>
<%= $result->line %>
</a>
</td>
<td class="<%= $td_class %>">
<a>
<%= $result->destination %>
</a>
</td>
<td class="<%= $td_class %>"><%= $result->departure->strftime('%H:%M') %>
% if ($result->departure_delay) {
(<%= sprintf('%+d', $result->departure_delay) %>)
% }
% elsif (not $result->has_realtime and $result->start->epoch < $now_epoch) {
<i class="material-icons" aria-label="Keine Echtzeitdaten vorhanden" style="font-size: 16px;">gps_off</i>
% }
</td>
</tr>
% }
</tbody>
</table>
</div>
</div>