diff options
Diffstat (limited to 'templates/journey.html.ep')
| -rw-r--r-- | templates/journey.html.ep | 245 |
1 files changed, 156 insertions, 89 deletions
diff --git a/templates/journey.html.ep b/templates/journey.html.ep index 45a1598..09ad76d 100644 --- a/templates/journey.html.ep +++ b/templates/journey.html.ep @@ -3,8 +3,8 @@ <div class="col s12"> <div class="card caution-color"> <div class="card-content white-text"> - <span class="card-title">Fehler</span> - <p>Fahrt nicht gefunden.</p> + <span class="card-title"><%= L('header.error') %></span> + <p><%= L('journey.not-found') %></p> </div> </div> </div> @@ -15,29 +15,17 @@ <div class="col s12"> <p> % if (my $name = stash('username')) { - <b><a href="/p/<%= $name %>"><%= $name %></a></b>s + Checkin von <b><a href="/p/<%= $name %>"><%= $name %></a></b> % } - % if ($journey->{cancelled}) { - Ausgefallene Fahrt + % elsif ($journey->{cancelled}) { + <b>Ausgefallene Fahrt</b> vom <%= $journey->{checkin}->strftime('%d.%m.%Y um %H:%M Uhr') %> % } % else { - Fahrt + Checkin vom <%= $journey->{checkin}->strftime('%d.%m.%Y um %H:%M Uhr') %> % } % if ($journey->{edited} & 0x0020) { ∗ % } - von - <b><%= $journey->{from_name} %></b> - % if ($journey->{edited} & 0x0004) { - ∗ - % } - nach - <b><%= $journey->{to_name} %></b> - % if ($journey->{edited} & 0x0400) { - ∗ - % } - am - <b><%= $journey->{sched_departure}->strftime('%d.%m.%Y') %></b> % if (my $v = stash('journey_visibility')) { % if (stash('username')) { <i class="material-icons right"><%= visibility_icon($v) %></i> @@ -67,9 +55,9 @@ %= end </div> % } - <table class="striped"> + <table class="striped journey"> <tr> - <th scope="row">Fahrt</th> + <th scope="row"><%= L('journey.trip') %></th> <td> <%= $journey->{type} %> <%= $journey->{no} %> % if ($journey->{line}) { @@ -78,19 +66,48 @@ </td> </tr> <tr> - <th scope="row">Abfahrt</th> + <th scope="row"><%= L('journey.from') %></th> + <td> + %= $journey->{from_name} + % if ($journey->{from_platform} and $journey->{to_platform}) { + (<%= $journey->{from_platform} %>) + % } + % if ($journey->{edited} & 0x0004) { + ∗ + % } + </td> + </tr> + <tr> + <th scope="row"><%= L('journey.to') %></th> + <td> + <%= $journey->{to_name} %> + % if ($journey->{from_platform} and $journey->{to_platform}) { + (<%= $journey->{to_platform} %>) + % } + % if ($journey->{edited} & 0x0400) { + ∗ + % } + </td> + </tr> + <tr> + <th scope="row"><%= L('journey.departure') %></th> <td> % if ($journey->{cancelled}) { <i class="material-icons">cancel</i> - (Plan: <%= $journey->{sched_departure}->strftime('%H:%M'); %>) + (Plan: <%= $journey->{sched_departure}->strftime('%d.%m.%Y %H:%M'); %>) % } - % elsif ($journey->{rt_departure} != $journey->{sched_departure}) { - %= ($journey->{rt_departure}->epoch % 60) ? $journey->{rt_departure}->strftime('%H:%M:%S') : $journey->{rt_departure}->strftime('%H:%M'); - (<%= sprintf('%+d', ($journey->{rt_departure}->epoch - $journey->{sched_departure}->epoch) / 60) %>, - Plan: <%= ($journey->{sched_departure}->epoch % 60) ? $journey->{sched_departure}->strftime('%H:%M:%S') : $journey->{sched_departure}->strftime('%H:%M'); %>) + % elsif ($journey->{delay_dep}) { + %= ($journey->{rt_departure}->epoch % 60) ? $journey->{rt_departure}->strftime('%d.%m.%Y %H:%M:%S') : $journey->{rt_departure}->strftime('%d.%m.%Y %H:%M') + % if (int(abs($journey->{delay_dep}) / 60)) { + (<%= sprintf('%+d', ($journey->{rt_departure}->epoch - $journey->{sched_departure}->epoch) / 60) %>, Plan: + % } + % else { + (Plan: + % } + %= ($journey->{sched_departure}->epoch % 60) ? $journey->{sched_departure}->strftime('%H:%M:%S)') : $journey->{sched_departure}->strftime('%H:%M)') % } % else { - %= ($journey->{sched_departure}->epoch % 60) ? $journey->{sched_departure}->strftime('%H:%M:%S') : $journey->{sched_departure}->strftime('%H:%M'); + %= ($journey->{sched_departure}->epoch % 60) ? $journey->{sched_departure}->strftime('%d.%m.%Y %H:%M:%S') : $journey->{sched_departure}->strftime('%d.%m.%Y %H:%M'); % } % if ($journey->{edited} & 0x0003) { ∗ @@ -98,24 +115,29 @@ </td> </tr> <tr> - <th scope="row">Ankunft</th> + <th scope="row"><%= L('journey.arrival') %></th> <td> % if ($journey->{cancelled}) { <i class="material-icons">cancel</i> % if ($journey->{sched_arrival}->epoch != 0) { - (Plan: <%= $journey->{sched_arrival}->strftime('%H:%M'); %>) + (Plan: <%= $journey->{sched_arrival}->strftime('%d.%m.%Y %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}->epoch % 60) ? $journey->{rt_arrival}->strftime('%H:%M:%S') : $journey->{rt_arrival}->strftime('%H:%M'); - (<%= sprintf('%+d', ($journey->{rt_arrival}->epoch - $journey->{sched_arrival}->epoch) / 60) %>, - Plan: <%= ($journey->{sched_arrival}->epoch % 60) ? $journey->{sched_arrival}->strftime('%H:%M:%S') : $journey->{sched_arrival}->strftime('%H:%M'); %>) + % elsif ($journey->{delay_arr}) { + %= ($journey->{rt_arrival}->epoch % 60) ? $journey->{rt_arrival}->strftime('%d.%m.%Y %H:%M:%S') : $journey->{rt_arrival}->strftime('%d.%m.%Y %H:%M') + % if (int(abs($journey->{delay_arr}) / 60)) { + (<%= sprintf('%+d', ($journey->{rt_arrival}->epoch - $journey->{sched_arrival}->epoch) / 60) %>, Plan: + % } + % else { + (Plan: + % } + %= ($journey->{sched_arrival}->epoch % 60) ? $journey->{sched_arrival}->strftime('%H:%M:%S)') : $journey->{sched_arrival}->strftime('%H:%M)') % } % else { - %= ($journey->{sched_arrival}->epoch % 60) ? $journey->{sched_arrival}->strftime('%H:%M:%S') : $journey->{sched_arrival}->strftime('%H:%M'); + %= ($journey->{sched_arrival}->epoch % 60) ? $journey->{sched_arrival}->strftime('%d.%m.%Y %H:%M:%S') : $journey->{sched_arrival}->strftime('%d.%m.%Y %H:%M'); % } % if ($journey->{edited} & 0x0300) { ∗ @@ -123,7 +145,7 @@ </td> </tr> <tr> - <th scope="row">Strecke</th> + <th scope="row"><%= L('journey.distance') %></th> <td> % if ($journey->{skip_route}) { <i class="material-icons right">location_off</i> @@ -131,10 +153,10 @@ % } % if ($journey->{km_route} > 0.1) { ca. <%= sprintf_km($journey->{km_route}) %> - (Luftlinie: <%= sprintf_km($journey->{km_beeline}) %>) + <%= L('journey.beeline.pre') %><%= sprintf_km($journey->{km_beeline}) %><%= L('journey.beeline.post') %> % } % elsif ($journey->{km_beeline} > 0.1) { - (Luftlinie: <%= sprintf_km($journey->{km_beeline}) %>) + <%= L('journey.beeline.pre') %><%= sprintf_km($journey->{km_beeline}) %><%= L('journey.beeline.post') %> % } % else { ? @@ -145,7 +167,7 @@ </td> </tr> <tr> - <th scope="row">Tempo</th> + <th scope="row"><%= L('journey.speed') %></th> <td> % if ($journey->{skip_route}) { <i class="material-icons right">location_off</i> @@ -168,7 +190,7 @@ </tr> % if ($journey->{user_data}{operator} or scalar @{ $journey->{user_data}{operators} // [] }) { <tr> - <th scope="row">Betrieb</th> + <th scope="row"><%= L('journey.operator') %></th> <td> %= $journey->{user_data}{operator} // join(q{, }, @{$journey->{user_data}{operators}}) </td> @@ -176,7 +198,7 @@ % } % if ($journey->{messages} and @{$journey->{messages}}) { <tr> - <th scope="row">Meldungen</th> + <th scope="row"><%= L('journey.messages') %></th> <td> % for my $message (@{$journey->{messages} // []}) { % my ($ts, $msg) = @{$message}; @@ -187,7 +209,7 @@ % } % if ($journey->{user_data}{him_msg} and @{$journey->{user_data}{him_msg}}) { <tr> - <th scope="row">Meldungen</th> + <th scope="row"><%= L('journey.messages') %></th> <td> % for my $message (@{$journey->{user_data}{him_msg} // []}) { <i class="material-icons tiny"><%= ($message->{prio} and $message->{prio} eq 'HOCH') ? 'warning' : 'info' %></i> <%= $message->{header} %> <%= $message->{lead} %><br/> @@ -197,7 +219,7 @@ % } % if ($journey->{user_data} and $journey->{user_data}{comment}) { <tr> - <th scope="row">Kommentar</th> + <th scope="row"><%= L('journey.comment') %></th> <td> <%= $journey->{user_data}{comment} %> </td> @@ -205,7 +227,7 @@ % } % if ($journey->{user_data} and $journey->{user_data}{wagongroups} and not exists $journey->{user_data}{wagons}) { <tr> - <th scope="row">Rollmaterial</th> + <th scope="row"><%= L('journey.carriages') %></th> <td class="wagons"> %= include '_wagons', wagongroups => $journey->{user_data}{wagongroups}; </td> @@ -213,7 +235,7 @@ % } % elsif ($journey->{user_data} and $journey->{user_data}{wagons}) { <tr> - <th scope="row">Rollmaterial</th> + <th scope="row"><%= L('journey.carriages') %></th> <td class="wagons"> % for my $wagongroup (@{$journey->{user_data}{wagongroups} // []}) { Wagenverbund <%= $wagongroup %><br/> @@ -230,16 +252,17 @@ </tr> % } <tr> - <th scope="row">Route</th> - <td> + <th scope="row"><%= L('journey.route') %></th> + <td class="route"> % my $before = 1; % my $within = 0; % my $at_startstop = 0; + % my $i = 0; % for my $station (@{$journey->{route}}) { - % if (($station->[1] and $station->[1] == $journey->{from_eva}) or $station->[0] eq $journey->{from_name}) { + % if ($i == $journey->{route_dep_index}) { % $within = 1; $at_startstop = 1; % } - % elsif (($station->[1] and $station->[1] == $journey->{to_eva}) or $station->[0] eq $journey->{to_name}) { + % elsif ($i == $journey->{route_arr_index}) { % $within = 0; $at_startstop = 1; % } % else { @@ -247,10 +270,10 @@ % } <span style="color: #808080;"> % if ($before and $station->[2]{sched_dep}) { - %= $station->[2]{sched_dep}->strftime('%H:%M') + %= $station->[2]{sched_dep_dt}->strftime('%H:%M') % } % elsif (not $before and $station->[2]{sched_arr}) { - %= $station->[2]{sched_arr}->strftime('%H:%M') + %= $station->[2]{sched_arr_dt}->strftime('%H:%M') % } </span> % if ($at_startstop or $within) { @@ -259,6 +282,12 @@ % else { <span style="color: #808080;"><%= $station->[0] %></span> % } + % if ($station->[2]{isAdditional}) { + <span style="color: #808080;">⊕</span> + % } + % elsif ($station->[2]{isCancelled}) { + <span style="color: #808080;">∅</span> + % } % if ($journey->{edited} & 0x0010) { ∗ % } @@ -276,6 +305,7 @@ % $before = 0; % } <br/> + % $i += 1; % } </td> </tr> @@ -293,62 +323,99 @@ </div> </div> % if (not stash('readonly')) { - % if (stash('with_share')) { - <div class="row"> - <div class="col s12 m6 l6"> - </div> - <div class="col s12 m6 l6 center-align"> + <div class="row"> + <div class="col s12 m6 l4 center-align"> + <a class="btn waves-effect waves-light" href="<%= url_for('journey', id => $journey->{id}, format => 'json' ) %>"> + <i class="material-icons left" aria-hidden="true">file_download</i> + %= L('journey.export') + </a> + </div> + <div class="col s12 m6 l4 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"> + <i class="material-icons left" aria-hidden="true">edit</i> + %= L('journey.edit') + </button> + %= end + </div> + <div class="col s12 m6 l4 center-align"> + % if (stash('with_share')) { <a class="btn waves-effect waves-light action-share" % if (stash('journey_visibility') eq 'public') { data-url="<%= url_for('public_journey', name => current_user()->{name}, id => $journey->{id} )->to_abs->scheme('https'); %>" % } % else { - data-url="<%= url_for('public_journey', name => current_user()->{name}, id => $journey->{id} )->to_abs->scheme('https'); %>?token=<%= $journey->{from_eva} %>-<%= $journey->{checkin_ts} % 337 %>-<%= $journey->{sched_dep_ts} %>" + data-url="<%= url_for('public_journey', name => current_user()->{name}, id => $journey->{id} )->to_abs->scheme('https'); %>?token=<%= $journey->{from_eva} %>-<%= $journey->{checkin_ts} % 337 %>-<%= int($journey->{sched_dep_ts}) %>" % } data-text="<%= stash('share_text') %>" > - <i class="material-icons left" aria-hidden="true">share</i> Teilen + <i class="material-icons left" aria-hidden="true">share</i> + %= L('journey.share') </a> - </div> - </div> - % } - <div class="row hide-on-small-only"> - <div class="col s12 m6 l6 center-align"> - <a class="waves-effect waves-light red btn action-delete" - data-id="<%= $journey->{id} %>" - 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 s12 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"> - <i class="material-icons left" aria-hidden="true">edit</i> - Bearbeiten - </button> - %= end + % } </div> </div> - <div class="row hide-on-med-and-up"> - <div class="col s12 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"> - <i class="material-icons left" aria-hidden="true">edit</i> - Bearbeiten - </button> - %= end + % if ($journey->{polyline} or $journey->{km_route} > 0.1) { + <h2><%= L('journey.map-data') %> + % if ($journey->{edited} & 0x0040) { + ∗ + % } + </h2> + <div class="row"> + <div class="col s12 m6 l6 center-align"> + <a class="btn waves-effect waves-light" href="<%= url_for('polyline_download', id => $journey->{id}, format => 'json' ) %>"> + <i class="material-icons left" aria-label="<%= L('journey.map.download') %>">file_download</i> + JSON + </a> + </div> + <div class="col s12 m6 l6 center-align"> + <a class="btn waves-effect waves-light" href="<%= url_for('polyline_download', id => $journey->{id}, format => 'gpx' ) %>"> + <i class="material-icons left" aria-label="<%= L('journey.map.download') %>">file_download</i> + GPX + </a> + </div> </div> - <div class="col s12 m6 l6 center-align" style="margin-top: 1em;"> + <div class="row"> + <div class="col s12"> + %= L('journey.map.info.download') + %= L('journey.map.info.upload') + </div> + </div> + %= form_for '/polyline/set' => (method => 'post', enctype => 'multipart/form-data') => begin + %= csrf_field + %= hidden_field id => $journey->{id} + <div class="row"> + <div class="col s12"> + <div class="file-field input-field"> + <div class="btn"> + <span><i class="material-icons left" aria-label="<%= L('journey.map.upload') %>">file_upload</i> GPX</span> + <input type="file"> + </div> + <div class="file-path-wrapper"> + <input class="file-path validate" type="text" name="file"> + </div> + %= file_field 'file' + </div> + </div> + <div class="col s12 m6 center-align"> + %= submit_button L('journey.map.upload-full'), class => 'waves-effect waves-light btn', name => 'upload-full' + </div> + <div class="col s12 m6 center-align"> + %= submit_button L('journey.map.upload-partial'), class => 'waves-effect waves-light btn', name => 'upload-partial' + </div> + </div> + %= end + % } + <h2><%= L('journey.danger') %></h2> + <div class="row"> + <div class="col s12 m12 l12 center-align" style="margin-top: 1em;"> <a class="waves-effect waves-light red btn action-delete" data-id="<%= $journey->{id} %>" data-checkin="<%= $journey->{checkin}->epoch %>" data-checkout="<%= $journey->{checkout}->epoch %>"> <i class="material-icons left" aria-hidden="true">delete_forever</i> - Löschen + %= L('journey.delete') </a> </div> </div> |
