diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 145e64256dc..6117354c8f3 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -73,7 +73,9 @@ sub index : Path : Args(0) { $c->stash->{edit_body_contacts} = 1 if grep { $_ eq 'body' } keys %{$c->stash->{allowed_pages}}; - my @unsent = $c->cobrand->problems->search( { + my $problems = ($c->cobrand->moniker eq 'fixmystreet' && $c->user->is_superuser) ? $c->model('DB::Problem') : $c->cobrand->problems; + + my @unsent = $problems->search( { send_state => ['unprocessed', 'acknowledged'], 'me.state' => [ FixMyStreet::DB::Result::Problem::open_states() ], bodies_str => { '!=', undef }, @@ -82,7 +84,7 @@ sub index : Path : Args(0) { }, { '+columns' => ['user.email'], - prefetch => 'contact', + prefetch => [ 'contact', 'user_planned_reports' ], join => 'user', order_by => 'confirmed', } )->all; diff --git a/templates/web/base/admin/index.html b/templates/web/base/admin/index.html index 11031b26cc4..bdb9dfd9a00 100644 --- a/templates/web/base/admin/index.html +++ b/templates/web/base/admin/index.html @@ -52,18 +52,19 @@ [% IF unsent_reports.size %] -

[% loc('Reports waiting to be sent') %]

+

[% tprintf( nget(loc('%d report waiting to be sent'), loc('%d reports waiting to be sent'), unsent_reports.size), unsent_reports.size ) %]

- - + + + - [% INCLUDE 'admin/problem_row.html' problems = unsent_reports %] + [% INCLUDE 'admin/unsent_problem_row.html' problems = unsent_reports %]
[% loc('ID') %] [% loc('Title') %][% loc('Name') %] [% loc('Body') %][% loc('State') %][% loc('Age') %][% loc('Failures') %][% loc('Last failure') %] *
[% END %] diff --git a/templates/web/base/admin/unsent_problem_row.html b/templates/web/base/admin/unsent_problem_row.html new file mode 100644 index 00000000000..782838b4afa --- /dev/null +++ b/templates/web/base/admin/unsent_problem_row.html @@ -0,0 +1,47 @@ +[%- FOR problem IN problems %] + + [%- IF problem.is_visible -%] + [%- uri = c.uri_for_email( '/report', problem.id ) %] + [% problem.id %] + [%- ELSE %] + [%- problem.id %] + [%- END -%] + [%~ IF problem.cobrand_data %]
[% problem.cobrand_data %][%~ END ~%] + + [% PROCESS value_or_nbsp value=problem.title %] + + [% PROCESS value_or_nbsp value=problem.category_display %] + [%- IF edit_body_contacts -%] + [% IF problem.whensent %] +
[% loc('When sent') %]: [% PROCESS format_time time=problem.whensent %] + [%- send_fail_bodies = problem.send_fail_bodies -%] + [%- IF send_fail_bodies.size %] +
[% loc('Failed bodies:') %] [% send_fail_bodies.join(', ') %] + [% END -%] + [% ELSE -%] + [% FOR body IN problem.bodies.values %] +
[% PROCESS value_or_nbsp value=body.name %] + [% END %] + [% END -%] + [%- ELSE -%] +
[%- PROCESS value_or_nbsp value=problem.bodies_str -%] + [%- END -%] + + + [% problem.time_ago %] +
[% PROCESS format_time time=problem.confirmed %] + + [% problem.send_fail_count %] + + [% IF problem.send_fail_timestamp %] + [% PROCESS format_time time=problem.send_fail_timestamp %] +
[% problem.time_ago('send_fail_timestamp') %] ago + [% END %] + + + [% IF c.user.has_permission_to('report_edit', problem.bodies_str_ids) %] + [% loc('Edit') %] + [% END %] + + +[%- END -%]