aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Oxfordshire.pm9
-rw-r--r--t/cobrand/oxfordshire.t3
-rw-r--r--templates/web/oxfordshire/report/inspect/_extra_details_field.html35
3 files changed, 47 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
index 8a188d96a..97174e1ce 100644
--- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
@@ -181,6 +181,15 @@ sub open311_munge_update_params {
$params->{'attribute[raise_defect]'} = 1;
$params->{'attribute[easting]'} = $e;
$params->{'attribute[northing]'} = $n;
+ my $details = $comment->user->email . ' ';
+ if (my $traffic = $p->get_extra_metadata('traffic_information')) {
+ $details .= 'TM1 ' if $traffic eq 'Signs and Cones';
+ $details .= 'TM2 ' if $traffic eq 'Stop and Go Boards';
+ }
+ (my $type = $p->get_extra_metadata('defect_item_type')) =~ s/ .*//;
+ $details .= $type eq 'Sweep' ? 'S&F' : $type;
+ $details .= ' ' . ($p->get_extra_metadata('detailed_information') || '');
+ $params->{'attribute[extra_details]'} = $details;
foreach (qw(defect_item_category defect_item_type defect_item_detail defect_location_description)) {
$params->{"attribute[$_]"} = $p->get_extra_metadata($_);
diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t
index 8a1ad1429..a1c842e2d 100644
--- a/t/cobrand/oxfordshire.t
+++ b/t/cobrand/oxfordshire.t
@@ -188,6 +188,8 @@ FixMyStreet::override_config {
$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->set_extra_metadata(traffic_information => 'Signs and Cones');
+ $comment->problem->set_extra_metadata(detailed_information => '100x100');
$comment->problem->update;
my $cbr = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire');
@@ -215,6 +217,7 @@ FixMyStreet::override_config {
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';
+ is $cgi->param('attribute[extra_details]'), $user2->email . ' TM1 Damaged 100x100';
# 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/_extra_details_field.html b/templates/web/oxfordshire/report/inspect/_extra_details_field.html
new file mode 100644
index 000000000..5fc7b0086
--- /dev/null
+++ b/templates/web/oxfordshire/report/inspect/_extra_details_field.html
@@ -0,0 +1,35 @@
+<p>
+ <label for="detailed_information">[% loc('Extra details') %]</label>
+ [% IF max_detailed_info_length %]
+ <span id="detailed_information_length">
+ [% tprintf(loc('%d characters maximum'), max_detailed_info_length) %]
+ </span>
+ [% END %]
+ <span class="js-inspect-defect-yes hidden-js">
+ <br>[% c.user.email %] <span id="js-defect-prefix"></span> &hellip;
+ </span>
+ <textarea rows="2" name="detailed_information" id="detailed_information" class="form-control"
+ [% IF max_detailed_info_length %]data-max-length="[% max_detailed_info_length %]"[% END %]>[% problem.get_extra_metadata('detailed_information') | html %]</textarea>
+</p>
+
+<script nonce="[% csp_nonce %]">
+(function(){
+ function update_prefix() {
+ var prefix = document.getElementById('js-defect-prefix');
+ var text = '';
+ var traffic = document.getElementById('traffic_information');
+ if (traffic.selectedIndex) {
+ text += 'TM' + traffic.selectedIndex + ' ';
+ }
+ var type = document.getElementById('defect_item_type');
+ type = type.options[type.selectedIndex].value;
+ type = type.split(' ')[0];
+ text += (type == 'Sweep') ? 'S&F' : type;
+ text += ' ';
+ prefix.textContent = text;
+ }
+
+ document.getElementById('traffic_information').addEventListener('change', update_prefix);
+ document.getElementById('defect_item_type').addEventListener('change', update_prefix);
+})();
+</script>