Skip to content

Commit

Permalink
fixup! [Kingston] Allow multiple bins to be requested.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed May 7, 2024
1 parent dc7e6e6 commit 64b6812
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion perllib/FixMyStreet/App/Form/Field/Checkbox.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package FixMyStreet::App::Form::Field::Checkbox;

# Same as HTML::FormHandler, but easier customisation of the option label
# Same as HTML::FormHandler, but easier customisation of the option label and hint

use HTML::FormHandler::Moose;
extends 'HTML::FormHandler::Field::Checkbox';
Expand All @@ -18,4 +18,10 @@ has build_option_label_method => (
handles => { 'build_option_label' => 'execute_method' },
);

has 'option_hint' => (
is => 'rw',
lazy => 1,
default => '',
);

1;
15 changes: 15 additions & 0 deletions perllib/FixMyStreet/Cobrand/Kingston.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use constant CONTAINER_REFUSE_240 => 2;
use constant CONTAINER_REFUSE_360 => 3;
use constant CONTAINER_RECYCLING_BIN => 12;
use constant CONTAINER_RECYCLING_BOX => 16;
use constant CONTAINER_FOOD_OUTDOOR => 24;

=head2 waste_on_the_day_criteria
Expand Down Expand Up @@ -112,6 +113,20 @@ sub garden_waste_renewal_sacks_cost_pa {

sub waste_request_single_radio_list { 0 }

=head2 bin_request_form_extra_fields
We want an extra message on the outdoor food container option.
=cut

sub bin_request_form_extra_fields {
my ($self, $service, $id, $field_list) = @_;

return unless $id == CONTAINER_FOOD_OUTDOOR;
my %fields = @$field_list;
$fields{"container-$id"}{option_hint} = 'Only three are allowed per property. Any more than this will not be collected.';
}

=head2 waste_munge_request_form_fields
If we're looking to change capacity, list the possibilities here.
Expand Down
1 change: 1 addition & 0 deletions t/app/controller/waste_kingston_r.t
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ FixMyStreet::override_config {
subtest 'Request new containers' => sub {
$mech->get_ok('/waste/12345/request');
# Missing 2, Damaged 19, Damaged+missing 16, two missing 24
$mech->content_contains('Only three are allowed per property');
$mech->submit_form_ok({ with_fields => { 'container-2' => 1, 'container-19' => 1, 'container-16' => 1, 'quantity-16' => 2, 'quantity-24' => 2, 'container-24' => 1, 'quantity-19' => 1 }});
$mech->submit_form_ok({ with_fields => { 'removal-2' => 0, 'removal-19' => 1, 'removal-16' => 1, 'removal-12' => 1, 'removal-24' => 0 } });
$mech->submit_form_ok({ with_fields => { 'how_many' => '5more' }});
Expand Down
2 changes: 1 addition & 1 deletion templates/web/base/govuk/fields.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[% ELSIF field.widget == 'CheckboxGroup' %]
[% PROCESS checkboxes options=field.options %]
[% ELSIF field.widget == 'Checkbox' %]
[% PROCESS checkboxes options=[{ value = 1, label = field.option_label, disabled = field.disabled }] %]
[% PROCESS checkboxes options=[{ value = 1, label = field.option_label, hint = field.option_hint, disabled = field.disabled }] %]
[% ELSIF field.type == 'DateTime' %]
[% PROCESS date %]
[% ELSIF field.type == 'Photo' %]
Expand Down
1 change: 0 additions & 1 deletion templates/web/kingston/waste/request/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@

<p>There is an £[% tprintf('%.2f', c.cobrand.request_cost(1, 1).0 / 100).replace('\.00$', '') %] administration/delivery charge for any container except for bags and food waste bins,
reduced to £[% tprintf('%.2f', c.cobrand.request_cost(1, 1).0 / 200).replace('\.00$', '') %] for subsequent containers.</p>
<p>Only 3 outdoor food caddies are allowed per property. Any more than this will not be collected.</p>

[% END %]

0 comments on commit 64b6812

Please sign in to comment.