summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-11-12 11:10:58 +0100
committerDaniel Friesel <derf@finalrewind.org>2022-11-12 11:10:58 +0100
commit6594d74edd87b350d2c9f1e510429a040cd402b1 (patch)
treec8d301354da13f15dc079a6991e4724b861afe65
parentc92b6bc9492d1d2cd8147354885d0a89f0fbfdb9 (diff)
show expected utilization alongsie train route
-rwxr-xr-xlib/Travelynx.pm15
-rw-r--r--sass/src/common/index.scss3
-rw-r--r--templates/_checked_in.html.ep28
3 files changed, 38 insertions, 8 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index d04171e..d473fd2 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -467,6 +467,21 @@ sub startup {
);
$self->helper(
+ 'load_icon' => sub {
+ my ( $self, $load ) = @_;
+ my $first = $load->{FIRST} // 0;
+ my $second = $load->{SECOND} // 0;
+
+ my @symbols
+ = (
+ qw(help_outline person_outline people priority_high not_interested)
+ );
+
+ return ( $symbols[$first], $symbols[$second] );
+ }
+ );
+
+ $self->helper(
'checkin' => sub {
my ( $self, %opt ) = @_;
diff --git a/sass/src/common/index.scss b/sass/src/common/index.scss
index 6f8282f..89e1b7b 100644
--- a/sass/src/common/index.scss
+++ b/sass/src/common/index.scss
@@ -43,6 +43,9 @@ a.tablerow {
span {
display: inline-block;
}
+ .material-icons {
+ margin-bottom: 0.2em;
+ }
}
.pagination {
diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep
index 761849d..d2439ee 100644
--- a/templates/_checked_in.html.ep
+++ b/templates/_checked_in.html.ep
@@ -219,18 +219,24 @@
% for my $station (@{$journey->{route_after}}) {
<a class="tablerow action-checkout" data-station="<%= $station->[0] %>">
<span><%= $station->[0] %></span>
+ <span>
+ % if ($station->[1]{load}{SECOND}) {
+ % my ($first, $second) = load_icon($station->[1]{load});
+ <i class="material-icons tiny" aria-hidden="true" style="padding-right: 0.5em; vertical-align: bottom;"><%= $first %></i> <i class="material-icons tiny" aria-hidden="true" style="vertical-align: bottom;"><%= $second %></i>
+ % }
% if ($station->[2] and $station->[2] eq 'cancelled') {
- <span>entfällt</span>
+ entfällt
% }
% elsif ($station->[1]{rt_arr}) {
- <span><%= $station->[1]{rt_arr}->strftime('%H:%M') %></span>
+ <%= $station->[1]{rt_arr}->strftime('%H:%M') %>
% }
% elsif ($station->[1]{sched_arr}) {
- <span><%= $station->[1]{sched_arr}->strftime('%H:%M') %></span>
+ <%= $station->[1]{sched_arr}->strftime('%H:%M') %>
% }
% elsif ($station->[2] and $station->[2] eq 'additional') {
- <span>Zusatzhalt</span>
+ Zusatzhalt
% }
+ </span>
</a>
% }
</p>
@@ -328,18 +334,24 @@
% my $is_dest = ($journey->{arr_name} and $station->[0] eq $journey->{arr_name});
<a class="action-checkout tablerow" style="<%= $is_dest? 'font-weight: bold;' : '' %>" data-station="<%= $station->[0] %>">
<span><%= $station->[0] %></span>
+ <span>
+ % if ($station->[1]{load}{SECOND}) {
+ % my ($first, $second) = load_icon($station->[1]{load});
+ <i class="material-icons tiny" aria-hidden="true" style="padding-right: 0.5em; vertical-align: bottom;"><%= $first %></i> <i class="material-icons tiny" aria-hidden="true" style="vertical-align: bottom;"><%= $second %></i>
+ % }
% if ($station->[2] and $station->[2] eq 'cancelled') {
- <span>entfällt</span>
+ entfällt
% }
% elsif ($station->[1]{rt_arr}) {
- <span><%= $station->[1]{rt_arr}->strftime('%H:%M') %></span>
+ <%= $station->[1]{rt_arr}->strftime('%H:%M') %>
% }
% elsif ($station->[1]{sched_arr}) {
- <span><%= $station->[1]{sched_arr}->strftime('%H:%M') %></span>
+ <%= $station->[1]{sched_arr}->strftime('%H:%M') %>
% }
% elsif ($station->[2] and $station->[2] eq 'additional') {
- <span>Zusatzhalt</span>
+ Zusatzhalt
% }
+ </span>
</a>
% if ($user->{sb_template}) {
<a class="nonflex" href="<%= resolve_sb_template($user->{sb_template}, name => $station->[0], eva => $station->[1]{eva}, tt => $journey->{train_type} // q{x}, tn => $journey->{train_no}, id => $journey->{train_id}) %>"><i class="material-icons tiny">train</i></a>