Skip to content

Commit

Permalink
Add an employment contract task to the admin
Browse files Browse the repository at this point in the history
The IRP journey includes a question asking if the claimant's contract is
at least 12 months. We want an admin task to confirm this answer.
  • Loading branch information
felixclack committed Jul 3, 2024
1 parent 52dc937 commit 4823ca2
Show file tree
Hide file tree
Showing 7 changed files with 45 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 %w[identity_confirmation visa arrival_date employment] if policy.international_relocation_payments?
return %w[identity_confirmation visa arrival_date employment employment_contract] 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 @@ -23,6 +23,7 @@ def applicable_task_names
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?
task_names.delete("arrival_date") unless claim.policy.international_relocation_payments?
task_names.delete("employment_contract") unless claim.policy.international_relocation_payments?
end
end

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

def employment_contract
[
["Employment contract at least one year", eligibility.one_year?]
]
end

def identity_confirmation
[
["Nationality", eligibility.nationality],
Expand Down
1 change: 1 addition & 0 deletions app/models/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Task < ApplicationRecord
matching_details
payroll_gender
arrival_date
employment_contract
visa
].freeze

Expand Down
27 changes: 27 additions & 0 deletions app/views/admin/tasks/employment_contract.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<% content_for(:page_title) { page_title("Claim #{@claim.reference} employment contract 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: "Employment contract 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.employment_contract %>
</div>

<div class="govuk-grid-column-two-thirds">
<% if !@task.passed.nil? %>
<%= render "task_outcome", task: @task %>
<% else %>
<%= render "form", task_name: "employment_contract", 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 @@ -156,6 +156,7 @@ en:
census_subjects_taught: "Check eligible subjects are taught"
visa: "Check visa"
arrival_date: "Check arrival date"
employment_contract: "Check employment contract"
undo_decision:
approved: "Undo approval"
rejected: "Undo rejection"
Expand Down Expand Up @@ -789,6 +790,8 @@ en:
title: "Does the claimant’s arrival date match the above information from their claim?"
employment:
title: "Does the claimant’s current school match the above information from their claim?"
employment_contract:
title: "Does the claimant’s employment contract match the above information from their claim?"

further_education_payments:
landing_page: Find out if you are eligible for any incentive payments for further education teachers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
end

trait :eligible do
eligible_contract
eligible_date_of_entry
eligible_home_office
eligible_school
Expand All @@ -18,5 +19,9 @@
trait :eligible_date_of_entry do
date_of_entry { 1.year.ago }
end

trait :eligible_contract do
one_year { true }
end
end
end
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", "Visa", "Arrival date", "Employment", "Decision"]
["Identity confirmation", "Visa", "Arrival date", "Employment", "Employment contract", "Decision"]
else
raise "Unimplemented policy: #{policy}"
end
Expand Down

0 comments on commit 4823ca2

Please sign in to comment.