diff options
Diffstat (limited to 'templates/wagenreihung.html.ep')
-rw-r--r-- | templates/wagenreihung.html.ep | 152 |
1 files changed, 34 insertions, 118 deletions
diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep index 2167204..19c49ab 100644 --- a/templates/wagenreihung.html.ep +++ b/templates/wagenreihung.html.ep @@ -1,141 +1,57 @@ -% if ($wr->errstr) { +% if (not $wr or $wr_error) { <div class="container"> <div class="error"> <strong>Fehler bei der Abfrage der Wagenreihung:</strong> - <%= $wr->errstr %> + <%= $wr_error // 'Unbekannter Fehler' %> </div> </div> % } % else { - % my $has_multi_dest = 0; - % if (scalar $wr->destinations > 1) { - % $has_multi_dest = 1; - % } <div class="container"> <div style="text-align: center;"> -%= join( ' / ', $wr->origins ) - → -%= join( ' / ', map { $_->{name} } $wr->destinations ) + Gleis <%= $wr->platform %><br/> </div> - % if ($has_multi_dest) { - <div style="text-align: center;"> - % for my $destination ($wr->destinations) { - Nach <%= $destination->{name} %> in Abschnitt <%= join(q{}, sort @{$destination->{sections} // []}) %><br/> - % } - </div> - % } - <%= $wr->station_name %> Gleis <%= $wr->platform %><br/> - % if ($wr->train_type =~ m{^IC|EC}) { - Zugtyp: <%= $wr->train_subtype // 'IC?' %> - % } - % elsif ($wr->train_powertype) { - %= $wr->train_type - % } - % my %translation = ( - % 90 => 'mit sonstigem Antrieb', - % 91 => 'mit elektrischer Lokomotive', - % 92 => 'mit Diesellokomotive', - % 93 => 'Hochgeschwindigkeitszug', - % 94 => 'Elektrischer Triebzug', - % 95 => 'Diesel-Triebzug', - % 96 => 'mit speziellen Beiwagen', - % 97 => 'mit elektrischer Rangierlok', - % 98 => 'mit Diesel-Rangierlok', - % 99 => 'Sonderfahrzeug', - % ); - % if (not $wr->train_powertype) { - % } - % else { - %= $translation{$wr->train_powertype}; - % } - </div> </div> <div class="container"> - <div class="wagonorder"> -% if (not $wr->has_bad_wagons) { -% for my $section ($wr->sections) { - <div class="section" style=" - top: <%= $section->{start_percent} %>%; bottom: <%= 100 - $section->{end_percent} %>%;"> -%= $section->{name} - </div> -% } + <div class="wagonorder exit-<%= stash('exit_dir') // 'unknown'%>"> +% for my $sector ($wr->sectors) { + <div class="section" style=" + top: <%= $sector->start_percent %>%; bottom: <%= 100 - $sector->end_percent %>%;"> +%= $sector->name + </div> % } -% for my $wagon ($wr->wagons) { -% my $bg = ''; -% my $extra_class = ''; -% if ($wagon->is_first_class) { -% $bg = 'background-color: #ffff99;'; -% } -% if ($wagon->is_locomotive or $wagon->is_powercar) { -% $bg = 'background-color: #cccccc;'; -% } -% if ($wagon->train_no ne $train_no) { -% $extra_class .= ' nondestwagon'; +% for my $group ($wr->groups) { +% my $first = 1; +% for my $wagon ($group->carriages) { +%= include '_wagon', wr => $wr, group => $group, wagon => $wagon, first => $first, multi => (scalar $wr->destinations) - 1 + (scalar $wr->train_numbers) - 1, wref => $wref, exit_dir => stash('exit_dir'), train_no => param('number'); +% $first = 0; % } - <div class="wagon <%= $extra_class %>" style=" - top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%; <%= $bg %>"> -% if ($wagon->is_locomotive or $wagon->is_powercar) { -% } -% else { -%= $wagon->number // '?' -% if ($wagon->has_accessibility) { - <i class="material-icons" style="font-size: 20px;">accessible</i> -% } -% if ($wagon->has_bistro) { - <i class="material-icons">restaurant</i> -% } -% if ($wagon->has_compartments) { - <!--<i class="material-icons">folder</i>--> -% } -% if ($wagon->has_quiet_area) { - <i class="tiny material-icons">volume_off</i> -% } -% if ($wagon->has_phone_area) { - <i class="material-icons">smartphone</i> -% } -% if ($wagon->has_family_area) { - <i class="material-icons">people</i> -% } -% if ($wagon->has_bahn_comfort) { - <i class="material-icons">star</i> -% } -% } - <div class="direction"> -% if ($wr->has_bad_wagons) { -% } -% elsif ($wr->direction == 100) { - <i class="material-icons">arrow_downward</i> -% } -% else { - <i class="material-icons">arrow_upward</i> -% } - </div> - </div> - <div class="details" style=" - top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;"> - <span class="type"> -%= $wagon->type - </span> -% my $uic_id = $wagon->uic_id; -% if (length($uic_id) != 12) { - <span class="uicunknown"><%= $uic_id %></span> -% } -% elsif ($wr->train_type eq 'ICE') { - <span class="uicexchange"><%= substr($uic_id, 0, 2) %></span><span class="uiccountry"><%= substr($uic_id, 2, 2) %></span><span class="uic5"><%= substr($uic_id, 4, 1) %></span><span class="uictype"><%= substr($uic_id, 5, 3) %></span><span class="uicno"><%= substr($uic_id, 8, 3) %></span><span class="uiccheck"><%= substr($uic_id, 11) %></span> -% } -% else { - <span class="uicexchange"><%= substr($uic_id, 0, 2) %></span><span class="uiccountry"><%= substr($uic_id, 2, 2) %></span><span class="uic56"><%= substr($uic_id, 4, 2) %></span><span class="uic78"><%= substr($uic_id, 6, 2) %></span><span class="uicno"><%= substr($uic_id, 8, 3) %></span><span class="uiccheck"><%= substr($uic_id, 11) %></span> -% } - </div> % } </div> + % for my $group ($wr->groups) { + % if ($group->description) { + <div style="text-align: center;"> + %= $group->description + % if ($group->designation) { + „<%= $group->designation %>“ + % } + % if (scalar $wr->groups > 1 and $group->has_sectors) { + in Abschnitt <%= join(q{}, sort $group->sectors) %> + % } + </div> + % } + % } + <div style="text-align: center;"> + nach +%= join( ' / ', map { $_->{name} } $wr->destinations ) + </div> <!-- <div> Legende: ♿ Behindertengerechte Ausstattung / 🍴 Bistro/Restaurant / 🚪 Abteile vorhanden </div> --> - <div> - Angaben ohne Gewähr – Echtzeitdaten sind möglicherweise nicht berücksichtigt. - </div> + <p class="copyright"> + Quelle: DB Wagenreihungs-API (<%= stash('ts') // q{} %>). Angaben ohne Gewähr. + </p> </div> % } |