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 9, 2023
1 parent 80b1069 commit ac2afdc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ 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,
Expand All @@ -106,16 +105,20 @@ def edit_verify
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

0 comments on commit ac2afdc

Please sign in to comment.