declutter Checked In-panel

This commit is contained in:
Daniel Friesel 2019-08-23 22:54:59 +02:00
parent a40aa1936b
commit 74f2132c2e

View file

@ -1,246 +1,264 @@
<div class="card autorefresh"> <div class="autorefresh">
<div class="card-content"> <div class="card">
<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> <div class="card-content">
<span class="card-title">Eingecheckt in <%= $journey->{train_type} %> <%= $journey->{train_no} %></span> <i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
<p> <span class="card-title">Eingecheckt in <%= $journey->{train_type} %> <%= $journey->{train_no} %></span>
<div class="center-align countdown" <p>
data-duration="<%= $journey->{journey_duration} // 0 %>" <div class="center-align countdown"
data-arrival="<%= $journey->{real_arrival}->epoch %>"> data-duration="<%= $journey->{journey_duration} // 0 %>"
% if ($journey->{boarding_countdown} > 120) { data-arrival="<%= $journey->{real_arrival}->epoch %>">
Einfahrt in <%= sprintf('%.f', $journey->{boarding_countdown} / 60) %> Minuten<br/> % if ($journey->{boarding_countdown} > 120) {
% } Einfahrt in <%= sprintf('%.f', $journey->{boarding_countdown} / 60) %> Minuten<br/>
% elsif ($journey->{boarding_countdown} > 60) {
Einfahrt in einer Minute<br/>
% }
% elsif ($journey->{boarding_countdown} > 0) {
Zug fährt ein<br/>
% }
% 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) { % elsif ($journey->{boarding_countdown} > 60) {
Ankunft in weniger als einer Minute Einfahrt in einer Minute<br/>
% } % }
% else { % elsif ($journey->{boarding_countdown} > 0) {
Ziel erreicht Zug fährt ein<br/>
% } % }
% if ($journey->{arrival_countdown} < (60 * 15) and $journey->{arr_platform}) { % if ($journey->{departure_countdown} > 120) {
% if ($journey->{arr_direction} and $journey->{arr_direction} eq 'r') { Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten
<br/>Gleis <%= $journey->{arr_platform} %> ▶ % }
% 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->{arr_direction} and $journey->{arr_direction} eq 'l') { % elsif ($journey->{arrival_countdown} > 0) {
<br/>◀ Gleis <%= $journey->{arr_platform} %> Ankunft in weniger als einer Minute
% } % }
% else { % else {
<br/>auf Gleis <%= $journey->{arr_platform} %> Ziel erreicht
% }
% if ($journey->{arrival_countdown} < (60 * 15) and $journey->{arr_platform}) {
% if ($journey->{arr_direction} and $journey->{arr_direction} eq 'r') {
<br/>Gleis <%= $journey->{arr_platform} %> ▶
% }
% elsif ($journey->{arr_direction} and $journey->{arr_direction} eq 'l') {
<br/>◀ Gleis <%= $journey->{arr_platform} %>
% }
% else {
<br/>auf Gleis <%= $journey->{arr_platform} %>
% }
% } % }
% } % }
% } % elsif ($journey->{arr_name}) {
% elsif ($journey->{arr_name}) { Ankunft in mehr als zwei Stunden
Ankunft in mehr als zwei Stunden
% }
% if ($journey->{departure_countdown} > 0 and $journey->{dep_platform}) {
% if ($journey->{dep_direction} and $journey->{dep_direction} eq 'r') {
<br/>Gleis <%= $journey->{dep_platform} %> ▶
% } % }
% elsif ($journey->{dep_direction} and $journey->{dep_direction} eq 'l') { % if ($journey->{departure_countdown} > 0 and $journey->{dep_platform}) {
<br/>◀ Gleis <%= $journey->{dep_platform} %> % if ($journey->{dep_direction} and $journey->{dep_direction} eq 'r') {
% } <br/>Gleis <%= $journey->{dep_platform} %> ▶
% else { % }
<br/>von Gleis <%= $journey->{dep_platform} %> % elsif ($journey->{dep_direction} and $journey->{dep_direction} eq 'l') {
% } <br/>◀ Gleis <%= $journey->{dep_platform} %>
% } % }
% if (my $wr = $journey->{wagonorder}) { % else {
<br/> <br/>von Gleis <%= $journey->{dep_platform} %>
% my @wagons = $wr->wagons;
% my $direction = $wr->direction == 100 ? '→' : '←';
% if ($journey->{dep_direction}) {
% $direction = $journey->{dep_direction} eq 'l' ? '◀' : '▶';
% if (($journey->{dep_direction} eq 'l' ? 0 : 100) != $wr->direction) {
% @wagons = reverse @wagons;
% } % }
% } % }
<a href="https://marudor.de/<%= $journey->{dep_name} %>?selectedDetail=<%= $journey->{train_id} %>"> % if (my $wr = $journey->{wagonorder}) {
%= $direction <br/>
% for my $wagon (@wagons) { % my @wagons = $wr->wagons;
% if (not ($wagon->is_locomotive or $wagon->is_powercar)) { % my $direction = $wr->direction == 100 ? '→' : '←';
%= $wagon->number || $wagon->type % if ($journey->{dep_direction}) {
% $direction = $journey->{dep_direction} eq 'l' ? '◀' : '▶';
% if (($journey->{dep_direction} eq 'l' ? 0 : 100) != $wr->direction) {
% @wagons = reverse @wagons;
% }
% } % }
% } <a href="https://marudor.de/<%= $journey->{dep_name} %>?selectedDetail=<%= $journey->{train_id} %>">
%= $direction %= $direction
</a> % for my $wagon (@wagons) {
% } % if (not ($wagon->is_locomotive or $wagon->is_powercar)) {
</div> %= $wagon->number || $wagon->type
<div class="progress" style="height: 1ex;"> % }
<div class="determinate" style="width: <%= sprintf('%.2f', 100 * ($journey->{journey_completion} // 0)); %>%;"></div> % }
</div> %= $direction
</p> </a>
% if ($journey->{arr_name}) {
<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>
<div style="float: right; text-align: right;"> <div class="progress" style="height: 1ex;">
<b><%= $journey->{arr_name} %></b><br/> <div class="determinate" style="width: <%= sprintf('%.2f', 100 * ($journey->{journey_completion} // 0)); %>%;"></div>
% 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) %>)
% }
% }
% else {
noch nicht bekannt
% }
</div>
<div class="center-align hide-on-small-only">
% for my $station (@{$journey->{route_after}}) {
% if ($station->[0] eq $journey->{arr_name}) {
% last;
% }
% if (($station->[1]{rt_arr_countdown} // 0) > 0) {
<%= $station->[0] %><br/><%= $station->[1]{rt_arr}->strftime('%H:%M') %>
% if ($station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) {
%= sprintf('(%+d)', ($station->[1]{rt_arr}->epoch - $station->[1]{sched_arr}->epoch ) / 60);
% }
% last;
% }
% if (($station->[1]{rt_dep_countdown} // 0) > 0) {
<%= $station->[0] %><br/>
<%= $station->[1]{rt_arr}->strftime('%H:%M') %> →
<%= $station->[1]{rt_dep}->strftime('%H:%M') %>
% if ($station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) {
%= sprintf('(%+d)', ($station->[1]{rt_dep}->epoch - $station->[1]{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 ($station->[0] eq $journey->{arr_name}) {
% last;
% }
% if (($station->[1]{rt_arr_countdown} // 0) > 0) {
Nächster Halt:<br/>
<%= $station->[0] %><br/><%= $station->[1]{rt_arr}->strftime('%H:%M') %>
% if ($station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) {
%= sprintf('(%+d)', ($station->[1]{rt_arr}->epoch - $station->[1]{sched_arr}->epoch ) / 60);
% }
% last;
% }
% if (($station->[1]{rt_dep_countdown} // 0) > 0) {
Aktueller Halt:<br/>
<%= $station->[0] %><br/>
<%= $station->[1]{rt_arr}->strftime('%H:%M') %> →
<%= $station->[1]{rt_dep}->strftime('%H:%M') %>
% if ($station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) {
%= sprintf('(%+d)', ($station->[1]{rt_dep}->epoch - $station->[1]{sched_dep}->epoch ) / 60);
% }
% last;
% }
% }
</div> </div>
</p> </p>
% } % if ($journey->{arr_name}) {
% if (@{$journey->{messages} // []} or @{$journey->{extra_data}{him_msg} // []} or @{$journey->{extra_data}{qos_msg} // []}) { <p>
<p style="margin-bottom: 2ex;"> <div style="float: left;">
<ul> <b><%= $journey->{dep_name} %></b><br/>
% for my $message (reverse @{$journey->{messages} // []}) { <b><%= $journey->{real_departure}->strftime('%H:%M') %></b>
% if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) { % if ($journey->{real_departure}->epoch != $journey->{sched_departure}->epoch) {
<li> <i class="material-icons tiny">warning</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li> (<%= sprintf('%+d', ($journey->{real_departure}->epoch - $journey->{sched_departure}->epoch)/60) %>)
% } % }
% } </div>
% if ($journey->{departure_countdown} > 0) { <div style="float: right; text-align: right;">
% for my $message (@{$journey->{extra_data}{qos_msg} // []}) { <b><%= $journey->{arr_name} %></b><br/>
<li> <i class="material-icons tiny">info</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li> % 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) %>)
% }
% } % }
% } % else {
% for my $message (@{$journey->{extra_data}{him_msg} // []}) { noch nicht bekannt
<li> <i class="material-icons tiny">info</i> <%= $message->{header} %> <%= $message->{lead} %></li> % }
% } </div>
</ul> <div class="center-align hide-on-small-only">
</p> % for my $station (@{$journey->{route_after}}) {
% } % if ($station->[0] eq $journey->{arr_name}) {
% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} < (20*60)) { % last;
% if (my @connections = get_connecting_trains()) { % }
<span class="card-title" style="margin-top: 2ex;">Verbindungen</span> % if (($station->[1]{rt_arr_countdown} // 0) > 0) {
% if ($journey->{arrival_countdown} < 0) { <%= $station->[0] %><br/><%= $station->[1]{rt_arr}->strftime('%H:%M') %>
<p>Zug auswählen zum Einchecken mit Zielwahl.</p> % if ($station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) {
% } %= sprintf('(%+d)', ($station->[1]{rt_arr}->epoch - $station->[1]{sched_arr}->epoch ) / 60);
%= include '_connections', connections => \@connections, checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_ds100} : undef; % }
% last;
% }
% if (($station->[1]{rt_dep_countdown} // 0) > 0) {
<%= $station->[0] %><br/>
<%= $station->[1]{rt_arr}->strftime('%H:%M') %> →
<%= $station->[1]{rt_dep}->strftime('%H:%M') %>
% if ($station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) {
%= sprintf('(%+d)', ($station->[1]{rt_dep}->epoch - $station->[1]{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 ($station->[0] eq $journey->{arr_name}) {
% last;
% }
% if (($station->[1]{rt_arr_countdown} // 0) > 0) {
Nächster Halt:<br/>
<%= $station->[0] %><br/><%= $station->[1]{rt_arr}->strftime('%H:%M') %>
% if ($station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) {
%= sprintf('(%+d)', ($station->[1]{rt_arr}->epoch - $station->[1]{sched_arr}->epoch ) / 60);
% }
% last;
% }
% if (($station->[1]{rt_dep_countdown} // 0) > 0) {
Aktueller Halt:<br/>
<%= $station->[0] %><br/>
<%= $station->[1]{rt_arr}->strftime('%H:%M') %> →
<%= $station->[1]{rt_dep}->strftime('%H:%M') %>
% if ($station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) {
%= sprintf('(%+d)', ($station->[1]{rt_dep}->epoch - $station->[1]{sched_dep}->epoch ) / 60);
% }
% last;
% }
% }
</div>
</p>
% } % }
% } % if (@{$journey->{messages} // []} or @{$journey->{extra_data}{him_msg} // []} or @{$journey->{extra_data}{qos_msg} // []}) {
% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) { <p style="margin-bottom: 2ex;">
<p style="margin-top: 2ex;"> <ul>
Der automatische Checkout erfolgt wegen gelegentlich veralteter % for my $message (reverse @{$journey->{messages} // []}) {
IRIS-Daten erst etwa zehn Minuten nach der Ankunft. <a % if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) {
class="action-checkout" <li> <i class="material-icons tiny">warning</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li>
data-station="<%= $journey->{arr_name}%>">Jetzt auschecken</a>. % }
</p> % }
% } % if ($journey->{departure_countdown} > 0) {
% elsif ($journey->{arr_name}) { % for my $message (@{$journey->{extra_data}{qos_msg} // []}) {
<p style="margin-top: 2em;">Ziel ändern?</p> <li> <i class="material-icons tiny">info</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li>
% } % }
% else { % }
<p>Ziel wählen:</p> % for my $message (@{$journey->{extra_data}{him_msg} // []}) {
% } <li> <i class="material-icons tiny">info</i> <%= $message->{header} %> <%= $message->{lead} %></li>
<table> % }
<tbody> </ul>
% my $is_after = 0; </p>
% for my $station (@{$journey->{route_after}}) {
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
<tr><td><b><a class="action-checkout" data-station="<%= $station->[0] %>"><%= $station->[0] %></a></b></td></tr>
% }
% else {
<tr><td><a class="action-checkout" data-station="<%= $station->[0] %>"><%= $station->[0] %></a></td></tr>
% }
% }
</tbody>
</table>
% if ($journey->{arr_name}) {
<p>
Falls das Backend ausgefallen ist oder der Zug aus anderen
Gründen verloren ging: <a class="action-checkout"
data-force="1" data-station="<%= $journey->{arr_name}
%>">Ohne Echtzeitdaten in <%= $journey->{arr_name} %>
auschecken</a>.
</p>
% }
</div>
<div class="card-action">
<a class="action-undo blue-text" data-id="in_transit">
<i class="material-icons left">undo</i> Rückgängig
</a>
% if ($journey->{arr_name}) {
% my $attrib = 'im';
% if ($journey->{train_type} =~ m{ ^ (?: S | RB ) $ }x) {
% $attrib = 'in der';
% } % }
<a class="action-share blue-text right" % if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} < (20*60)) {
data-text="Ich bin gerade <%= $attrib %> <%= $journey->{train_type} %> <%= $journey->{train_no} %> nach <%= $journey->{arr_name} %> #NowTräwelling #dbl" % if (my @connections = get_connecting_trains()) {
% if (current_user()->{is_public} & 0x02) { <span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
data-url="<%= url_for('/status')->to_abs->scheme('https') %>/<%= current_user->{name} %>/<%= $journey->{sched_departure}->epoch %>" % if ($journey->{arrival_countdown} < 0) {
<p>Zug auswählen zum Einchecken mit Zielwahl.</p>
% }
%= include '_connections', connections => \@connections, checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_ds100} : undef;
% } % }
> % }
<i class="material-icons left">share</i> Teilen % if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) {
<p style="margin-top: 2ex;">
Der automatische Checkout erfolgt wegen gelegentlich veralteter
IRIS-Daten erst etwa zehn Minuten nach der Ankunft. <a
class="action-checkout"
data-station="<%= $journey->{arr_name}%>">Jetzt auschecken</a>.
</p>
% }
% elsif (not $journey->{arr_name}) {
<p>Ziel wählen:</p>
<table>
<tbody>
% my $is_after = 0;
% for my $station (@{$journey->{route_after}}) {
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
<tr><td><b><a class="action-checkout" data-station="<%= $station->[0] %>"><%= $station->[0] %></a></b></td></tr>
% }
% else {
<tr><td><a class="action-checkout" data-station="<%= $station->[0] %>"><%= $station->[0] %></a></td></tr>
% }
% }
</tbody>
</table>
% }
</div>
<div class="card-action">
<a class="action-undo blue-text" data-id="in_transit">
<i class="material-icons left">undo</i> Rückgängig
</a> </a>
% } % if ($journey->{arr_name}) {
% my $attrib = 'im';
% if ($journey->{train_type} =~ m{ ^ (?: S | RB ) $ }x) {
% $attrib = 'in der';
% }
<a class="action-share blue-text right"
data-text="Ich bin gerade <%= $attrib %> <%= $journey->{train_type} %> <%= $journey->{train_no} %> nach <%= $journey->{arr_name} %> #NowTräwelling #dbl"
% if (current_user()->{is_public} & 0x02) {
data-url="<%= url_for('/status')->to_abs->scheme('https') %>/<%= current_user->{name} %>/<%= $journey->{sched_departure}->epoch %>"
% }
>
<i class="material-icons left">share</i> Teilen
</a>
% }
</div>
</div> </div>
% if ($journey->{arr_name}) {
<div class="card" style="margin-top: 3em;">
<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">Ziel ändern?</span>
<table>
<tbody>
% my $is_after = 0;
% for my $station (@{$journey->{route_after}}) {
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
<tr><td><b><a class="action-checkout" data-station="<%= $station->[0] %>"><%= $station->[0] %></a></b></td></tr>
% }
% else {
<tr><td><a class="action-checkout" data-station="<%= $station->[0] %>"><%= $station->[0] %></a></td></tr>
% }
% }
</tbody>
</table>
<p>
Falls das Backend ausgefallen ist oder der Zug aus anderen
Gründen verloren ging: <a class="action-checkout"
data-force="1" data-station="<%= $journey->{arr_name}
%>">Ohne Echtzeitdaten in <%= $journey->{arr_name} %>
auschecken</a>.
</p>
</div>
</div>
% }
</div> </div>