Skip to content

Commit

Permalink
Merge pull request #2954 from DFE-Digital/visa-task
Browse files Browse the repository at this point in the history
Add a visa check task for IRP
  • Loading branch information
felixclack authored Jul 2, 2024
2 parents c546c77 + b9e55db commit 3656cc2
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/models/claim_checking_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(claim)
delegate :policy, to: :claim

def applicable_task_names
return ["identity_confirmation"] if policy.international_relocation_payments?
return ["identity_confirmation", "visa"] if policy.international_relocation_payments?

@applicable_task_names ||= Task::NAMES.dup.tap do |task_names|
task_names.delete("induction_confirmation") unless claim.policy == Policies::EarlyCareerPayments
Expand All @@ -21,6 +21,7 @@ def applicable_task_names
task_names.delete("payroll_details") unless claim.must_manually_validate_bank_details?
task_names.delete("matching_details") unless matching_claims.exists?
task_names.delete("payroll_gender") unless claim.payroll_gender_missing? || task_names_for_claim.include?("payroll_gender")
task_names.delete("visa") unless claim.policy.international_relocation_payments?
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ def identity_confirmation
]
end

def visa
[
["Visa type", eligibility.visa_type]
]
end

private

delegate :eligibility, to: :claim
Expand Down
1 change: 1 addition & 0 deletions app/models/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Task < ApplicationRecord
payroll_details
matching_details
payroll_gender
visa
].freeze

belongs_to :claim
Expand Down
26 changes: 26 additions & 0 deletions app/views/admin/tasks/visa.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<% content_for(:page_title) { page_title("Claim #{@claim.reference} visa check for #{@claim.policy.short_name}") } %>
<%= link_to "Back", admin_claim_tasks_path(claim_id: @claim.id), class: "govuk-back-link" %>
<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>

<div class="govuk-grid-row">
<%= render "claim_summary", claim: @claim, heading: "Visa check" %>

<div class="govuk-grid-column-two-thirds">
<h2 class="govuk-heading-l"><%= @current_task_name.humanize %></h2>
</div>

<div class="govuk-grid-column-two-thirds">
<%= render "admin/claims/answers", answers: @tasks_presenter.visa %>
</div>

<div class="govuk-grid-column-two-thirds">
<% if !@task.passed.nil? %>
<%= render "task_outcome", task: @task %>
<% else %>
<%= render "form", task_name: "visa", claim: @claim %>
<% end %>

<%= render partial: "admin/task_pagination" %>
</div>
</div>

3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ en:
student_loan_plan: "Check student loan plan"
payroll_details: "Check bank/building society account details"
census_subjects_taught: "Check eligible subjects are taught"
visa: "Check visa"
undo_decision:
approved: "Undo approval"
rejected: "Undo rejection"
Expand Down Expand Up @@ -780,6 +781,8 @@ en:
task_questions:
identity_confirmation:
title: "Did %{claim_full_name} submit the claim?"
visa:
title: "Is the claimant’s visa type eligible for a claim?"

further_education_payments:
landing_page: Find out if you are eligible for any incentive payments for further education teachers
Expand Down
2 changes: 1 addition & 1 deletion spec/support/admin_view_claim_feature_shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def expect_page_to_have_policy_sections(policy)
when Policies::EarlyCareerPayments
["Identity confirmation", "Qualifications", "Induction confirmation", "Census subjects taught", "Employment", "Student loan plan", "Decision"]
when Policies::InternationalRelocationPayments
["Identity confirmation", "Decision"]
["Identity confirmation", "Visa", "Decision"]
else
raise "Unimplemented policy: #{policy}"
end
Expand Down

0 comments on commit 3656cc2

Please sign in to comment.