Skip to content

Commit

Permalink
Add AssessmentRecommendationReviewController
Browse files Browse the repository at this point in the history
This adds a new controller for handling the process of sending the
application to review after the verification stage.
  • Loading branch information
thomasleese committed Oct 6, 2023
1 parent d7a21b0 commit d7332bb
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

module AssessorInterface
class AssessmentRecommendationReviewController < BaseController
before_action :authorize_assessor
before_action :ensure_can_review
before_action :load_assessment_and_application_form

def edit
@professional_standing_request =
assessment.professional_standing_request if assessment.professional_standing_request.verify_failed?
end

def update
ActiveRecord::Base.transaction do
assessment.review!
ApplicationFormStatusUpdater.call(
application_form:,
user: current_staff,
)
end

redirect_to [:status, :assessor_interface, application_form]
end

private

def assessment
@assessment ||=
Assessment
.includes(:application_form)
.where(application_form_id: params[:application_form_id])
.find(params[:assessment_id])
end

delegate :application_form, to: :assessment

def ensure_can_review
unless assessment.can_review?
redirect_to [:assessor_interface, application_form]
end
end

def load_assessment_and_application_form
@assessment = assessment
@application_form = application_form
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<% content_for :page_title, "Send application for review" %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<h1 class="govuk-heading-xl">Send application for review</h1>

<p class="govuk-body">The following verification tasks have been flagged for review:</p>

<%= govuk_table do |table|
if @professional_standing_request.present?
table.with_caption(text: "LoPS")
table.with_head do |head|
head.with_row do |row|
row.with_cell(text: "Internal note")
row.with_cell(text: "Status")
end
end
table.with_body do |body|
body.with_row do |row|
row.with_cell { simple_format @professional_standing_request.verify_note }
row.with_cell { render(StatusTag::Component.new(@professional_standing_request.status)) }
end
end
end
end %>

<%= govuk_button_to "Continue", [:assessor_interface, @application_form, @assessment, :assessment_recommendation_review], method: :put %>
5 changes: 5 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
post "confirm", to: "assessment_recommendation_decline#update_confirm"
end

resource :assessment_recommendation_review,
controller: "assessment_recommendation_review",
path: "/recommendation/review",
only: %i[edit update]

resource :assessment_recommendation_verify,
controller: "assessment_recommendation_verify",
path: "/recommendation/verify",
Expand Down

0 comments on commit d7332bb

Please sign in to comment.