Skip to content

Commit

Permalink
[Merton] Initial WasteWorks setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Apr 9, 2024
1 parent 1caff93 commit cbe92c6
Show file tree
Hide file tree
Showing 12 changed files with 846 additions and 285 deletions.
38 changes: 38 additions & 0 deletions perllib/FixMyStreet/App/Form/Waste/Request/Merton.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package FixMyStreet::App::Form::Waste::Request::Merton;

use utf8;
use HTML::FormHandler::Moose;
extends 'FixMyStreet::App::Form::Waste::Request';

has_page about_you => (
fields => ['name', 'email', 'phone', 'continue'],
intro => 'about_you.html',
title => 'About you',
next => 'summary',
);

has_page replacement => (
fields => ['request_reason', 'continue'],
title => 'Reason for request',
next => 'about_you',
);

has_field request_reason => (
required => 1,
type => 'Select',
widget => 'RadioGroup',
label => 'Why do you need a replacement container?',
);

sub options_request_reason {
my $form = shift;
my @options = (
{ value => 'new_build', label => 'I am a new resident without a container' },
{ value => 'damaged', label => 'Damaged' },
{ value => 'missing', label => 'Missing' },
{ value => 'more', label => 'I need an additional container/bin' },
);
return @options;
}

1;
2 changes: 2 additions & 0 deletions perllib/FixMyStreet/Cobrand/Bexley/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ sub image_for_unit {

sub bin_day_format { '%A, %-d~~~ %B %Y' }

sub waste_images_2x_unavailable { 1 }

# TODO This logic is copypasted across multiple files; get it into one place
my %irregulars = ( 1 => 'st', 2 => 'nd', 3 => 'rd', 11 => 'th', 12 => 'th', 13 => 'th');
sub ordinal {
Expand Down
1 change: 1 addition & 0 deletions perllib/FixMyStreet/Cobrand/Merton.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use strict;
use warnings;
use Moo;
with 'FixMyStreet::Roles::CobrandOpenUSRN';
with 'FixMyStreet::Cobrand::Merton::Waste';

sub council_area_id { 2500 }
sub council_area { 'Merton' }
Expand Down
127 changes: 127 additions & 0 deletions perllib/FixMyStreet/Cobrand/Merton/Waste.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
package FixMyStreet::Cobrand::Merton::Waste;

use Moo::Role;
with 'FixMyStreet::Roles::CobrandSLWPEcho';

use FixMyStreet::App::Form::Waste::Request::Merton;

has lpi_value => ( is => 'ro', default => 'MERTON' );

sub waste_auto_confirm_report { 1 }

sub service_name_override {
my ($self, $service) = @_;

my %service_name_override = (
2238 => 'Non-recyclable Refuse',
2239 => 'Food waste',
2240 => 'Paper and card',
2241 => 'Mixed recycling',
2242 => 'Non-recyclable Refuse',
2243 => 'Non-recyclable Refuse',
2246 => 'Mixed recycling',
2247 => 'Garden Waste',
2248 => "Food waste",
2249 => "Paper and card",
2250 => "Mixed recycling",
2632 => 'Paper and card',
3571 => 'Mixed recycling',
3576 => 'Non-recyclable Refuse',
2256 => '', # Deliver refuse bags
2257 => '', # Deliver recycling bags
);

return $service_name_override{$service->{ServiceId}} // '';
}

sub waste_password_hidden { 1 }

Check warning on line 37 in perllib/FixMyStreet/Cobrand/Merton/Waste.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Merton/Waste.pm#L37

Added line #L37 was not covered by tests

sub waste_containers {
return {
1 => 'Black rubbish bin (140L)',
2 => 'Black rubbish bin (240L)',
3 => 'Black rubbish bin (360L)',
35 => 'Black rubbish bin (180L)',

4 => 'Refuse Blue Sack',
5 => 'Refuse Black Sack',
6 => 'Refuse Red Stripe Bag',

12 => 'Green recycling bin (240L)',
13 => 'Green recycling bin (360L)',
16 => 'Green recycling box (55L)',

18 => 'Recycling Blue Stripe Bag',
29 => 'Recycling Single Use Bag',

19 => 'Blue lid paper and cardboard bin (240L)',
20 => 'Blue lid paper and cardboard bin (360L)',
36 => 'Blue lid paper and cardboard bin (180L)',

21 => 'Paper & Card Reusable Bag',
22 => 'Paper Sacks',
30 => 'Paper Single Use Bag',
31 => 'Paper 55L Box',

23 => 'Food waste bin (kitchen)',
24 => 'Food waste bin (outdoor)',

26 => 'Garden waste bin (240L)',
27 => 'Garden waste bin (140L)',
28 => 'Garden waste sacks',

7 => 'Communal Refuse bin (240L)',
8 => 'Communal Refuse bin (360L)',
9 => 'Communal Refuse bin (660L)',
10 => 'Communal Refuse bin (1100L)',
11 => 'Communal Refuse Chamberlain',
33 => 'Communal Refuse bin (140L)',
34 => 'Communal Refuse bin (1280L)',
14 => 'Communal Recycling bin (660L)',
15 => 'Communal Recycling bin (1100L)',
25 => 'Communal Food bin (240L)',
};
}

sub image_for_unit {
my ($self, $unit) = @_;
my $base = '/i/waste-containers';
my $service_id = $unit->{service_id};
my $images = {
2238 => "$base/bin-black", # refuse
2239 => "$base/caddy-brown-large", # food
2240 => "$base/bin-grey-blue-lid-recycling", # paper and card
2241 => "$base/box-green-mix", # dry mixed
2242 => "$base/sack-clear-red", # domestic refuse bag
2243 => "$base/large-communal-grey-black-lid", # Communal refuse
2246 => "$base/sack-clear-blue", # domestic recycling bag
2247 => "$base/bin-brown", # garden
#2248 => "$base/bin-brown", # Communal food
#2249 => "$base/bin-grey-blue-lid-recycling", # Communal paper
2250 => "$base/large-communal-green", # Communal recycling
2632 => "$base/sack-clear", # domestic paper bag
};
return $images->{$service_id};
}

# TODO
sub garden_echo_container_name { }
sub garden_container_data_extract { }
sub waste_bulky_missed_blocked_codes {}

sub waste_quantity_max {
return (
2247 => 3, # Garden waste maximum
);
}

sub waste_request_form_first_next {
my $self = shift;
return sub {
my $data = shift;
return 'about_you' if $data->{"container-18"} || $data->{"container-30"};
return 'replacement';
};
}

1;
27 changes: 24 additions & 3 deletions perllib/FixMyStreet/Roles/CobrandEcho.pm
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ sub bin_services_for_address {
}
}

my $request_allowed = ($request_allowed{$service_id} || $self->moniker eq 'kingston' || $self->moniker eq 'sutton') && $request_max && $schedules->{next};
my $request_allowed = ($request_allowed{$service_id} || !%service_to_containers) && $request_max && $schedules->{next};
my $row = {
id => $_->{Id},
service_id => $service_id,
Expand Down Expand Up @@ -512,6 +512,27 @@ sub waste_task_resolutions {
}
}

=head2 waste_on_the_day_criteria
Treat an Outstanding/Allocated task as if it's the next collection and in
progress, and do not allow missed collection reporting if the task is not
completed.
=cut

sub waste_on_the_day_criteria {
my ($self, $completed, $state, $now, $row) = @_;

if ($state eq 'Outstanding' || $state eq 'Allocated') {
$row->{next} = $row->{last};
$row->{next}{state} = 'In progress';
delete $row->{last};
}
if (!$completed) {
$row->{report_allowed} = 0;
}
}

sub bin_future_collections {
my $self = shift;

Expand Down Expand Up @@ -565,7 +586,7 @@ sub admin_templates_external_status_code_hook {

my $code = "$res_code,$task_type,$task_state";
$code = '' if $code eq ',,';
$code =~ s/,,$// if $code && $self->moniker eq 'brent';
$code =~ s/,,$// if $code && ($self->moniker eq 'brent' || $self->moniker eq 'merton');

return $code;
}
Expand Down Expand Up @@ -667,7 +688,7 @@ sub construct_waste_open311_update {
my $status = $event_type->{states}{$state_id}{state};
my $description = $event_type->{resolution}{$resolution_id} || $event_type->{states}{$state_id}{name};
my $external_status_code;
if ($self->moniker eq "brent") {
if ($self->moniker eq "brent" || $self->moniker eq 'merton') {
$external_status_code = $resolution_id ? "$resolution_id" : "",
} else {
$external_status_code = $resolution_id ? "$resolution_id,," : "",
Expand Down

0 comments on commit cbe92c6

Please sign in to comment.