move wagon group display to sub-template

This commit is contained in:
Daniel Friesel 2019-12-19 20:25:38 +01:00
parent e0a2b9aa26
commit 837e3a949e
2 changed files with 17 additions and 11 deletions

16
templates/_wagons.html.ep Normal file
View file

@ -0,0 +1,16 @@
% for my $wagongroup (@{$wagongroups // []}) {
Wagenverbund <%= $wagongroup->{name} %> von <b><%= $wagongroup->{from} %></b> nach <b><%= $wagongroup->{to} %></b> als <b><%= $journey->{type} %> <%= $wagongroup->{no} %></b><br/>
% for my $wagon (@{$wagongroup->{wagons}}) {
% if (length($wagon->{id}) == 12) {
<span><%= substr($wagon->{id}, 0, 2) %></span><span><%= substr($wagon->{id}, 2, 2) %></span><span><%= substr($wagon->{id}, 4, 1) %></span><span class="wagonclass"><%= substr($wagon->{id}, 5, 3) %></span><span class="wagonnum"><%= substr($wagon->{id}, 8, 3) %></span><span class="checksum"><%= substr($wagon->{id}, 11) %></span>
% }
% elsif ($wagon->{id}) {
„<%= $wagon->{id} %>“
% }
%= $wagon->{type}
% if ($wagon->{number}) {
Wagen <%= $wagon->{number} %>
% }
<br/>
% }
% }

View file

@ -192,17 +192,7 @@
<tr>
<th scope="row">Rollmaterial</th>
<td class="wagons">
% for my $wagongroup (@{$journey->{user_data}{wagongroups} // []}) {
Wagenverbund <%= $wagongroup->{name} %> von <%= $wagongroup->{from} %> nach <%= $wagongroup->{to} %> als <%= $journey->{type} %> <%= $wagongroup->{no} %><br/>
% for my $wagon (@{$wagongroup->{wagons}}) {
<span><%= substr($wagon->{id}, 0, 2) %></span><span><%= substr($wagon->{id}, 2, 2) %></span><span><%= substr($wagon->{id}, 4, 1) %></span><span class="wagonclass"><%= substr($wagon->{id}, 5, 3) %></span><span class="wagonnum"><%= substr($wagon->{id}, 8, 3) %></span><span class="checksum"><%= substr($wagon->{id}, 11) %></span>
%= $wagon->{type}
% if ($wagon->{number}) {
Wagen <%= $wagon->{number} %>
% }
<br/>
% }
% }
%= include '_wagons', wagongroups => $journey->{user_data}{wagongroups};
</td>
</tr>
% }