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 %>
Application details