Skip to content

Commit e0a2fea

Browse files
committed
[Kingston] Show removals on request summary page.
1 parent 73e286e commit e0a2fea

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

perllib/FixMyStreet/App/Form/Waste/Request/Merton/Larger.pm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ has_page how_much => (
4545
return 'how_many' if $how_much eq 'less1';
4646
return 'request_static' if $how_much eq '3more';
4747
$data->{'container-' . CONTAINER_REFUSE_240} = 1;
48-
$data->{'quantity-' . CONTAINER_REFUSE_240} = 1;
49-
$data->{'removal-' . CONTAINER_REFUSE_240} = 1;
5048
return 'about_you';
5149
},
5250
);
@@ -70,8 +68,6 @@ has_page how_many => (
7068
my $data = shift;
7169
return 'request_static' if $data->{how_many} eq 'less5';
7270
$data->{'container-' . CONTAINER_REFUSE_240} = 1;
73-
$data->{'quantity-' . CONTAINER_REFUSE_240} = 1;
74-
$data->{'removal-' . CONTAINER_REFUSE_240} = 1;
7571
return 'about_you';
7672
},
7773
);

t/app/controller/waste.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ FixMyStreet::override_config {
291291
$mech->get_ok('/waste/12345/request');
292292
$mech->submit_form_ok({ with_fields => { 'container-9' => 1, 'quantity-9' => 2, 'container-10' => 1, 'quantity-10' => 1 } });
293293
$mech->submit_form_ok({ with_fields => { name => "Test McTest", email => $user->email } });
294-
$mech->content_like(qr{Outside Food Waste Container</dt>\s*<dd[^>]*>1</dd>});
295-
$mech->content_like(qr{Kitchen Caddy</dt>\s*<dd[^>]*>2</dd>});
294+
$mech->content_like(qr{Outside Food Waste Container</dt>\s*<dd[^>]*>\s*1\s*</dd>});
295+
$mech->content_like(qr{Kitchen Caddy</dt>\s*<dd[^>]*>\s*2\s*</dd>});
296296
$mech->submit_form_ok({ with_fields => { process => 'summary' } });
297297
$mech->content_contains('Now check your email');
298298
my $link = $mech->get_link_from_email; # Only one email sent, this also checks

t/app/controller/waste_kingston_r.t

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ FixMyStreet::override_config {
187187
$mech->submit_form_ok({ with_fields => { name => 'Bob Marge', email => $user->email }});
188188
$mech->content_contains('Continue to payment');
189189

190+
$mech->content_like(qr/Food waste bin \(outdoor\)<\/dt>\s*<dd[^>]*>\s*2\s*<\/dd>/);
191+
$mech->content_like(qr/Green recycling box \(55L\)<\/dt>\s*<dd[^>]*>\s*2\s+to deliver,\s+1 to remove\s*<\/dd>/);
192+
$mech->content_like(qr/Black rubbish bin<\/dt>\s*<dd[^>]*>\s*1\s*<\/dd>/);
193+
$mech->content_like(qr/Blue lid paper and cardboard bin \(240L\)<\/dt>\s*<dd[^>]*>\s*1\s+to deliver,\s+1 to remove\s*<\/dd>/);
194+
$mech->content_like(qr/Green recycling bin \(240L\)<\/dt>\s*<dd[^>]*>\s*1 to remove\s*<\/dd>/);
195+
190196
$mech->waste_submit_check({ with_fields => { process => 'summary' } });
191197
my $pay_params = $sent_params;
192198
is scalar @{$pay_params->{items}}, 4, 'right number of line items';

templates/web/base/waste/summary_request.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
[% ELSE %]
1414
[% SET container_id = container.replace('container-', '') %]
1515
[% SET quantity_key = container.replace('container-', 'quantity-') %]
16+
[%# removal-* is used by Kingston %]
17+
[% SET removal_key = container.replace('container-', 'removal-') %]
1618
[% END %]
1719
<div class="govuk-summary-list__row">
1820
<dt class="govuk-summary-list__key govuk-summary-list__key--sub">[% containers.$container_id %]</dt>
@@ -21,10 +23,23 @@
2123
[% ELSIF c.cobrand.moniker == 'sutton' %]
2224
<dd class="govuk-summary-list__value">[% data.request_reason.ucfirst %]</dd>
2325
[% ELSE %]
24-
<dd class="govuk-summary-list__value">[% data.$quantity_key %]</dd>
26+
<dd class="govuk-summary-list__value">
27+
[% data.$quantity_key %]
28+
[% ' to deliver, ' IF data.$quantity_key AND data.$removal_key %]
29+
[% IF data.$removal_key %][% data.$removal_key %] to remove[% END %]
30+
</dd>
2531
[% END %]
2632
</div>
2733
[% END %]
34+
[% FOR removal IN data.keys.grep('^removal-') %]
35+
[% SET container_key = removal.replace('removal-', 'container-') %]
36+
[% SET container_id = removal.replace('removal-', '') %]
37+
[% NEXT UNLESS data.$removal AND NOT data.$container_key %]
38+
<div class="govuk-summary-list__row">
39+
<dt class="govuk-summary-list__key govuk-summary-list__key--sub">[% containers.$container_id %]</dt>
40+
<dd class="govuk-summary-list__value">[% data.$removal %] to remove</dd>
41+
</div>
42+
[% END %]
2843

2944
[% IF data.payment %]
3045
<div class="govuk-summary-list__row">

0 commit comments

Comments
 (0)