diff --git a/app/controllers/planning_applications/review/cil_liability_controller.rb b/app/controllers/planning_applications/review/cil_liability_controller.rb index 5265f30a7..a2eb2ef9d 100644 --- a/app/controllers/planning_applications/review/cil_liability_controller.rb +++ b/app/controllers/planning_applications/review/cil_liability_controller.rb @@ -3,6 +3,8 @@ module PlanningApplications module Review class CilLiabilityController < BaseController + before_action :redirect_to_review_tasks, unless: :cil_feature? + def update @previous_decision = @planning_application.cil_liable if @planning_application.update(cil_liability_params) @@ -44,6 +46,14 @@ def activity_information "Reviewer marked application as#{" not" unless @planning_application.cil_liable} liable for CIL" end end + + def redirect_to_review_tasks + redirect_to planning_application_review_tasks_path(@planning_application) + end + + def cil_feature? + @planning_application.application_type.cil? + end end end end diff --git a/app/controllers/planning_applications/validation/cil_liability_controller.rb b/app/controllers/planning_applications/validation/cil_liability_controller.rb index 9ec0c5158..7a1b30560 100644 --- a/app/controllers/planning_applications/validation/cil_liability_controller.rb +++ b/app/controllers/planning_applications/validation/cil_liability_controller.rb @@ -3,6 +3,8 @@ module PlanningApplications module Validation class CilLiabilityController < BaseController + before_action :redirect_to_validation_tasks, unless: :cil_feature? + def edit respond_to do |format| format.html @@ -22,6 +24,14 @@ def update def cil_liability_params params.require(:planning_application).permit([:cil_liable]) end + + def redirect_to_validation_tasks + redirect_to planning_application_validation_tasks_path(@planning_application) + end + + def cil_feature? + @planning_application.application_type.cil? + end end end end diff --git a/app/controllers/planning_applications/validation/environment_impact_assessments_controller.rb b/app/controllers/planning_applications/validation/environment_impact_assessments_controller.rb index 324b929bd..9ccb3343f 100644 --- a/app/controllers/planning_applications/validation/environment_impact_assessments_controller.rb +++ b/app/controllers/planning_applications/validation/environment_impact_assessments_controller.rb @@ -3,6 +3,7 @@ module PlanningApplications module Validation class EnvironmentImpactAssessmentsController < BaseController + before_action :redirect_to_validation_tasks, unless: :eia_feature? before_action :set_environment_impact_assessment, only: %i[show update edit] def edit @@ -58,6 +59,14 @@ def environmental_impact_assessment_params def set_environment_impact_assessment @environment_impact_assessment = @planning_application.environment_impact_assessment end + + def redirect_to_validation_tasks + redirect_to planning_application_validation_tasks_path(@planning_application) + end + + def eia_feature? + @planning_application.application_type.eia? + end end end end diff --git a/app/controllers/planning_applications/validation/legislation_controller.rb b/app/controllers/planning_applications/validation/legislation_controller.rb index 8513c7af2..889e32557 100644 --- a/app/controllers/planning_applications/validation/legislation_controller.rb +++ b/app/controllers/planning_applications/validation/legislation_controller.rb @@ -3,6 +3,7 @@ module PlanningApplications module Validation class LegislationController < BaseController + before_action :redirect_to_validation_tasks, unless: :legislative_requirements_feature? before_action :ensure_legislation_is_defined def show @@ -41,6 +42,14 @@ def ensure_legislation_is_defined def redirect_failed_update redirect_to planning_application_validation_tasks_path(@planning_application), alert: t(".alert") end + + def redirect_to_validation_tasks + redirect_to planning_application_validation_tasks_path(@planning_application) + end + + def legislative_requirements_feature? + @planning_application.application_type.legislative_requirements? + end end end end diff --git a/app/models/application_type.rb b/app/models/application_type.rb index 2e379aa8a..6c0a9bbb7 100644 --- a/app/models/application_type.rb +++ b/app/models/application_type.rb @@ -86,8 +86,11 @@ class ApplicationType < ApplicationRecord with_options to: :features do delegate :appeals? delegate :assess_against_policies? + delegate :cil? delegate :considerations? + delegate :eia? delegate :informatives? + delegate :legislative_requirements? delegate :ownership_details? delegate :planning_conditions? delegate :permitted_development_rights? diff --git a/app/models/application_type_feature.rb b/app/models/application_type_feature.rb index 47d89cffa..a1ee30b4e 100644 --- a/app/models/application_type_feature.rb +++ b/app/models/application_type_feature.rb @@ -5,8 +5,11 @@ class ApplicationTypeFeature attribute :appeals, :boolean, default: true attribute :assess_against_policies, :boolean, default: false + attribute :cil, :boolean, default: true attribute :considerations, :boolean, default: false + attribute :eia, :boolean, default: true attribute :informatives, :boolean, default: false + attribute :legislative_requirements, :boolean, default: true attribute :ownership_details, :boolean, default: true attribute :planning_conditions, :boolean, default: false attribute :permitted_development_rights, :boolean, default: true diff --git a/app/views/planning_applications/review/tasks/_review_assessment.html.erb b/app/views/planning_applications/review/tasks/_review_assessment.html.erb index da31eeffb..74339817f 100644 --- a/app/views/planning_applications/review/tasks/_review_assessment.html.erb +++ b/app/views/planning_applications/review/tasks/_review_assessment.html.erb @@ -1,16 +1,19 @@ <%= bops_task_accordion(id: "review-assessment") do |accordion| %> <% accordion.with_heading(text: "Review assessment") %> - <% accordion.with_section(id: "check-cil", expanded: false) do |section| %> - <%= section.with_heading(text: "Check Community Infrastructure Levy (CIL)") %> - <%= section.with_status do %> - <%= render( - StatusTags::BaseComponent.new( - status: (@planning_application.audits.review_cil_liability.any? ? :complete : :not_started) - ) - ) %> - <% end %> - <%= section.with_footer do %> - <%= render(partial: "planning_applications/review/cil_liability/form") %> + + <% if @planning_application.application_type.cil? %> + <% accordion.with_section(id: "check-cil", expanded: false) do |section| %> + <%= section.with_heading(text: "Check Community Infrastructure Levy (CIL)") %> + <%= section.with_status do %> + <%= render( + StatusTags::BaseComponent.new( + status: (@planning_application.audits.review_cil_liability.any? ? :complete : :not_started) + ) + ) %> + <% end %> + <%= section.with_footer do %> + <%= render(partial: "planning_applications/review/cil_liability/form") %> + <% end %> <% end %> <% end %> diff --git a/app/views/planning_applications/validation/tasks/_application_requirements.html.erb b/app/views/planning_applications/validation/tasks/_application_requirements.html.erb index 9d674eabe..5528265f8 100644 --- a/app/views/planning_applications/validation/tasks/_application_requirements.html.erb +++ b/app/views/planning_applications/validation/tasks/_application_requirements.html.erb @@ -5,9 +5,13 @@ <%= govuk_task_list(id_prefix: "application-requirements-tasks", html_attributes: {id: "application-requirements-tasks"}) do |task_list| render Validation::FeeValidationTask.new(@planning_application, task_list:) - render Validation::CilLiabilityTask.new(@planning_application, task_list:) + if @planning_application.application_type.cil? + render Validation::CilLiabilityTask.new(@planning_application, task_list:) + end - render Validation::EnvironmentalImpactAssessmentTask.new(@planning_application, task_list:) + if @planning_application.application_type.eia? + render Validation::EnvironmentalImpactAssessmentTask.new(@planning_application, task_list:) + end if @planning_application.application_type.ownership_details? render Validation::OwnershipCertificateTask.new(@planning_application, task_list:) diff --git a/engines/bops_config/app/controllers/bops_config/application_types/features_controller.rb b/engines/bops_config/app/controllers/bops_config/application_types/features_controller.rb index 9125c2070..9cf795fbe 100644 --- a/engines/bops_config/app/controllers/bops_config/application_types/features_controller.rb +++ b/engines/bops_config/app/controllers/bops_config/application_types/features_controller.rb @@ -33,8 +33,11 @@ def features_attributes [ :appeals, :assess_against_policies, + :cil, :considerations, + :eia, :informatives, + :legislative_requirements, :ownership_details, :planning_conditions, :permitted_development_rights, diff --git a/engines/bops_config/app/helpers/bops_config/application_type_helper.rb b/engines/bops_config/app/helpers/bops_config/application_type_helper.rb index eb6fadeec..a414b62da 100644 --- a/engines/bops_config/app/helpers/bops_config/application_type_helper.rb +++ b/engines/bops_config/app/helpers/bops_config/application_type_helper.rb @@ -11,5 +11,19 @@ module ApplicationTypeHelper def tag_colour(tag) COLOURS[tag.to_sym] end + + def application_details_features + %i[ + assess_against_policies + considerations + cil + eia + informatives + legislative_requirements + ownership_details + planning_conditions + permitted_development_rights + ] + end end end diff --git a/engines/bops_config/app/views/bops_config/application_types/features/edit.html.erb b/engines/bops_config/app/views/bops_config/application_types/features/edit.html.erb index b246a8097..765107051 100644 --- a/engines/bops_config/app/views/bops_config/application_types/features/edit.html.erb +++ b/engines/bops_config/app/views/bops_config/application_types/features/edit.html.erb @@ -21,12 +21,9 @@ <%= form.fields_for :features, @application_type.features do |ff| %> <%= ff.govuk_fieldset legend: {text: t("application_type_features.legends.check_application_details"), size: "s"} do %> - <%= ff.govuk_check_box :assess_against_policies, 1, 0, multiple: false, label: {text: t("application_type_features.labels.assess_against_policies")} %> - <%= ff.govuk_check_box :considerations, 1, 0, multiple: false, label: {text: t("application_type_features.labels.considerations")} %> - <%= ff.govuk_check_box :informatives, 1, 0, multiple: false, label: {text: t("application_type_features.labels.informatives")} %> - <%= ff.govuk_check_box :ownership_details, 1, 0, multiple: false, label: {text: t("application_type_features.labels.ownership_details")} %> - <%= ff.govuk_check_box :planning_conditions, 1, 0, multiple: false, label: {text: t("application_type_features.labels.planning_conditions")} %> - <%= ff.govuk_check_box :permitted_development_rights, 1, 0, multiple: false, label: {text: t("application_type_features.labels.permitted_development_rights")} %> + <% application_details_features.each do |field| %> + <%= ff.govuk_check_box field, 1, 0, multiple: false, label: {text: t("application_type_features.labels.#{field}")} %> + <% end %> <% end %>
diff --git a/engines/bops_config/app/views/bops_config/application_types/show.html.erb b/engines/bops_config/app/views/bops_config/application_types/show.html.erb index dd53c2ac9..b75b1561a 100644 --- a/engines/bops_config/app/views/bops_config/application_types/show.html.erb +++ b/engines/bops_config/app/views/bops_config/application_types/show.html.erb @@ -59,23 +59,10 @@ row.with_value { %>

Application details

diff --git a/engines/bops_config/config/locales/application_type_features.yml b/engines/bops_config/config/locales/application_type_features.yml index aec1c1bdd..94a6aa4fc 100644 --- a/engines/bops_config/config/locales/application_type_features.yml +++ b/engines/bops_config/config/locales/application_type_features.yml @@ -3,9 +3,12 @@ en: labels: appeals: "Enable appeals" assess_against_policies: "Assess against legislation" + cil: "Community Infrastructure Levy" considerations: "Assess policies and guidance (considerations)" consultations_skip_bank_holidays: "Extend consultation periods that contain bank holidays" + eia: "Environmental Impact Assessment" informatives: "Add informatives" + legislative_requirements: "Check legislative requirments" ownership_details: "Ownership details" planning_conditions: "Check planning conditions" permitted_development_rights: "Check permitted development rights" diff --git a/engines/bops_config/spec/system/application_types_spec.rb b/engines/bops_config/spec/system/application_types_spec.rb index 28518712b..d3e9cd31e 100644 --- a/engines/bops_config/spec/system/application_types_spec.rb +++ b/engines/bops_config/spec/system/application_types_spec.rb @@ -526,6 +526,9 @@ expect(page).to have_selector("li", text: "Add informatives") expect(page).to have_selector("li", text: "Ownership details") expect(page).to have_selector("li", text: "Check planning conditions") + expect(page).to have_selector("li", text: "Environmental Impact Assessment") + expect(page).to have_selector("li", text: "Community Infrastructure Levy") + expect(page).to have_selector("li", text: "Check legislative requirments") expect(page).not_to have_selector("li", text: "Check permitted development rights") expect(page).not_to have_selector("li", text: "Enable appeals") @@ -555,6 +558,9 @@ uncheck("Ownership details") uncheck("Check planning conditions") + uncheck("Environmental Impact Assessment") + uncheck("Community Infrastructure Levy") + uncheck("Check legislative requirments") check("Check permitted development rights") check("Consultees") check("Enable appeals") @@ -569,6 +575,9 @@ expect(page).to have_selector("li", text: "Add informatives") expect(page).not_to have_selector("li", text: "Ownership details") expect(page).not_to have_selector("li", text: "Check planning conditions") + expect(page).not_to have_selector("li", text: "Environmental Impact Assessment") + expect(page).not_to have_selector("li", text: "Community Infrastructure Levy") + expect(page).not_to have_selector("li", text: "Check legislative requirments") expect(page).to have_selector("li", text: "Check permitted development rights") expect(page).to have_selector("li", text: "Enable appeals") @@ -582,6 +591,9 @@ expect(application_type.informatives?).to eq(true) expect(application_type.ownership_details?).to eq(false) expect(application_type.planning_conditions?).to eq(false) + expect(application_type.eia?).to eq(false) + expect(application_type.cil?).to eq(false) + expect(application_type.legislative_requirements?).to eq(false) expect(application_type.permitted_development_rights?).to eq(true) expect(application_type.consultation_steps).to eq(["neighbour", "consultee", "publicity"]) expect(application_type.appeals?).to eq(true) diff --git a/spec/factories/application_type.rb b/spec/factories/application_type.rb index 187da755c..9763b62a9 100644 --- a/spec/factories/application_type.rb +++ b/spec/factories/application_type.rb @@ -558,6 +558,14 @@ trait :pre_application do code { "preApp" } suffix { "PRE" } + + features { + { + "cil" => false, + "eia" => false, + "legislative_requirements" => false + } + } end trait :without_consultation do diff --git a/spec/system/planning_applications/review/check_cil_liability_spec.rb b/spec/system/planning_applications/review/check_cil_liability_spec.rb index 0679b3636..79c66f13b 100644 --- a/spec/system/planning_applications/review/check_cil_liability_spec.rb +++ b/spec/system/planning_applications/review/check_cil_liability_spec.rb @@ -146,4 +146,17 @@ expect(page).to have_content "Reviewer marked application as not liable for CIL" end end + + context "when CIL liability feature is disabled" do + let!(:planning_application) do + create(:planning_application, :awaiting_determination, :pre_application, local_authority: local_authority) + end + + it "does not have a section to review CIL" do + visit "planning_applications/#{planning_application.reference}/review/tasks" + + expect(page).not_to have_css("#check-cil") + expect(page).not_to have_content("Check Community Infrastructure Levy (CIL)") + end + end end diff --git a/spec/system/planning_applications/validating/check_legislation_spec.rb b/spec/system/planning_applications/validating/check_legislation_spec.rb index 3f1009bfe..2824bb11a 100644 --- a/spec/system/planning_applications/validating/check_legislation_spec.rb +++ b/spec/system/planning_applications/validating/check_legislation_spec.rb @@ -101,4 +101,25 @@ expect(page).to have_content("Not found") end end + + context "when legislative requirements feature is disabled" do + let!(:planning_application) do + create(:planning_application, :not_started, :pre_application, local_authority: default_local_authority) + end + + before do + sign_in assessor + visit "/planning_applications/#{planning_application.reference}/validation/tasks" + end + + it "does not have a section to check legislative requirements" do + visit "planning_applications/#{planning_application.reference}/validation/tasks" + + expect(page).not_to have_content("Check legislative requirements") + + visit "planning_applications/#{planning_application.reference}/validation/legislation" + + expect(page).to have_current_path("/planning_applications/#{planning_application.reference}/validation/tasks") + end + end end diff --git a/spec/system/planning_applications/validating/cil_liability_spec.rb b/spec/system/planning_applications/validating/cil_liability_spec.rb index c2d4770c9..33a7dfa67 100644 --- a/spec/system/planning_applications/validating/cil_liability_spec.rb +++ b/spec/system/planning_applications/validating/cil_liability_spec.rb @@ -141,4 +141,20 @@ end end end + + context "when CIL liability feature is disabled" do + let!(:planning_application) do + create(:planning_application, :not_started, :pre_application, local_authority: default_local_authority) + end + + it "does not have a section to check CIL" do + visit "planning_applications/#{planning_application.reference}/validation/tasks" + + expect(page).not_to have_content("Check Community Infrastructure Levy (CIL)") + + visit "planning_applications/#{planning_application.reference}/validation/cil_liability/edit" + + expect(page).to have_current_path("/planning_applications/#{planning_application.reference}/validation/tasks") + end + end end diff --git a/spec/system/planning_applications/validating/environment_impact_assessment_spec.rb b/spec/system/planning_applications/validating/environment_impact_assessment_spec.rb index e67853499..c737d9ccf 100644 --- a/spec/system/planning_applications/validating/environment_impact_assessment_spec.rb +++ b/spec/system/planning_applications/validating/environment_impact_assessment_spec.rb @@ -194,4 +194,20 @@ end end end + + context "when EIA feature is disabled" do + let!(:planning_application) do + create(:planning_application, :not_started, :pre_application, local_authority: default_local_authority) + end + + it "does not have a section to check EIA" do + visit "planning_applications/#{planning_application.reference}/validation/tasks" + + expect(page).not_to have_content("Check Environment Impact Assessment") + + visit "planning_applications/#{planning_application.reference}/validation/environment_impact_assessment" + + expect(page).to have_current_path("/planning_applications/#{planning_application.reference}/validation/tasks") + end + end end