-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AssessmentRecommendationReviewController
This adds a new controller for handling the process of sending the application to review after the verification stage.
- Loading branch information
1 parent
d7a21b0
commit d7332bb
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
app/controllers/assessor_interface/assessment_recommendation_review_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
26 changes: 26 additions & 0 deletions
26
app/views/assessor_interface/assessment_recommendation_review/edit.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters