Skip to content

Commit

Permalink
Add a task for checking arrival date
Browse files Browse the repository at this point in the history
We want to confirm the date of entry provided is eligible for an IRP
claim.
  • Loading branch information
felixclack committed Jul 2, 2024
1 parent 3656cc2 commit dbb8478
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 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", "visa"] if policy.international_relocation_payments?
return %w[identity_confirmation visa arrival_date] 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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ def initialize(claim)
@claim = claim
end

def arrival_date
[
["Arrival date", eligibility.date_of_entry.to_fs(:govuk_date)]
]
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 @@ -18,6 +18,7 @@ class Task < ApplicationRecord
payroll_details
matching_details
payroll_gender
arrival_date
visa
].freeze

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

<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.arrival_date %>
</div>

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

<%= render partial: "admin/task_pagination" %>
</div>
</div>
1 change: 1 addition & 0 deletions config/initializers/date_formats.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DateTime::DATE_FORMATS[:custom_ordinal] = lambda { |time| time.strftime("%A #{time.day.ordinalize} %B %Y") }
DateTime::DATE_FORMATS[:govuk_date] = lambda { |time| time.strftime("%d-%m-%Y") }
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ en:
claim_route_with_tid: "Signed in with DfE Identity"
passport_number: "Passport number"
nationality: "Nationality"
arrival_date: "Date of entry"
decision:
created_at: "Created at"
result: "Result"
Expand Down Expand Up @@ -154,6 +155,7 @@ en:
payroll_details: "Check bank/building society account details"
census_subjects_taught: "Check eligible subjects are taught"
visa: "Check visa"
arrival_date: "Check arrival date"
undo_decision:
approved: "Undo approval"
rejected: "Undo rejection"
Expand Down Expand Up @@ -783,6 +785,8 @@ en:
title: "Did %{claim_full_name} submit the claim?"
visa:
title: "Is the claimant’s visa type eligible for a claim?"
arrival_date:
title: "Does the claimant’s arrival 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 @@ -6,12 +6,17 @@
end

trait :eligible do
eligible_date_of_entry
eligible_home_office
eligible_school
end

trait :eligible_school do
association :current_school, factory: :school
end

trait :eligible_date_of_entry do
date_of_entry { 1.year.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", "Decision"]
["Identity confirmation", "Visa", "Arrival date", "Decision"]
else
raise "Unimplemented policy: #{policy}"
end
Expand Down

0 comments on commit dbb8478

Please sign in to comment.