Skip to content

Commit

Permalink
Add an employment start date task
Browse files Browse the repository at this point in the history
THe IRP journey collects a claimant's employment start date.

We want an admin task to verify the answer provided.
  • Loading branch information
felixclack committed Jul 3, 2024
1 parent 8105263 commit 837f9a7
Show file tree
Hide file tree
Showing 7 changed files with 44 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 employment_contract] if policy.international_relocation_payments?
return %w[identity_confirmation visa arrival_date employment employment_contract employment_start] 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 @@ -24,6 +24,7 @@ def applicable_task_names
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?
task_names.delete("employment_start") unless claim.policy.international_relocation_payments?
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def employment_contract
["Employment contract at least one year", eligibility.one_year?]
]
end

def employment_start
[
["Employment start date", eligibility.start_date&.to_fs(:govuk_date)]
]
end

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

Expand Down
27 changes: 27 additions & 0 deletions app/views/admin/tasks/employment_start.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 start date 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 start date 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_start %>
</div>

<div class="govuk-grid-column-two-thirds">
<% if !@task.passed.nil? %>
<%= render "task_outcome", task: @task %>
<% else %>
<%= render "form", task_name: "employment_start", 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 @@ -157,6 +157,7 @@ en:
visa: "Check visa"
arrival_date: "Check arrival date"
employment_contract: "Check employment contract"
employment_start: "Check employment start date"
undo_decision:
approved: "Undo approval"
rejected: "Undo rejection"
Expand Down Expand Up @@ -792,6 +793,8 @@ en:
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?"
employment_start:
title: "Does the claimant’s employment start date 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 @@ -23,5 +23,9 @@
trait :eligible_contract do
one_year { true }
end

trait :eligible_start_date do
start_date { 1.month.ago }
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", "Employment contract", "Decision"]
["Identity confirmation", "Visa", "Arrival date", "Employment", "Employment contract", "Employment start", "Decision"]
else
raise "Unimplemented policy: #{policy}"
end
Expand Down

0 comments on commit 837f9a7

Please sign in to comment.