diff options
Diffstat (limited to 'templates/_train_details.html.ep')
-rw-r--r-- | templates/_train_details.html.ep | 390 |
1 files changed, 314 insertions, 76 deletions
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep index 548d2c8..2c18da2 100644 --- a/templates/_train_details.html.ep +++ b/templates/_train_details.html.ep @@ -2,12 +2,10 @@ <div> % if ($departure->{train_no} or $departure->{train_line}) { <span class="train-line <%= $linetype %>"><%= $departure->{train_type} %> - <%= $departure->{train_line} // $departure->{train_no} %></span> + %= $departure->{train_line} // $departure->{train_no} + </span> <span class="train-no"><%= $departure->{train_line} ? $departure->{train_no} : q{} %></span> % } -% else { - <span class="train-line"><%= $departure->{train} // q{???} %></span> -% } </div> <div> % if ($departure->{origin}) { @@ -16,91 +14,189 @@ % } <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> <!-- mheader --> + <div class="mfooter"> + <div class="dataline"> + <div> + <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} %> % } - </div> -% } +% elsif ($departure->{arrival_is_cancelled}) { + <span class="minfo">Beginnt hier</span><br/>Plan: <%= $departure->{sched_arrival} %> +% } +% elsif ($departure->{arrival}) { +% if ($departure->{arrival} ne $departure->{sched_arrival}) { + % if (($departure->{arrival_delay} // 0) < 0) { + An: <span class="undelay"><%= $departure->{arrival} %></span> + % } + % else { + An: <span class="minfo"><%= $departure->{arrival} %></span> + % } + <br/>Plan: <%= $departure->{sched_arrival} %> +% } +% else { + An: <%= $departure->{arrival} %> +% } +% } +% elsif ($departure->{sched_arrival}) { + An: <%= $departure->{sched_arrival} %> +% } +% elsif ($departure->{prep_time}) { + Ein: <%= $departure->{prep_time} %> +% } +% if ($departure->{tz_offset} and $departure->{local_sched_arr}) { + <br/>Lokal: <%= $departure->{local_sched_arr}->strftime('%H:%M') %> +% } + </div> + </div> + <div> + <div class="platform"> % if (@{$departure->{replaced_by}}) { % for my $replacement (@{$departure->{replaced_by}}) { - <span class="replaced">Ersatzzug: <%= $replacement %></span> + <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">Ersatzzug für <%= $replacement %></span> + <span class="replacement">Ersatzfahrt für <a href="/z/<%= $replacement %>/<%= stash('station_name') // q{} %>"><%= $replacement %></a></span><br/> % } % } - </div> <!-- mheader --> - <div class="mfooter"> - <div class="platforminfo"> -% if ($departure->{scheduled_platform} or $departure->{platform}) { - Gleis <%= $departure->{scheduled_platform} // $departure->{platform} %> +% if ($departure->{arrival_is_cancelled} and $departure->{departure_is_cancelled}) { + <span class="minfo">Fahrt fällt aus</span> +% } +% else { +% my $left = ''; +% my $right = ''; +% if ($departure->{wr_direction} and $departure->{wr_direction} =~ m{l}) { +% $left = '◀ '; +% } +% elsif ($departure->{wr_direction} and $departure->{wr_direction} =~ m{r}) { +% $right = ' ▶'; +% } +% if ($departure->{scheduled_platform} and $departure->{platform} +% and $departure->{scheduled_platform} ne $departure->{platform}) { + <span class="minfo"><%= $left %>Gleis <%= $departure->{platform} %><%= $right %></span> +% } +% elsif ($departure->{scheduled_platform} or $departure->{platform}) { + <%= $left %>Gleis <%= $departure->{platform} // $departure->{scheduled_platform} %><%= $right %> +% } % } -% if ($departure->{scheduled_platform} and $departure->{platform} -% and $departure->{scheduled_platform} ne $departure->{platform}) { - (heute Gleis <%= $departure->{platform} %>) +% if ($departure->{arrival_hidden} and not $departure->{prep_time}) { + <br/><span class="timehidden">Nur Einstieg</span> % } -% elsif ($departure->{changed_platform}) { - (Gleiswechsel) +% if ($departure->{departure_hidden}) { + <br/><span class="timehidden">Nur Ausstieg</span> % } - </div> <!-- platforminfo --> -% my ($arr_time, $dep_time); -% if ($departure->{sched_arrival}) { -% $arr_time = $departure->{sched_arrival}; -% if ($departure->{arrival} and $departure->{arrival} ne $departure->{sched_arrival}) { -% $arr_time .= ' (heute ' . $departure->{arrival} . ')'; + </div> + </div> + <div> + <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} %> % } -% } -% if ($departure->{sched_departure}) { -% $dep_time = $departure->{sched_departure}; -% if ($departure->{departure} and $departure->{departure} ne $departure->{sched_departure}) { -% $dep_time .= ' (heute ' . $departure->{departure} . ')'; +% elsif ($departure->{departure_is_cancelled}) { + <span class="minfo">Endet hier</span><br/>Plan: <%= $departure->{sched_departure} %> % } -% } -% if (not $departure->{is_cancelled}) { - <div class="timeinfo"> -% if ($departure->{sched_arrival}) { - Ankunft: <%= $arr_time %><br/> +% elsif ($departure->{departure}) { +% if ($departure->{departure} ne $departure->{sched_departure}) { + Ab: <span class="minfo"><%= $departure->{departure} %></span> + <br/>Plan: <%= $departure->{sched_departure} %> +% } +% else { + Ab: <%= $departure->{departure} %> +% } +% } +% elsif ($departure->{sched_departure}) { + Ab: <%= $departure->{sched_departure} %> % } -% if ($departure->{sched_departure}) { - Abfahrt: <%= $dep_time %><br/> +% if ($departure->{tz_offset} and $departure->{local_sched_dep}) { + <br/>Lokal: <%= $departure->{local_sched_dep}->strftime('%H:%M') %> +% } + </div> + </div> + </div> <!-- dataline --> +% if (my $wr = $departure->{wr}) { + <div class="wagonorder-preview"> +% my $left = defined $wr->direction ? $wr->direction == 100 ? q{} : '←' : q{}; +% my $right = defined $wr->direction ? $wr->direction == 100 ? '→' : q{} : q{}; +% if ($departure->{wr_direction} and $departure->{wr_direction} =~ m{l}) { +% $left = '◀'; +% $right = q{}; % } -% if (not ($departure->{sched_arrival} or $departure->{sched_departure})) { - Abfahrt: <%= $departure->{time} %> -% if ($departure->{delay}) { - (heute +<%= $departure->{delay} %>) +% elsif ($departure->{wr_direction} and $departure->{wr_direction} =~ m{r}) { +% $left = q{}; +% $right = '▶'; +% } + <a href="/carriage-formation?<%= $departure->{wr_link} %>&e=<%= $departure->{wr_direction} // '' %>"> + %= $left + % for my $entry ((defined $departure->{wr_direction_num} and $departure->{wr_direction_num} != $wr->direction) ? reverse @{$departure->{wr_preview} // []} : @{$departure->{wr_preview} // []}) { + % if ($entry->[1]) { + <span class="<%= $entry->[1] %>"><%= $entry->[0] %></span> + % } + % else { + %= $entry->[0] + % } + % } + %= $right + </a> + </div> +% } + <div class="verbose"> +% if ($departure->{trip_id}) { +% if (stash('station_name')) { + <a class="smallbutton" href="/map/<%= $departure->{trip_id} =~ s{#}{%23}gr %>/<%= $departure->{train_line} || 0 %>?from=<%= stash('station_name') %>&dbris=<%= param('dbris') %>&efa=<%= param('efa') // q{} %>&hafas=<%= param('hafas') // q{} %>"><i class="material-icons" aria-hidden="true">map</i> Karte</a> % } +% else { + <a class="smallbutton" href="/map/<%= $departure->{trip_id} =~ s{#}{%23}gr %>/<%= $departure->{train_line} || 0 %>?dbris=<%= param('dbris') %>&efa=<%= param('efa') // q{} %>&hafas=<%= param('hafas') // q{} %>"><i class="material-icons" aria-hidden="true">map</i> Karte</a> +% } +% } +% if ($departure->{wr_link}) { + <a class="smallbutton" href="/carriage-formation?<%= $departure->{wr_link} %>&e=<%= $departure->{wr_direction} // '' %>"><i class="material-icons" aria-hidden="true">train</i> <%= $departure->{wr_text} || 'Wagen' %> + </a> +% } +% if ($departure->{trip_id} and param('dbris') and param('dbris') eq 'bahn.de') { + <a class="smallbutton" href="https://bahn.expert/details/x/h/<%= Mojo::Util::url_escape( $departure->{trip_id} ) %>"><img src="/static/icons/bahn-expert.svg">Details</a> +% } elsif ($departure->{train_type} and $departure->{train_no} and (not param('hafas') or param('hafas') eq 'DB')) { + <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> % } - </div> <!-- timeinfo --> -% if ($departure->{wr_link} or ($icetype and $icetype->[1] and $departure->{train_type} ne 'Bus')) { +% for my $link (@{$departure->{links}}) { + <a class="smallbutton" href="<%= $link->[1] %>"><i class="material-icons" aria-hidden="true">warning</i> <%= $link->[0] %></a> +% } + </div> + +% if (not $departure->{departure_is_cancelled}) { +% if (my $u = $departure->{utilization}) { <div class="verbose"> -% if ($departure->{wr_link}) { - <a href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>">Wagenreihung</a> -% } -% if ($icetype and $icetype->[1]) { - (Plan: <%= $icetype->[0] %>)<br/> -% } +% my ($text, $icon1, $icon2) = utilization_icon($u); + <%= $text %><span style="padding-right: 0.5em;">.</span> 1. <i class="material-icons" aria-hidden="true" style="padding-right: 0.5em; vertical-align: bottom;"><%= $icon1 %></i> 2. <i class="material-icons" aria-hidden="true" style="vertical-align: bottom;"><%= $icon2 %></i> </div> % } -% if ($departure->{trip_id}) { +% elsif (my $o = $departure->{occupancy}) { <div class="verbose"> - <a href="/map/<%= $departure->{trip_id} %>/<%= $departure->{train_line} // 0 %>?from=<%= $station_name %>">Karte</a> +% my ($text, $icon) = occupancy_icon($o); + <%= $text %><span style="padding-right: 0.5em;">.</span> <i class="material-icons" aria-hidden="true" style="padding-right: 0.5em; vertical-align: bottom;"><%= $icon %></i></i> </div> % } - % } +% +% if ($departure->{missing_realtime}) { + <div class="verbose"> + <i class="material-icons no-realtime" aria-hidden="true" style="padding-right: 0.5em; vertical-align: bottom;">gps_off</i> Echtzeitdaten fehlen. Ob die Zugfahrt wie im Fahrplan vorgesehen stattfindet, ist nicht bekannt. + </div> +% } +% elsif ($departure->{no_realtime_yet}) { + <div class="verbose"> + <i class="material-icons" aria-hidden="true" style="padding-right: 0.5em; vertical-align: bottom;">gps_off</i> Für diese Zugfahrt sind derzeit nur Fahrplandaten bekannt. + </div> +% } + % 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') @@ -108,13 +204,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}) { @@ -123,11 +228,33 @@ </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> - <a href="/<%= $stop->{name} %>#<%= $departure->{train_type} . $departure->{train_no} %>" class=" +% if ($stop->{is_annotated} and $stop->{prod_name}) { + <li class="annotation"> +% if ($stop->{prod_name}) { +%= $stop->{prod_name} +% } +% if ($stop->{direction}) { + → <%= $stop->{direction} %> +% } +% if ($stop->{operator}) { + (<%= $stop->{operator} %>) +% } + </li> +% } + <li class="<%= $stop->{isPast} ? 'past-stop' : 'future-stop' %>"> + <a href="<%= url_for('station', station => $stop->{eva} // $stop->{name})->query({detailed => param('detailed'), past => param('past'), rt => param('rt'), dbris => param('dbris'), efa => param('efa'), hafas => param('hafas')}) %>#<%= ((param('dbris') or param('hafas')) and $departure->{trip_id}) ? ($departure->{trip_id} =~ s{[ #|]}{x}gr) : (($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x})) %>" class=" % if ($stop->{isAdditional}) { additional-stop % } @@ -140,18 +267,89 @@ % 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})) { + "><span class="time-sched-only"><%= ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') %></span> <span class="time-delayed"><%= ($stop->{rt_dep} // $stop->{rt_arr})->strftime('%H:%M') %></span> +% } +% elsif (($stop->{rt_dep} and defined $stop->{dep_delay}) or (not $stop->{rt_dep} and $stop->{rt_arr} and defined $stop->{arr_delay})) { + "><span class="time-sched-ontime"><%= ($stop->{sched_dep} // $stop->{sched_arr}) ? ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') : q{} %></span> % } % else { - "><%= $stop->{sched_dep} ? $stop->{sched_dep}->strftime('%H:%M') : q{} %> <%= $stop->{name} %></a> + "><span class="time-sched"><%= ($stop->{sched_dep} // $stop->{sched_arr}) ? ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') : q{} %></span> +% } +% if ($stop->{tz_offset} and $stop->{local_dt_da}) { + (lokal <%= $stop->{local_dt_da}->strftime('%H:%M') %>) +% } + <%= $stop->{name} %></a> +% if ($stop->{load}{FIRST} or $stop->{load}{SECOND}) { +% my ($text, $icon1, $icon2) = utilization_icon([$stop->{load}{FIRST}, $stop->{load}{SECOND}]); + % if ($icon1 ne 'help_outline') { + <i class="material-icons" aria-hidden="true"><%= $icon1 %></i> + % } + <i class="material-icons" aria-hidden="true"><%= $icon2 %></i> +% } + </li> +% } +% if (stash('station_name')) { +% if ($departure->{is_annotated} and $departure->{prod_name}) { + <li class="annotation"> +% if ($departure->{prod_name}) { +%= $departure->{prod_name} +% } +% if ($departure->{direction}) { + → <%= $departure->{direction} %> +% } +% if ($departure->{operator}) { + (<%= $departure->{operator} %>) +% } + </li> % } + <li class="<%= $departure->{is_cancelled} ? 'cancelled-stop' : q{} %> <%= $departure->{isPast} ? 'past-stop' : 'future-stop' %>"> +% if ($departure->{departure} and $departure->{sched_departure} and $departure->{departure} ne $departure->{sched_departure}) { + <span class="time-sched-only"><%= $departure->{sched_departure} // $departure->{sched_arrival} // q{} %></span><span class="time-delayed"> +% } +% elsif ($departure->{departure} and $departure->{sched_departure} and $departure->{departure} eq $departure->{sched_departure} and not $departure->{no_realtime_yet}) { + <span class="time-sched-ontime"> +% } +% elsif ($departure->{arrival} and $departure->{sched_arrival} and $departure->{arrival} ne $departure->{sched_arrival}) { + <span class="time-sched-only"><%= $departure->{sched_departure} // $departure->{sched_arrival} // q{} %></span><span class="time-delayed"> +% } +% elsif ($departure->{arrival} and $departure->{sched_arrival} and $departure->{arrival} eq $departure->{sched_arrival} and not $departure->{no_realtime_yet}) { + <span class="time-sched-ontime"> +% } +% else { + <span class="time-sched"> +% } +%= $departure->{departure} // $departure->{arrival} // $departure->{sched_departure} // $departure->{sched_arrival} // q{} + </span> +% if ($departure->{tz_offset} and $departure->{local_dt_da}) { + (lokal <%= $departure->{local_dt_da}->strftime('%H:%M') %>) +% } + <strong><%= stash('station_name') %></strong> +% if (my $u = $departure->{utilization}) { +% my ($text, $icon1, $icon2) = utilization_icon($u); + % if ($icon1 ne 'help_outline') { + <i class="material-icons" aria-hidden="true"><%= $icon1 %></i> + % } + <i class="material-icons" aria-hidden="true"><%= $icon2 %></i> +% } </li> % } - <li class="<%= $departure->{is_cancelled} ? 'cancelled-stop' : q{} %>"><%= $dep_time // $arr_time // q{} %> <strong><%= $station_name %></strong></li> % for my $stop (@{$departure->{route_post_diff}}) { - <li> - <a href="/<%= $stop->{name} %>#<%= $departure->{train_type} . $departure->{train_no} %>" class=" +% if ($stop->{is_annotated} and $stop->{prod_name}) { + <li class="annotation"> +% if ($stop->{prod_name}) { +%= $stop->{prod_name} +% } +% if ($stop->{direction}) { + → <%= $stop->{direction} %> +% } +% if ($stop->{operator}) { + (<%= $stop->{operator} %>) +% } + </li> +% } + <li class="<%= $stop->{isPast} ? 'past-stop' : 'future-stop' %>"> + <a href="<%= url_for('station', station => $stop->{eva} // $stop->{name})->query({detailed => param('detailed'), past => param('past'), rt => param('rt'), dbris => param('dbris'), efa => param('efa'), hafas => param('hafas')}) %>#<%= ((param('dbris') or param('hafas')) and $departure->{trip_id}) ? ($departure->{trip_id} =~ s{[ #|]}{x}gr) : (($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x})) %>" class=" % if ($stop->{isAdditional}) { additional-stop % } @@ -164,14 +362,54 @@ % 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})) { + "><span class="time-sched-only"><%= ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') %></span> <span class="time-delayed"><%= ($stop->{rt_arr} // $stop->{rt_dep})->strftime('%H:%M') %></span> +% } +% elsif (($stop->{rt_arr} and defined $stop->{arr_delay}) or (not $stop->{rt_arr} and $stop->{rt_dep} and defined $stop->{dep_delay})) { + "><span class="time-sched-ontime"><%= ($stop->{sched_arr} // $stop->{sched_dep}) ? ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') : q{} %></span> % } % else { - "><%= $stop->{sched_arr} ? $stop->{sched_arr}->strftime('%H:%M') : q{} %> <%= $stop->{name} %></a> + "><span class="time-sched"><%= ($stop->{sched_arr} // $stop->{sched_dep}) ? ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') : q{} %></span> +% } +% if ($stop->{tz_offset} and $stop->{local_dt_ad}) { + (lokal <%= $stop->{local_dt_ad}->strftime('%H:%M') %>) +% } + <%= $stop->{name} %></a> +% if ($stop->{load}{FIRST} or $stop->{load}{SECOND}) { +% my ($text, $icon1, $icon2) = utilization_icon([$stop->{load}{FIRST}, $stop->{load}{SECOND}]); + % if ($icon1 ne 'help_outline') { + <i class="material-icons" aria-hidden="true"><%= $icon1 %></i> + % } + <i class="material-icons" aria-hidden="true"><%= $icon2 %></i> % } </li> % } </ul> <!-- mroute --> % } +% if ($departure->{operators} and @{$departure->{operators} // []}) { + <div class="details">Betrieb: <%= join(q{, }, @{ $departure->{operators} // [] } ) %></div> +% } +% if ($departure->{details} and @{$departure->{details}}) { + <div class="details">Details: + <ul> +% for my $pair (@{$departure->{details}}) { + <li> +% 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> + </li> +% } +% if ($departure->{route_info}) { + <li><%= $departure->{route_info} %></li> +% } + </ul> + </div> +% } </div> <!-- mfooter --> |