summaryrefslogtreecommitdiff
path: root/templates/_checked_in.html.ep
blob: ebe84e869564d1cb10cfa14fdc4c443165d43bf8 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<div class="card autorefresh">
	<div class="card-content">
		<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
		<span class="card-title">Eingecheckt in <%= $journey->{train_type} %> <%= $journey->{train_no} %></span>
		<p>
			<div class="center-align countdown"
				data-duration="<%= $journey->{journey_duration} // 0 %>"
				data-arrival="<%= $journey->{real_arrival}->epoch %>">
				% if ($journey->{departure_countdown} > 120) {
					Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten
					<br/>von Gleis <%= $journey->{dep_platform} %>
				% }
				% elsif ($journey->{departure_countdown} > 60) {
					Abfahrt in einer Minute
					<br/>von Gleis <%= $journey->{dep_platform} %>
				% }
				% elsif ($journey->{departure_countdown} > 0) {
					Abfahrt in weniger als einer Minute
					<br/>von Gleis <%= $journey->{dep_platform} %>
				% }
				% elsif (defined $journey->{arrival_countdown}) {
					% if ($journey->{arrival_countdown} > 60) {
						Ankunft in <%= sprintf('%.f', $journey->{arrival_countdown} / 60) %>
						Minute<%= sprintf('%.f', $journey->{arrival_countdown} / 60) == 1 ? '' : 'n' %>
					% }
					% elsif ($journey->{arrival_countdown} > 0) {
						Ankunft in weniger als einer Minute
					% }
					% else {
						Ziel erreicht
					% }
					% if ($journey->{arrival_countdown} < (60 * 15)) {
						<br/>auf Gleis <%= $journey->{arr_platform} %>
					% }
				% }
				% elsif ($journey->{arr_name}) {
					Ankunft in mehr als zwei Stunden
				% }
			</div>
			<div class="progress" style="height: 1ex;">
				<div class="determinate" style="width: <%= sprintf('%.2f', 100 * ($journey->{journey_completion} // 0)); %>%;"></div>
			</div>
		</p>
		% if ($journey->{arr_name}) {
			<p>
				<div style="float: left;">
					<b><%= $journey->{dep_name} %></b><br/>
					<b><%= $journey->{real_departure}->strftime('%H:%M') %></b>
					% if ($journey->{real_departure}->epoch != $journey->{sched_departure}->epoch) {
						(<%= sprintf('%+d', ($journey->{real_departure}->epoch - $journey->{sched_departure}->epoch)/60) %>)
					% }
				</div>
				<div style="float: right; text-align: right;">
					<b><%= $journey->{arr_name} %></b><br/>
					% if ($journey->{real_arrival}->epoch) {
						<b><%= $journey->{real_arrival}->strftime('%H:%M') %></b>
						% if ($journey->{real_arrival}->epoch != $journey->{sched_arrival}->epoch) {
							(<%= sprintf('%+d', ($journey->{real_arrival}->epoch - $journey->{sched_arrival}->epoch)/60) %>)
						% }
					% }
					% else {
						noch nicht bekannt
					% }
				</div>
				<div style="clear: both;">
				</div>
			</p>
		% }
		% if (@{$journey->{messages} // []} > 0 and $journey->{messages}[0]) {
			<p style="margin-bottom: 2ex;">
				<ul>
					% for my $message (reverse @{$journey->{messages} // []}) {
						% if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) {
							<li> <i class="material-icons tiny">warning</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li>
						% }
					% }
				</ul>
			</p>
		% }
		% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} < (20*60)) {
			% if (my @connections = get_connecting_trains()) {
				<span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
				% if ($journey->{arrival_countdown} < 0) {
					<p>Zug auswählen zum Einchecken mit Zielwahl.</p>
				% }
				%= include '_connections', connections => \@connections, checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_ds100} : undef;
			% }
		% }
		% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) {
			<p style="margin-top: 2ex;">
				Der automatische Checkout erfolgt in wenigen Minuten. Zum Umsteigen:
				Aktuelle Station erneut in der Liste auswählen. Zum Weiterfahren im
				aktuellen Zug: Neues Ziel wählen.
			</p>
		% }
		% elsif ($journey->{arr_name}) {
			<p style="margin-top: 2em;">Ziel ändern?</p>
		% }
		% else {
			<p>Ziel wählen:</p>
		% }
		<table>
			<tbody>
				% my $is_after = 0;
				% for my $station (@{$journey->{route_after}}) {
					% if ($journey->{arr_name} and $station eq $journey->{arr_name}) {
						<tr><td><b><a class="action-checkout" data-station="<%= $station %>"><%= $station %></a></b></td></tr>
					% }
					% else {
						<tr><td><a class="action-checkout" data-station="<%= $station %>"><%= $station %></a></td></tr>
					% }
				% }
			</tbody>
		</table>
		% if ($journey->{arr_name}) {
			<p>
				Falls das Backend ausgefallen ist oder der Zug aus anderen
				Gründen verloren ging: <a class="action-checkout"
				data-force="1" data-station="<%= $journey->{arr_name}
				%>">Ohne Echtzeitdaten in <%= $journey->{arr_name} %>
				auschecken</a>.
			</p>
		% }
	</div>
	<div class="card-action">
		<a class="action-undo blue-text" data-id="in_transit">
			<i class="material-icons left">undo</i> Rückgängig
		</a>
		% if ($journey->{arr_name}) {
			% my $attrib = 'im';
			% if ($journey->{train_type} =~ m{ ^ (?: S | RB ) $ }x) {
				% $attrib = 'in der';
			% }
			<a class="action-share blue-text right"
				data-text="Ich bin gerade <%= $attrib %> <%= $journey->{train_type} %> <%= $journey->{train_no} %> nach <%= $journey->{arr_name} %> #NowTräwelling #dbl"
				% if (current_user()->{is_public} & 0x02) {
					data-url="<%= url_for('/status')->to_abs->scheme('https') %>/<%= current_user->{name} %>"
				% }
				>
				<i class="material-icons left">share</i> Teilen
			</a>
		% }
	</div>
</div>