Skip to content

Commit 4de1391

Browse files
Add advice to preapp report
1 parent 73b9575 commit 4de1391

File tree

9 files changed

+236
-14
lines changed

9 files changed

+236
-14
lines changed

Diff for: app/assets/stylesheets/_main.scss

+15-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ body {
471471

472472
.comment-component {
473473
border-left: 10px solid $govuk-link-colour;
474-
background-color: #F2F9FF;
474+
background-color: #f2f9ff;
475475
}
476476

477477
.govuk-details--borderless {
@@ -595,3 +595,17 @@ body {
595595
position: relative;
596596
}
597597
}
598+
599+
.govuk-list--divided {
600+
li + li {
601+
border-top: 1px solid govuk-colour("mid-grey");
602+
padding-top: 1rem;
603+
}
604+
}
605+
606+
.govuk-table--borderless {
607+
.govuk-table__header,
608+
.govuk-table__cell {
609+
border-bottom: none;
610+
}
611+
}

Diff for: app/components/status_tags/preapp_component.rb

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
module StatusTags
4+
class PreappComponent < BaseComponent
5+
private
6+
7+
def status
8+
return :supported if @status&.to_sym == :complies
9+
10+
super
11+
end
12+
13+
def colour
14+
return "green" if status == :supported
15+
16+
super
17+
end
18+
end
19+
end

Diff for: app/controllers/planning_applications/assessment/considerations_controller.rb

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class ConsiderationsController < BaseController
77
before_action :set_considerations
88
before_action :set_consideration
99
before_action :set_review
10+
before_action :store_return_to_report_path, only: %i[create edit]
1011

1112
def create
1213
@consideration.submitted_by = current_user

Diff for: app/controllers/planning_applications/assessment/requirements_controller.rb

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Assessment
55
class RequirementsController < BaseController
66
before_action :set_requirements, only: %i[index create]
77
before_action :set_requirement, only: %i[update edit destroy]
8+
before_action :store_return_to_report_path, only: %i[index]
89

910
def index
1011
@categories = LocalAuthority::Requirement.categories

Diff for: app/models/planning_application.rb

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ class WithdrawOrCancelError < RuntimeError; end
8282
has_one :consistency_checklist
8383
has_one :informative_set
8484
has_one :pre_commencement_condition_set, -> { where(pre_commencement: true) }, class_name: "ConditionSet", required: false
85+
86+
has_many :considerations, through: :consideration_set
8587
end
8688

8789
with_options to: :application_type do

Diff for: config/locales/en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2292,6 +2292,7 @@ en:
22922292
review_not_started: Not started
22932293
sending: Sending
22942294
submitted: Submitted
2295+
supported: Supported
22952296
supportive: Supportive
22962297
to_be_determined: To be determined
22972298
to_be_reviewed: To be reviewed

Diff for: engines/bops_reports/app/views/bops_reports/planning_applications/show.html.erb

+150-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
["Site constraints", "#site-constraints"],
5555
["Site history", "#site-history"],
5656
["Site and surroundings", "#site-and-surroundings"],
57-
["Your pre-application details", "#pre-application-details"],
57+
["Considerations and advice", "#considerations-advice"],
58+
["Policies and guidance", "#policies-guidance"],
59+
["Requirements", "#requirements"],
5860
["Next steps", "#next-steps"],
5961
["Disclaimer", "#disclaimer"]
6062
]}
@@ -280,9 +282,156 @@
280282
No site description set.
281283
</p>
282284
<% end %>
285+
</section>
286+
287+
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
288+
289+
<section id="considerations-advice">
290+
<div class="flex-between govuk-!-margin-bottom-2">
291+
<h2 class="govuk-heading-m">Planning considerations and advice</h2>
292+
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_considerations_path(
293+
@planning_application,
294+
return_to: "report"
295+
) %>
296+
</div>
297+
298+
<p class="govuk-body"> This section includes the case officer's assessment of your proposal against relevant policy and guidance. The elements of the proposal are grouped by how acceptable they are:</p>
299+
300+
<%= govuk_table(html_attributes: {class: "govuk-table--borderless"}) do |table| %>
301+
<% table.with_body do |body|
302+
body.with_row do |row|
303+
row.with_cell(text: "‘Supported’", header: true)
304+
row.with_cell(text: "means that the current proposal is likely to be supported")
305+
end
306+
body.with_row do |row|
307+
row.with_cell(text: "‘Needs changes’", header: true)
308+
row.with_cell(text: "means that an element of the proposal is likely to be supported subject to suggested changes")
309+
end
310+
body.with_row do |row|
311+
row.with_cell(text: "‘Does not comply’", header: true)
312+
row.with_cell(text: "means that an element of the proposal will not be acceptable and permission is likely to be refused")
313+
end
314+
end %>
315+
<% end %>
316+
317+
<%= govuk_table(html_attributes: {id: "considerations-overview"}) do |table| %>
318+
<% table.with_head do |head|
319+
head.with_row do |row|
320+
row.with_cell(text: "Consideration")
321+
row.with_cell(text: "Element of proposal")
322+
row.with_cell(text: "Status")
323+
end
324+
end %>
325+
<% table.with_body do |body|
326+
@planning_application.considerations.each do |consideration|
327+
body.with_row do |row|
328+
row.with_cell(text: consideration.policy_area)
329+
row.with_cell(text: consideration.proposal)
330+
row.with_cell(text: render(StatusTags::PreappComponent.new(status: consideration.summary_tag)))
331+
end
332+
end
333+
end %>
334+
<% end %>
335+
336+
<% @planning_application.considerations.group_by(&:policy_area).each do |policy_area, considerations| %>
337+
<%= govuk_summary_card(title: policy_area) do %>
338+
<% considerations.each do |consideration| %>
339+
<div class="flex-between">
340+
<strong class="govuk-heading-s"><%= consideration.proposal %></strong>
341+
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_considerations_path(
342+
@planning_application,
343+
return_to: "report"
344+
) %>
345+
</div>
346+
347+
<%= render StatusTags::PreappComponent.new(status: consideration.summary_tag) %><br>
348+
349+
<div class="govuk-body govuk-!-margin-top-4"><strong>Relevant policies</strong><br>
350+
<ul class="govuk-list">
351+
<% consideration.policy_references.each do |reference| %>
352+
<li class="govuk-body">
353+
<% if reference.url.present? %>
354+
<%= govuk_link_to reference.code_and_description, reference.url %>
355+
<% else %>
356+
<%= reference.code_and_description %>
357+
<% end %>
358+
</li>
359+
<% end %>
360+
</ul>
361+
</div>
362+
363+
<p class="govuk-body">
364+
<%= render(FormattedContentComponent.new(text: consideration.assessment)) %>
365+
</p>
366+
<p class="govuk-body">
367+
<%= render(FormattedContentComponent.new(text: consideration.conclusion)) %>
368+
</p>
369+
<% end %>
370+
<% end %>
371+
<% end %>
372+
283373
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
374+
375+
<section id="summary-advice">
376+
<div class="flex-between">
377+
<h2 class="govuk-heading-m">Summary</h2>
378+
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_assessment_detail_path(
379+
@planning_application, @summary_of_advice, category: "summary_of_advice", return_to: "report"
380+
) %>
381+
</div>
382+
383+
<p class="govuk-body">This is the case officer's summary of the conclusions and advice.</p>
384+
<p class="govuk-body grey-border-box">
385+
<%= @planning_application.summary_of_advice.entry %>
386+
</p>
387+
</section>
388+
</section>
389+
390+
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
391+
392+
<section id="policies-guidance">
393+
<h2 class="govuk-heading-m">List of relevant policies and guidance</h2>
394+
<p class="govuk-body">You can view all relevant planning policy and guidance at <%= govuk_link_to @planning_application.local_authority.submission_guidance_url, @planning_application.local_authority.submission_guidance_url %>.</p>
395+
396+
<% @planning_application.considerations.group_by(&:policy_area).each do |policy_area, considerations| %>
397+
<% references = considerations.map(&:policy_references).flatten %>
398+
<p class="govuk-body"><strong><%= policy_area.humanize %></strong></p>
399+
<ul class="govuk-list">
400+
<% references.each do |reference| %>
401+
<li><%= govuk_link_to reference.description, reference.url %></li>
402+
<% end %>
403+
</ul>
404+
<% end %>
284405
</section>
285406

407+
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
408+
409+
<section id="requirements">
410+
<div class="flex-between">
411+
<h2 class="govuk-heading-m">Requirements</h2>
412+
<%= govuk_link_to "Edit", main_app.planning_application_assessment_requirements_path(@planning_application, return_to: "report") %>
413+
</div>
414+
415+
<p class="govuk-body">Should you wish to submit an application, the following requirements are needed:</p>
416+
<% @planning_application.requirements.group_by(&:category).each do |category, requirements| %>
417+
<%= govuk_summary_card(title: category.humanize) do %>
418+
<ul class="govuk-list govuk-list--divided">
419+
<% requirements.each do |requirement| %>
420+
<li>
421+
<p class="govuk-body"><%= govuk_link_to requirement.description, requirement.url %></p>
422+
<% if requirement.guidelines.present? %>
423+
<p class="govuk-body govuk-hint"><%= requirement.guidelines %></p>
424+
<% end %>
425+
</li>
426+
<% end %>
427+
</ul>
428+
<% end %>
429+
<% end %>
430+
<!-- TODO pdf link -->
431+
</section>
432+
433+
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
434+
286435
<section id="next-steps">
287436
<h3 class="govuk-heading-s"><%= t(".next_steps_heading") %></h3>
288437

Diff for: engines/bops_reports/spec/system/pre_application_report_spec.rb

+45-11
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,23 @@
3737
:planning_application,
3838
:pre_application,
3939
:in_assessment,
40+
:with_preapp_assessment,
4041
user: reviewer,
4142
local_authority:,
4243
boundary_geojson:,
44+
consideration_set:,
45+
consistency_checklist:,
4346
validated_at: Time.zone.local(2024, 6, 1),
4447
determined_at: Time.zone.local(2024, 6, 20),
4548
description: "Single-storey rear extension",
4649
recommended_application_type: create(:application_type, :householder)
4750
)
4851
end
4952

53+
let(:consideration_set) { create(:consideration_set, considerations: create_list(:consideration, 3)) }
54+
let(:local_authority_requirements) { create_list(:local_authority_requirement, 3, local_authority:) }
55+
let!(:requirements) { local_authority_requirements.map { |r| planning_application.requirements.create(**r.as_json.except("id", "local_authority_id", "search")) } }
56+
5057
let!(:site_visit) do
5158
create(:site_visit, planning_application:, visited_at: Time.zone.local(2024, 6, 10))
5259
end
@@ -56,9 +63,7 @@
5663

5764
let!(:assessment_detail) { create(:assessment_detail, planning_application:) }
5865

59-
let!(:summary_of_advice) do
60-
create(:assessment_detail, planning_application:, category: "summary_of_advice", summary_tag: "complies", entry: "Looks good")
61-
end
66+
let(:summary_of_advice) { planning_application.summary_of_advice }
6267

6368
let(:report_url) { "/reports/planning_applications/#{planning_application.reference}" }
6469
let!(:site_history) { create(:site_history, planning_application:) }
@@ -67,20 +72,14 @@
6772
create(:assessment_detail, planning_application:, category: "site_description", entry: "A double storey detached house adjacent to greenbelt.")
6873
end
6974

70-
let!(:consistency_checklist) do
71-
create(:consistency_checklist, :site_map_incorrect, planning_application:)
75+
let(:consistency_checklist) do
76+
create(:consistency_checklist, :site_map_incorrect)
7277
end
7378

7479
let!(:designated_conservation_area) do
7580
create(:planning_application_constraint, planning_application:)
7681
end
7782

78-
let!(:tpo) { create(:constraint, :tpo) }
79-
80-
let!(:planning_application_constraint) do
81-
create(:planning_application_constraint, constraint: tpo, planning_application:)
82-
end
83-
8483
let(:report_url) { "/planning_applications/#{planning_application.reference}" }
8584

8685
before do
@@ -117,6 +116,14 @@
117116
end
118117
end
119118

119+
it "displays the summary of advice section" do
120+
within("#summary-advice") do
121+
expect(page).to have_content("Summary")
122+
expect(page).to have_link("Edit", href: "/planning_applications/#{planning_application.reference}/assessment/assessment_details/#{summary_of_advice.id}/edit?category=summary_of_advice&return_to=report")
123+
expect(page).to have_content("Looks good")
124+
end
125+
end
126+
120127
it "displays the officer contact details" do
121128
within("#contact-details") do
122129
expect(page).to have_content(reviewer.name)
@@ -372,6 +379,33 @@
372379
end
373380
end
374381

382+
it "displays considerations" do
383+
within "#considerations-advice" do
384+
expect(page).to have_selector(".govuk-summary-card__title", text: planning_application.considerations.first.policy_area.humanize)
385+
expect(page).to have_selector("li", text: planning_application.considerations.first.policy_references.first.description)
386+
387+
within "#considerations-overview" do
388+
within ".govuk-table__body .govuk-table__row:first-child" do
389+
expect(page).to have_text(planning_application.considerations.first.policy_area)
390+
expect(page).to have_text(planning_application.considerations.first.proposal)
391+
expect(page).to have_text(planning_application.considerations.first.summary_tag)
392+
end
393+
end
394+
end
395+
end
396+
397+
it "displays policies and guidance" do
398+
end
399+
400+
it "displays requirements" do
401+
within "#requirements" do
402+
expect(page).to have_text(planning_application.local_authority.submission_guidance_url)
403+
expect(page).to have_text(planning_application.requirements.first.category.humanize)
404+
expect(page).to have_text(planning_application.requirements.first.description)
405+
expect(page).to have_text(planning_application.requirements.first.guidelines)
406+
end
407+
end
408+
375409
it "displays next steps and disclaimer" do
376410
local_authority.update(submission_guidance_url: "https://www.southwark.gov.uk/planning-and-building-control/planning-policy-and-guidance")
377411

Diff for: spec/factories/planning_application.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,10 @@
815815
trait :with_preapp_assessment do
816816
after(:create) do |planning_application|
817817
create(:assessment_detail, planning_application:, category: "site_description", entry: "A double storey detached house adjacent to greenbelt.")
818-
create(:consistency_checklist, planning_application:)
818+
create(:consistency_checklist, planning_application:) if planning_application.consistency_checklist.blank?
819819
create(:planning_application_constraint, planning_application:)
820820
create(:planning_application_constraint, constraint: create(:constraint, :tpo), planning_application:)
821+
create(:assessment_detail, planning_application:, category: "summary_of_advice", summary_tag: "complies", entry: "Looks good")
821822

822823
planning_application.update!(recommended_application_type: create(:application_type, :householder))
823824
end

0 commit comments

Comments
 (0)