diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 14 | ||||
-rw-r--r-- | t/app/controller/report_inspect.t | 2 | ||||
-rw-r--r-- | t/cobrand/oxfordshire.t | 5 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/inspect/_raise_defect.html | 74 |
4 files changed, 92 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index 34e21ddfc..ab0bfe563 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -181,6 +181,10 @@ sub open311_munge_update_params { $params->{'attribute[raise_defect]'} = 1; $params->{'attribute[easting]'} = $e; $params->{'attribute[northing]'} = $n; + + foreach (qw(defect_item_category defect_item_type defect_item_detail defect_location_description)) { + $params->{"attribute[$_]"} = $p->get_extra_metadata($_); + } } } @@ -197,6 +201,16 @@ sub should_skip_sending_update { return 0; } + +sub report_inspect_update_extra { + my ( $self, $problem ) = @_; + + foreach (qw(defect_item_category defect_item_type defect_item_detail defect_location_description)) { + my $value = $self->{c}->get_param($_); + $problem->set_extra_metadata($_ => $value) if $value; + } +} + sub on_map_default_status { return 'open'; } sub admin_user_domain { 'oxfordshire.gov.uk' } diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 367327c16..d5eaed2c1 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -920,10 +920,12 @@ FixMyStreet::override_config { $mech->submit_form_ok({ button => 'save', with_fields => { public_update => "This is a public update.", include_update => "1", state => 'action scheduled', raise_defect => 1, + defect_item_category => 'Kerbing', } }); $report2->discard_changes; is $report2->get_extra_metadata('inspected'), 1, 'report marked as inspected'; $mech->get_ok("/report/$report2_id"); + $mech->content_like(qr/Defect category<\/dt>\s*<dd>Kerbing/); my $meta = $mech->extract_update_metas; like $meta->[0], qr/State changed to: Action scheduled/, 'First update mentions action scheduled'; like $meta->[1], qr/Posted by .*defect raised/, 'Update mentions defect raised'; diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t index b5e51e808..8a1ad1429 100644 --- a/t/cobrand/oxfordshire.t +++ b/t/cobrand/oxfordshire.t @@ -184,6 +184,10 @@ FixMyStreet::override_config { $comment->set_extra_metadata(defect_raised => 1); $comment->update; $comment->problem->external_id('hey'); + $comment->problem->set_extra_metadata(defect_location_description => 'Location'); + $comment->problem->set_extra_metadata(defect_item_category => 'Kerbing'); + $comment->problem->set_extra_metadata(defect_item_type => 'Damaged'); + $comment->problem->set_extra_metadata(defect_item_detail => '1 kerb unit or 1 linear m'); $comment->problem->update; my $cbr = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire'); @@ -210,6 +214,7 @@ FixMyStreet::override_config { my $cgi = CGI::Simple->new($o->test_req_used->content); is $cgi->param('attribute[usrn]'), 13579, 'USRN sent with update'; is $cgi->param('attribute[raise_defect]'), 1, 'Defect flag sent with update'; + is $cgi->param('attribute[defect_item_category]'), 'Kerbing'; # Now set a USRN on the problem (found at submission) $comment->problem->push_extra_fields({ name => 'usrn', value => '12345' }); diff --git a/templates/web/oxfordshire/report/inspect/_raise_defect.html b/templates/web/oxfordshire/report/inspect/_raise_defect.html index 5783def48..b2cdf7487 100644 --- a/templates/web/oxfordshire/report/inspect/_raise_defect.html +++ b/templates/web/oxfordshire/report/inspect/_raise_defect.html @@ -1,11 +1,79 @@ -[% IF permissions.report_instruct AND NOT problem.get_extra_metadata('inspected') %] +[% IF permissions.report_instruct %] + +[% IF problem.get_extra_metadata('inspected') AND NOT errors %] + +<dl> + <dt>Defect category</dt> + <dd>[% problem.get_extra_metadata('defect_item_category') %]</dd> + + <dt>Defect type</dt> + <dd>[% problem.get_extra_metadata('defect_item_type') %]</dd> + + <dt>Defect detail</dt> + <dd>[% problem.get_extra_metadata('defect_item_detail') %]</dd> + + <dt>Location description</dt> + <dd>[% problem.get_extra_metadata('defect_location_description') %]</dd> +</dl> + +[% ELSE %] + <div id="js-inspect-action-scheduled" class="[% "hidden" UNLESS problem.state == 'action scheduled' %]"> + <p>[% loc('Do you want to automatically raise a defect?') %]</p> <p class="segmented-control segmented-control--radio"> - <input type="radio" name="raise_defect" id="raise_defect_yes" value="1"> + <input type="radio" name="raise_defect" id="raise_defect_yes" value="1" data-show=".js-inspect-defect-yes"> <label class="btn" for="raise_defect_yes">[% loc('Yes') %]</label> - <input type="radio" name="raise_defect" id="raise_defect_no" value="0"> + <input type="radio" name="raise_defect" id="raise_defect_no" value="0" data-hide=".js-inspect-defect-yes"> <label class="btn" for="raise_defect_no">[% loc('No') %]</label> </p> + + <div class="js-inspect-defect-yes hidden-js"> + + <p>Please fill in the below:</p> + + <label for="defect_item_category">Defect category</label> + <select id="defect_item_category" name="defect_item_category" class="form-control" required> + <option value="">-- Pick a category --</option> + <option data-show=".defect-non-kerb-options" data-hide=".defect-kerb-options">Minor Carriageway</option> + <option data-show=".defect-non-kerb-options" data-hide=".defect-kerb-options">Footway/ Cycleway</option> + <option data-show=".defect-kerb-options" data-hide=".defect-non-kerb-options">Kerbing</option> + </select> + + <label for="defect_item_type">Defect type</label> + <select id="defect_item_type" name="defect_item_type" class="form-control" required> + <option value="">-- Pick a type --</option> + <optgroup class="defect-non-kerb-options" label="Minor Carriageway/ Footway/ Cycleway"> + <option>Sweep & Fill</option> + </optgroup> + <optgroup class="defect-kerb-options" label="Kerbing"> + <option>Damaged</option> + <option>Loose</option> + <option>Misaligned Single Units or Uneven Run of Units</option> + <option>Missing</option> + </optgroup> + </select> + + <label for="defect_item_detail">Defect detail</label> + <select id="defect_item_detail" name="defect_item_detail" class="form-control" required> + <option value="">-- Pick a detail --</option> + <optgroup class="defect-non-kerb-options" label="Minor Carriageway/ Footway/ Cycleway"> + <option>Pothole Sweep & Fill 0-1m²</option> + <option>Pothole Cluster Sweep & Fill 1-2m²</option> + </optgroup> + <optgroup class="defect-kerb-options" label="Kerbing"> + <option>1 kerb unit or 1 linear m</option> + <option>Greater than 1 kerb unit or 1 linear m</option> + </optgroup> + </select> + + <label for="defect_location_description">Location description</label> + <textarea rows="2" id="defect_location_description" name="defect_location_description" class="form-control"></textarea> + + </div> + </div> + +[% END %] + [% END %] |