diff --git a/templates/_wagons.html.ep b/templates/_wagons.html.ep new file mode 100644 index 0000000..8918273 --- /dev/null +++ b/templates/_wagons.html.ep @@ -0,0 +1,16 @@ +% for my $wagongroup (@{$wagongroups // []}) { + Wagenverbund <%= $wagongroup->{name} %> von <%= $wagongroup->{from} %> nach <%= $wagongroup->{to} %> als <%= $journey->{type} %> <%= $wagongroup->{no} %>
+ % for my $wagon (@{$wagongroup->{wagons}}) { + % if (length($wagon->{id}) == 12) { + <%= substr($wagon->{id}, 0, 2) %><%= substr($wagon->{id}, 2, 2) %><%= substr($wagon->{id}, 4, 1) %><%= substr($wagon->{id}, 5, 3) %><%= substr($wagon->{id}, 8, 3) %><%= substr($wagon->{id}, 11) %> + % } + % elsif ($wagon->{id}) { + „<%= $wagon->{id} %>“ + % } + %= $wagon->{type} + % if ($wagon->{number}) { + – Wagen <%= $wagon->{number} %> + % } +
+ % } +% } diff --git a/templates/journey.html.ep b/templates/journey.html.ep index 396bc4e..74ad962 100644 --- a/templates/journey.html.ep +++ b/templates/journey.html.ep @@ -192,17 +192,7 @@ Rollmaterial - % for my $wagongroup (@{$journey->{user_data}{wagongroups} // []}) { - Wagenverbund <%= $wagongroup->{name} %> von <%= $wagongroup->{from} %> nach <%= $wagongroup->{to} %> als <%= $journey->{type} %> <%= $wagongroup->{no} %>
- % for my $wagon (@{$wagongroup->{wagons}}) { - <%= substr($wagon->{id}, 0, 2) %><%= substr($wagon->{id}, 2, 2) %><%= substr($wagon->{id}, 4, 1) %><%= substr($wagon->{id}, 5, 3) %><%= substr($wagon->{id}, 8, 3) %><%= substr($wagon->{id}, 11) %> - %= $wagon->{type} - % if ($wagon->{number}) { - – Wagen <%= $wagon->{number} %> - % } -
- % } - % } + %= include '_wagons', wagongroups => $journey->{user_data}{wagongroups}; % }