travelynx/templates/landingpage.html.ep

73 lines
2.2 KiB
Text
Raw Normal View History

2018-09-02 19:41:33 +00:00
<div class="row">
<div class="col s12">
% my $status = $self->get_user_status;
% if ($status->{checked_in}) {
<div class="card green darken-4">
<div class="card-content white-text">
<span class="card-title">Hallo, <%= $self->get_user_name %>!</span>
<p>Du bist gerade eingecheckt in
<%= $status->{train_type} %> <%= $status->{train_no} %>
2018-11-02 20:35:53 +00:00
ab <%= $status->{station_name} %>.
% if ($status->{timestamp_delta} < 3600) {
<a class="action-undo"><i class="material-icons">undo</i> Rückgängig</a>
% }
</p>
<p>Auschecken?</p>
<table>
<tbody>
2018-09-02 19:41:33 +00:00
% my $is_after = 0;
% for my $station (@{$status->{route_after}}) {
2018-10-05 14:33:59 +00:00
<tr><td><a class="action-checkout" data-station="<%= $station %>"><%= $station %></a></td></tr>
2018-09-02 19:41:33 +00:00
% }
</tbody>
</table>
2018-09-02 19:41:33 +00:00
</div>
</div>
% }
% else {
<div class="card grey darken-4">
<div class="card-content white-text">
<span class="card-title">Hallo, <%= $self->get_user_name %>!</span>
<p>Du bist gerade nicht eingecheckt.</p>
2018-10-07 09:35:47 +00:00
<p class="geolocationhint">Stationen in der Umgebung:</p>
<div class="geolocation">
<div class="progress"><div class="indeterminate"></div></div>
</div>
2018-09-02 19:41:33 +00:00
</div>
</div>
% }
</div>
</div>
<h1>Letzte Fahrten</h1>
2018-09-02 19:41:33 +00:00
<div class="row">
<table class="striped">
<thead>
<tr>
<th>Datum</th>
<th>Zug</th>
<th>Strecke</th>
<th>Dauer</th>
</tr>
</thead>
<tbody>
% for my $travel (get_user_travels(1)) {
2018-09-02 19:41:33 +00:00
% if ($travel->{completed}) {
<tr>
<td><%= $travel->{sched_departure}->strftime('%d.%m.%Y') %></td>
<td><%= $travel->{type} %> <%= $travel->{line} // $travel->{no} %></td>
<td><%= $travel->{from_name} %> → <%= $travel->{to_name} %></td>
2018-10-21 14:05:18 +00:00
% if ($travel->{rt_arrival}->epoch and $travel->{rt_departure}->epoch) {
2018-10-05 18:41:28 +00:00
<td><%= ($travel->{rt_arrival}->epoch - $travel->{rt_departure}->epoch) / 60 %> min
</td>
% } else {
2018-10-21 14:05:18 +00:00
<td><%= sprintf('%.f', $self->get_travel_distance($travel->{from_name}, $travel->{to_name}, $travel->{route})) %>km
<i class="material-icons">timer_off</i>
</td>
2018-09-02 19:41:33 +00:00
% }
</tr>
% }
% }
</tbody>
</tabel>
</div>