From bdea96741143e6297af9376d74ba347019ea15de Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Thu, 5 Oct 2023 14:19:22 +0100 Subject: [PATCH] Replace LoPS verify view This replaces the existing view which admins use with the newer LoPS response page. --- ...ofessional_standing_requests_controller.rb | 32 ++++++++++++------- .../edit_verify.html.erb | 27 ++++++---------- .../show.html.erb | 2 +- config/locales/assessor_interface.en.yml | 5 --- 4 files changed, 31 insertions(+), 35 deletions(-) diff --git a/app/controllers/assessor_interface/professional_standing_requests_controller.rb b/app/controllers/assessor_interface/professional_standing_requests_controller.rb index 9fd7709c8f..d360f6b95d 100644 --- a/app/controllers/assessor_interface/professional_standing_requests_controller.rb +++ b/app/controllers/assessor_interface/professional_standing_requests_controller.rb @@ -32,7 +32,7 @@ def update_locate if @form.save redirect_to [:assessor_interface, application_form] else - render :edit_location, status: :unprocessable_entity + render :edit_locate, status: :unprocessable_entity end end @@ -93,29 +93,32 @@ def update_review end def edit_verify - authorize [:assessor_interface, professional_standing_request], - :edit_review? + authorize [:assessor_interface, professional_standing_request] @form = - RequestableReviewForm.new( + RequestableVerifyForm.new( requestable:, user: current_staff, - passed: requestable.review_passed, - note: requestable.review_note, + passed: requestable.verify_passed, + note: requestable.verify_note, ) end def update_verify - authorize [:assessor_interface, professional_standing_request], - :update_review? + authorize [:assessor_interface, professional_standing_request] @form = - RequestableReviewForm.new( - review_form_params.merge(requestable:, user: current_staff), + RequestableVerifyForm.new( + verify_form_params.merge(requestable:, user: current_staff), ) if @form.save - redirect_to [:assessor_interface, application_form] + redirect_to [ + :assessor_interface, + application_form, + assessment, + :professional_standing_request, + ] else render :edit_verify, status: :unprocessable_entity end @@ -148,6 +151,13 @@ def review_form_params ) end + def verify_form_params + params.require(:assessor_interface_requestable_verify_form).permit( + :passed, + :note, + ) + end + def professional_standing_request @professional_standing_request ||= ProfessionalStandingRequest.joins( diff --git a/app/views/assessor_interface/professional_standing_requests/edit_verify.html.erb b/app/views/assessor_interface/professional_standing_requests/edit_verify.html.erb index 7a8b10263f..816f027fba 100644 --- a/app/views/assessor_interface/professional_standing_requests/edit_verify.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/edit_verify.html.erb @@ -1,28 +1,19 @@ -<% title = region_certificate_name(@application_form.region) %> - -<% content_for :page_title, "#{"Error: " if @form.errors.any?}#{title}" %> +<% content_for :page_title, "#{"Error: " if @form.errors.any?}Record LoPS response" %> <% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %> <%= form_with model: @form, url: [:verify, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %> <%= f.govuk_error_summary %> -

<%= title %>

- - <% if (location_note = @professional_standing_request.location_note).present? %> -

How to find the response

- <%= govuk_inset_text { simple_format location_note } %> - <% end %> +

Record LoPS response

- <% if @professional_standing_request.received? || @professional_standing_request.expired? || @professional_standing_request.ready_for_review %> - <%= f.govuk_radio_buttons_fieldset :passed, legend: { text: t(".passed"), size: "s" } do %> - <%= f.govuk_radio_button :passed, :true, link_errors: true %> - <%= f.govuk_radio_button :passed, :false do %> - <%= f.govuk_text_area :note, label: { text: t(".failure_assessor_note").html_safe } %> - <% end %> + <%= f.govuk_radio_buttons_fieldset :passed, legend: { text: "Does the response confirm that the LoPS is valid?" } do %> + <%= f.govuk_radio_button :passed, :true, label: { text: "Yes, mark as completed" }, link_errors: true %> + <%= f.govuk_radio_button :passed, :false, label: { text: "No, send for review" } do %> + <%= f.govuk_text_area :note, label: { text: "Internal note: briefly explain to the assessor why you are sending this LoPS for review." } %> <% end %> + <% end %> - <%= f.govuk_submit "Save and continue" do %> - <%= govuk_link_to "Cancel", [:assessor_interface, @application_form] %> - <% end %> + <%= f.govuk_submit do %> + <%= govuk_link_to "Cancel", [:assessor_interface, @application_form] %> <% end %> <% end %> diff --git a/app/views/assessor_interface/professional_standing_requests/show.html.erb b/app/views/assessor_interface/professional_standing_requests/show.html.erb index 5f93a2ffb8..4b864737bd 100644 --- a/app/views/assessor_interface/professional_standing_requests/show.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/show.html.erb @@ -28,7 +28,7 @@ { name: "Record LoPS verification", link: [ - :review, + :verify, :assessor_interface, @application_form, @assessment, diff --git a/config/locales/assessor_interface.en.yml b/config/locales/assessor_interface.en.yml index 1e7ae16a53..f1056f0c0b 100644 --- a/config/locales/assessor_interface.en.yml +++ b/config/locales/assessor_interface.en.yml @@ -236,11 +236,6 @@ en: passed: Has the applicant completed this section to your satisfaction? failure_assessor_note: 'Internal note: Explain why this section is not completed to your satisfaction' - professional_standing_requests: - edit_verify: - passed: Does the response confirm that this document is legitimate? - failure_assessor_note: 'Internal note: Briefly explain why the document should not be accepted.' - reference_requests: edit: title: Review work reference