mirror of
https://github.com/derf/travelynx
synced 2024-11-14 00:37:16 +00:00
201 lines
8.2 KiB
Text
201 lines
8.2 KiB
Text
<div class="autorefresh" data-from-profile="<%= stash('from_profile') ? 1 : 0 %>">
|
|
% if ($journey->{checked_in}) {
|
|
<div class="card">
|
|
<div class="card-content">
|
|
<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
|
|
<span class="card-title">
|
|
% if (stash('from_profile')) {
|
|
Unterwegs mit <%= include '_format_train', journey => $journey %>
|
|
% }
|
|
% else {
|
|
<a href="/p/<%= $name %>"><%= $name %></a> ist unterwegs
|
|
% }
|
|
% if ($journey_visibility) {
|
|
<i class="material-icons right"><%= visibility_icon($journey_visibility) %></i>
|
|
% }
|
|
</span>
|
|
% if ($public_level & 0x04 and $journey->{comment}) {
|
|
<p>„<%= $journey->{comment} %>“</p>
|
|
% }
|
|
<p>
|
|
% if (not stash('from_profile')) {
|
|
<div class="center-align">
|
|
%= include '_format_train', journey => $journey
|
|
</div>
|
|
% }
|
|
<div class="center-align countdown"
|
|
data-duration="<%= $journey->{journey_duration} // 0 %>"
|
|
% if (param('token')) {
|
|
data-token="<%= $journey->{dep_eva} %>-<%= $journey->{timestamp}->epoch % 337 %>-<%= $journey->{sched_departure}->epoch %>"
|
|
% }
|
|
data-arrival="<%= $journey->{real_arrival}->epoch %>">
|
|
% if ($journey->{departure_countdown} > 120) {
|
|
Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten
|
|
% }
|
|
% elsif ($journey->{departure_countdown} > 60) {
|
|
Abfahrt in einer Minute
|
|
% }
|
|
% elsif ($journey->{departure_countdown} > 0) {
|
|
Abfahrt in weniger als einer Minute
|
|
% }
|
|
% elsif (defined $journey->{arrival_countdown}) {
|
|
% if ($journey->{arrival_countdown} > 60) {
|
|
Ankunft in <%= sprintf('%.f', $journey->{arrival_countdown} / 60) %>
|
|
Minute<%= sprintf('%.f', $journey->{arrival_countdown} / 60) == 1 ? '' : 'n' %>
|
|
% }
|
|
% elsif ($journey->{arrival_countdown} > 0) {
|
|
Ankunft in weniger als einer Minute
|
|
% }
|
|
% else {
|
|
Ziel erreicht
|
|
% }
|
|
% if ($journey->{arrival_countdown} < (60 * 15) and $journey->{arr_platform}) {
|
|
<br/>auf Gleis <%= $journey->{arr_platform} %>
|
|
% }
|
|
% }
|
|
% elsif ($journey->{arr_name}) {
|
|
Ankunft in mehr als zwei Stunden
|
|
% }
|
|
</div>
|
|
<div class="progress" style="height: 1ex;">
|
|
<div class="determinate" style="width: <%= sprintf('%.2f', 100 * ($journey->{journey_completion} // 0)); %>%;"></div>
|
|
</div>
|
|
</p>
|
|
<p>
|
|
<div style="float: left;">
|
|
<b><%= $journey->{dep_name} %></b><br/>
|
|
<b><%= $journey->{real_departure}->strftime('%H:%M') %></b>
|
|
% if ($journey->{real_departure}->epoch != $journey->{sched_departure}->epoch) {
|
|
(<%= sprintf('%+d', ($journey->{real_departure}->epoch - $journey->{sched_departure}->epoch)/60) %>)
|
|
% }
|
|
</div>
|
|
<div style="float: right; text-align: right;">
|
|
% if ($journey->{arr_name}) {
|
|
<b><%= $journey->{arr_name} %></b><br/>
|
|
% }
|
|
% else {
|
|
Fahrt ins Blaue<br/>
|
|
% }
|
|
% if ($journey->{real_arrival}->epoch) {
|
|
<b><%= $journey->{real_arrival}->strftime('%H:%M') %></b>
|
|
% if ($journey->{real_arrival}->epoch != $journey->{sched_arrival}->epoch) {
|
|
(<%= sprintf('%+d', ($journey->{real_arrival}->epoch - $journey->{sched_arrival}->epoch)/60) %>)
|
|
% }
|
|
% }
|
|
% elsif ($journey->{arr_name}) {
|
|
noch nicht bekannt
|
|
% }
|
|
</div>
|
|
<div class="center-align hide-on-small-only">
|
|
% for my $station (@{$journey->{route_after}}) {
|
|
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
|
|
% last;
|
|
% }
|
|
% if (($station->[2]{rt_arr_countdown} // 0) > 0 and $station->[2]{rt_arr}) {
|
|
<%= $station->[0] %><br/><%= $station->[2]{rt_arr}->strftime('%H:%M') %>
|
|
% if ($station->[2]{sched_arr} and $station->[2]{sched_arr}->epoch != $station->[2]{rt_arr}->epoch) {
|
|
%= sprintf('(%+d)', ($station->[2]{rt_arr}->epoch - $station->[2]{sched_arr}->epoch ) / 60);
|
|
% }
|
|
% last;
|
|
% }
|
|
% if (($station->[2]{rt_dep_countdown} // 0) > 0 and $station->[2]{rt_arr} and $station->[2]{rt_dep}) {
|
|
<%= $station->[0] %><br/>
|
|
<%= $station->[2]{rt_arr}->strftime('%H:%M') %> →
|
|
<%= $station->[2]{rt_dep}->strftime('%H:%M') %>
|
|
% if ($station->[2]{sched_dep} and $station->[2]{sched_dep}->epoch != $station->[2]{rt_dep}->epoch) {
|
|
%= sprintf('(%+d)', ($station->[2]{rt_dep}->epoch - $station->[2]{sched_dep}->epoch ) / 60);
|
|
% }
|
|
% last;
|
|
% }
|
|
% }
|
|
</div>
|
|
<div style="clear: both;">
|
|
</div>
|
|
<div class="hide-on-med-and-up" style="margin-top: 2ex;">
|
|
% for my $station (@{$journey->{route_after}}) {
|
|
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
|
|
% last;
|
|
% }
|
|
% if (($station->[2]{rt_arr_countdown} // 0) > 0 and $station->[2]{rt_arr}) {
|
|
Nächster Halt:<br/>
|
|
<%= $station->[0] %><br/><%= $station->[2]{rt_arr}->strftime('%H:%M') %>
|
|
% if ($station->[2]{sched_arr} and $station->[2]{sched_arr}->epoch != $station->[2]{rt_arr}->epoch) {
|
|
%= sprintf('(%+d)', ($station->[2]{rt_arr}->epoch - $station->[2]{sched_arr}->epoch ) / 60);
|
|
% }
|
|
% last;
|
|
% }
|
|
% if (($station->[2]{rt_dep_countdown} // 0) > 0 and $station->[2]{rt_arr} and $station->[2]{rt_dep}) {
|
|
Aktueller Halt:<br/>
|
|
<%= $station->[0] %><br/>
|
|
<%= $station->[2]{rt_arr}->strftime('%H:%M') %> →
|
|
<%= $station->[2]{rt_dep}->strftime('%H:%M') %>
|
|
% if ($station->[2]{sched_dep} and $station->[2]{sched_dep}->epoch != $station->[2]{rt_dep}->epoch) {
|
|
%= sprintf('(%+d)', ($station->[2]{rt_dep}->epoch - $station->[2]{sched_dep}->epoch ) / 60);
|
|
% }
|
|
% last;
|
|
% }
|
|
% }
|
|
</div>
|
|
</p>
|
|
% if ($journey->{extra_data}{cancelled_destination}) {
|
|
<p style="margin-bottom: 2ex;">
|
|
<i class="material-icons tiny" aria-hidden="true">error</i>
|
|
Der Halt an der Zielstation <b><%=
|
|
$journey->{extra_data}{cancelled_destination} %></b> entfällt.
|
|
</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>
|
|
% }
|
|
% }
|
|
% for my $message (@{$journey->{extra_data}{qos_msg} // []}) {
|
|
<li> <i class="material-icons tiny">info</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li>
|
|
% }
|
|
</ul>
|
|
</p>
|
|
% }
|
|
</div>
|
|
<div class="card-action">
|
|
% if ($journey->{traewelling_url}) {
|
|
<a style="margin-right: 0;" href="<%= $journey->{traewelling_url} %>"><i class="material-icons left">timeline</i> Träwelling</a>
|
|
% } else {
|
|
% my $url = 'https://bahn.expert/details/' . $journey->{train_type} . ' ' . $journey->{train_no} . '/' . DateTime->now(time_zone => 'Europe/Berlin')->epoch . '000';
|
|
<a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left">timeline</i> Zuglauf</a>
|
|
% }
|
|
% if ($journey->{extra_data}{trip_id}) {
|
|
<a class="right" style="margin-right: 0;" href="https://dbf.finalrewind.org/map/<%= $journey->{extra_data}{trip_id} %>/<%= $journey->{train_line} || 0 %>?from=<%= $journey->{dep_name} %>&to=<%= $journey->{arr_name} // '' %>"><i class="material-icons left">map</i> Karte</a>
|
|
% }
|
|
</div>
|
|
</div>
|
|
% }
|
|
% else {
|
|
<div class="card">
|
|
<div class="card-content">
|
|
<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
|
|
% if (stash('from_profile')) {
|
|
<span class="card-title">Aktuell nicht eingecheckt</span>
|
|
% }
|
|
% else {
|
|
<span class="card-title"><a href="/p/<%= $name %>"><%= $name %></a> ist gerade nicht eingecheckt</span>
|
|
% }
|
|
<p>
|
|
% if ($journey->{arr_name}) {
|
|
Zuletzt gesehen
|
|
% if ($journey->{real_arrival}->epoch and ($public_level & 0x20 or ($public_level & 0x10 and is_user_authenticated()))) {
|
|
%= $journey->{real_arrival}->strftime('am %d.%m.%Y')
|
|
in <b><%= $journey->{arr_name} %></b>
|
|
%= $journey->{real_arrival}->strftime('(Ankunft um %H:%M Uhr)')
|
|
% }
|
|
% else {
|
|
in <b><%= $journey->{arr_name} %></b>
|
|
% }
|
|
% }
|
|
</p>
|
|
</div>
|
|
</div>
|
|
% }
|
|
</div>
|