summaryrefslogtreecommitdiff
path: root/templates/departures.html.ep
blob: 9ab4340b010f13b2013974f77adc827b58e491f1 (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
<div class="row">
	<div class="col s12 center-align"><b>
		%= $station
	</b></div>
</div>
% my $status = $self->get_user_status;
% my $have_connections = 0;
% if ($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 <%= $status->{train_type} %> <%= $status->{train_no} %>
						ab <%= $status->{dep_name} %></p>
				</div>
				<div class="card-action">
					<a class="action-checkout" data-station="<%= $ds100 %>" data-force="1">
						Hier auschecken
					</a>
				</div>
			</div>
		</div>
	</div>
% }
% elsif ($status->{timestamp_delta} < 180) {
	<div class="row">
		<div class="col s12">
			%= include '_checked_out', journey => $status;
		</div>
	</div>
% }
% elsif (not param('train') and my @connections = get_connecting_trains(ds100 => $ds100)) {
	% $have_connections = 1;
	<div class="row">
		<div class="col s12">
			<p>Häufig genutzte Verbindungen – Zug auswählen zum Einchecken mit Zielwahl</p>
			%= include '_connections', connections => \@connections, checkin_from => $ds100;
		</div>
	</div>
% }
<div class="row">
	<div class="col s12">
		<p>
			% if ($have_connections) {
				Alle Abfahrten –
			% }
			% if (@{$results}) {
				Zug 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>
		<table class="striped">
			<tbody>
				% for my $result (@{$results}) {
					% my $td_class = '';
					% my $link_class = 'action-checkin';
					% if ($result->departure_is_cancelled) {
						% $td_class = "cancelled";
						% $link_class = 'action-cancelled-from';
					% }
					<tr>
						<td>
							<a class="<%= $link_class %>" data-station="<%= $result->station_uic %>" data-train="<%= $result->train_id %>">
								<%= $result->line %>
							</a>
						</td>
						<td class="<%= $td_class %>">
							<a class="<%= $link_class %>" data-station="<%= $result->station_uic %>" data-train="<%= $result->train_id %>">
								<%= $result->destination %>
							</a>
						</td>
						<td class="<%= $td_class %>"><%= $result->departure->strftime('%H:%M') %>
							% if ($result->departure_delay) {
								(<%= sprintf('%+d', $result->departure_delay) %>)
							% }
						</td>
					</tr>
				% }
			</tbody>
		</table>
	</div>
</div>