Skip to content

Commit 188c7d8

Browse files
Add advice to preapp report
1 parent 22f03da commit 188c7d8

File tree

8 files changed

+235
-2
lines changed

8 files changed

+235
-2
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
@@ -2291,6 +2291,7 @@ en:
22912291
review_not_started: Not started
22922292
sending: Sending
22932293
submitted: Submitted
2294+
supported: Supported
22942295
supportive: Supportive
22952296
to_be_determined: To be determined
22962297
to_be_reviewed: To be reviewed

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

+156-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
["Site constraints", "#site-constraints"],
3737
["Site history", "#site-history"],
3838
["Site and surroundings", "#site-and-surroundings"],
39-
["Your pre-application details", "#pre-application-details"],
39+
["Considerations and advice", "#considerations-advice"],
40+
["Policies and guidance", "#policies-guidance"],
41+
["Requirements", "#requirements"],
4042
["Next steps", "#next-steps"],
4143
["Disclaimer", "#disclaimer"]
4244
]}
@@ -262,9 +264,162 @@
262264
No site description set.
263265
</p>
264266
<% end %>
267+
</section>
268+
269+
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
270+
271+
<section id="considerations-advice">
272+
<div class="flex-between govuk-!-margin-bottom-2">
273+
<h2 class="govuk-heading-m">Planning considerations and advice</h2>
274+
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_considerations_path(
275+
@planning_application,
276+
return_to: "report"
277+
) %>
278+
</div>
279+
280+
<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>
281+
282+
<%= govuk_table(html_attributes: {class: "govuk-table--borderless"}) do |table| %>
283+
<% table.with_body do |body|
284+
body.with_row do |row|
285+
row.with_cell(text: "‘Supported’", header: true)
286+
row.with_cell(text: "means that the current proposal is likely to be supported")
287+
end
288+
body.with_row do |row|
289+
row.with_cell(text: "‘Needs changes’", header: true)
290+
row.with_cell(text: "means that an element of the proposal is likely to be supported subject to suggested changes")
291+
end
292+
body.with_row do |row|
293+
row.with_cell(text: "‘Does not comply’", header: true)
294+
row.with_cell(text: "means that an element of the proposal will not be acceptable and permission is likely to be refused")
295+
end
296+
end %>
297+
<% end %>
298+
299+
<%= govuk_table(html_attributes: {id: "considerations-overview"}) do |table| %>
300+
<% table.with_head do |head|
301+
head.with_row do |row|
302+
row.with_cell(text: "Consideration")
303+
row.with_cell(text: "Element of proposal")
304+
row.with_cell(text: "Status")
305+
end
306+
end %>
307+
<% table.with_body do |body|
308+
@planning_application.considerations.each do |consideration|
309+
body.with_row do |row|
310+
row.with_cell(text: consideration.policy_area)
311+
row.with_cell(text: consideration.proposal)
312+
row.with_cell(text: render(StatusTags::PreappComponent.new(status: consideration.summary_tag)))
313+
end
314+
end
315+
end %>
316+
<% end %>
317+
318+
<% @planning_application.considerations.group_by(&:policy_area).each do |policy_area, considerations| %>
319+
<%= govuk_summary_card(title: policy_area) do %>
320+
<% considerations.each do |consideration| %>
321+
<div class="flex-between">
322+
<strong class="govuk-heading-s"><%= consideration.proposal %></strong>
323+
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_considerations_path(
324+
@planning_application,
325+
return_to: "report"
326+
) %>
327+
</div>
328+
329+
<%= render StatusTags::PreappComponent.new(status: consideration.summary_tag) %><br>
330+
331+
<div class="govuk-body govuk-!-margin-top-4"><strong>Relevant policies</strong><br>
332+
<ul class="govuk-list">
333+
<% consideration.policy_references.each do |reference| %>
334+
<li class="govuk-body">
335+
<% if reference.url.present? %>
336+
<%= govuk_link_to reference.code_and_description, reference.url %>
337+
<% else %>
338+
<%= reference.code_and_description %>
339+
<% end %>
340+
</li>
341+
<% end %>
342+
</ul>
343+
</div>
344+
345+
<p class="govuk-body">
346+
<%= render(FormattedContentComponent.new(text: consideration.assessment)) %>
347+
</p>
348+
<p class="govuk-body">
349+
<%= render(FormattedContentComponent.new(text: consideration.conclusion)) %>
350+
</p>
351+
<% end %>
352+
<% end %>
353+
<% end %>
354+
265355
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
356+
357+
<section id="summary-advice">
358+
<div class="flex-between">
359+
<h2 class="govuk-heading-m">Summary</h2>
360+
<% if @summary_of_advice&.summary_tag %>
361+
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_assessment_detail_path(
362+
@planning_application, @summary_of_advice, category: "summary_of_advice", return_to: "report"
363+
) %>
364+
<% else %>
365+
<%= govuk_link_to "Add outcome", main_app.new_planning_application_assessment_assessment_detail_path(
366+
@planning_application, category: "summary_of_advice", return_to: "report"
367+
) %>
368+
<% end %>
369+
</div>
370+
371+
<p class="govuk-body">This is the case officer's summary of the conclusions and advice.</p>
372+
<p class="govuk-body grey-border-box">
373+
<%= @planning_application.summary_of_advice&.entry || "[none given]" %>
374+
</p>
375+
</section>
376+
</section>
377+
378+
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
379+
380+
<section id="policies-guidance">
381+
<h2 class="govuk-heading-m">List of relevant policies and guidance</h2>
382+
<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>
383+
384+
<% @planning_application.considerations.group_by(&:policy_area).each do |policy_area, considerations| %>
385+
<% references = considerations.map(&:policy_references).flatten %>
386+
<p class="govuk-body"><strong><%= policy_area.humanize %></strong></p>
387+
<ul class="govuk-list">
388+
<% references.each do |reference| %>
389+
<li><%= govuk_link_to reference.description, reference.url %></li>
390+
<% end %>
391+
</ul>
392+
<% end %>
266393
</section>
267394

395+
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
396+
397+
<section id="requirements">
398+
<div class="flex-between">
399+
<h2 class="govuk-heading-m">Requirements</h2>
400+
<%= govuk_link_to "Edit", main_app.planning_application_assessment_requirements_path(@planning_application, return_to: "report") %>
401+
</div>
402+
403+
<p class="govuk-body">Should you wish to submit an application, the following requirements are needed:</p>
404+
<% @planning_application.requirements.group_by(&:category).each do |category, requirements| %>
405+
<%= govuk_summary_card(title: category.humanize) do %>
406+
<ul class="govuk-list govuk-list--divided">
407+
<% requirements.each do |requirement| %>
408+
<li>
409+
<p class="govuk-body"><%= govuk_link_to requirement.description, requirement.url %></p>
410+
<% if requirement.guidelines.present? %>
411+
<p class="govuk-body govuk-hint"><%= requirement.guidelines %></p>
412+
<% end %>
413+
</li>
414+
<% end %>
415+
</ul>
416+
<% end %>
417+
<% end %>
418+
<!-- TODO pdf link -->
419+
</section>
420+
421+
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
422+
268423
<section id="next-steps">
269424
<h3 class="govuk-heading-s"><%= t(".next_steps_heading") %></h3>
270425

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

+40
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@
4040
user: reviewer,
4141
local_authority:,
4242
boundary_geojson:,
43+
consideration_set:,
4344
validated_at: Time.zone.local(2024, 6, 1),
4445
determined_at: Time.zone.local(2024, 6, 20),
4546
description: "Single-storey rear extension",
4647
recommended_application_type: create(:application_type, :householder)
4748
)
4849
end
4950

51+
let(:consideration_set) { create(:consideration_set, considerations: create_list(:consideration, 3)) }
52+
let(:local_authority_requirements) { create_list(:local_authority_requirement, 3, local_authority:) }
53+
let!(:requirements) { local_authority_requirements.map { |r| planning_application.requirements.create(**r.as_json.except("id", "local_authority_id", "search")) } }
54+
5055
let!(:site_visit) do
5156
create(:site_visit, planning_application:, visited_at: Time.zone.local(2024, 6, 10))
5257
end
@@ -117,6 +122,14 @@
117122
end
118123
end
119124

125+
it "displays the summary of advice section" do
126+
within("#summary-advice") do
127+
expect(page).to have_content("Summary")
128+
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")
129+
expect(page).to have_content("Looks good")
130+
end
131+
end
132+
120133
it "displays the officer contact details" do
121134
within("#contact-details") do
122135
expect(page).to have_content(reviewer.name)
@@ -372,6 +385,33 @@
372385
end
373386
end
374387

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

0 commit comments

Comments
 (0)