Skip to content

Add considerations, advice, requirements #2263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion app/assets/stylesheets/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ body {

.comment-component {
border-left: 10px solid $govuk-link-colour;
background-color: #F2F9FF;
background-color: #f2f9ff;
}

.govuk-details--borderless {
Expand Down Expand Up @@ -595,3 +595,17 @@ body {
position: relative;
}
}

.govuk-list--divided {
li + li {
border-top: 1px solid govuk-colour("mid-grey");
padding-top: 1rem;
}
}

.govuk-table--borderless {
.govuk-table__header,
.govuk-table__cell {
border-bottom: none;
}
}
19 changes: 19 additions & 0 deletions app/components/status_tags/preapp_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

module StatusTags
class PreappComponent < BaseComponent
private

def status
return :supported if @status&.to_sym == :complies

super
end

def colour
return "green" if status == :supported

super
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
module PlanningApplications
module Assessment
class ConsiderationsController < BaseController
include ReturnToReport

before_action :set_consideration_set
before_action :set_considerations
before_action :set_consideration
before_action :set_review
before_action :store_return_to_report_path, only: %i[create edit]

def create
@consideration.submitted_by = current_user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
module PlanningApplications
module Assessment
class RequirementsController < BaseController
include ReturnToReport

before_action :set_requirements, only: %i[index create]
before_action :set_requirement, only: %i[update edit destroy]
before_action :store_return_to_report_path, only: %i[index]

def index
@categories = LocalAuthority::Requirement.categories
Expand Down
2 changes: 2 additions & 0 deletions app/models/planning_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class WithdrawOrCancelError < RuntimeError; end
has_one :consistency_checklist
has_one :informative_set
has_one :pre_commencement_condition_set, -> { where(pre_commencement: true) }, class_name: "ConditionSet", required: false

has_many :considerations, through: :consideration_set
end

with_options to: :application_type do
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2292,6 +2292,7 @@ en:
review_not_started: Not started
sending: Sending
submitted: Submitted
supported: Supported
supportive: Supportive
to_be_determined: To be determined
to_be_reviewed: To be reviewed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
["Site constraints", "#site-constraints"],
["Site history", "#site-history"],
["Site and surroundings", "#site-and-surroundings"],
["Your pre-application details", "#pre-application-details"],
["Considerations and advice", "#considerations-advice"],
["Policies and guidance", "#policies-guidance"],
["Requirements", "#requirements"],
["Next steps", "#next-steps"],
["Disclaimer", "#disclaimer"]
]}
Expand Down Expand Up @@ -280,9 +282,156 @@
No site description set.
</p>
<% end %>
</section>

<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">

<section id="considerations-advice">
<div class="flex-between govuk-!-margin-bottom-2">
<h2 class="govuk-heading-m">Planning considerations and advice</h2>
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_considerations_path(
@planning_application,
return_to: "report"
) %>
</div>

<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>

<%= govuk_table(html_attributes: {class: "govuk-table--borderless"}) do |table| %>
<% table.with_body do |body|
body.with_row do |row|
row.with_cell(text: "‘Supported’", header: true)
row.with_cell(text: "means that the current proposal is likely to be supported")
end
body.with_row do |row|
row.with_cell(text: "‘Needs changes’", header: true)
row.with_cell(text: "means that an element of the proposal is likely to be supported subject to suggested changes")
end
body.with_row do |row|
row.with_cell(text: "‘Does not comply’", header: true)
row.with_cell(text: "means that an element of the proposal will not be acceptable and permission is likely to be refused")
end
end %>
<% end %>

<%= govuk_table(html_attributes: {id: "considerations-overview"}) do |table| %>
<% table.with_head do |head|
head.with_row do |row|
row.with_cell(text: "Consideration")
row.with_cell(text: "Element of proposal")
row.with_cell(text: "Status")
end
end %>
<% table.with_body do |body|
@planning_application.considerations.each do |consideration|
body.with_row do |row|
row.with_cell(text: consideration.policy_area)
row.with_cell(text: consideration.proposal)
row.with_cell(text: render(StatusTags::PreappComponent.new(status: consideration.summary_tag)))
end
end
end %>
<% end %>

<% @planning_application.considerations.group_by(&:policy_area).each do |policy_area, considerations| %>
<%= govuk_summary_card(title: policy_area) do %>
<% considerations.each do |consideration| %>
<div class="flex-between">
<strong class="govuk-heading-s"><%= consideration.proposal %></strong>
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_considerations_path(
@planning_application,
return_to: "report"
) %>
</div>

<%= render StatusTags::PreappComponent.new(status: consideration.summary_tag) %><br>

<div class="govuk-body govuk-!-margin-top-4"><strong>Relevant policies</strong><br>
<ul class="govuk-list">
<% consideration.policy_references.each do |reference| %>
<li class="govuk-body">
<% if reference.url.present? %>
<%= govuk_link_to reference.code_and_description, reference.url %>
<% else %>
<%= reference.code_and_description %>
<% end %>
</li>
<% end %>
</ul>
</div>

<p class="govuk-body">
<%= render(FormattedContentComponent.new(text: consideration.assessment)) %>
</p>
<p class="govuk-body">
<%= render(FormattedContentComponent.new(text: consideration.conclusion)) %>
</p>
<% end %>
<% end %>
<% end %>

<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">

<section id="summary-advice">
<div class="flex-between">
<h2 class="govuk-heading-m">Summary</h2>
<%= govuk_link_to "Edit", main_app.edit_planning_application_assessment_assessment_detail_path(
@planning_application, @summary_of_advice, category: "summary_of_advice", return_to: "report"
) %>
</div>

<p class="govuk-body">This is the case officer's summary of the conclusions and advice.</p>
<p class="govuk-body grey-border-box">
<%= @planning_application.summary_of_advice.entry %>
</p>
</section>
</section>

<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">

<section id="policies-guidance">
<h2 class="govuk-heading-m">List of relevant policies and guidance</h2>
<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>

<% @planning_application.considerations.group_by(&:policy_area).each do |policy_area, considerations| %>
<% references = considerations.map(&:policy_references).flatten %>
<p class="govuk-body"><strong><%= policy_area.humanize %></strong></p>
<ul class="govuk-list">
<% references.each do |reference| %>
<li><%= govuk_link_to reference.description, reference.url %></li>
<% end %>
</ul>
<% end %>
</section>

<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">

<section id="requirements">
<div class="flex-between">
<h2 class="govuk-heading-m">Requirements</h2>
<%= govuk_link_to "Edit", main_app.planning_application_assessment_requirements_path(@planning_application, return_to: "report") %>
</div>

<p class="govuk-body">Should you wish to submit an application, the following requirements are needed:</p>
<% @planning_application.requirements.group_by(&:category).each do |category, requirements| %>
<%= govuk_summary_card(title: category.humanize) do %>
<ul class="govuk-list govuk-list--divided">
<% requirements.each do |requirement| %>
<li>
<p class="govuk-body"><%= govuk_link_to requirement.description, requirement.url %></p>
<% if requirement.guidelines.present? %>
<p class="govuk-body govuk-hint"><%= requirement.guidelines %></p>
<% end %>
</li>
<% end %>
</ul>
<% end %>
<% end %>
<!-- TODO pdf link -->
</section>

<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">

<section id="next-steps">
<h3 class="govuk-heading-s"><%= t(".next_steps_heading") %></h3>

Expand Down
60 changes: 49 additions & 11 deletions engines/bops_reports/spec/system/pre_application_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,23 @@
:planning_application,
:pre_application,
:in_assessment,
:with_preapp_assessment,
user: reviewer,
local_authority:,
boundary_geojson:,
consideration_set:,
consistency_checklist:,
validated_at: Time.zone.local(2024, 6, 1),
determined_at: Time.zone.local(2024, 6, 20),
description: "Single-storey rear extension",
recommended_application_type: create(:application_type, :householder)
)
end

let(:consideration_set) { create(:consideration_set, considerations: create_list(:consideration, 3, summary_tag: "complies")) }
let(:local_authority_requirements) { create_list(:local_authority_requirement, 3, local_authority:) }
let!(:requirements) { local_authority_requirements.map { |r| planning_application.requirements.create(**r.as_json.except("id", "local_authority_id", "search")) } }

let!(:site_visit) do
create(:site_visit, planning_application:, visited_at: Time.zone.local(2024, 6, 10))
end
Expand All @@ -56,9 +63,7 @@

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

let!(:summary_of_advice) do
create(:assessment_detail, planning_application:, category: "summary_of_advice", summary_tag: "complies", entry: "Looks good")
end
let(:summary_of_advice) { planning_application.summary_of_advice }

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

let!(:consistency_checklist) do
create(:consistency_checklist, :site_map_incorrect, planning_application:)
let(:consistency_checklist) do
create(:consistency_checklist, :site_map_incorrect)
end

let!(:designated_conservation_area) do
create(:planning_application_constraint, planning_application:)
end

let!(:tpo) { create(:constraint, :tpo) }

let!(:planning_application_constraint) do
create(:planning_application_constraint, constraint: tpo, planning_application:)
end

let(:report_url) { "/planning_applications/#{planning_application.reference}" }

before do
Expand Down Expand Up @@ -117,6 +116,14 @@
end
end

it "displays the summary of advice section" do
within("#summary-advice") do
expect(page).to have_content("Summary")
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")
expect(page).to have_content("Looks good")
end
end

it "displays the officer contact details" do
within("#contact-details") do
expect(page).to have_content(reviewer.name)
Expand Down Expand Up @@ -372,6 +379,37 @@
end
end

it "displays considerations" do
within "#considerations-advice" do
expect(page).to have_selector(".govuk-summary-card__title", text: planning_application.considerations.first.policy_area.humanize)
expect(page).to have_selector("li", text: planning_application.considerations.first.policy_references.first.description)

within "#considerations-overview" do
within ".govuk-table__body .govuk-table__row:first-child" do
expect(page).to have_text(planning_application.considerations.first.policy_area)
expect(page).to have_text(planning_application.considerations.first.proposal)
expect(page).to have_text("Supported")
end
end
end
end

it "displays policies and guidance" do
within "#policies-guidance" do
expect(page).to have_text(planning_application.considerations.first.policy_area)
expect(page).to have_text(planning_application.considerations.first.policy_references.first.description)
end
end

it "displays requirements" do
within "#requirements" do
expect(page).to have_text(planning_application.local_authority.submission_guidance_url)
expect(page).to have_text(planning_application.requirements.first.category.humanize)
expect(page).to have_text(planning_application.requirements.first.description)
expect(page).to have_text(planning_application.requirements.first.guidelines)
end
end

it "displays next steps and disclaimer" do
local_authority.update(submission_guidance_url: "https://www.southwark.gov.uk/planning-and-building-control/planning-policy-and-guidance")

Expand Down
1 change: 1 addition & 0 deletions spec/factories/consideration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
assessment { Faker::Lorem.paragraph }
conclusion { Faker::Lorem.sentence }
advice { Faker::Lorem.paragraph }
proposal { Faker::Lorem.sentence }

consideration_set

Expand Down
3 changes: 2 additions & 1 deletion spec/factories/planning_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,10 @@
trait :with_preapp_assessment do
after(:create) do |planning_application|
create(:assessment_detail, planning_application:, category: "site_description", entry: "A double storey detached house adjacent to greenbelt.")
create(:consistency_checklist, planning_application:)
create(:consistency_checklist, planning_application:) if planning_application.consistency_checklist.blank?
create(:planning_application_constraint, planning_application:)
create(:planning_application_constraint, constraint: create(:constraint, :tpo), planning_application:)
create(:assessment_detail, planning_application:, category: "summary_of_advice", summary_tag: "complies", entry: "Looks good")

planning_application.update!(recommended_application_type: create(:application_type, :householder))
end
Expand Down