Skip to content

Commit

Permalink
Replace LoPS verify view
Browse files Browse the repository at this point in the history
This replaces the existing view which admins use with the newer LoPS
response page.
  • Loading branch information
thomasleese committed Oct 13, 2023
1 parent 728b067 commit 4ee9f4f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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 %>

<h1 class="govuk-heading-xl"><%= title %></h1>

<% if (location_note = @professional_standing_request.location_note).present? %>
<h2 class="govuk-heading-m">How to find the response</h2>
<%= govuk_inset_text { simple_format location_note } %>
<% end %>
<h1 class="govuk-heading-xl">Record LoPS response</h1>

<% 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 %>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{
name: "Record LoPS verification",
link: [
:review,
:verify,
:assessor_interface,
@application_form,
@assessment,
Expand Down
5 changes: 0 additions & 5 deletions config/locales/assessor_interface.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,6 @@ en:
passed: Has the applicant completed this section to your satisfaction?
failure_assessor_note: '<strong class="govuk-!-font-weight-bold">Internal note:</strong> 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: '<strong class="govuk-!-font-weight-bold">Internal note:</strong> Briefly explain why the document should not be accepted.'

reference_requests:
edit:
title: Review work reference
Expand Down

0 comments on commit 4ee9f4f

Please sign in to comment.