aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/web/base/admin/areastats/area.html72
-rw-r--r--templates/web/base/admin/areastats/index.html11
-rw-r--r--templates/web/base/admin/stats.html106
-rw-r--r--templates/web/base/admin/stats/fix_rate.html (renamed from templates/web/base/admin/stats_fix_rate.html)0
-rw-r--r--templates/web/base/admin/stats/index.html10
-rw-r--r--templates/web/base/admin/stats/questionnaire.html (renamed from templates/web/base/admin/questionnaire.html)0
-rw-r--r--templates/web/base/admin/stats/state.html (renamed from templates/web/base/admin/stats_by_state.html)0
-rw-r--r--templates/web/base/dashboard/index.html219
-rw-r--r--templates/web/zurich/admin/stats/index.html (renamed from templates/web/zurich/admin/stats.html)0
9 files changed, 113 insertions, 305 deletions
diff --git a/templates/web/base/admin/areastats/area.html b/templates/web/base/admin/areastats/area.html
deleted file mode 100644
index a7330692d..000000000
--- a/templates/web/base/admin/areastats/area.html
+++ /dev/null
@@ -1,72 +0,0 @@
-[% INCLUDE 'admin/header.html' title=tprintf(('Area stats for %s'), area_name) -%]
-<p>
-[% loc('There are currently:') %]
-</p>
-
-<table>
- <tr>
- <th></th>
- <th>[% loc('Open') %]</th>
- <th>[% loc('Scheduled') %]</th>
- <th>[% loc('Closed') %]</th>
- <th>[% loc('Fixed') %]</th>
- </tr>
- [% FOR k IN by_category.keys.sort %]
- <tr>
- <td>[% k %]</td>
- <td>[% by_category.$k.open OR 0 %]</td>
- <td>[% by_category.$k.scheduled OR 0 %]</td>
- <td>[% by_category.$k.closed OR 0 %]</td>
- <td>[% by_category.$k.fixed OR 0 %]</td>
- </tr>
- [% END %]
-
-</table>
-
-<p>
-[% loc('Issues in the last month:') %]
-</p>
-
-<p>
-[% tprintf(
- loc('%d opened, %d scheduled, %d closed, %d fixed'),
- open,
- scheduled,
- closed,
- fixed
- );
-%]
-</p>
-
-<table>
- [% FOR k IN recent_by_category.keys.sort %]
- <tr>
- <td>[% k %]</td>
- <td>[% recent_by_category.$k OR 0 %]</td>
- </tr>
- [% END %]
-</table>
-
-[% IF average >= 0 %]
-<p>[% tprintf(loc('In the last month – average time between issue being opened and set to another status was %s days'), average) %]</p>
-[% ELSE %]
-<p>[% loc('In the last month no problems changed state') %]</p>
-[% END %]
-
-
-[% IF NOT c.user.area_id %]
-<p>
-<form action="" method="GET">
-[% loc('Show stats for:') %]
- <select name="area">
- <option value="">[% loc('Whole council') %]</option>
- [% FOR area IN areas.values.sort('name')%]
- <option value="[% area.id %]">[% area.name %]</option>
- [% END %]
- </select>
- <input type="submit" value="Go">
-</form>
-</p>
-[% END %]
-
-[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/admin/areastats/index.html b/templates/web/base/admin/areastats/index.html
deleted file mode 100644
index 1ebde20e7..000000000
--- a/templates/web/base/admin/areastats/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-[% INCLUDE 'admin/header.html' title=('Area Stats') -%]
-
-<ul>
- [% FOR body IN bodies %]
- <li>
- <a href="[% c.uri_for('', body.id) %]">[% body.name %]</a>
- </li>
- [% END %]
-</ul>
-
-[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/admin/stats.html b/templates/web/base/admin/stats.html
deleted file mode 100644
index 150afd619..000000000
--- a/templates/web/base/admin/stats.html
+++ /dev/null
@@ -1,106 +0,0 @@
-[% 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" class="form-control"
- 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" class="form-control"
- 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>
-
- [% IF c.user.is_superuser %]
- <p>
- [% loc('Council:') %] <select class="form-control" 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>
- [% END %]
-
- <p>
- <input type="submit" class="btn" name="getcounts" size="30" id="getcounts" value="[% loc('Get Count') %]" />
- </p>
-</form>
-
-[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/admin/stats_fix_rate.html b/templates/web/base/admin/stats/fix_rate.html
index fb88a1c06..fb88a1c06 100644
--- a/templates/web/base/admin/stats_fix_rate.html
+++ b/templates/web/base/admin/stats/fix_rate.html
diff --git a/templates/web/base/admin/stats/index.html b/templates/web/base/admin/stats/index.html
new file mode 100644
index 000000000..6ea1ae403
--- /dev/null
+++ b/templates/web/base/admin/stats/index.html
@@ -0,0 +1,10 @@
+[% INCLUDE 'admin/header.html' title=loc('Stats') %]
+
+<ul>
+<li><a href="[% c.uri_for_action('admin/stats/questionnaire') %]">[% loc('Survey Results') %]</a></li>
+<li><a href="[% c.uri_for_action('admin/stats/state') %]">[% loc('Problem breakdown by state') %]</a></li>
+<li><a href="[% c.uri_for_action('admin/stats/fix_rate') %]">[% loc('Category fix rate for problems > 4 weeks old') %]</a></li>
+<li><a href="[% c.uri_for_action('dashboard/index') %]">[% loc('Summary statistics') %]</a></li>
+</ul>
+
+[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/admin/questionnaire.html b/templates/web/base/admin/stats/questionnaire.html
index 680e0d214..680e0d214 100644
--- a/templates/web/base/admin/questionnaire.html
+++ b/templates/web/base/admin/stats/questionnaire.html
diff --git a/templates/web/base/admin/stats_by_state.html b/templates/web/base/admin/stats/state.html
index 6bcd35f88..6bcd35f88 100644
--- a/templates/web/base/admin/stats_by_state.html
+++ b/templates/web/base/admin/stats/state.html
diff --git a/templates/web/base/dashboard/index.html b/templates/web/base/dashboard/index.html
index d7ad6ddfa..b201ebcc9 100644
--- a/templates/web/base/dashboard/index.html
+++ b/templates/web/base/dashboard/index.html
@@ -1,3 +1,5 @@
+[% USE Number.Format %]
+
[% extra_css = BLOCK %]
<link rel="stylesheet" href="[% version('/cobrands/fixmystreet/dashboard.css') %]">
[% END %]
@@ -11,11 +13,17 @@
<form>
+[% IF body %]
<hgroup>
- [% tprintf(loc('<h2>Reports, Statistics and Actions for</h2> <h1>%s</h1>'), council.name) %]
+ [% tprintf(loc('<h2>Reports, Statistics and Actions for</h2> <h1>%s</h1>'), body_name) %]
</hgroup>
+[% ELSE %]
+<h1>[% loc('Summary statistics') %]</h1>
+[% END %]
<div class="filters">
+ [% IF body %]
+ [% IF NOT c.user.area_id %]
<p>
<label for="ward">[% loc('Ward:') %]</label>
<select class="form-control" name="ward"><option value=''>[% loc('All') %]</option>
@@ -24,114 +32,30 @@
[% END %]
</select>
</p>
+ [% END %]
<p>
<label for="category">[% loc('Category:') %]</label>
<select class="form-control" name="category"><option value=''>[% loc('All') %]</option>
- [% FOR cat_op IN category_options %]
- <option value='[% cat_op.name | html %]'[% ' selected' IF category == cat_op.name %]>[% cat_op.value | html %]</option>
+ [% FOR cat IN contacts %]
+ <option value='[% cat.category | html %]'[% ' selected' IF category == cat.category %]>[% cat.category_display | html %]</option>
[% END %]
</select>
</p>
- <p class="no-label">
- <input type="submit" class="btn" value="[% loc('Look up') %]">
- </p>
-</div>
-
-
-<table width="100%" id="overview">
- <tr>
- <th>&nbsp;</th>
- <th scope="col"><abbr title="[% loc('Week To Date') %]">[% loc('WTD', "Week to date") %]</abbr></th>
- <th scope="col">[% loc('Last 7 days') %]</th>
- <th scope="col">[% loc('Last 4 weeks') %]</th>
- <th scope="col">[% loc('YTD', "Year to date") %]</th>
- </tr>
-
- [%
- rows = {
- '0' => [ "total", loc("Total reports received") ]
- '1' => [ "fixed - council", loc("Council has marked as fixed") ]
- '2' => [ "fixed_user", loc("User has marked as fixed") ]
- };
- FOR row IN rows %]
- <tr id="[% row.value.0.replace('[^\w]+', '_' ) %]">
- <th scope="row">[% row.value.1 %]</th>
- <td>[% problems.wtd.${row.value.0} %]</td>
- <td>[% problems.week.${row.value.0} %]</td>
- <td>[% problems.weeks.${row.value.0} %]</td>
- <td>[% problems.ytd.${row.value.0} %]</td>
- </tr>
- [% END %]
-
- <tr class='subtotal' id="total_fixed">
- <th scope="row">[% loc('Total marked as fixed') %]</th>
- <td>[% problems.wtd.${"fixed - council"} + problems.wtd.fixed_user %]</td>
- <td>[% problems.week.${"fixed - council"} + problems.week.fixed_user %]</td>
- <td>[% problems.weeks.${"fixed - council"} + problems.weeks.fixed_user %]</td>
- <td>[% problems.ytd.${"fixed - council"} + problems.ytd.fixed_user %]</td>
- </tr>
-
- [%
- rows = {
- '0' => [ "in progress", loc("Council has marked as in progress") ]
- '1' => [ "action scheduled", loc("Council has marked as planned") ]
- '2' => [ "investigating", loc("Council has marked as investigating") ]
- '3' => [ "closed", loc("Council has marked as closed") ]
- };
- wtd = 0, week = 0, weeks = 0, ytd = 0;
- FOR row IN rows %]
- <tr id="[% row.value.0.replace('[^\w]+', '_' ) %]">
- <th scope="row">[% row.value.1 %]</th>
- <td>[% problems.wtd.${row.value.0} %]</td>
- <td>[% problems.week.${row.value.0} %]</td>
- <td>[% problems.weeks.${row.value.0} %]</td>
- <td>[% problems.ytd.${row.value.0} %]</td>
- </tr>
- [% END %]
-
- <tr class='subtotal' id="marked">
- <th scope="row">[% loc('Total marked') %]</th>
- <td>[% problems.wtd.${"in progress"} + problems.wtd.${"action scheduled"} +
- problems.wtd.investigating + problems.wtd.closed %]</td>
- <td>[% problems.week.${"in progress"} + problems.week.${"action scheduled"} +
- problems.week.investigating + problems.wtd.closed %]</td>
- <td>[% problems.weeks.${"in progress"} + problems.weeks.${"action scheduled"} +
- problems.weeks.investigating + problems.wtd.closed %]</td>
- <td>[% problems.ytd.${"in progress"} + problems.ytd.${"action scheduled"} +
- problems.ytd.investigating + problems.wtd.closed %]</td>
- </tr>
-
- <tr id="avg_fixed">
- <th scope="row">[% loc('Average time to council marking fixed (days)') %]</th>
- <td>[% problems.wtd.time_to_fix %]</td>
- <td>[% problems.week.time_to_fix %]</td>
- <td>[% problems.weeks.time_to_fix %]</td>
- <td>[% problems.ytd.time_to_fix %]</td>
- </tr>
-
- <tr id="avg_marked">
- <th scope="row">[% loc('Average time to first council state change (days)') %]</th>
- <td>[% problems.wtd.time_to_mark %]</td>
- <td>[% problems.week.time_to_mark %]</td>
- <td>[% problems.weeks.time_to_mark %]</td>
- <td>[% problems.ytd.time_to_mark %]</td>
- </tr>
-
- <tr class='subtotal' id="not_marked">
- <th scope="row">[% loc('Total not marked') %]</th>
- <td>[% problems.wtd.not_marked %]</td>
- <td>[% problems.week.not_marked %]</td>
- <td>[% problems.weeks.not_marked %]</td>
- <td>[% problems.ytd.not_marked %]</td>
- </tr>
+ [% ELSE %]
-</table>
+ <p>
+ <label for="ward">[% loc('Council:') %]</label>
+ <select class="form-control" name="body"><option value=''>[% loc('All') %]</option>
+ [% FOR b IN bodies %]
+ <option value="[% b.id %]">[% b.name %]</option>
+ [% END %]
+ </select>
+ </p>
-<h2>[% loc('Reports') %]</h2>
+ [% END %]
-<div class="filters">
<p>
<label for="state">[% loc('Report state:') %]</label>
<select class="form-control" name="state">
@@ -152,31 +76,94 @@
<label for="end_date">[% loc('End Date') %]</label>
<input name="end_date" type="date" value="[% end_date | html %]" class="form-control">
</p>
- <p class="no-label">
- <input type="submit" class="btn" value="[% loc('Look up') %]">
- <a class="btn export_as_csv" href="[% c.req.uri_with({ export => 1 }) %]">[% loc('Export as CSV') %]</a>
- </p>
</div>
-<table width="100%" id="reports">
+<p align="center">
+ <input type="hidden" name="group_by" value="[% group_by | html %]">
+ <input type="hidden" name="body" value="[% body.id | html %]">
+ <input type="submit" class="btn" value="[% loc('Look up') %]">
+ <input type="submit" class="btn" name="export" value="[% loc('Export as CSV') %]">
+</p>
+
+</form>
+
+[% BLOCK gb %]
+[% IF group_by == new_gb %]
+ <strong>[% text %]</strong>
+[% ELSE %]
+ <a href="[% c.uri_with({ group_by => new_gb }) %]">[% text %]</a>
+[% END %]
+[% END %]
+
+<table width="100%" id="overview">
+ <caption>
+ [% loc('Current state of filtered reports') %]
+ <p>
+ [% loc('Group by:') %]
+ [% INCLUDE gb new_gb='category' text=loc('Category') %]
+ | [% INCLUDE gb new_gb='state' text=loc('State') %]
+ | [% INCLUDE gb new_gb='month' text=loc('Month') %]
+ | [% INCLUDE gb new_gb='category+state' text=loc('Category and State') %]
+ | [% INCLUDE gb new_gb='device+site' text=loc('Device and Site') %]
+ </p>
+ </caption>
<tr>
- <th scope="col">[% loc('Less than 7 days old') %]</th>
- <th scope="col">[% loc('7-14 days old') %]</th>
- <th scope="col">[% loc('14-30 days old') %]</th>
+ <th></th>
+ [% IF group_by == 'category+state' %]
+ <th scope="col">[% loc('Open') %]</th>
+ <th scope="col">[% loc('Closed') %]</th>
+ <th scope="col">[% loc('Fixed') %]</th>
+ <th scope="col">[% loc('Total') %]</th>
+ [% ELSE %]
+ [% FOR k2 IN columns.sort %]
+ <th scope="col">[% k2 or loc('Website') %]</td>
+ [% END %]
+ <th scope="col">[% loc('Total') %]</th>
+ [% END %]
</tr>
+ [% FOR k IN rows %]
<tr>
- <td width="34%"><ul>[% INCLUDE list, list = lists.1 %]</ul></td>
- <td width="33%"><ul>[% INCLUDE list, list = lists.2 %]</ul></td>
- <td width="33%"><ul>[% INCLUDE list, list = lists.3 %]</ul></td>
+ [% IF group_by == 'state' %]
+ <th scope="row">[% prettify_state(k) %]</th>
+ [% ELSE %]
+ <th scope="row">[% k %]</th>
+ [% END %]
+ [% IF group_by == 'category+state' %]
+ <td>[% grouped.$k.open OR 0 %]</td>
+ <td>[% grouped.$k.closed OR 0 %]</td>
+ <td>[% grouped.$k.fixed OR 0 %]</td>
+ <td>[% grouped.$k.total OR 0 %]</td>
+ [% ELSE %]
+ [% FOR k2 IN columns.sort %]
+ <td>[% grouped.$k.$k2 OR 0 %]</td>
+ [% END %]
+ <td>[% grouped.$k.total OR 0 %]</td>
+ [% END %]
+ </tr>
+ [% END %]
+ <tr class="subtotal">
+ <th scope="row">[% loc('Total') %]</th>
+ [% IF group_by == 'category+state' %]
+ <td>[% totals.open OR 0 %]</td>
+ <td>[% totals.closed OR 0 %]</td>
+ <td>[% totals.fixed OR 0 %]</td>
+ [% ELSE %]
+ [% FOR k2 IN columns.sort %]
+ <td>[% totals.$k2 OR 0 %]</td>
+ [% END %]
+ [% END %]
+ <td>[% totals.total OR 0 %]</td>
</tr>
</table>
-</form>
+<p>
+[% loc('Within the specified timeframe:') %]
+[%
+summary_open = summary_open | format_number;
+summary_closed = summary_closed | format_number;
+summary_fixed = summary_fixed | format_number;
+tprintf( loc('%s opened, %s closed, %s fixed'),
+ decode(summary_open), decode(summary_closed), decode(summary_fixed) ) %]
+</p>
[% INCLUDE 'footer.html' %]
-
-[% BLOCK list %]
-[% FOR p IN list %]
-<li><a href="/report/[% p.id %]">[% p.title | html %]</a> <date>[% p.confirmed.dmy('/') %]</date></li>
-[% END %]
-[% END %]
diff --git a/templates/web/zurich/admin/stats.html b/templates/web/zurich/admin/stats/index.html
index ce8e238f7..ce8e238f7 100644
--- a/templates/web/zurich/admin/stats.html
+++ b/templates/web/zurich/admin/stats/index.html