summaryrefslogtreecommitdiff
path: root/templates/commute.html.ep
blob: 4e575e61977f91cfb82364c24dcfbc196ccb9f69 (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
<div class="row">
	<div class="col s12">
		<p>
			Hier werden nur Zugfahrten angezeigt, deren Start- oder Zielstation
			den angegebenen Kriterien entpricht.  Diese Daten können zum Beispiel für
			die Angaben zur Pendlerpauschale bei der Steuererklärung genutzt
			werden.
		</p>
	</div>
</div>

%= form_for '/history/commute' => begin
	<div class="row">
		<div class="input-field col s12 m12 l12">
			%= text_field 'year', id => 'year', class => 'validate', pattern => '[0-9][0-9][0-9][0-9]'
			<label for="year">Jahr</label>
		</div>
	</div>
	<div class="row">
		<div class="input-field col s12 m12 l6">
			<div>
				<label>
					%= radio_button filter_type => 'exact'
					<span>Name der Station ist:</span>
				</label>
			</div>
			<div>
				<label>
					%= radio_button filter_type => 'substring'
					<span>Name der Station enthält:</span>
				</label>
			</div>
			<div>
				<label>
					%= radio_button filter_type => 'regex'
					<span>Name der Station erfüllt den regulären Ausdruck:</span>
				</label>
			</div>
		</div>
		<div class="input-field col s12 m12 l6">
			%= text_field 'station', id => 'station', required => undef, class => 'autocomplete contrast-color-text', autocomplete => 'off'
			<label for="station">Fahrtziel</label>
		</div>
	</div>
	<div class="row">
		<div class="col s12 m12 l12 center-align">
			<button class="btn waves-effect waves-light" type="submit" name="action" value="show">
				<i class="material-icons left" aria-hidden="true">send</i>
				Anzeigen
			</button>
		</div>
	</div>
%= end

<h1><%= param('year') %></h1>
<div class="row">
	<div class="col s12 m12 l12">
		<p>
			An <b><%= $total_journeys %></b> Tagen im Jahr wurde mindestens
			eine Zugfahrt von oder zu
			% if (param('filter_type') eq 'exact') {
				der ausgewählten Station
			% }
			% else {
				den ausgewählten Stationen
			% }
			eingetragen.
		</p>
		<table class="striped">
			<thead>
				<tr>
					<th>Monat</th>
					<th>Tage mit Fahrten</th>
				</tr>
			</thead>
			<tbody>
				% for my $i (0 .. $#{$months}) {
					<tr>
						<td><%= $months->[$i] %></td>
						<td><%= $count_by_month->{$i+1} // 0 %></td>
					</tr>
				% }
			</tbody>
		</table>
	</div>
</div>

% for my $i (0 .. $#{$months}) {
	<h2><%= $months->[$i] %></h2>
	%= include '_history_trains', date_format => '%a %d.%m.', journeys => $journeys_by_month->{$i+1} // []
% }