summaryrefslogtreecommitdiff
path: root/templates/edit_journey.html.ep
blob: 69c536571de9bd2b4e8aa145a69b4cdee0c784f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<h1>Zugfahrt bearbeiten</h1>
% if ($error and $error eq 'notfound') {
	<div class="row">
		<div class="col s12">
			<div class="card caution-color">
				<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 caution-color">
					<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
					Daten nicht 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"></th>
						<td>
							<label>
								%= check_box cancelled => 1
								<span>Fahrt ist ausgefallen</span>
							</label>
						</td>
					</tr>
					<tr>
						<th scope="row">Start:</th>
						<td class="input-field">
							%= text_field 'from_name', id => 'from_name', class => 'autocomplete validate', autocomplete => 'off', required => undef
						</td>
					</tr>
					<tr>
						<th scope="row">Geplante Abfahrt</th>
						<td class="input-field">
							%= 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 class="input-field">
							%= 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">Ziel:</th>
						<td class="input-field">
							%= text_field 'to_name', id => 'to_name', class => 'autocomplete validate', autocomplete => 'off', required => undef
						</td>
					</tr>
					<tr>
						<th scope="row">Geplante Ankunft</th>
						<td class="input-field">
							%= 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 class="input-field">
							%= 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>
					<tr>
						<th scope="row">Route</th>
						<td class="input-field">
							%= text_area 'route', id => 'route', class => 'materialize-textarea'
						</td>
					</tr>
					<tr>
						<th scope="row">Kommentar</th>
						<td class="input-field">
							%= text_field 'comment'
						</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" aria-hidden="true">send</i>
				</button>
			</div>
		</div>
	%= end
% }