diff --git a/app/controllers/nsm/claim_details_controller.rb b/app/controllers/nsm/claim_details_controller.rb index 0cfe996cf..4c9708846 100644 --- a/app/controllers/nsm/claim_details_controller.rb +++ b/app/controllers/nsm/claim_details_controller.rb @@ -12,7 +12,7 @@ def show def provider_updates return nil if claim.data['further_information'].blank? - BaseViewModel.build(:further_information, claim, 'further_information').sort_by(&:requested_at) + BaseViewModel.build(:further_information, claim, 'further_information').sort_by(&:requested_at).reverse end def claim diff --git a/app/controllers/nsm/send_backs_controller.rb b/app/controllers/nsm/send_backs_controller.rb index e92c9524e..22785b8ec 100644 --- a/app/controllers/nsm/send_backs_controller.rb +++ b/app/controllers/nsm/send_backs_controller.rb @@ -2,6 +2,10 @@ module Nsm class SendBacksController < Nsm::BaseController include NameConstructable + def show + claim + end + def edit send_back = SendBackForm.new(claim: claim, send_back_comment: claim.data['send_back_comment']) render locals: { claim:, send_back: } @@ -14,7 +18,7 @@ def update send_back.stash redirect_to your_nsm_claims_path elsif send_back.save - redirect_to your_nsm_claims_path + redirect_to nsm_claim_send_back_path(claim) else render :edit, locals: { claim:, send_back: } end diff --git a/app/models/event/new_version.rb b/app/models/event/new_version.rb index fcdb560d6..9e6d80a81 100644 --- a/app/models/event/new_version.rb +++ b/app/models/event/new_version.rb @@ -4,5 +4,9 @@ def self.build(submission:) create(submission: submission, submission_version: submission.current_version) .tap(&:notify) end + + def body + t('updated_body') if submission_version > 1 + end end end diff --git a/app/models/nsm/event/send_back.rb b/app/models/nsm/event/send_back.rb index a5ae57f54..27568914b 100644 --- a/app/models/nsm/event/send_back.rb +++ b/app/models/nsm/event/send_back.rb @@ -4,6 +4,10 @@ class SendBack < ::Event::Decision def title t('title') end + + def body + t('body') + end end end end diff --git a/app/views/nsm/claim_details/show.html.erb b/app/views/nsm/claim_details/show.html.erb index 9efaa1a12..43f21a310 100644 --- a/app/views/nsm/claim_details/show.html.erb +++ b/app/views/nsm/claim_details/show.html.erb @@ -10,6 +10,7 @@ <% if claim.sent_back? || claim.expired? %>

<%= t(".sent_back", date: claim_summary.sent_back_on.to_fs(:stamp)) %>

+ <%= t(".further_information_request") %> <%= simple_format claim_summary.assessment_comment %>
<% elsif claim.provider_updated? %> @@ -40,7 +41,7 @@ <% if provider_updates %>

<%= t('.provider_updates') %>

<% provider_updates.each do |further_information| %> - <%= govuk_summary_list(card: { title: further_information.title }) do |table| + <%= govuk_summary_list(card: { title: further_information.title }, actions: false) do |table| further_information.data.each do | field | table.with_row do |row| row.with_key(text: field[:title]) diff --git a/app/views/nsm/send_backs/show.html.erb b/app/views/nsm/send_backs/show.html.erb new file mode 100644 index 000000000..0be098776 --- /dev/null +++ b/app/views/nsm/send_backs/show.html.erb @@ -0,0 +1,35 @@ +<% title t('.page_title') %> + +
+
+
+

+ <%= t('.page_title') %> +

+
+

<%= t('.sent_to_provider') %>

+
+
+
+ <%= t('.laa_reference') %> +
+
+ <%= @claim.data['laa_reference'] %> +
+
+ +
+
+ <%= t('.further_information') %> +
+
+ <%= simple_format @claim.data['assessment_comment'] %> +
+
+
+
+ <%= govuk_button_to(t('.next_claim'), nsm_claims_path) %> + <%= govuk_link_to(t('.return'), nsm_claim_claim_details_path(@claim)) %> +
+
+
diff --git a/config/locales/en/events.yml b/config/locales/en/events.yml index 419748658..685b14fbb 100644 --- a/config/locales/en/events.yml +++ b/config/locales/en/events.yml @@ -15,10 +15,12 @@ en: rejected: Decision made to reject claim event/new_version: title: Received + updated_body: Received from Provider with further information event/note: title: Caseworker note nsm/event/send_back: - title: Claim sent back to provider + title: Sent back + body: Sent back to Provider for further information event/unassignment: title: self: Caseworker removed self from claim diff --git a/config/locales/en/nsm/claim_details.yml b/config/locales/en/nsm/claim_details.yml index 02e4cacc2..404151843 100644 --- a/config/locales/en/nsm/claim_details.yml +++ b/config/locales/en/nsm/claim_details.yml @@ -6,6 +6,7 @@ en: page_title: Assess a non-standard magistrates’ court payment overview: Overview sent_back: Sent back to provider on %{date} + further_information_request: 'Further information request:' assessed_statuses: granted: Granted part_grant: Part granted @@ -95,7 +96,7 @@ en: identification: Defendant identification disability: Defendant disability provider_update: - title: Further information request + title: Further information request %{date} caseworker: Caseworker information_request: Information request provider_response: Provider response diff --git a/config/locales/en/nsm/send_back.yml b/config/locales/en/nsm/send_back.yml index d5cb7bac4..253bba3ad 100644 --- a/config/locales/en/nsm/send_back.yml +++ b/config/locales/en/nsm/send_back.yml @@ -9,6 +9,13 @@ en: save_and_exit: Save and come back later update: decision: You sent back this claim %{ref} + show: + page_title: Claim sent back + sent_to_provider: Your request has been sent to the provider. + laa_reference: Claim reference + further_information: Further information request + next_claim: Assess next claim + return: Return to the claim helpers: label: diff --git a/config/routes.rb b/config/routes.rb index b7acd4a22..06e051073 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -83,7 +83,7 @@ resource :history, only: [:show, :create] resource :change_risk, only: [:edit, :update], path_names: { edit: '' } resource :make_decision, only: [:edit, :update], path_names: { edit: '' } - resource :send_back, only: [:edit, :update], path_names: { edit: '' } + resource :send_back, only: [:edit, :update, :show] resource :unassignment, only: [:edit, :update], path_names: { edit: '' } resources :assignments, only: %i[new create] end diff --git a/spec/controllers/nsm/claim_details_controller_spec.rb b/spec/controllers/nsm/claim_details_controller_spec.rb index 715a0722b..86b41f5b3 100644 --- a/spec/controllers/nsm/claim_details_controller_spec.rb +++ b/spec/controllers/nsm/claim_details_controller_spec.rb @@ -35,7 +35,7 @@ let(:further_information) { [instance_double(Nsm::V1::FurtherInformation)] } before do - allow(further_information).to receive(:sort_by).and_return true + allow(further_information).to receive(:sort_by).and_return further_information allow(BaseViewModel).to receive(:build) .with(:further_information, claim, 'further_information') .and_return(further_information) diff --git a/spec/controllers/nsm/send_backs_controller_spec.rb b/spec/controllers/nsm/send_backs_controller_spec.rb index c9f600bb5..3c57c2fca 100644 --- a/spec/controllers/nsm/send_backs_controller_spec.rb +++ b/spec/controllers/nsm/send_backs_controller_spec.rb @@ -55,7 +55,7 @@ nsm_send_back_form: { send_back_comment: nil, id: claim.id } } - expect(response).to redirect_to(your_nsm_claims_path) + expect(response).to redirect_to(nsm_claim_send_back_path(claim)) end end diff --git a/spec/models/event/send_back_spec.rb b/spec/models/event/send_back_spec.rb index 8cfb8440e..d549fd670 100644 --- a/spec/models/event/send_back_spec.rb +++ b/spec/models/event/send_back_spec.rb @@ -25,10 +25,10 @@ end it 'has a valid title' do - expect(subject.title).to eq('Claim sent back to provider') + expect(subject.title).to eq('Sent back') end - it 'body is set to comment' do - expect(subject.body).to eq('decison was made') + it 'body is set to static text' do + expect(subject.body).to eq('Sent back to Provider for further information') end end diff --git a/spec/system/nsm/assessment_spec.rb b/spec/system/nsm/assessment_spec.rb index 027847de6..1b168697c 100644 --- a/spec/system/nsm/assessment_spec.rb +++ b/spec/system/nsm/assessment_spec.rb @@ -112,7 +112,7 @@ it 'shows the FI details' do visit nsm_claim_claim_details_path(claim) - expect(page).to have_content "Sent back to provider on 4 July 2024\nTest Data" + expect(page).to have_content "Sent back to provider on 4 July 2024\nFurther information request:\nTest Data" end end diff --git a/spec/system/nsm/history_spec.rb b/spec/system/nsm/history_spec.rb index 637ccb1e9..43f3bd8e5 100644 --- a/spec/system/nsm/history_spec.rb +++ b/spec/system/nsm/history_spec.rb @@ -26,6 +26,8 @@ claim.state = 'sent_back' Nsm::Event::SendBack.build(submission: claim, current_user: caseworker, previous_state: 'submitted', comment: 'Send Back test') + claim.current_version = 2 + Event::NewVersion.build(submission: claim) claim.state = 'granted' Event::Decision.build(submission: claim, current_user: caseworker, previous_state: 'sent_back', comment: 'Decision test') @@ -45,7 +47,8 @@ [ 'case worker', 'Caseworker removed from claim by super visor', 'unassignment 2', 'case worker', 'Decision made to grant claim', 'Decision test', - 'case worker', 'Claim sent back to provider', 'Send Back test', + '', 'Received', 'Received from Provider with further information', + 'case worker', 'Sent back', 'Sent back to Provider for further information', 'case worker', 'Caseworker note', 'User test note', 'case worker', 'Claim risk changed to low risk', 'Risk change test', 'case worker', 'Self-assigned by case worker', 'Manual assignment note',