From de074342de0bdc3604a0610a0c5f9cce5338bb85 Mon Sep 17 00:00:00 2001
From: Birte Kristina Friesel
Date: Sun, 24 Sep 2023 18:19:17 +0200
Subject: add support for HAFAS connection suggestions; drop manual destination
list
Still TODO: handle stations that have several EVAs
---
templates/_cancelled_departure.html.ep | 2 +-
templates/_checked_in.html.ep | 14 ++++----
templates/_checked_out.html.ep | 11 +++++--
templates/_connections.html.ep | 6 ++--
templates/_connections_hafas.html.ep | 59 ++++++++++++++++++++++++++++++++++
templates/_transit_fyi.html.ep | 22 -------------
templates/account.html.ep | 2 +-
templates/departures.html.ep | 9 ++++--
templates/use_history.html.ep | 24 --------------
9 files changed, 85 insertions(+), 64 deletions(-)
create mode 100644 templates/_connections_hafas.html.ep
delete mode 100644 templates/_transit_fyi.html.ep
(limited to 'templates')
diff --git a/templates/_cancelled_departure.html.ep b/templates/_cancelled_departure.html.ep
index 2f7f60b..79492a5 100644
--- a/templates/_cancelled_departure.html.ep
+++ b/templates/_cancelled_departure.html.ep
@@ -5,7 +5,7 @@
in <%= $journey->{dep_name} %>
entfällt. Der Zugausfall auf der Fahrt nach <%= $journey->{arr_name} %> wurde bereits dokumentiert.
- % if (my @connections = @{stash('connections') // []}) {
+ % if (my @connections = @{stash('connections_iris') // []}) {
Alternative Reisemöglichkeiten:
%= include '_connections', connections => \@connections, checkin_from => $journey->{dep_eva};
% }
diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep
index f3ecda4..2300ddd 100644
--- a/templates/_checked_in.html.ep
+++ b/templates/_checked_in.html.ep
@@ -199,19 +199,17 @@
% }
- % if (my @connections = @{stash('connections') // []}) {
+ % if (@{stash('connections_iris') // [] } or @{stash('connections_hafas') // []}) {
Verbindungen
% if ($journey->{arrival_countdown} < 0) {
Fahrt auswählen zum Einchecken mit Zielwahl.
% }
- %= include '_connections', connections => \@connections, checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
- % }
- % if (my @transit_fyi = @{stash('transit_fyi') // []}) {
- Nahverkehr
- % if ($journey->{arrival_countdown} < 0) {
- Nur zur Information – kein Checkin möglich.
+ % if (@{stash('connections_iris') // [] }) {
+ %= include '_connections', connections => stash('connections_iris'), checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
+ % }
+ % if (@{stash('connections_hafas') // [] }) {
+ %= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
% }
- %= include '_transit_fyi', transit_fyi => \@transit_fyi;
% }
% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) {
diff --git a/templates/_checked_out.html.ep b/templates/_checked_out.html.ep
index 55ced95..98db660 100644
--- a/templates/_checked_out.html.ep
+++ b/templates/_checked_out.html.ep
@@ -3,10 +3,15 @@
Ausgecheckt
Aus <%= $journey->{train_type} %> <%= $journey->{train_no} %>
bis <%= $journey->{arr_name} %>
- % if (my @connections = @{stash('connections') // []}) {
+ % if (@{stash('connections_iris') // [] } or @{stash('connections_hafas') // []}) {
Verbindungen
- Zug auswählen zum Einchecken mit Zielwahl.
- %= include '_connections', connections => \@connections, checkin_from => $journey->{arr_eva};
+ Fahrt auswählen zum Einchecken mit Zielwahl.
+ % if (@{stash('connections_iris') // [] }) {
+ %= include '_connections', connections => stash('connections_iris'), checkin_from => $journey->{arr_eva};
+ % }
+ % if (@{stash('connections_hafas') // [] }) {
+ %= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $journey->{arr_eva};
+ % }
% }
diff --git a/templates/_connections.html.ep b/templates/_connections.html.ep
index e4f1872..98be766 100644
--- a/templates/_connections.html.ep
+++ b/templates/_connections.html.ep
@@ -9,7 +9,7 @@
% $link_class = 'action-cancelled-from';
% }
% if ($checkin_from) {
-
+
% }
% else {
@@ -33,10 +33,10 @@
% if ($checkin_from) {
- <%= $via %>
+ <%= $via->{name} %>
% }
% else {
- %= $via
+ %= $via->{name}
% }
% if ($load) {
diff --git a/templates/_connections_hafas.html.ep b/templates/_connections_hafas.html.ep
new file mode 100644
index 0000000..9322116
--- /dev/null
+++ b/templates/_connections_hafas.html.ep
@@ -0,0 +1,59 @@
+
+ % for my $res (@{$connections}) {
+ % my ($train, $via, $via_arr) = @{$res};
+ % $via_arr = $via_arr ? $via_arr->strftime('%H:%M') : q{};
+ % my $td_class = '';
+ % my $link_class = 'action-checkin';
+ % if ($train->is_cancelled) {
+ % $td_class = 'cancelled';
+ % $link_class = 'action-cancelled-from';
+ % }
+ % if ($checkin_from) {
+
+ % }
+ % else {
+
+ % }
+
+ % if ($train->platform) {
+ % if ($checkin_from) {
+ Gleis <%= $train->platform %>
+ % }
+ % else {
+ Gleis <%= $train->platform %>
+ % }
+
+ % }
+ % if ($checkin_from) {
+ <%= $train->line %>
+ % }
+ % else {
+ %= $train->line
+ % }
+
+
+ % if ($checkin_from) {
+ <%= $via->{name} %>
+ % }
+ % else {
+ %= $via->{name}
+ % }
+
+
+ % if ($train->is_cancelled) {
+ %= $train->sched_datetime->strftime('%H:%M')
+ ⊖
+ % }
+ % else {
+ %= $train->datetime->strftime('%H:%M')
+ % }
+ % if ($via_arr) {
+ → <%= $via_arr %>
+ % }
+ % if ($train->delay) {
+ %= sprintf('(%+d)', $train->delay)
+ % }
+
+
+ % }
+
diff --git a/templates/_transit_fyi.html.ep b/templates/_transit_fyi.html.ep
deleted file mode 100644
index 5951e7d..0000000
--- a/templates/_transit_fyi.html.ep
+++ /dev/null
@@ -1,22 +0,0 @@
-
- % for my $res (@{$transit_fyi}) {
- % my ($info, $via, $via_arr) = @{$res};
- % $via_arr = $via_arr ? $via_arr->strftime('%H:%M') : q{};
-
-
- %= $info->{line}
-
-
- %= $via
-
-
- %= $info->{departure}->strftime('%H:%M')
- →
- %= $via_arr
- % if ($info->{departure_delay}) {
- %= sprintf('(%+d)', $info->{departure_delay})
- % }
-
-
- % }
-
diff --git a/templates/account.html.ep b/templates/account.html.ep
index fac5817..7f689c2 100644
--- a/templates/account.html.ep
+++ b/templates/account.html.ep
@@ -67,7 +67,7 @@
Verbindungen
edit
- % if ($use_history & 0x07) {
+ % if ($use_history & 0x03) {
Vorschläge aktiv
% }
% else {
diff --git a/templates/departures.html.ep b/templates/departures.html.ep
index 3a2516f..021e9ca 100644
--- a/templates/departures.html.ep
+++ b/templates/departures.html.ep
@@ -72,12 +72,17 @@
% }
-% elsif (not param('train') and my @connections = @{stash('connections') // []}) {
+% elsif (not param('train') and (@{stash('connections_iris') // []} or @{stash('connections_hafas') // []}) ) {
% $have_connections = 1;
Häufig genutzte Verbindungen – Fahrt auswählen zum Einchecken mit Zielwahl
- %= include '_connections', connections => \@connections, checkin_from => $eva;
+ % if (@{stash('connections_iris') // []}) {
+ %= include '_connections', connections => stash('connections_iris'), checkin_from => $eva;
+ % }
+ % if (@{stash('connections_hafas') // []}) {
+ %= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $eva;
+ % }
% }
diff --git a/templates/use_history.html.ep b/templates/use_history.html.ep
index e90f17f..9b76e98 100644
--- a/templates/use_history.html.ep
+++ b/templates/use_history.html.ep
@@ -47,30 +47,6 @@
ohne Umweg über die Abfahrtstafel möglich.
-
-
-
- %= check_box local_transit => 1
- Nahverkehr
-
-
-
-
-
- Zeige beim Reisestatus zusätzlich Anschlussmöglichkeiten an den
- Nahverkehr. Diese dienen lediglich zur Information; ein Checkin ist
- nicht möglich. Es werden nur Anschlussmöglichkeiten zu Zielen
- angezeigt, die im folgenden Feld gelistet sind (ein Ziel pro
- Zeile, z.B. „Eichlinghofen H-Bahn, Dortmund“). Falls travelynx in
- Zukunft eine Möglichkeit für Checkins in Nahverkehrsmittel erhält,
- wird diese Liste ggf. gelöscht.
-
-
-
-
- %= text_area 'destinations', id => 'destinations', class => 'materialize-textarea'
-
-