summaryrefslogtreecommitdiff
path: root/templates/departures.html.ep
diff options
context:
space:
mode:
Diffstat (limited to 'templates/departures.html.ep')
-rw-r--r--templates/departures.html.ep166
1 files changed, 101 insertions, 65 deletions
diff --git a/templates/departures.html.ep b/templates/departures.html.ep
index 91b3331..6aac482 100644
--- a/templates/departures.html.ep
+++ b/templates/departures.html.ep
@@ -1,113 +1,149 @@
<div class="row">
- <div class="col s12 center-align">
- <b><%= $station %></b>
+ <div class="col s12">
+ <h2>
+ <i class="material-icons " aria-hidden="true"><%= param('hafas') ? 'directions' : 'train' %></i>
+ <%= $station %>
+ </h2>
% for my $related_station (sort { $a->{name} cmp $b->{name} } @{$related_stations}) {
- <br/><%= $related_station->{name} %>
+ + <%= $related_station->{name} %> <br/>
% }
</div>
</div>
-% my $status = $self->get_user_status;
+% if ($api_link) {
+<div class="row">
+ <div class="col s12 center-align">
+ % if (param('hafas')) {
+ <a href="<%= $api_link %>" class="btn-small"><i class="material-icons left" aria-hidden="true">train</i>zum Schienenverkehr</a>
+ % }
+ % else {
+ <a href="<%= $api_link %>" class="btn-small"><i class="material-icons left" aria-hidden="true">directions</i>zum Nahverkehr</a>
+ % }
+ </div>
+</div>
+% }
+
% my $have_connections = 0;
-% if ($status->{checked_in}) {
+% if ($user_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>
+ <p>In <%= $user_status->{train_type} %> <%= $user_status->{train_no} %>
+ % if ( $user_status->{arr_name}) {
+ von <%= $user_status->{dep_name} %> nach <%= $user_status->{arr_name} %>
+ % }
+ % else {
+ ab <%= $user_status->{dep_name} %>
+ % }
+ </p>
</div>
<div class="card-action">
- <a class="action-checkout" data-station="<%= $eva %>" data-force="1">
- Hier auschecken
- </a>
+ % if ($can_check_out) {
+ <a class="action-undo" data-id="in_transit" data-checkints="<%= $user_status->{timestamp}->epoch %>" style="margin-right: 0;">
+ <i class="material-icons left" aria-hidden="true">undo</i> Rückgängig
+ </a>
+ <a class="action-checkout right" data-station="<%= $eva %>" data-force="1">
+ Hier auschecken
+ </a>
+ % }
+ % else {
+ <a class="action-undo" data-id="in_transit" data-checkints="<%= $user_status->{timestamp}->epoch %>" style="margin-right: 0;">
+ <i class="material-icons left" aria-hidden="true">undo</i> Rückgängig
+ </a>
+ <a class="action-checkout right" data-station="<%= $eva %>" data-force="1">
+ <i class="material-icons left" aria-hidden="true">gps_off</i>
+ Hier auschecken
+ </a>
+ % }
</div>
</div>
</div>
</div>
% }
-% elsif ($status->{cancellation} and $station eq $status->{cancellation}{dep_name}) {
+% elsif ($user_status->{cancellation} and $station eq $user_status->{cancellation}{dep_name}) {
<div class="row">
<div class="col s12">
- %= include '_cancelled_departure', journey => $status->{cancellation};
+ %= include '_cancelled_departure', journey => $user_status->{cancellation};
</div>
</div>
% }
-% elsif ($status->{timestamp_delta} < 180) {
+% elsif ($user_status->{timestamp_delta} < 180) {
<div class="row">
<div class="col s12">
- %= include '_checked_out', journey => $status;
+ %= include '_checked_out', journey => $user_status;
</div>
</div>
% }
-% elsif (not param('train') and my @connections = get_connecting_trains(eva => $eva)) {
+% elsif (not param('train') and (@{stash('connections_iris') // []} or @{stash('connections_hafas') // []}) ) {
% $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;
+ <p>Häufig genutzte Verbindungen – Fahrt auswählen zum Einchecken mit Zielwahl</p>
+ % if (@{stash('connections_iris') // []}) {
+ %= include '_connections', connections => stash('connections_iris'), checkin_from => $eva;
+ % }
+ % if (@{stash('connections_hafas') // []}) {
+ %= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $eva;
+ % }
</div>
</div>
% }
+
+<div class="row">
+ <div class="col s4 center-align">
+ % if ($hafas) {
+ <a class="btn-small" href="<%= url_for('sstation', station => param('station'))->query({hafas => 1, timestamp => $datetime->clone->subtract(hours => 1)->epoch}) %>"><i class="material-icons left" aria-hidden="true">chevron_left</i><span class="hide-on-small-only">früher</span></a>
+ % }
+ </div>
+ <div class="col s4 center-align">
+ % if ($now_in_range) {
+ <a class="btn-small" href="#now"><i class="material-icons left" aria-hidden="true">vertical_align_center</i><span class="hide-on-small-only">Jetzt</span></a>
+ % }
+ </div>
+ <div class="col s4 center-align">
+ % if ($hafas) {
+ <a class="btn-small" href="<%= url_for('sstation', station => param('station'))->query({hafas => 1, timestamp => $datetime->clone->add(hours => 1)->epoch}) %>"><span class="hide-on-small-only">später</span><i class="material-icons right" aria-hidden="true">chevron_right</i></a>
+ % }
+ </div>
+</div>
+
<div class="row">
<div class="col s12">
<p>
% if ($have_connections) {
Alle Abfahrten –
% }
- % if (@{$results}) {
- Zug auswählen zum Einchecken.
+ % if ($user_status->{checked_in} and not $can_check_out) {
+ Diese Station liegt nicht auf der Route deines <a href="/">aktuellen Checkins</a>.
+ Falls du aktuell nicht mit <b><%= $user_status->{train_type} %> <%= $user_status->{train_no} %></b> unterwegs bist, kannst du den Checkin rückgängig machen.
+ Falls es sich bei <b><%= $station %></b> um einen nicht in den Echtzeitdaten abgebildeten Zusatzhalt handelt, kannst du hier auchecken.
+ Da travelynx nicht weiß, welcher der beiden Fälle zutrifft, sind bis dahin keine neuen Checkins möglich.
+ % }
+ % elsif ($user_status->{checked_in} and not $user_status->{arr_eva}) {
+ Du bist bereits eingecheckt und hast noch kein Fahrtziel angegeben.
+ Bitte <a href="/">wähle zunächst ein Ziel</a>.
+ Neue Checkins sind erst nach Ankunft der aktuellen Fahrt möglich.
+ % }
+ % elsif ($user_status->{checked_in} and $user_status->{arrival_countdown} > 0) {
+ Deine aktuelle Fahrt ist <a href="/">noch unterwegs</a>.
+ Ein neuer Checkin ist erst nach Ankunft am ausgewählten Ziel möglich.
+ % }
+ % elsif (@{$results}) {
+ Fahrt 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>
- <td>
- <a class="<%= $link_class %>" data-station="<%= $result->station_uic %>" data-train="<%= $result->train_id %>">
- <%= $result->line %>
- </a>
- </td>
- <td class="<%= $td_class %>">
- <a class="<%= $link_class %>" data-station="<%= $result->station_uic %>" data-train="<%= $result->train_id %>">
- <%= $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>
+ % if (not $user_status->{checked_in} or ($can_check_out and $user_status->{arr_eva} and $user_status->{arrival_countdown} <= 0)) {
+ % if ($hafas) {
+ %= include '_departures_hafas', results => $results;
+ % }
+ % else {
+ %= include '_departures_iris', results => $results;
+ % }
+ % }
</div>
</div>