summaryrefslogtreecommitdiff
path: root/templates/_train_details.html.ep
diff options
context:
space:
mode:
Diffstat (limited to 'templates/_train_details.html.ep')
-rw-r--r--templates/_train_details.html.ep263
1 files changed, 141 insertions, 122 deletions
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep
index 7ef2138..3432c30 100644
--- a/templates/_train_details.html.ep
+++ b/templates/_train_details.html.ep
@@ -2,9 +2,6 @@
<div>
% if ($departure->{train_no} or $departure->{train_line}) {
<span class="train-line <%= $linetype %>"><%= $departure->{train_type} %>
-% if ($linetype eq 'fern' and $icetype and $icetype->[1]) {
- <span class="trainsubtype" aria-hidden="true"><%= $icetype->[1] %></span>
-% }
<%= $departure->{train_line} // $departure->{train_no} %></span>
<span class="train-no"><%= $departure->{train_line} ? $departure->{train_no} : q{} %></span>
@@ -17,33 +14,11 @@
% }
<span class="train-dest"><%= $departure->{destination} // q{???} %></span>
</div>
-<!--
-% if ($departure->{is_cancelled}) {
- <div class="minfo">Fahrt fällt aus</div>
-% }
-% elsif (defined $departure->{delay} and $departure->{delay} > 0) {
- <div class="minfo">+<%= $departure->{delay} %>
-% if ($departure->{departure_is_cancelled}) {
- (endet hier)
-% }
- </div>
-% }
-% if (@{$departure->{replaced_by}}) {
-% for my $replacement (@{$departure->{replaced_by}}) {
- <span class="replaced">Ersatzzug: <%= $replacement %></span>
-% }
-% }
-% if (@{$departure->{replacement_for}}) {
-% for my $replacement (@{$departure->{replacement_for}}) {
- <span class="replacement">Ersatzzug für <%= $replacement %></span>
-% }
-% }
--->
</div> <!-- mheader -->
<div class="mfooter">
<div class="dataline">
<div>
- <div class="arrival">
+ <div class="arrival <%= $departure->{arrival_hidden} ? 'timehidden' : q{} %>">
% if ($departure->{is_cancelled} and $departure->{sched_arrival}) {
<span class="minfo">An: ––:––</span><br/>Plan: <%= $departure->{sched_arrival} %>
% }
@@ -52,7 +27,7 @@
% }
% elsif ($departure->{arrival}) {
% if ($departure->{arrival} ne $departure->{sched_arrival}) {
- % if ($departure->{delay} < 0) {
+ % if (($departure->{arrival_delay} // 0) < 0) {
An: <span class="undelay"><%= $departure->{arrival} %></span>
% }
% else {
@@ -64,10 +39,26 @@
An: <%= $departure->{arrival} %>
% }
% }
+% elsif ($departure->{sched_arrival}) {
+ An: <%= $departure->{sched_arrival} %>
+% }
+% elsif ($departure->{prep_time}) {
+ Ein: <%= $departure->{prep_time} %>
+% }
</div>
</div>
<div>
<div class="platform">
+% if (@{$departure->{replaced_by}}) {
+% for my $replacement (@{$departure->{replaced_by}}) {
+ <span class="replaced">Ersatzfahrt: <a href="/z/<%= $replacement %>/<%= stash('station_name') // q{} %>"><%= $replacement %></a></span><br/>
+% }
+% }
+% if (@{$departure->{replacement_for}}) {
+% for my $replacement (@{$departure->{replacement_for}}) {
+ <span class="replacement">Ersatzfahrt für <a href="/z/<%= $replacement %>/<%= stash('station_name') // q{} %>"><%= $replacement %></a></span><br/>
+% }
+% }
% if ($departure->{arrival_is_cancelled} and $departure->{departure_is_cancelled}) {
<span class="minfo">Fahrt fällt aus</span>
% }
@@ -88,10 +79,16 @@
<%= $left %>Gleis <%= $departure->{platform} // $departure->{scheduled_platform} %><%= $right %>
% }
% }
+% if ($departure->{arrival_hidden} and not $departure->{prep_time}) {
+ <br/><span class="timehidden">Nur Einstieg</span>
+% }
+% if ($departure->{departure_hidden}) {
+ <br/><span class="timehidden">Nur Ausstieg</span>
+% }
</div>
</div>
<div>
- <div class="departure">
+ <div class="departure <%= $departure->{departure_hidden} ? 'timehidden' : q{} %>">
% if ($departure->{is_cancelled} and $departure->{sched_departure}) {
<span class="minfo">Ab: ––:––</span><br/>Plan: <%= $departure->{sched_departure} %>
% }
@@ -107,27 +104,58 @@
Ab: <%= $departure->{departure} %>
% }
% }
+% elsif ($departure->{sched_departure}) {
+ Ab: <%= $departure->{sched_departure} %>
+% }
</div>
</div>
</div> <!-- dataline -->
+% if (my $wr = $departure->{wr}) {
+ <div class="wagonorder-preview">
+% my @wagons = $wr->wagons;
+% my $direction = $wr->direction ? $wr->direction == 100 ? '→' : '←' : q{};
+% if ($departure->{direction}) {
+% $direction = $departure->{direction} eq 'l' ? '◀' : '▶';
+% if (($departure->{direction} eq 'l' ? 0 : 100) != $wr->direction) {
+% @wagons = reverse @wagons;
+% }
+% }
+ <a href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>?e=<%= $departure->{direction} // '' %>">
+ %= $direction
+% my $gi;
+% for my $wagon (@wagons) {
+% if (not ($wagon->is_locomotive or $wagon->is_powercar)) {
+% if (defined $gi and $gi != $wagon->group_index) {
+ •
+% }
+% if ($wagon->is_closed) {
+ X
+% }
+% else {
+%= $wagon->number || ($wagon->type =~ m{AB} ? '½' : $wagon->type =~ m{A} ? '1.' : $wagon->type =~ m{B} ? '2.' : $wagon->type )
+% }
+% }
+% $gi = $wagon->group_index;
+% }
+ %= $direction
+ </a>
+ </div>
+% }
<div class="verbose">
% if ($departure->{trip_id}) {
% if (stash('station_name')) {
- <a class="smallbutton" href="/map/<%= $departure->{trip_id} %>/<%= $departure->{train_line} // 0 %>?from=<%= stash('station_name') %>"><i class="material-icons" aria-hidden="true">map</i> Karte</a>
+ <a class="smallbutton" href="/map/<%= $departure->{trip_id} =~ s{#}{%23}gr %>/<%= $departure->{train_line} // 0 %>?from=<%= stash('station_name') %>&amp;hafas=<%= param('hafas') // q{} %>"><i class="material-icons" aria-hidden="true">map</i> Karte</a>
% }
% else {
- <a class="smallbutton" href="/map/<%= $departure->{trip_id} %>/<%= $departure->{train_line} // 0 %>"><i class="material-icons" aria-hidden="true">map</i> Karte</a>
+ <a class="smallbutton" href="/map/<%= $departure->{trip_id} =~ s{#}{%23}gr %>/<%= $departure->{train_line} // 0 %>?hafas=<%= param('hafas') // q{} %>"><i class="material-icons" aria-hidden="true">map</i> Karte</a>
% }
% }
% if ($departure->{wr_link}) {
- <a class="smallbutton" href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>?e=<%= $departure->{direction} // '' %>"><i class="material-icons" aria-hidden="true">train</i> Wagenreihung
+ <a class="smallbutton" href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>?e=<%= $departure->{direction} // '' %>"><i class="material-icons" aria-hidden="true">train</i> <%= $departure->{wr_text} || 'Wagen' %>
</a>
% }
-% elsif ($icetype and $icetype->[2] and ($linetype eq 'fern' or $departure->{train_type} =~ m{NJ})) {
- <a class="smallbutton" href="/wr/<%= $departure->{train_no} %>"><i class="material-icons" aria-hidden="true">train</i> Plan: <%= $icetype->[0] %></a>
-% }
-% elsif ($icetype and $icetype->[1] and $linetype eq 'fern') {
- <span class="disabledbutton"><i class="material-icons" aria-hidden="true">train</i> Plan: <%= $icetype->[0] %></span>
+% if ($departure->{train_type} and $departure->{train_no}) {
+ <a class="smallbutton" href="https://bahn.expert/details/<%= $departure->{train_type} %>%20<%= $departure->{train_no} %>/<%= ($departure->{date} // DateTime->now(time_zone => 'Europe/Berlin'))->iso8601 %>?evaNumberAlongRoute=<%= $departure->{eva} %>"><img src="/static/icons/bahn-expert.svg">Details</a>
% }
% for my $link (@{$departure->{links}}) {
<a class="smallbutton" href="<%= $link->[1] %>"><i class="material-icons" aria-hidden="true">warning</i> <%= $link->[0] %></a>
@@ -161,11 +189,11 @@
% }
% if ($departure->{moreinfo} and @{$departure->{moreinfo}}) {
- Meldungen:
- <ul>
+ Meldungen
+ <ul class="messages">
% for my $pair (@{$departure->{moreinfo}}) {
<li>
-% if ($pair->[0]->isa('DateTime')) {
+% if (ref($pair->[0]) eq 'DateTime') {
% if ($pair->[0]->day != $dt_now->day) {
% $pair->[0]->set_locale('de_DE');
%= $pair->[0]->strftime('%a %H:%M')
@@ -173,16 +201,22 @@
% else {
%= $pair->[0]->strftime('%H:%M')
% }
+ <span class="reason">
+%= $pair->[1]
+ </span>
% }
% else {
+% if ($pair->[1]{icon}) {
+ <i class="material-icons"><%= $pair->[1]{icon} %></i>
+% }
%= $pair->[0]
% if (length($pair->[0]) > 25) {
<br/>
% }
+ <span class="reason">
+%= $pair->[1]{text}
+ </span>
% }
- <span class="reason">
-%= $pair->[1]
- </span>
</li>
% }
% if ($departure->{route_info}) {
@@ -191,11 +225,20 @@
</ul>
% }
% if ($departure->{route_pre_diff} and $departure->{route_post_diff}) {
- Fahrtverlauf:
+% if ($departure->{date}) {
+ Fahrtverlauf am
+% if (stash('train') !~ m{[|]}) {
+ <a href="<%= url_for('train', train => stash('train'))->query({detailed => param('detailed'), past => param('past'), rt => param('rt'), hafas => param('hafas'), date => $departure->{date}->clone->subtract(days => 1)->strftime('%d.%m.%Y'), highlight => param('highlight') // stash('station')}) %>">◀</a>
+% }
+%= $departure->{date}->strftime('%d.%m.%Y')
+% if (stash('train') !~ m{[|]}) {
+ <a href="<%= url_for('train', train => stash('train'))->query({detailed => param('detailed'), past => param('past'), rt => param('rt'), hafas => param('hafas'), date => $departure->{date}->clone->add(days => 1)->strftime('%d.%m.%Y'), highlight => param('highlight') // stash('station')}) %>">▶</a>
+% }
+% }
<ul class="mroute">
% for my $stop (@{$departure->{route_pre_diff}}) {
<li class="<%= $stop->{isPast} ? 'past-stop' : 'future-stop' %>">
- <a href="<%= url_for('station', station => $stop->{name})->query({detailed => param('detailed'), past => param('past'), rt => param('rt')}) %>#<%= ($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x}) %>" class="
+ <a href="<%= url_for('station', station => $stop->{eva} // $stop->{name})->query({detailed => param('detailed'), past => param('past'), rt => param('rt'), hafas => param('hafas')}) %>#<%= ($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x}) %>" class="
% if ($stop->{isAdditional}) {
additional-stop
% }
@@ -208,39 +251,45 @@
% else {
generic-stop
% }
-% if ($stop->{rt_dep}) {
- "><%= $stop->{sched_dep}->strftime('%H:%M') %> (heute <%= $stop->{rt_dep}->strftime('%H:%M') %>) <%= $stop->{name} %></a>
+% if (($stop->{rt_dep} and $stop->{dep_delay}) or (not $stop->{rt_dep} and $stop->{rt_arr} and $stop->{arr_delay})) {
+ "><%= ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') %> (heute <%= ($stop->{rt_dep} // $stop->{rt_arr})->strftime('%H:%M') %>)
% }
% else {
- "><%= $stop->{sched_dep} ? $stop->{sched_dep}->strftime('%H:%M') : q{} %>
-% if ($stop->{rt_bogus}) {
- <i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
-% }
- <%= $stop->{name} %></a>
+ "><%= ($stop->{sched_dep} // $stop->{sched_arr}) ? ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') : q{} %>
+% if ($stop->{rt_bogus}) {
+ <i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
+% }
+% }
+ <%= $stop->{name} %></a>
+% if ($stop->{load}{FIRST} or $stop->{load}{SECOND}) {
+% my ($text, $icon1, $icon2) = utilization_icon([$stop->{load}{FIRST}, $stop->{load}{SECOND}]);
+ <i class="material-icons" aria-hidden="true"><%= $icon1 %></i>
+ <i class="material-icons" aria-hidden="true"><%= $icon2 %></i>
% }
</li>
% }
% if (stash('station_name')) {
<li class="<%= $departure->{is_cancelled} ? 'cancelled-stop' : q{} %> <%= $departure->{isPast} ? 'past-stop' : 'future-stop' %>"><%= $departure->{sched_departure} // $departure->{sched_arrival} // q{} %>
-% if ($departure->{sched_departure}) {
-% if ($departure->{departure} ne $departure->{sched_departure}) {
- (heute <%= $departure->{departure} %>)
-% }
+% if ($departure->{departure} and $departure->{sched_departure} and $departure->{departure} ne $departure->{sched_departure}) {
+ (heute <%= $departure->{departure} %>)
% }
-% elsif ($departure->{arrival}) {
-% if ($departure->{arrival} ne $departure->{sched_arrival}) {
- (heute <%= $departure->{arrival} %>)
-% }
+% elsif ($departure->{arrival} and $departure->{sched_arrival} and $departure->{arrival} ne $departure->{sched_arrival}) {
+ (heute <%= $departure->{arrival} %>)
% }
% if ($departure->{missing_realtime} or $departure->{no_realtime_yet}) {
<i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
% }
<strong><%= stash('station_name') %></strong>
+% if (my $u = $departure->{utilization}) {
+% my ($text, $icon1, $icon2) = utilization_icon($u);
+ <i class="material-icons" aria-hidden="true"><%= $icon1 %></i>
+ <i class="material-icons" aria-hidden="true"><%= $icon2 %></i>
+% }
</li>
% }
% for my $stop (@{$departure->{route_post_diff}}) {
<li class="<%= $stop->{isPast} ? 'past-stop' : 'future-stop' %>">
- <a href="<%= url_for('station', station => $stop->{name})->query({detailed => param('detailed'), past => param('past'), rt => param('rt')}) %>#<%= ($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x}) %>" class="
+ <a href="<%= url_for('station', station => $stop->{eva} // $stop->{name})->query({detailed => param('detailed'), past => param('past'), rt => param('rt'), hafas => param('hafas')}) %>#<%= ($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x}) %>" class="
% if ($stop->{isAdditional}) {
additional-stop
% }
@@ -253,79 +302,49 @@
% else {
generic-stop
% }
-% if ($stop->{rt_arr}) {
- "><%= $stop->{sched_arr}->strftime('%H:%M') %> (heute <%= $stop->{rt_arr}->strftime('%H:%M') %>) <%= $stop->{name} %></a>
+% if (($stop->{rt_arr} and $stop->{arr_delay}) or (not $stop->{rt_arr} and $stop->{rt_dep} and $stop->{dep_delay})) {
+ "><%= ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') %> (heute <%= ($stop->{rt_arr} // $stop->{rt_dep})->strftime('%H:%M') %>)
% }
% else {
- "><%= $stop->{sched_arr} ? $stop->{sched_arr}->strftime('%H:%M') : q{} %>
-% if ($stop->{rt_bogus}) {
- <i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
-% }
- <%= $stop->{name} %></a>
+ "><%= ($stop->{sched_arr} // $stop->{sched_dep}) ? ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') : q{} %>
+% if ($stop->{rt_bogus}) {
+ <i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
+% }
+% }
+ <%= $stop->{name} %></a>
+% if ($stop->{load}{FIRST} or $stop->{load}{SECOND}) {
+% my ($text, $icon1, $icon2) = utilization_icon([$stop->{load}{FIRST}, $stop->{load}{SECOND}]);
+ <i class="material-icons" aria-hidden="true"><%= $icon1 %></i>
+ <i class="material-icons" aria-hidden="true"><%= $icon2 %></i>
% }
</li>
% }
</ul> <!-- mroute -->
% }
-% if ($departure->{has_cycle}) {
- <div class="db-attr"><a href="https://lib.finalrewind.org/dbdb/db_umlauf/<%= $departure->{train_no} %>.svg">Umlaufplan</a>
- (ggf. fehlerhaft)</div>
-% }
-% if ($details->{commonAttr}) {
-% if ($details->{attrVariants} and (not $details->{commonAttr}{vmax} or not $details->{commonAttr}{brakingPercentage})) {
- <div class="db-attr">
- Attribute:
- <ul>
-% for my $attr (@{$details->{attrVariants} // [] }) {
- <li><%= include '_train_attr', attr => $attr, with_station => 1 %></li>
-% }
- </ul>
- </div>
-% }
-% else {
- <div class="db-attr">
-%= include '_train_attr', attr => $details->{commonAttr}, with_station => 0
- </div>
-% }
+% if ($departure->{operator}) {
+ <div class="details">Betrieb: <%= $departure->{operator} %></div>
% }
-% if ($details and not $departure->{arrival}) {
-% if (my $s = $details->{route}{preStart}) {
- Zug wird voraussichtlich aus <%= $s %> eingesetzt.<br/><br/>
-% }
-% if (@{$departure->{cycle_from} // []}) {
- Bildung möglicherweise aus
+% if ($departure->{details} and @{$departure->{details}}) {
+ <div class="details">Details:
<ul>
-% for my $t (@{$departure->{cycle_from}}) {
-% my ($train_no, $train) = @{$t};
-% my $tt = $train->{type} // $train->{rawType} // 'Zug';
-% $tt =~ s{ .*|[0-9]}{};
- <li><%= $tt %> <%= $train_no %>
-% if ($train->{route}{start} and $train->{route}{end}) {
- <%= $train->{route}{start} %> → <%= $train->{route}{end} %>
-% }
- </li>
+% for my $pair (@{$departure->{details}}) {
+ <li>
+% if ($pair->[1]{icon}) {
+ <i class="material-icons"><%= $pair->[1]{icon} %></i>
% }
- </ul>
-% }
-% }
-% elsif ($details and not $departure->{departure}) {
-% if (my $e = $details->{route}{postEnd}) {
- Zug wird voraussichtlich in <%= $e %> abgestellt.<br/><br/>
-% }
-% if (@{$departure->{cycle_to} // []}) {
- Weiterfahrt möglicherweise als
- <ul>
-% for my $t (@{$departure->{cycle_to}}) {
-% my ($train_no, $train) = @{$t};
-% my $tt = $train->{type} // $train->{rawType} // 'Zug';
-% $tt =~ s{ .*|[0-9]}{};
- <li><%= $tt %> <%= $train_no %>
-% if ($train->{route}{start} and $train->{route}{end}) {
- <%= $train->{route}{start} %> → <%= $train->{route}{end} %>
-% }
- </li>
+%= $pair->[0]
+% if (length($pair->[0]) > 25) {
+ <br/>
% }
+ <span class="reason">
+%= $pair->[1]{text}
+ </span>
+ </li>
+% }
+% if ($departure->{route_info}) {
+ <li><%= $departure->{route_info} %></li>
+% }
</ul>
-% }
+ </div>
% }
</div> <!-- mfooter -->