diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 37 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit-sdm.html | 7 |
3 files changed, 38 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index e9b4bb9a2..cd1436598 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -600,11 +600,13 @@ sub report_edit : Path('report_edit') : Args(1) { $c->stash->{problem} = $problem; + $c->forward('get_token'); + if ( $c->cobrand->moniker eq 'zurich' ) { - $c->cobrand->admin_report_edit(); + my $done = $c->cobrand->admin_report_edit(); + return if $done; } - $c->forward('get_token'); $c->forward('check_email_for_abuse', [ $problem->user->email ] ); $c->stash->{updates} = diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 15397e0a2..d39e017f7 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -122,17 +122,46 @@ sub admin_report_edit { $c->detach( '/page_error_404_not_found' ) unless $allowed_bodies{$problem->bodies_str}; - if ($type eq 'dm') { + if ($type eq 'super') { + + my @bodies = $c->model('DB::Body')->all(); + @bodies = sort { strcoll($a->name, $b->name) } @bodies; + $c->stash->{bodies} = \@bodies; + + } elsif ($type eq 'dm') { + + # Can assign to other DMs, and their own subdivisions my @bodies = $c->model('DB::Body')->search( [ { parent => $body->parent->id }, { parent => $body->id } ] ); @bodies = sort { strcoll($a->name, $b->name) } @bodies; $c->stash->{bodies} = \@bodies; + } elsif ($type eq 'sdm') { + + # Has cut-down edit template for adding update and sending back up only $c->stash->{template} = 'admin/report_edit-sdm.html'; - my @bodies = $c->model('DB::Body')->search( [ { id => $body->parent->id }, { id => $body->id } ] ); - @bodies = sort { strcoll($a->name, $b->name) } @bodies; - $c->stash->{bodies} = \@bodies; + + if ($c->req->param('send_back')) { + $c->forward('check_token'); + + $problem->bodies_str( $body->parent->id ); + $problem->update; + + # log here + + $c->res->redirect( '/admin/summary' ); + return 1; + + } elsif ($c->req->param('submit')) { + $c->forward('check_token'); + + # Add new update from status_update + + return 1; + } } + return 0; + } 1; diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html index bdbf2735b..dd9144e14 100644 --- a/templates/web/zurich/admin/report_edit-sdm.html +++ b/templates/web/zurich/admin/report_edit-sdm.html @@ -12,12 +12,7 @@ <li><a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% loc('View report on site' )%]</a></li> <li>[% loc('Details:') %] [% problem.detail | html %]</li> <li>[% loc('Co-ordinates:') %] [% problem.latitude %], [% problem.longitude %] ( [% loc('originally entered') %] ‘[% problem.postcode | html %]’, [% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])</li> -<li>[% loc('Body:') %] - <select name="body"> - [% FOR body IN bodies %] - <option value="[% body.id %]"[% IF body.id == problem.bodies_str%] selected[% END %]>[% body.name %]</option> - [% END %] - </select> +<li><input type="submit" name="send_back" value="[% loc('Send back to division') %]"> </li> <li>[% loc('Internal notes:') %] [% problem.extra | html %] |