aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base/admin/stats.html
blob: 5aaf59068e338a8069dd51476f38ad5abd25dd56 (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
[% INCLUDE 'admin/header.html' title=loc('Stats') %]

[% IF show_count %]
<p>
<strong>[% tprintf( unconfirmed ? loc( 'All reports between %s and %s' ) : loc( 'Confirmed reports between %s and %s' ), start_date.ymd, end_date.ymd ) | html %]</strong>
</p>
[% IF bymonth %]
<table>
    <thead>
        <td style="width: 8em"><strong>[% loc('Year') %]</strong></td>
        <td style="width: 8em"><strong>[% loc('Month') %]</strong></td>
        <td><strong>[% loc('Count') %]</strong></td>
    </thead>
    [% total = 0 %]
    [% WHILE ( state = states.next ) %]
    [% total = total + state.get_column( 'count' ) %]
    <tr>
        <td>[% state.get_column( 'c_year') | html %]</td>
        <td>[% state.get_column( 'c_month') | html %]</td>
        <td>[% state.get_column( 'count' ) %]</td>
    </tr>
    [% END %]
    <tr>
        <td colspan="2"><strong>[% loc( 'Total' ) %]</strong></td>
        <td><strong>[% total %]</strong></td>
    </tr>
</table>
[% ELSE %]
<table>
    <thead>
        <td style="width: 8em"><strong>[% loc('Current state') %]</strong></td>
        <td><strong>[% loc('Count') %]</strong></td>
    </thead>
    [% total = 0 %]
    [% WHILE ( state = states.next ) %]
    [% total = total + state.get_column( 'count' ) %]
    <tr>
        <td>[% state.state | html %]</td>
        <td>[% state.get_column( 'count' ) %]</td>
    </tr>
    [% END %]
    <tr>
        <td><strong>[% loc( 'Total' ) %]</strong></td>
        <td><strong>[% total %]</strong></td>
    </tr>
</table>
[% END %]

[% IF unconfirmed %]
    <p>
    <small>[% loc( 'Note that when including unconfirmed reports we use the date the report was created which may not be in the same month the report was confirmed so the numbers may jump about a little' ) %]</small>
    </p>
[% END %]
[% ELSE %]
<ul>
<li><a href="stats/questionnaire">[% loc('Survey Results') %]</a></li>
<li><a href="stats/state">[% loc('Problem breakdown by state') %]</a></li>
<li><a href="stats/fix-rate">[% loc('Category fix rate for problems > 4 weeks old') %]</a></li>
</ul>

[% END %]

[% IF errors %]
    [% FOREACH error IN errors %]
    <p class="error">[% error %]</p>
    [% END %]
[% END %]

<form method="post" action="[% c.uri_for('stats') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
    <p>
    <label for="start_date">[% loc('Start Date:') %]</label><input type="text"
      placeholder="[% loc('Click here or enter as dd/mm/yyyy') %]" name="start_date" id="start_date"
      value="[% start_date ? start_date.strftime( '%d/%m/%Y') : '' | html %]" />
    </p>

    <p>
    <label for="end_date">[% loc('End Date:') %]</label><input type="text"
      placeholder="[% loc('Click here or enter as dd/mm/yyyy') %]" name="end_date" id="end_date" size="5"
      value="[% end_date ? end_date.strftime( '%d/%m/%Y') : '' | html %]" />
    </p>

    <p>
    <input type="checkbox" name="unconfirmed" id="unconfirmed"[% unconfirmed ? ' checked' : '' %] /><label class="inline" for="unconfirmed">[% loc('Include unconfirmed reports') %]</label>
    </p>

    <p>
    <input type="checkbox" name="bymonth" id="bymonth"[% bymonth ? ' checked' : '' %] /><label class="inline" for="bymonth">[% loc('By Date') %]</label>
    </p>

    <p>
    [% loc('Council:') %] <select id='body' name='body'>
        <option value=''>[% loc('No council') %]</option>
        [% FOR body IN bodies %]
        <option value="[% body.id %]"[% ' selected' IF body.id == selected_body %]>[% body.name %]</option>
        [% END %]
    </select>
    </p>

    <p>
    <input type="submit" name="getcounts"  size="30" id="getcounts" value="Get Count" />
    </p>
</form>

[% INCLUDE 'admin/footer.html' %]