summaryrefslogtreecommitdiff
path: root/templates/_wagon.html.ep
blob: c19087ceaafd31fa8439da5a45bd0dbb26be1cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
% my $bg = '';
% my $extra_class = '';
% if ($wagon->is_first_class) {
%   $extra_class .= ' firstclass';
% }
% if ($wagon->is_locomotive or $wagon->is_powercar) {
%   $extra_class .= ' powercar';
% }
% if ($wagon->is_closed) {
%   $extra_class .= ' closed';
% }
% if ($wagon->train_no ne $train_no) {
%   $extra_class .= ' nondestwagon';
% }
  <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) {
%   }
%   elsif ($wagon->is_closed) {
      X
%   }
%   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 (not defined $wr->direction) {
%   }
%   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} %>%;">
%   if ($exit_dir ne 'right') {
%     if (my $img = wagon_image($wagon->train_subtype // $wr->train_type // '?', $wagon->type, $wagon->uic_id)) {
        <a class="type" href="/w/<%= $img %>?n=<%= $wagon->number // '' %>&amp;s=<%= $wagon->section %>&amp;r=<%= $wref %>"><%= $wagon->type %></a>
%     }
%     else {
        <span class="type">
%=        $wagon->type
        </span>
%     }
%   }
%   my $uic_id = $wagon->uic_id;
%   if (length($uic_id) != 12) {
      <span class="uicunknown"><%= $uic_id %></span>
%   }
%   elsif (substr($uic_id, 0, 2) >= 90) {
      <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>
%   }
%   if ($exit_dir eq 'right') {
%     if (my $img = wagon_image($wagon->train_subtype // $wr->train_type // '?', $wagon->type, $wagon->uic_id)) {
        <a class="type" href="/w/<%= $img %>?n=<%= $wagon->number // '' %>&amp;s=<%= $wagon->section %>&amp;r=<%= $wref %>"><%= $wagon->type %></a>
%     }
%     else {
        <span class="type">
%=        $wagon->type
        </span>
%     }
%   }
%   if ($multi and defined $wagon->group_index and (not defined $prev_gi or $wagon->group_index != $prev_gi)) {
      <br/>
      <span class="groupno">
%       if (scalar $wr->train_nos > 1) {
          <%= $wr->train_type %> <%= ($wr->groups)[$wagon->group_index]->train_no %>
%       }
%       if (scalar $wr->destinations > 1) {
          → <%= $wr->{data}{istformation}{allFahrzeuggruppe}[$wagon->group_index]{zielbetriebsstellename} %>
%       }
      </span>
      % if (scalar $wr->train_descriptions > 1 and ($wr->train_descriptions)[$wagon->group_index]{short}) {
        <span class="grouptype"><%= ($wr->train_descriptions)[$wagon->group_index]{short} %></span>
%     }
%   }
  </div>