diff --git a/perllib/FixMyStreet/App/Controller/Admin/Waste.pm b/perllib/FixMyStreet/App/Controller/Admin/Waste.pm index f3ef0b37812..1dd3ca2b5b1 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Waste.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Waste.pm @@ -93,7 +93,8 @@ sub edit : Chained('body') : PathPart('') : Args(0) { band1_max => 'int', free_mode => 'bool', food_bags_disabled => 'bool', - show_location_page => 'sel' + show_location_page => 'sel', + show_individual_notes => 'bool', ); foreach (keys %keys) { my $val = $c->get_param($_); @@ -217,7 +218,7 @@ sub stash_body_config_json : Private { } else { $c->stash->{body_config_json} = JSON->new->utf8(1)->pretty->canonical->encode($cfg); } - foreach (qw(free_mode per_item_costs base_price daily_slots items_per_collection_max food_bags_disabled show_location_page band1_price band1_max)) { + foreach (qw(free_mode per_item_costs base_price daily_slots items_per_collection_max food_bags_disabled show_location_page band1_price band1_max show_individual_notes)) { $c->stash->{$_} = $c->get_param($_) || $cfg->{$_}; } } diff --git a/perllib/FixMyStreet/App/Controller/Waste/Bulky.pm b/perllib/FixMyStreet/App/Controller/Waste/Bulky.pm index 746118d45bb..1cd163c88e8 100644 --- a/perllib/FixMyStreet/App/Controller/Waste/Bulky.pm +++ b/perllib/FixMyStreet/App/Controller/Waste/Bulky.pm @@ -59,6 +59,7 @@ sub item_list : Private { my $max_items = $c->cobrand->bulky_items_maximum; my $field_list = []; + for my $num ( 1 .. $max_items ) { push @$field_list, "item_$num" => { @@ -81,13 +82,19 @@ sub item_list : Private { type => 'FileIdPhoto', num_photos_required => 0, linked_field => "item_photo_$num", + }, + "item_notes_${num}" => { + type => 'TextArea', + label => 'Item note (optional)', + maxlength => 100, + tags => { hint => 'Describe the item to help our crew pick up the right thing' }, }; } $c->stash->{page_list} = [ add_items => { fields => [ 'continue', - map { ("item_$_", "item_photo_$_", "item_photo_${_}_fileid") } ( 1 .. $max_items ), + map { ("item_$_", "item_photo_$_", "item_photo_${_}_fileid", "item_notes_$_") } ( 1 .. $max_items ), ], template => 'waste/bulky/items.html', title => 'Add items for collection', diff --git a/perllib/FixMyStreet/Cobrand/Brent.pm b/perllib/FixMyStreet/Cobrand/Brent.pm index 454c1ec13df..aed9d5cdff4 100644 --- a/perllib/FixMyStreet/Cobrand/Brent.pm +++ b/perllib/FixMyStreet/Cobrand/Brent.pm @@ -1397,7 +1397,7 @@ sub waste_munge_bulky_data { $data->{extra_Collection_Date} = $date; $data->{extra_Exact_Location} = $data->{location}; - my (%types, @photos); + my (%types, @photos, @notes); my $max = $self->bulky_items_maximum; for (1..$max) { if (my $item = $data->{"item_$_"}) { @@ -1414,8 +1414,10 @@ sub waste_munge_bulky_data { $data->{extra_Small_WEEE} = 1; } push @photos, $data->{"item_photos_$_"} || ''; + push @notes, $data->{"item_notes_$_"} || ''; # XXX IF other }; } + # TODO Include notes in this field as well, if the key is Other? $data->{extra_Notes} = join("\n", map { "$types{$_} x $_" } sort keys %types); $data->{extra_Image} = join("::", @photos); } diff --git a/perllib/FixMyStreet/Roles/CobrandBulkyWaste.pm b/perllib/FixMyStreet/Roles/CobrandBulkyWaste.pm index 8bcfb19a7af..7e68ff69187 100644 --- a/perllib/FixMyStreet/Roles/CobrandBulkyWaste.pm +++ b/perllib/FixMyStreet/Roles/CobrandBulkyWaste.pm @@ -66,6 +66,8 @@ sub bulky_show_location_page { }; sub bulky_show_location_field_mandatory { 0 } +sub bulky_show_individual_notes { $_[0]->wasteworks_config->{show_individual_notes} }; + sub bulky_pricing_strategy { my $self = shift; my $base_price = $self->wasteworks_config->{base_price}; diff --git a/perllib/FixMyStreet/Roles/CobrandSLWP.pm b/perllib/FixMyStreet/Roles/CobrandSLWP.pm index 2d9f6e23694..35c2fa598e2 100644 --- a/perllib/FixMyStreet/Roles/CobrandSLWP.pm +++ b/perllib/FixMyStreet/Roles/CobrandSLWP.pm @@ -1094,6 +1094,4 @@ sub dashboard_export_problems_add_columns { }); } - - 1; diff --git a/t/app/controller/waste_peterborough.t b/t/app/controller/waste_peterborough.t index cde91057b0d..9c2a35a43a1 100644 --- a/t/app/controller/waste_peterborough.t +++ b/t/app/controller/waste_peterborough.t @@ -798,6 +798,7 @@ FixMyStreet::override_config { $body->discard_changes; is_deeply $body->get_extra_metadata('wasteworks_config'), { show_location_page => 'noshow', + show_individual_notes => 0, band1_max => '', band1_price => '', daily_slots => 50, diff --git a/templates/web/base/admin/waste/edit.html b/templates/web/base/admin/waste/edit.html index b41ecbbf6ff..9445dc71bd2 100644 --- a/templates/web/base/admin/waste/edit.html +++ b/templates/web/base/admin/waste/edit.html @@ -67,9 +67,9 @@
- - + + [% IF c.cobrand.moniker == 'peterborough' %]
diff --git a/templates/web/base/waste/bulky/items.html b/templates/web/base/waste/bulky/items.html index 7ed1f4442c3..38ec09a4b2e 100644 --- a/templates/web/base/waste/bulky/items.html +++ b/templates/web/base/waste/bulky/items.html @@ -92,6 +92,10 @@ [% # Building names beforehand because override_fields does not seem to like them being built inside its arg list %] [% item = 'item_' _ num %] [% PROCESS form override_fields = [ item ] %] + [% IF c.cobrand.moniker == 'brent' AND c.cobrand.call_hook('bulky_show_individual_notes') %] + [% notes = 'item_notes_' _ num %] + [% PROCESS form override_fields = [ notes ] %] + [% END %] [% PROCESS extra_text num = num %] [% IF c.cobrand.moniker != 'brent' %] [% photo = 'item_photo_' _ num %] diff --git a/templates/web/base/waste/bulky/summary.html b/templates/web/base/waste/bulky/summary.html index 16163aa0c2c..3ecd9f9e362 100644 --- a/templates/web/base/waste/bulky/summary.html +++ b/templates/web/base/waste/bulky/summary.html @@ -120,8 +120,9 @@
[% item.item %]
+ [% IF item.notes %] +[% item.notes %]
+ [% END %]