summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-10-29 16:01:30 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-10-29 16:01:30 +0200
commitd08f50909c185dd5c764bfdb0f2241a405c47b31 (patch)
treeadb9561b07a8628adb0b329f50d6d80384618f01
parentcc76d03925b18cacc91c8f0f86cc39b6f42bf3b8 (diff)
train details: show per-stop utilization
-rw-r--r--sass/app.scss4
-rw-r--r--templates/_train_details.html.ep35
2 files changed, 29 insertions, 10 deletions
diff --git a/sass/app.scss b/sass/app.scss
index 1d4f5e9..a1f2d32 100644
--- a/sass/app.scss
+++ b/sass/app.scss
@@ -584,6 +584,10 @@ div.app {
.future-stop {
list-style-type: circle;
}
+
+ i.material-icons {
+ font-size: 14px;
+ }
}
.db-attr {
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep
index d3815fe..9a440ef 100644
--- a/templates/_train_details.html.ep
+++ b/templates/_train_details.html.ep
@@ -215,14 +215,19 @@
generic-stop
% }
% if (($stop->{rt_dep} and $stop->{dep_delay}) or (not $stop->{rt_dep} and $stop->{rt_arr} and $stop->{arr_delay})) {
- "><%= ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') %> (heute <%= ($stop->{rt_dep} // $stop->{rt_arr})->strftime('%H:%M') %>) <%= $stop->{name} %></a>
+ "><%= ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') %> (heute <%= ($stop->{rt_dep} // $stop->{rt_arr})->strftime('%H:%M') %>)
% }
% else {
"><%= ($stop->{sched_dep} // $stop->{sched_arr}) ? ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') : q{} %>
-% if ($stop->{rt_bogus}) {
- <i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
-% }
- <%= $stop->{name} %></a>
+% if ($stop->{rt_bogus}) {
+ <i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
+% }
+% }
+ <%= $stop->{name} %></a>
+% if ($stop->{load}{FIRST} or $stop->{load}{SECOND}) {
+% my ($text, $icon1, $icon2) = utilization_icon([$stop->{load}{FIRST}, $stop->{load}{SECOND}]);
+ <i class="material-icons" aria-hidden="true"><%= $icon1 %></i>
+ <i class="material-icons" aria-hidden="true"><%= $icon2 %></i>
% }
</li>
% }
@@ -242,6 +247,11 @@
<i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
% }
<strong><%= stash('station_name') %></strong>
+% if (my $u = $departure->{utilization}) {
+% my ($text, $icon1, $icon2) = utilization_icon($u);
+ <i class="material-icons" aria-hidden="true"><%= $icon1 %></i>
+ <i class="material-icons" aria-hidden="true"><%= $icon2 %></i>
+% }
</li>
% }
% for my $stop (@{$departure->{route_post_diff}}) {
@@ -260,14 +270,19 @@
generic-stop
% }
% if (($stop->{rt_arr} and $stop->{arr_delay}) or (not $stop->{rt_arr} and $stop->{rt_dep} and $stop->{dep_delay})) {
- "><%= ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') %> (heute <%= ($stop->{rt_arr} // $stop->{rt_dep})->strftime('%H:%M') %>) <%= $stop->{name} %></a>
+ "><%= ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') %> (heute <%= ($stop->{rt_arr} // $stop->{rt_dep})->strftime('%H:%M') %>)
% }
% else {
"><%= ($stop->{sched_arr} // $stop->{sched_dep}) ? ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') : q{} %>
-% if ($stop->{rt_bogus}) {
- <i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
-% }
- <%= $stop->{name} %></a>
+% if ($stop->{rt_bogus}) {
+ <i class="material-icons" aria-label="Echtzeitdaten fehlen">gps_off</i>
+% }
+% }
+ <%= $stop->{name} %></a>
+% if ($stop->{load}{FIRST} or $stop->{load}{SECOND}) {
+% my ($text, $icon1, $icon2) = utilization_icon([$stop->{load}{FIRST}, $stop->{load}{SECOND}]);
+ <i class="material-icons" aria-hidden="true"><%= $icon1 %></i>
+ <i class="material-icons" aria-hidden="true"><%= $icon2 %></i>
% }
</li>
% }