travelynx/templates/edit_journey.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

95 lines
2.8 KiB
Text

<h1>Zugfahrt bearbeiten</h1>
% if ($error and $error eq 'notfound') {
<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 {
% 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">Ungültige Eingabe</span>
<p><%= $error %></p>
</div>
</div>
</div>
</div>
% }
%= form_for '/journey/edit' => (method => 'POST') => begin
%= csrf_field
%= hidden_field 'journey_id' => param('journey_id')
<div class="row">
<div class="col s12">
<p>
Fahrt von
<b><%= $journey->{from_name} %></b>
nach
<b><%= $journey->{to_name} %></b>
am
<b><%= $journey->{sched_departure}->strftime('%d.%m.%Y') %></b>
</p>
<p>
Nach einer Änderung können die ursprünglich eingetragenen
Zeiten nicht mehr wiederhergestellt werden.
</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">Geplante Abfahrt</th>
<td>
%= text_field 'sched_departure', id => 'sched_departure', class => 'validate', required => undef, pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
</td>
</tr>
<tr>
<th scope="row">Tatsächliche Abfahrt</th>
<td>
%= text_field 'rt_departure', id => 'real_departure', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
</td>
</tr>
<tr>
<th scope="row">Geplante Ankunft</th>
<td>
%= text_field 'sched_arrival', id => 'sched_arrival', class => 'validate', required => undef, pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
</td>
</tr>
<tr>
<th scope="row">Tatsächliche Ankunft</th>
<td>
%= text_field 'rt_arrival', id => 'real_arrival', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col s6 m6 l6 center-align">
<a href="/journey/<%= param('journey_id') %>" class="waves-effect waves-light btn">
Abbrechen
</a>
</div>
<div class="col s6 m6 l6 center-align">
<button class="btn waves-effect waves-light" type="submit" name="action" value="save">
Speichern
<i class="material-icons right">send</i>
</button>
</div>
</div>
%= end
% }