From 6594d74edd87b350d2c9f1e510429a040cd402b1 Mon Sep 17 00:00:00 2001
From: Daniel Friesel
Date: Sat, 12 Nov 2022 11:10:58 +0100
Subject: [PATCH] show expected utilization alongsie train route
---
lib/Travelynx.pm | 15 +++++++++++++++
sass/src/common/index.scss | 3 +++
templates/_checked_in.html.ep | 28 ++++++++++++++++++++--------
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
@@ -466,6 +466,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}}) {
<%= $station->[0] %>
+
+ % if ($station->[1]{load}{SECOND}) {
+ % my ($first, $second) = load_icon($station->[1]{load});
+ <%= $first %> <%= $second %>
+ % }
% if ($station->[2] and $station->[2] eq 'cancelled') {
- entfällt
+ entfällt
% }
% elsif ($station->[1]{rt_arr}) {
- <%= $station->[1]{rt_arr}->strftime('%H:%M') %>
+ <%= $station->[1]{rt_arr}->strftime('%H:%M') %>
% }
% elsif ($station->[1]{sched_arr}) {
- <%= $station->[1]{sched_arr}->strftime('%H:%M') %>
+ <%= $station->[1]{sched_arr}->strftime('%H:%M') %>
% }
% elsif ($station->[2] and $station->[2] eq 'additional') {
- Zusatzhalt
+ Zusatzhalt
% }
+
% }
@@ -328,18 +334,24 @@
% my $is_dest = ($journey->{arr_name} and $station->[0] eq $journey->{arr_name});
<%= $station->[0] %>
+
+ % if ($station->[1]{load}{SECOND}) {
+ % my ($first, $second) = load_icon($station->[1]{load});
+ <%= $first %> <%= $second %>
+ % }
% if ($station->[2] and $station->[2] eq 'cancelled') {
- entfällt
+ entfällt
% }
% elsif ($station->[1]{rt_arr}) {
- <%= $station->[1]{rt_arr}->strftime('%H:%M') %>
+ <%= $station->[1]{rt_arr}->strftime('%H:%M') %>
% }
% elsif ($station->[1]{sched_arr}) {
- <%= $station->[1]{sched_arr}->strftime('%H:%M') %>
+ <%= $station->[1]{sched_arr}->strftime('%H:%M') %>
% }
% elsif ($station->[2] and $station->[2] eq 'additional') {
- Zusatzhalt
+ Zusatzhalt
% }
+
% if ($user->{sb_template}) {
train