From 249fb654304c0df19f725cc75b82614c498fa931 Mon Sep 17 00:00:00 2001 From: Moray Jones Date: Tue, 9 Dec 2025 15:57:12 +0000 Subject: [PATCH 1/2] [Brent] Remove trailing lines spacing in file --- web/cobrands/brent/base.scss | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web/cobrands/brent/base.scss b/web/cobrands/brent/base.scss index 463b99a9fc8..4b4c6fad21c 100644 --- a/web/cobrands/brent/base.scss +++ b/web/cobrands/brent/base.scss @@ -93,7 +93,7 @@ a { } } -.item-list__item__shortlist-add { +.item-list__item__shortlist-add { @include brent-input-with-no-border; } @@ -188,7 +188,7 @@ a { outline: none; background: $link-focus-color url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='18' viewBox='0 0 22 18'%3E%3Cpath d='M2.01 3.999h17.98c1.109 0 2.01-.896 2.01-2.001A2.006 2.006 0 0019.99 0H2.01C.9 0 0 .896 0 1.999 0 3.104.901 4 2.01 4v-.001zM19.99 7H2.01C.9 7 0 7.896 0 8.999 0 10.102.901 11 2.01 11h17.98c1.109 0 2.01-.896 2.01-2.001A2.005 2.005 0 0019.99 7zm0 7H2.01C.9 14 0 14.894 0 15.999 0 17.102.901 18 2.01 18h17.98c1.109 0 2.01-.896 2.01-2.001A2.005 2.005 0 0019.99 14z'/%3E%3C/svg%3E") center center no-repeat; } - + html.js-nav-open & { background: $nav_background_colour url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='18' viewBox='0 0 22 18'%3E%3Cpath d='M3.223 1.221c.78-.78 2.049-.778 2.835.008l4.941 4.942 4.943-4.942a2.005 2.005 0 012.835-.008 2.006 2.006 0 01-.006 2.837v-.001l-4.944 4.942 4.944 4.943c.743.744.785 1.923.125 2.708l-.116.127a2.006 2.006 0 01-2.837-.007L11 11.827 6.057 16.77a2.006 2.006 0 01-2.837.007c-.779-.78-.775-2.05.01-2.835L8.171 9 3.23 4.057a2.005 2.005 0 01-.007-2.836z'/%3E%3C/svg%3E") center center no-repeat; &:focus, &.focussed { @@ -371,13 +371,13 @@ dl dt { font-weight: 700; margin-bottom: 0.5em; } - + &-link { display: block; color: $footer-colour; text-decoration: none; padding: 0.5em 0; - + &:hover { text-decoration: underline; } @@ -387,7 +387,7 @@ dl dt { color: $primary_b; text-decoration: underline; } - + svg { height: 1em; overflow: visible; @@ -398,12 +398,12 @@ dl dt { &:last-of-type { order: 2; margin-bottom: calc(30px*1.5); - } + } &:first-of-type { order: 1; margin-bottom: calc(30px*1.5); - } + } } .footer__column-summary { @@ -513,7 +513,7 @@ dl dt { .place-banner__bg-inner-container { max-width: 1110px; margin: 0 auto; - + } .place-banner__bg-inner { From 27d03deeac5e53bb356e35a4e1280b7194966cdf Mon Sep 17 00:00:00 2001 From: Moray Jones Date: Tue, 14 Oct 2025 11:54:42 +0100 Subject: [PATCH 2/2] [Brent] Add form for refuse container requests Adds form to request refuse containers. Filter requests for extra containers to calculate whether request will be unsuccessful and automate the response. https://github.com/mysociety/societyworks/issues/5120 --- perllib/FixMyStreet/App/Controller/Waste.pm | 2 +- .../App/Form/Waste/Request/Brent.pm | 38 +++++++-- perllib/FixMyStreet/Cobrand/Brent.pm | 60 +++++++++++++- t/cobrand/brent.t | 78 ++++++++++++++++++- templates/web/base/waste/confirmation.html | 19 +++++ templates/web/base/waste/summary_request.html | 25 +++++- templates/web/brent/waste/refuse_call_us.html | 12 --- .../brent/waste/refuse_extra_container.html | 8 +- web/cobrands/brent/base.scss | 5 ++ 9 files changed, 218 insertions(+), 29 deletions(-) diff --git a/perllib/FixMyStreet/App/Controller/Waste.pm b/perllib/FixMyStreet/App/Controller/Waste.pm index 02342d01f7d..0368dce10a9 100644 --- a/perllib/FixMyStreet/App/Controller/Waste.pm +++ b/perllib/FixMyStreet/App/Controller/Waste.pm @@ -1339,7 +1339,7 @@ sub add_report : Private { $c->forward('/report/new/redirect_or_confirm_creation', [ 1 ]); } - $c->cobrand->call_hook('waste_post_report_creation', $report); + $c->cobrand->call_hook('waste_post_report_creation', $report, $data); $c->user->update({ name => $original_name }) if $original_name; diff --git a/perllib/FixMyStreet/App/Form/Waste/Request/Brent.pm b/perllib/FixMyStreet/App/Form/Waste/Request/Brent.pm index fd7873f1e0a..3924820cfea 100644 --- a/perllib/FixMyStreet/App/Form/Waste/Request/Brent.pm +++ b/perllib/FixMyStreet/App/Form/Waste/Request/Brent.pm @@ -52,11 +52,6 @@ has_page about_you => ( next => 'summary', ); -has_page request_refuse_call_us => ( - fields => [], - template => 'waste/refuse_call_us.html', -); - has_page request_extra_refusal => ( fields => [], template => 'waste/refuse_extra_container.html', @@ -70,6 +65,10 @@ has_page replacement => ( my $choice = $data->{"container-choice"}; my $reason = $data->{request_reason}; + if ($choice == $CONTAINER_GREY_BIN && $reason eq 'extra') { + return 'request_extra_refusal' if $data->{refuse_outcome}; + return 'request_refuse_container'; + } return 'about_you' if $choice == $CONTAINER_CLEAR_SACK; return 'how_long_lived' if $reason eq 'new_build'; return 'request_extra_refusal' if $reason eq 'extra' && $data->{ordered_previously}; @@ -146,7 +145,7 @@ sub options_request_reason { push @options, { value => 'damaged', label => 'My container is damaged' }; push @options, { value => 'missing', label => 'My container is missing' }; } else { - push @options, { value => 'new_build', label => 'I am a new resident without a container' }; + push @options, { value => 'new_build', label => 'I am a new resident without a container' } unless $choice == $CONTAINER_GREY_BIN; push @options, { value => 'damaged', label => 'My container is damaged' }; push @options, { value => 'missing', label => 'My container is missing' }; push @options, { value => 'extra', label => 'I would like an extra container' }; @@ -171,6 +170,33 @@ has_field how_long_lived => ( ], ); +has_page request_refuse_container => ( + title => 'Household details', + intro => 'refuse_call_us.html', + fields => [ 'property_people', 'property_children', 'continue'], + next => 'about_you', +); + +has_field property_people =>( + required => 1, + type => 'Select', + label => 'How many people live at your property?', + options => [ + { value => '1', label => 'Up to 5' }, + { value => '6', label => '6 or more' } + ], +); + +has_field property_children =>( + required => 1, + type => 'Select', + label => 'Do any children live at the property?', + options => [ + { value => 'No', label => 'No' }, + { value => 'Yes', label => 'Yes' } + ], +); + has_field submit => ( type => 'Submit', value => 'Request container', diff --git a/perllib/FixMyStreet/Cobrand/Brent.pm b/perllib/FixMyStreet/Cobrand/Brent.pm index 4e4ee298e79..03b1cfec924 100644 --- a/perllib/FixMyStreet/Cobrand/Brent.pm +++ b/perllib/FixMyStreet/Cobrand/Brent.pm @@ -1228,6 +1228,9 @@ sub waste_munge_request_form_fields { next unless $key =~ /^container-(\d+)/; my $id = $1; my ($cost, $hint) = $self->request_cost($id); + if (!$hint) { + $hint = $id == $CONTAINER_IDS{rubbish_grey_bin} ? 'Chargeable - Subject to approval' : ''; + } push @radio_options, { value => $id, label => $self->{c}->stash->{containers}->{$id}, @@ -1291,7 +1294,7 @@ sub waste_munge_request_data { my $c = $self->{c}; - for (qw(how_long_lived contamination_reports ordered_previously)) { + for (qw(how_long_lived contamination_reports ordered_previously property_people property_children)) { $c->set_param("request_$_", $data->{$_} || ''); } if (request_referral($id, $data)) { @@ -1357,6 +1360,20 @@ sub request_referral { # return 1 if ($data->{contamination_reports} || 0) >= 3; # Will be present on missing only return 1 if ($data->{how_long_lived} || '') eq '3more'; # Will be present on new build only return 1 if $data->{ordered_previously}; + + if ( + ( ($data->{'container-choice'} && $data->{'container-choice'} == $CONTAINER_IDS{rubbish_grey_bin}) + || $data->{'container-' . $CONTAINER_IDS{rubbish_grey_bin}} + ) + ) { + if ($data->{request_reason} eq 'extra') { + if ($data->{property_people} == 6 || $data->{property_children} eq 'Yes') { + return 1; + } + } else { + return 1; + } + } } sub waste_request_form_first_title { 'Which container do you need?' } @@ -1366,7 +1383,26 @@ sub waste_request_form_first_next { return sub { my $data = shift; my $choice = $data->{"container-choice"}; - return 'request_refuse_call_us' if $choice == $CONTAINER_IDS{rubbish_grey_bin}; + if ($choice == $CONTAINER_IDS{rubbish_grey_bin}) { + my $date = DateTime->now()->subtract( weeks => 2 ); + my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d'); + my $c = $self->{c}; + $data->{refuse_outcome} = $c->cobrand->problems->search( + { + category => 'Request new container', + title => ['Request new General rubbish bin (grey bin)'], + confirmed => { '>=', $parser->format_datetime($date) }, + uprn => $c->stash->{property}{uprn}, + } + )->first; + }; + if ($data->{refuse_outcome}) { + if ($data->{refuse_outcome}->get_extra_field_value('request_referral')) { + $data->{refuse_outcome} = 'referral'; + } else { + $data->{refuse_outcome} = 'capacity'; + } + }; return 'replacement'; }; } @@ -1493,6 +1529,26 @@ sub waste_garden_mod_params { } } + +sub waste_post_report_creation { + my ($self, $report, $data) = @_; + + if ( + $report->title =~ /Request new General rubbish bin \(grey bin\)/ + && $data->{request_reason} eq 'extra' + ) { + + if ($report->get_extra_field_value('request_referral')) { + $report->detail('Request forwarded to Brent Council by email'); + } else { + $self->{c}->stash->{brent_request_automatic} = 1; + $report->detail('Request automatically calculated'); + $report->state('fixed - council'); + } + $report->update; + } +}; + =item * Uses custom text for the title field for new reports. =cut diff --git a/t/cobrand/brent.t b/t/cobrand/brent.t index 810fd9b59f0..1579185f127 100644 --- a/t/cobrand/brent.t +++ b/t/cobrand/brent.t @@ -206,6 +206,8 @@ create_contact({ category => 'Request new container', email => 'request@example. { code => 'request_how_long_lived', required => 0, automated => 'hidden_field' }, { code => 'request_ordered_previously', required => 0, automated => 'hidden_field' }, { code => 'request_contamination_reports', required => 0, automated => 'hidden_field' }, + { code => 'request_property_people', required => 0, automated => 'hidden_field' }, + { code => 'request_property_nappies', required => 0, automated => 'hidden_field' }, ); create_contact({ category => 'Assisted collection add', email => 'Echo-assisted' }, { code => 'Notes', description => 'Additional notes', required => 0, datatype => 'text' }, @@ -1281,10 +1283,6 @@ FixMyStreet::override_config { $mech->content_contains('Request a recycling container'); $mech->follow_link_ok({url => 'http://brent.fixmystreet.com/waste/12345/request'}); - $mech->submit_form_ok({ with_fields => { 'container-choice' => 16 } }, "Choose refuse bin"); - $mech->content_contains('Apply for a new/replacement refuse bin'); - $mech->back; - $mech->submit_form_ok({ with_fields => { 'container-choice' => 13 } }, "Choose garden bin"); $mech->content_contains("Why do you need a replacement container?"); $mech->content_contains("My container is damaged", "Can report damaged container"); @@ -1343,6 +1341,78 @@ FixMyStreet::override_config { restore_time(); }; + subtest 'test requesting a replacement refuse container' => sub { + $mech->get_ok('/waste/12345'); + $mech->follow_link_ok({url => 'http://brent.fixmystreet.com/waste/12345/request'}); + $mech->submit_form_ok({ with_fields => { 'container-choice' => 16 } }, "Choose refuse bin"); + $mech->submit_form_ok({ with_fields => { 'request_reason' => 'damaged' } }, "Request replacement for damaged refuse container"); + $mech->submit_form_ok({ with_fields => { name => "Test McTest", email => $user1->email } }); + $mech->submit_form_ok({ with_fields => { 'process' => 'summary' } }); + $mech->content_contains('Your container request has been sent'); + my ($report) = FixMyStreet::DB->resultset('Problem')->search( + { + category => 'Request new container', + title => ['Request new General rubbish bin (grey bin)'], + } + ); + is $report->get_extra_field_value('request_referral'), 1, "Damaged refuse container is a referral"; + $report->delete; + }; + + subtest 'test requesting an extra refuse container' => sub { + for my $test ( + { children => 'Yes', detail => 'Request forwarded to Brent Council by email', referral => 1}, + { children => 'No', detail => 'Request automatically calculated', referral => ''}, + ) { + FixMyStreet::DB->resultset('Problem')->search( + { + category => 'Request new container', + title => ['Request new General rubbish bin (grey bin)'], + } + )->delete; + $mech->get_ok('/waste/12345'); + $mech->follow_link_ok({url => 'http://brent.fixmystreet.com/waste/12345/request'}); + $mech->submit_form_ok({ with_fields => { 'container-choice' => 16 } }, "Choose refuse bin"); + $mech->content_contains("Why do you need a replacement container?"); + $mech->content_contains("My container is damaged", "Can report damaged container"); + $mech->content_contains("I would like an extra container", "Can not request an extra container"); + $mech->content_contains("My container is missing", "Can report missing container"); + $mech->content_lacks("I am a new resident without a container", "Can not request new container as new resident"); + $mech->submit_form_ok({ with_fields => { 'request_reason' => 'extra' } }, "Request extra container"); + $mech->content_contains('Household details', "Questions for extra refuse container"); + $mech->submit_form_ok({ with_fields => + { + 'property_people' => 'Up to 5' , + 'property_children' => $test->{children}, + }, + }, "Request extra container"); + $mech->submit_form_ok({ with_fields => { name => "Test McTest", email => $user1->email } }); + $mech->submit_form_ok({ with_fields => { 'process' => 'summary' } }); + if ($test->{referral}) { + $mech->content_contains('Your container request has been sent'); + $mech->content_contains('contact you to let you know if your request has been approved'); + } else { + $mech->content_lacks('Your container request'); + $mech->content_lacks('contact you to let you know if your request has been approved'); + $mech->content_contains('Your property meets current general waste bin capacity requirements'); + } + $mech->content_lacks('A copy has been sent to your email address'); + my ($report) = FixMyStreet::DB->resultset('Problem')->search({ category => 'Request new container' })->order_by('-id')->first; + is $report->detail, $test->{detail}; + is $report->get_extra_field_value('request_referral'), $test->{referral}, "Correct referral status"; + is $report->state, $test->{referral} ? 'confirmed' : 'fixed - council'; + $mech->get_ok('/waste/12345'); + $mech->follow_link_ok({url => 'http://brent.fixmystreet.com/waste/12345/request'}); + $mech->submit_form_ok({ with_fields => { 'container-choice' => 16 } }, "Choose refuse bin"); + $mech->submit_form_ok({ with_fields => { 'request_reason' => 'extra' } }, "Request extra container"); + if ($test->{referral}) { + $mech->content_contains('We are unable to complete your request because our records show a similar container'); + } else { + $mech->content_contains('Your property meets current general waste bin capacity requirements'); + } + }; + }; + subtest 'test requesting a container with payment' => sub { for my $test ( # { id => 11, name => 'food waste caddy', service_id => 316, pence_cost => 500 }, diff --git a/templates/web/base/waste/confirmation.html b/templates/web/base/waste/confirmation.html index f7d738ebe9d..cfb5ecd325c 100644 --- a/templates/web/base/waste/confirmation.html +++ b/templates/web/base/waste/confirmation.html @@ -2,6 +2,8 @@ IF report.category == 'Request new container' || report.category == 'Request container removal'; IF cobrand.moniker == 'bexley'; title = 'Your bin request has been sent'; + ELSIF cobrand.moniker == 'brent' AND brent_request_automatic; + title = ''; ELSE; title = 'Your container request has been sent'; END; @@ -14,11 +16,27 @@ END ~%] [% PROCESS 'waste/header.html' %] +[% IF report.category == 'Request new container' && c.cobrand.moniker == 'brent' && brent_request_automatic %] +
+[% ELSE %]
+[% END %]

[% title %]

+ [% IF report.category == 'Request new container' && c.cobrand.moniker == 'brent' %] + [% IF NOT brent_request_automatic %] +

Your application has been sent to Brent Council who will + contact you to let you know if your request has been approved. If it has, they will need + to take payment before any bins can be delivered. +

+ [% ELSE %] +

+ Your property meets current general waste bin capacity requirements. +

+ [% END %] + [% ELSE %]

[% IF report.user.email && report.get_extra_metadata('contributed_as') != 'anonymous_user' %] A copy has been sent to your email address, [% report.user.email %]. @@ -30,6 +48,7 @@

[% END %] [% INCLUDE 'waste/_report_ids.html' %]

+ [% END %]

diff --git a/templates/web/base/waste/summary_request.html b/templates/web/base/waste/summary_request.html index f8769c94d52..dac5c762a6f 100644 --- a/templates/web/base/waste/summary_request.html +++ b/templates/web/base/waste/summary_request.html @@ -28,8 +28,29 @@ [% IF data.$removal_key %][% data.$removal_key %] to remove[% END %] [% END %] -
- [% END %] + + [% IF c.cobrand.moniker == 'brent' AND containers.$container_id == 'General rubbish bin (grey bin)' AND data.request_reason == 'extra' %] +
+
Household details
+
+
+
+ + + +
+
+
+
+
People at propery
+
[% label_for_field(form, 'property_people', data.property_people) %]
+
+
+
Children at property
+
[% label_for_field(form, 'property_children', data.property_children) %]
+
+ [% END %] + [% END %] [% FOR removal IN data.keys.grep('^removal-') %] [% SET container_key = removal.replace('removal-', 'container-') %] [% SET container_id = removal.replace('removal-', '') %] diff --git a/templates/web/brent/waste/refuse_call_us.html b/templates/web/brent/waste/refuse_call_us.html index 5cc20b60136..c0a9b99117d 100644 --- a/templates/web/brent/waste/refuse_call_us.html +++ b/templates/web/brent/waste/refuse_call_us.html @@ -1,11 +1,3 @@ -[% USE date(format='%Y%m%d') ~%] -[% PROCESS 'waste/header.html' %] -[% IF property %] - [% INCLUDE 'waste/_address_display.html' %] -[% END %] - -

Please complete this form to apply for a new/replacement refuse bin

-

New and replacement rubbish bins cost: