diff --git a/app/controllers/providers/interrupt/blocks_controller.rb b/app/controllers/providers/interrupt/blocks_controller.rb new file mode 100644 index 0000000000..374b539076 --- /dev/null +++ b/app/controllers/providers/interrupt/blocks_controller.rb @@ -0,0 +1,7 @@ +module Providers + module Interrupt + class BlocksController < ProviderBaseController + def show; end + end + end +end diff --git a/app/helpers/providers_helper.rb b/app/helpers/providers_helper.rb index a1e6975bf7..08ee1fdd5e 100644 --- a/app/helpers/providers_helper.rb +++ b/app/helpers/providers_helper.rb @@ -4,7 +4,11 @@ def link_to_application(text, legal_aid_application) end def url_for_application(legal_aid_application) - name = legal_aid_application.provider_step.presence || :proceedings_types + name = if legal_aid_application.expired? + :providers_blocked + else + legal_aid_application.provider_step.presence || :proceedings_types + end Flow::ProviderFlowService.new( legal_aid_application:, @@ -25,4 +29,15 @@ def journey_start_path(legal_aid_application) legal_aid_application:, ) end + + def tag_colour(legal_aid_application) + case legal_aid_application.summary_state + when :expired + "red" + when :submitted + "green" + else + "blue" + end + end end diff --git a/app/models/legal_aid_application.rb b/app/models/legal_aid_application.rb index 79e86dda4a..bf9533c6db 100644 --- a/app/models/legal_aid_application.rb +++ b/app/models/legal_aid_application.rb @@ -478,11 +478,18 @@ def merits_complete! end def summary_state + return :expired if expired? return :submitted if merits_submitted_at :in_progress end + def expired? + [ + expired_by_2023_surname_at_birth_issue?, + ].any? + end + def policy_disregards? policy_disregards&.any? ? true : false end @@ -561,6 +568,15 @@ def bank_statement_upload_path? private + def expired_by_2023_surname_at_birth_issue? + created_at.year < 2024 && + (provider_step.nil? || %i[end_of_applications + submitted_applications + use_ccms + use_ccms_employed + use_ccms_under16s].exclude?(provider_step.to_sym)) + end + def client_not_given_consent_to_open_banking? provider_received_citizen_consent == false end diff --git a/app/services/flow/flows/provider_blocked.rb b/app/services/flow/flows/provider_blocked.rb new file mode 100644 index 0000000000..420104f4d2 --- /dev/null +++ b/app/services/flow/flows/provider_blocked.rb @@ -0,0 +1,11 @@ +module Flow + module Flows + class ProviderBlocked < FlowSteps + STEPS = { + providers_blocked: { + path: ->(application) { urls.providers_legal_aid_application_block_path(application) }, + }, + }.freeze + end + end +end diff --git a/app/services/flow/provider_flow_service.rb b/app/services/flow/provider_flow_service.rb index 85b58fa95c..394477db80 100644 --- a/app/services/flow/provider_flow_service.rb +++ b/app/services/flow/provider_flow_service.rb @@ -9,6 +9,7 @@ class ProviderFlowService < BaseFlowService .deep_merge(Flows::ProviderCapital::STEPS) .deep_merge(Flows::ProviderDependants::STEPS) .deep_merge(Flows::ProviderMerits::STEPS) + .deep_merge(Flows::ProviderBlocked::STEPS) use_steps(steps.freeze) end diff --git a/app/views/providers/interrupt/blocks/show.html.erb b/app/views/providers/interrupt/blocks/show.html.erb new file mode 100644 index 0000000000..435aa9e5f3 --- /dev/null +++ b/app/views/providers/interrupt/blocks/show.html.erb @@ -0,0 +1,19 @@ +
+ <%= page_template(page_title: t(".title_html"), column_width: "full", template: :basic) do %> + <%= page_heading(size: "l") %> + +
+

<%= t(".body_text") %>

+

<%= t(".options") %>

+ +
+ +
+ <%= govuk_button_link_to t(".applications"), providers_legal_aid_applications_path, class: "white-button", role: "button" %> +
+ <% end %> +
diff --git a/app/views/providers/legal_aid_applications/_legal_aid_applications.html.erb b/app/views/providers/legal_aid_applications/_legal_aid_applications.html.erb index 3393337ee7..9fcc5add5e 100644 --- a/app/views/providers/legal_aid_applications/_legal_aid_applications.html.erb +++ b/app/views/providers/legal_aid_applications/_legal_aid_applications.html.erb @@ -67,7 +67,7 @@ end end row.with_cell(html_attributes: { class: "sortable-cell", "data-sort-value": t(application.summary_state, scope: %i[enums legal_aid_application summary_state]) }) do - govuk_tag(text: t(application.summary_state, scope: %i[enums legal_aid_application summary_state]), colour: application.summary_state == :submitted ? "green" : "blue") + govuk_tag(text: t(application.summary_state, scope: %i[enums legal_aid_application summary_state]), colour: tag_colour(application)) end row.with_cell do concat render partial: "shared/partials/modal_dialogue", locals: { application:, index: } diff --git a/config/locales/en/enums.yml b/config/locales/en/enums.yml index b6056eb6a3..0f76a66313 100644 --- a/config/locales/en/enums.yml +++ b/config/locales/en/enums.yml @@ -45,5 +45,6 @@ en: submission_paused: Submission paused use_ccms: use_ccms summary_state: + expired: Out of date in_progress: In progress submitted: Submitted diff --git a/config/locales/en/providers.yml b/config/locales/en/providers.yml index 9157ff0596..02ae9ba4ce 100644 --- a/config/locales/en/providers.yml +++ b/config/locales/en/providers.yml @@ -1696,3 +1696,13 @@ en: select_a_scope_limitation_error: Select a scope limitation enter_valid_hearing_date_error: Enter a valid hearing date for %{scope_limitation} enter_limitation_note_error: Enter a limitation note for %{scope_limitation} + interrupt: + blocks: + show: + title_html: You cannot submit this application + body_text: This is because it’s out of date. The application will be missing information because of service updates. + options: "You can (choose one of the following):" + option_bullets: + - make a new application for your client if you still need to submit one + - go back to your applications + applications: Make a new application diff --git a/config/routes.rb b/config/routes.rb index 4866062c71..ca2b1659cf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -266,7 +266,9 @@ patch :continue patch :reset end - + scope module: :interrupt do + resource :block, only: %i[show], path: "out-of-date-application" + end scope module: :proceeding_loop do resources :delegated_functions, only: %i[show update] resources :confirm_delegated_functions_date, only: %i[show update] diff --git a/spec/helpers/providers_helper_spec.rb b/spec/helpers/providers_helper_spec.rb index c9a8eac277..f487f0bcd0 100644 --- a/spec/helpers/providers_helper_spec.rb +++ b/spec/helpers/providers_helper_spec.rb @@ -24,6 +24,30 @@ non_uk_home_addresses] end + describe "#tag_colour" do + subject(:url_helper) { tag_colour(legal_aid_application) } + + context "when the application has `expired`" do + let(:legal_aid_application) do + travel_to Date.parse("2023-12-25") do + create(:legal_aid_application, :with_multiple_proceedings_inc_section8, provider_step: "chances_of_success") + end + end + + it { is_expected.to eql("red") } + end + + context "when the application is submitted" do + let(:legal_aid_application) { create(:legal_aid_application, :with_merits_submitted_at) } + + it { is_expected.to eql("green") } + end + + context "when the application is not submitted" do + it { is_expected.to eql("blue") } + end + end + describe "#url_for_application" do subject(:url_helper) { url_for_application(legal_aid_application) } @@ -112,5 +136,31 @@ expect(url_for_application(legal_aid_application)).to eq("/providers/applications/#{legal_aid_application.id}/means/remove_dependants/#{dependant.id}?locale=en") end end + + context "when the application predates the 2023 surname at birth issue" do + let(:legal_aid_application) do + travel_to Date.parse("2023-12-25") do + create(:legal_aid_application, :with_multiple_proceedings_inc_section8, provider_step:) + end + end + + context "and the provider step is not in the expired_by_2023_surname_at_birth_issue expiry exclusion list" do + let(:provider_step) { "chances_of_success" } + + it "routes to the block page" do + application_id = legal_aid_application.id + expect(url_for_application(legal_aid_application)).to eq("/providers/applications/#{application_id}/out-of-date-application?locale=en") + end + end + + context "and the provider step is in the expired_by_2023_surname_at_birth_issue expiry exclusion list" do + let(:provider_step) { "submitted_applications" } + + it "routes to the submitted application page" do + application_id = legal_aid_application.id + expect(url_for_application(legal_aid_application)).to eq("/providers/applications/#{application_id}/submitted_application?locale=en") + end + end + end end end diff --git a/spec/requests/providers/interrupt/blocks_controller_spec.rb b/spec/requests/providers/interrupt/blocks_controller_spec.rb new file mode 100644 index 0000000000..15ee98c2cb --- /dev/null +++ b/spec/requests/providers/interrupt/blocks_controller_spec.rb @@ -0,0 +1,32 @@ +require "rails_helper" + +RSpec.describe Providers::Interrupt::BlocksController do + let(:legal_aid_application) { create(:legal_aid_application) } + let(:provider) { legal_aid_application.provider } + + describe "GET /providers/applications/:id/blocked" do + subject(:get_request) { get providers_legal_aid_application_block_path(legal_aid_application) } + + context "when the provider is not authenticated" do + before { get_request } + + it_behaves_like "a provider not authenticated" + end + + context "when the provider is authenticated" do + before do + login_as provider + get_request + end + + it "returns http success" do + expect(response).to have_http_status(:ok) + end + + it "shows text to use CCMS" do + get_request + expect(response.body).to include("You cannot submit this application") + end + end + end +end