travelynx/templates/departures.html.ep
Daniel Friesel e168d9cd39 Use one row per journey instead of split checkin/checkout entries
Whether a user is in transit or not is now determined by an entry in the
in_transit table instead of a dangling checkin.

All completed journeys are stored in the "journeys" table.

This does most of the work needed for automatic checkout. However, note that
the corresponding worker process is not implemented yet.
2019-04-23 18:08:07 +02:00

82 lines
2.3 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="row">
<div class="col s12">
% my $status = $self->get_user_status;
% if ($status->{checked_in}) {
<div class="card grey darken-4">
<div class="card-content white-text">
<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>
% }
% elsif ($status->{timestamp_delta} < 180) {
<div class="card grey darken-4">
<div class="card-content white-text">
<span class="card-title">Ausgecheckt</span>
<p>Aus <%= $status->{train_type} %> <%= $status->{train_no} %>
bis <%= $status->{arr_name} %></p>
</div>
<div class="card-action">
<a class="action-undo" data-id="<%= $status->{journey_id} %>">
<i class="material-icons">undo</i> Rückgängig?
</a>
</div>
</div>
% }
</div>
</div>
<div class="row">
<div class="col s12">
%= $station
% 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.
% }
<br/>
<table class="striped">
<thead>
<tr>
<th>Zug</th>
<th></th>
<th>Abfahrt</th>
</tr>
</thead>
<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="<%= $ds100 %>" data-train="<%= $result->train_id %>">
<%= $result->line %>
</a>
</td>
<td class="<%= $td_class %>">
<a class="<%= $link_class %>" data-station="<%= $ds100 %>" 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>