mirror of
https://github.com/derf/travelynx
synced 2024-12-11 13:33:00 +00:00
bba6721754
Provides a workaround for #2
164 lines
4.5 KiB
Text
164 lines
4.5 KiB
Text
% if ($error) {
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<div class="card red darken-4">
|
||
<div class="card-content white-text">
|
||
<span class="card-title">Fehler</span>
|
||
<p>Zugfahrt nicht gefunden.</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
% }
|
||
% else {
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<p>
|
||
% if ($journey->{cancelled}) {
|
||
Ausgefallene Fahrt von
|
||
% }
|
||
% else {
|
||
Fahrt von
|
||
% }
|
||
<b><%= $journey->{from_name} %></b>
|
||
nach
|
||
<b><%= $journey->{to_name} %></b>
|
||
am
|
||
<b><%= $journey->{sched_departure}->strftime('%d.%m.%Y') %></b>
|
||
</p>
|
||
% if ($journey->{edited}) {
|
||
<p>
|
||
∗ Daten wurden manuell eingetragen
|
||
</p>
|
||
% }
|
||
<table class="striped">
|
||
<tr>
|
||
<th scope="row">Zug</th>
|
||
<td>
|
||
<%= $journey->{type} %> <%= $journey->{no} %>
|
||
% if ($journey->{line}) {
|
||
(Linie <%= $journey->{line} %>)
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Abfahrt</th>
|
||
<td>
|
||
% if ($journey->{cancelled}) {
|
||
<i class="material-icons">cancel</i>
|
||
(Plan: <%= $journey->{sched_departure}->strftime('%H:%M'); %>)
|
||
% }
|
||
% elsif ($journey->{rt_departure} != $journey->{sched_departure}) {
|
||
%= $journey->{rt_departure}->strftime('%H:%M');
|
||
(<%= sprintf('%+d', ($journey->{rt_departure}->epoch - $journey->{sched_departure}->epoch) / 60) %>,
|
||
Plan: <%= $journey->{sched_departure}->strftime('%H:%M'); %>)
|
||
% }
|
||
% else {
|
||
%= $journey->{sched_departure}->strftime('%H:%M');
|
||
% }
|
||
% if ($journey->{edited} & 0x0003) {
|
||
∗
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Ankunft</th>
|
||
<td>
|
||
% if ($journey->{cancelled}) {
|
||
<i class="material-icons">cancel</i>
|
||
% if ($journey->{sched_arrival}->epoch != 0) {
|
||
(Plan: <%= $journey->{sched_arrival}->strftime('%H:%M'); %>)
|
||
% }
|
||
% }
|
||
% elsif ($journey->{rt_arrival}->epoch == 0 and $journey->{sched_arrival}->epoch == 0) {
|
||
<i class="material-icons">timer_off</i>
|
||
% }
|
||
% elsif ($journey->{rt_arrival} != $journey->{sched_arrival}) {
|
||
%= $journey->{rt_arrival}->strftime('%H:%M');
|
||
(<%= sprintf('%+d', ($journey->{rt_arrival}->epoch - $journey->{sched_arrival}->epoch) / 60) %>,
|
||
Plan: <%= $journey->{sched_arrival}->strftime('%H:%M'); %>)
|
||
% }
|
||
% else {
|
||
%= $journey->{sched_arrival}->strftime('%H:%M');
|
||
% }
|
||
% if ($journey->{edited} & 0x0300) {
|
||
∗
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Entfernung</th>
|
||
<td>
|
||
% if ($journey->{km_route} > 0.1) {
|
||
ca. <%= sprintf('%.f', $journey->{km_route}) %> km
|
||
% }
|
||
(Luftlinie: <%= sprintf('%.f', $journey->{km_beeline}) %> km)
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Geschwindigkeit</th>
|
||
<td>
|
||
∅ <%= sprintf('%.f', $journey->{kmh_route}) %> km/h
|
||
(<%= sprintf('%.f', $journey->{kmh_beeline}) %> km/h)
|
||
% if ($journey->{edited} & 0x0303) {
|
||
∗
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Meldungen</th>
|
||
<td>
|
||
% for my $message (@{$journey->{messages} // []}) {
|
||
% my ($ts, $msg) = @{$message};
|
||
<%= $ts->strftime('%d.%m.%Y %H:%M') %> : <%= $msg %><br/>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Route</th>
|
||
<td>
|
||
% my $within = 0;
|
||
% my $at_startstop = 0;
|
||
% for my $station (@{$journey->{route}}) {
|
||
% if ($station eq $journey->{from_name}) {
|
||
% $within = 1; $at_startstop = 1;
|
||
% }
|
||
% elsif ($station eq $journey->{to_name}) {
|
||
% $within = 0; $at_startstop = 1;
|
||
% }
|
||
% else {
|
||
% $at_startstop = 0;
|
||
% }
|
||
% if ($at_startstop or $within) {
|
||
<%= $station %>
|
||
% }
|
||
% else {
|
||
<span style="color: #666666;"><%= $station %></span>
|
||
% }
|
||
<br/>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
<div class="col s6 m6 l6 center-align">
|
||
<a class="waves-effect waves-light red btn action-delete"
|
||
data-id="<%= join(q{,}, @{$journey->{ids}}) %>"
|
||
data-checkin="<%= $journey->{checkin}->epoch %>"
|
||
data-checkout="<%= $journey->{checkout}->epoch %>">
|
||
<i class="material-icons left">delete_forever</i>
|
||
Löschen
|
||
</a>
|
||
</div>
|
||
<div class="col s6 m6 l6 center-align">
|
||
%= form_for '/journey/edit' => (method => 'POST') => begin
|
||
%= hidden_field 'journey_id' => param('journey_id')
|
||
<button class="btn waves-effect waves-light" type="submit" name="action" value="edit">
|
||
Bearbeiten
|
||
</button>
|
||
%= end
|
||
</div>
|
||
</div>
|
||
% }
|