summaryrefslogtreecommitdiff
path: root/templates/departures.html.ep
blob: 021e9ca1cd8f479caf4cc16d0abe06fe7f13430e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<div class="row">
	<div class="col s12 center-align">
		<i class="tiny material-icons "><%= param('hafas') ? 'directions' : 'train' %></i>
		<b><%= $station %></b>
		% for my $related_station (sort { $a->{name} cmp $b->{name} } @{$related_stations}) {
			<br/>+ <%= $related_station->{name} %>
		% }
	</div>
</div>
% if ($api_link) {
	<div class="row">
		<div class="col s12 center-align">
			% if (param('hafas')) {
				<a href="<%= $api_link %>">zum Schienenverkehr</a>
			% }
			% else {
				<a href="<%= $api_link %>">zum Nahverkehr</a>
			% }
		</div>
	</div>
% }
% my $have_connections = 0;
% if ($user_status->{checked_in}) {
	<div class="row">
		<div class="col s12">
			<div class="card">
				<div class="card-content">
					<span class="card-title">Aktuell eingecheckt</span>
					<p>In <%= $user_status->{train_type} %> <%= $user_status->{train_no} %>
						% if ( $user_status->{arr_name}) {
							von <%= $user_status->{dep_name} %> nach <%= $user_status->{arr_name} %>
						% }
						% else {
							ab <%= $user_status->{dep_name} %>
						% }
					</p>
				</div>
				<div class="card-action">
					% if ($can_check_out) {
						<a class="action-undo" data-id="in_transit" data-checkints="<%= $user_status->{timestamp}->epoch %>"  style="margin-right: 0;">
							<i class="material-icons left" aria-hidden="true">undo</i> Rückgängig
						</a>
						<a class="action-checkout right" data-station="<%= $eva %>" data-force="1">
							Hier auschecken
						</a>
					% }
					% else {
						<a class="action-undo" data-id="in_transit" data-checkints="<%= $user_status->{timestamp}->epoch %>"  style="margin-right: 0;">
							<i class="material-icons left" aria-hidden="true">undo</i> Rückgängig
						</a>
						<a class="action-checkout right" data-station="<%= $eva %>" data-force="1">
							<i class="material-icons left">gps_off</i>
							Hier auschecken
						</a>
					% }
				</div>
			</div>
		</div>
	</div>
% }
% elsif ($user_status->{cancellation} and $station eq $user_status->{cancellation}{dep_name}) {
	<div class="row">
		<div class="col s12">
			%= include '_cancelled_departure', journey => $user_status->{cancellation};
		</div>
	</div>
% }
% elsif ($user_status->{timestamp_delta} < 180) {
	<div class="row">
		<div class="col s12">
			%= include '_checked_out', journey => $user_status;
		</div>
	</div>
% }
% elsif (not param('train') and (@{stash('connections_iris') // []} or @{stash('connections_hafas') // []}) ) {
	% $have_connections = 1;
	<div class="row">
		<div class="col s12">
			<p>Häufig genutzte Verbindungen – Fahrt auswählen zum Einchecken mit Zielwahl</p>
			% 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;
			% }
		</div>
	</div>
% }
<div class="row">
	<div class="col s12">
		<p>
			% if ($have_connections) {
				Alle Abfahrten –
			% }
			% if ($user_status->{checked_in} and not $can_check_out) {
				Diese Station liegt nicht auf der Route deines <a href="/">aktuellen Checkins</a>.
				Falls du aktuell nicht mit <b><%= $user_status->{train_type} %> <%= $user_status->{train_no} %></b> unterwegs bist, kannst du den Checkin rückgängig machen.
				Falls es sich bei <b><%= $station %></b> um einen nicht in den Echtzeitdaten abgebildeten Zusatzhalt handelt, kannst du hier auchecken.
				Da travelynx nicht weiß, welcher der beiden Fälle zutrifft, sind bis dahin keine neuen Checkins möglich.
			% }
			% elsif ($user_status->{checked_in} and not $user_status->{arr_eva}) {
				Du bist bereits eingecheckt und hast noch kein Fahrtziel angegeben.
				Bitte <a href="/">wähle zunächst ein Ziel</a>.
				Neue Checkins sind erst nach Ankunft der aktuellen Fahrt möglich.
			% }
			% elsif ($user_status->{checked_in} and $user_status->{arrival_countdown} > 0) {
				Deine aktuelle Fahrt ist <a href="/">noch unterwegs</a>.
				Ein neuer Checkin ist erst nach Ankunft am ausgewählten Ziel möglich.
			% }
			% elsif (@{$results}) {
				Fahrt auswählen zum Einchecken.
			% }
			% else {
				Keine Abfahrten gefunden. Ein Checkin ist frühestens 30 Minuten vor
				und maximal 120 Minuten nach Abfahrt möglich.
			% }
		</p>
		% if (not $user_status->{checked_in} or ($can_check_out and $user_status->{arr_eva} and $user_status->{arrival_countdown} <= 0)) {
			% if ($hafas) {
				%= include '_departures_hafas', results => $results;
			% }
			% else {
				%= include '_departures_iris', results => $results;
			% }
		% }
	</div>
</div>