From 3056a32cf43fb3fbdad136a876b304a21dd36491 Mon Sep 17 00:00:00 2001 From: Alkesh Vaghmaria Date: Wed, 4 Sep 2024 18:02:54 +0100 Subject: [PATCH] Claim Summary for FE --- .../admin/amendments_controller.rb | 1 + .../admin/base_admin_controller.rb | 5 + app/controllers/admin/claims_controller.rb | 1 + app/controllers/admin/decisions_controller.rb | 1 + app/controllers/admin/notes_controller.rb | 1 + app/controllers/admin/payments_controller.rb | 1 + .../admin/support_tickets_controller.rb | 1 + app/controllers/admin/tasks_controller.rb | 1 + app/views/admin/amendments/index.html.erb | 2 +- app/views/admin/decisions/new.html.erb | 2 +- app/views/admin/notes/index.html.erb | 2 +- app/views/admin/payments/index.html.erb | 2 +- ...ummary_further_education_payments.html.erb | 149 ++++++++++++++++++ app/views/admin/tasks/arrival_date.html.erb | 2 +- .../tasks/census_subjects_taught.html.erb | 2 +- app/views/admin/tasks/employment.html.erb | 2 +- .../admin/tasks/employment_contract.html.erb | 4 +- .../admin/tasks/employment_start.html.erb | 2 +- .../tasks/identity_confirmation.html.erb | 2 +- app/views/admin/tasks/index.html.erb | 2 +- .../admin/tasks/induction_confirmation.erb | 2 +- .../admin/tasks/matching_details.html.erb | 2 +- .../admin/tasks/payroll_details.html.erb | 2 +- app/views/admin/tasks/payroll_gender.html.erb | 2 +- app/views/admin/tasks/qualifications.html.erb | 2 +- .../admin/tasks/student_loan_amount.html.erb | 2 +- .../admin/tasks/student_loan_plan.html.erb | 2 +- app/views/admin/tasks/subject.html.erb | 2 +- app/views/admin/tasks/teaching_hours.html.erb | 2 +- app/views/admin/tasks/visa.html.erb | 2 +- spec/features/admin/admin_view_claim_spec.rb | 1 + ...dmin_view_claim_feature_shared_examples.rb | 23 --- ...ged_in_with_tid_feature_shared_examples.rb | 72 +++++++++ 33 files changed, 255 insertions(+), 46 deletions(-) create mode 100644 app/views/admin/tasks/_claim_summary_further_education_payments.html.erb create mode 100644 spec/support/admin_view_claim_logged_in_with_tid_feature_shared_examples.rb diff --git a/app/controllers/admin/amendments_controller.rb b/app/controllers/admin/amendments_controller.rb index 967a555237..5955dd7985 100644 --- a/app/controllers/admin/amendments_controller.rb +++ b/app/controllers/admin/amendments_controller.rb @@ -2,6 +2,7 @@ class Admin::AmendmentsController < Admin::BaseAdminController before_action :load_claim before_action :ensure_service_operator before_action :ensure_claim_is_amendable + before_action :set_claim_summary_view, only: [:index] def index end diff --git a/app/controllers/admin/base_admin_controller.rb b/app/controllers/admin/base_admin_controller.rb index e589014d1c..5b6846d941 100644 --- a/app/controllers/admin/base_admin_controller.rb +++ b/app/controllers/admin/base_admin_controller.rb @@ -58,5 +58,10 @@ def clear_session session.delete(:role_codes) session.delete(:claims_backlink_path) end + + def set_claim_summary_view + policy_append = @claim.policy.to_s.underscore if @claim.policy.is_a?(Policies::FurtherEducationPayments) + @claim_summary_view = ["claim_summary", policy_append].compact.join("_") + end end end diff --git a/app/controllers/admin/claims_controller.rb b/app/controllers/admin/claims_controller.rb index 6f26e3cb2a..b42a0c878b 100644 --- a/app/controllers/admin/claims_controller.rb +++ b/app/controllers/admin/claims_controller.rb @@ -62,6 +62,7 @@ def hold redirect_to admin_claim_notes_path(@claim) else @note = Note.new + set_claim_summary_view render "admin/notes/index" end end diff --git a/app/controllers/admin/decisions_controller.rb b/app/controllers/admin/decisions_controller.rb index e24adfbb14..8bb37d76f0 100644 --- a/app/controllers/admin/decisions_controller.rb +++ b/app/controllers/admin/decisions_controller.rb @@ -6,6 +6,7 @@ class Admin::DecisionsController < Admin::BaseAdminController before_action :reject_decided_claims, unless: -> { qa_decision_task? } before_action :reject_missing_payroll_gender, only: [:create] before_action :reject_if_claims_preventing_payment, only: [:create] + before_action :set_claim_summary_view def new @decision = Decision.new diff --git a/app/controllers/admin/notes_controller.rb b/app/controllers/admin/notes_controller.rb index 8efb06a6a4..c67eb15da3 100644 --- a/app/controllers/admin/notes_controller.rb +++ b/app/controllers/admin/notes_controller.rb @@ -2,6 +2,7 @@ module Admin class NotesController < BaseAdminController before_action :ensure_service_operator before_action :load_claim + before_action :set_claim_summary_view def index @note = Note.new diff --git a/app/controllers/admin/payments_controller.rb b/app/controllers/admin/payments_controller.rb index 452a39bcf6..2e68f8ec50 100644 --- a/app/controllers/admin/payments_controller.rb +++ b/app/controllers/admin/payments_controller.rb @@ -3,6 +3,7 @@ class PaymentsController < BaseAdminController before_action :ensure_service_operator before_action :find_payroll_run, except: [:index] before_action :find_payment, except: [:index] + before_action :set_claim_summary_view, only: [:index] def index @claim = Claim.find(params[:claim_id]) diff --git a/app/controllers/admin/support_tickets_controller.rb b/app/controllers/admin/support_tickets_controller.rb index 33ccef43f8..73b0d0e1b0 100644 --- a/app/controllers/admin/support_tickets_controller.rb +++ b/app/controllers/admin/support_tickets_controller.rb @@ -2,6 +2,7 @@ module Admin class SupportTicketsController < BaseAdminController before_action :ensure_service_operator before_action :load_claim + before_action :set_claim_summary_view def create @support_ticket = @claim.build_support_ticket(support_ticket_params) diff --git a/app/controllers/admin/tasks_controller.rb b/app/controllers/admin/tasks_controller.rb index f98582e2b4..801a9bf5fd 100644 --- a/app/controllers/admin/tasks_controller.rb +++ b/app/controllers/admin/tasks_controller.rb @@ -5,6 +5,7 @@ class Admin::TasksController < Admin::BaseAdminController before_action :load_claim before_action :ensure_task_has_not_already_been_completed, only: [:create] before_action :load_matching_claims, only: [:show], if: -> { params[:name] == "matching_details" } + before_action :set_claim_summary_view def index @claim_checking_tasks = ClaimCheckingTasks.new(@claim) diff --git a/app/views/admin/amendments/index.html.erb b/app/views/admin/amendments/index.html.erb index 6537072356..213bcea8bb 100644 --- a/app/views/admin/amendments/index.html.erb +++ b/app/views/admin/amendments/index.html.erb @@ -3,7 +3,7 @@ <%= link_to "Back", claims_backlink_path, class: "govuk-back-link" %>
- <%= render "admin/tasks/claim_summary", claim: @claim, heading: @claim.reference %> + <%= render "admin/tasks/#{@claim_summary_view}", claim: @claim, heading: @claim.reference %>
diff --git a/app/views/admin/decisions/new.html.erb b/app/views/admin/decisions/new.html.erb index f298b5a001..61e18646a4 100644 --- a/app/views/admin/decisions/new.html.erb +++ b/app/views/admin/decisions/new.html.erb @@ -4,7 +4,7 @@
<%= render("shared/error_summary", instance: @decision, errored_field_id_overrides: { "result": "decision_result_approved" }) if @decision.errors.any? %> - <%= render "admin/tasks/claim_summary", claim: @claim, heading: "Claim decision" %> + <%= render "admin/tasks/#{@claim_summary_view}", claim: @claim, heading: "Claim decision" %>
<%= render("incomplete_tasks", claim: @claim, incomplete_task_names: @claim_checking_tasks.incomplete_task_names) if @claim_checking_tasks.incomplete_task_names.any? %> diff --git a/app/views/admin/notes/index.html.erb b/app/views/admin/notes/index.html.erb index 9ac9766a0d..91509e736b 100644 --- a/app/views/admin/notes/index.html.erb +++ b/app/views/admin/notes/index.html.erb @@ -6,7 +6,7 @@ <%= render("shared/error_summary", instance: @hold_note, errored_field_id_overrides: {body: "hold_body"}) if @hold_note.errors.any? %>
- <%= render "admin/tasks/claim_summary", claim: @claim, heading: @claim.reference %> + <%= render "admin/tasks/#{@claim_summary_view}", claim: @claim, heading: @claim.reference %>
diff --git a/app/views/admin/payments/index.html.erb b/app/views/admin/payments/index.html.erb index 07418af218..d5047f0ae5 100644 --- a/app/views/admin/payments/index.html.erb +++ b/app/views/admin/payments/index.html.erb @@ -6,7 +6,7 @@ <%# render("shared/error_summary", instance: @hold_note, errored_field_id_overrides: {body: "hold_body"}) if @hold_note.errors.any? %>
- <%= render "admin/tasks/claim_summary", claim: @claim, heading: @claim.reference %> + <%= render "admin/tasks/#{@claim_summary_view}", claim: @claim, heading: @claim.reference %>
diff --git a/app/views/admin/tasks/_claim_summary_further_education_payments.html.erb b/app/views/admin/tasks/_claim_summary_further_education_payments.html.erb new file mode 100644 index 0000000000..39b790187f --- /dev/null +++ b/app/views/admin/tasks/_claim_summary_further_education_payments.html.erb @@ -0,0 +1,149 @@ +
+ <%= claim.policy.short_name %> (<%= claim.academic_year %>) +

+ + <%= claim_summary_heading(claim) %> + + + <%= link_to "View full claim", admin_claim_path(claim), class: "govuk-link" %> + <%= link_to "Amend claim", new_admin_claim_amendment_path(claim), class: "govuk-link" if claim.amendable? %> + <%= link_to "Top up claim", new_admin_claim_topup_path(@claim), class: "govuk-link" if @claim.topupable? %> + +

+
+ +
+ <%= render("admin/claims/banner", important_notes: @claim.important_notes) if @claim.important_notes.any? %> +
+ +<%= render "shared/assignment_banner", claim: @claim %> + +
+
+
+
+ TRN +
+
+ <%= claim.eligibility.teacher_reference_number.present? ? claim.eligibility.teacher_reference_number : "Not provided" %> +
+
+
+
+ NI number +
+ +
+ <%= claim.personal_data_removed? ? personal_data_removed_text : claim.national_insurance_number %> +
+
+
+
+ Full name +
+ +
+ <%= claim.personal_data_removed? ? personal_data_removed_text : claim.full_name %> +
+
+
+
+ Date of birth +
+ +
+ <%= claim.personal_data_removed? ? personal_data_removed_text : l(claim.date_of_birth, format: :day_month_year) %> +
+
+
+
+ Email address +
+ +
+ <%= claim.email_address %> +
+
+
+
+ Mobile number +
+ +
+ <%= claim.mobile_number %> +
+
+
+
+ Reference +
+ +
+ <%= claim.reference %> +
+
+
+
+
+
+
+
+ Submitted +
+ +
+ <%= l(claim.submitted_at) %> +
+
+
+
+ Decision due +
+ +
+ <%= l(claim.decision_deadline_date) %> + <%= decision_deadline_warning(claim, {na_text: ""}) %> +
+
+ +
+
+ Status +
+ +
+ <%= status(claim) %> +
+
+ +
+
+ Claim amount +
+ +
+ <%= number_to_currency(claim.award_amount_with_topups) %> +
+
+ +
+
+ Provider Name +
+ +
+ <%= @claim.school.name %> +
+
+ +
+
+ UK Provider Reference Number (UKPRN) +
+ +
+ <%= claim.school.ukprn %> +
+
+
+
diff --git a/app/views/admin/tasks/arrival_date.html.erb b/app/views/admin/tasks/arrival_date.html.erb index 1fbe12d7b3..e7895719d3 100644 --- a/app/views/admin/tasks/arrival_date.html.erb +++ b/app/views/admin/tasks/arrival_date.html.erb @@ -3,7 +3,7 @@ <%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render "claim_summary", claim: @claim, heading: "Arrival date" %> + <%= render @claim_summary_view, claim: @claim, heading: "Arrival date" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/census_subjects_taught.html.erb b/app/views/admin/tasks/census_subjects_taught.html.erb index 38df1ebfe7..90b69959f1 100644 --- a/app/views/admin/tasks/census_subjects_taught.html.erb +++ b/app/views/admin/tasks/census_subjects_taught.html.erb @@ -4,7 +4,7 @@
- <%= render "claim_summary", claim: @claim, heading: "School workforce census subjects taught" %> + <%= render @claim_summary_view, claim: @claim, heading: "School workforce census subjects taught" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/employment.html.erb b/app/views/admin/tasks/employment.html.erb index 4bfef7e3d2..f466b15788 100644 --- a/app/views/admin/tasks/employment.html.erb +++ b/app/views/admin/tasks/employment.html.erb @@ -4,7 +4,7 @@
- <%= render "claim_summary", claim: @claim, heading: "Employment" %> + <%= render @claim_summary_view, claim: @claim, heading: "Employment" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/employment_contract.html.erb b/app/views/admin/tasks/employment_contract.html.erb index 08a9e683b0..f9d3acff5b 100644 --- a/app/views/admin/tasks/employment_contract.html.erb +++ b/app/views/admin/tasks/employment_contract.html.erb @@ -3,7 +3,7 @@ <%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render "claim_summary", claim: @claim, heading: "Employment contract check" %> + <%= render @claim_summary_view, claim: @claim, heading: "Employment contract check" %>

<%= @current_task_name.humanize %>

@@ -23,5 +23,3 @@ <%= render partial: "admin/task_pagination" %>
- - diff --git a/app/views/admin/tasks/employment_start.html.erb b/app/views/admin/tasks/employment_start.html.erb index cc32b639ba..bfc4f7b9b8 100644 --- a/app/views/admin/tasks/employment_start.html.erb +++ b/app/views/admin/tasks/employment_start.html.erb @@ -3,7 +3,7 @@ <%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render "claim_summary", claim: @claim, heading: "Employment start date check" %> + <%= render @claim_summary_view, claim: @claim, heading: "Employment start date check" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/identity_confirmation.html.erb b/app/views/admin/tasks/identity_confirmation.html.erb index 2efe3073c6..e5394b84f4 100644 --- a/app/views/admin/tasks/identity_confirmation.html.erb +++ b/app/views/admin/tasks/identity_confirmation.html.erb @@ -4,7 +4,7 @@
- <%= render "claim_summary", claim: @claim, heading: "Identity confirmation" %> + <%= render @claim_summary_view, claim: @claim, heading: "Identity confirmation" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/index.html.erb b/app/views/admin/tasks/index.html.erb index a3298d52f9..72fc04bd14 100644 --- a/app/views/admin/tasks/index.html.erb +++ b/app/views/admin/tasks/index.html.erb @@ -19,7 +19,7 @@ <% end %>
- <%= render "claim_summary", claim: @claim %> + <%= render @claim_summary_view, claim: @claim %>
diff --git a/app/views/admin/tasks/induction_confirmation.erb b/app/views/admin/tasks/induction_confirmation.erb index 38c6e30473..c765d146cc 100644 --- a/app/views/admin/tasks/induction_confirmation.erb +++ b/app/views/admin/tasks/induction_confirmation.erb @@ -4,7 +4,7 @@
- <%= render "claim_summary", claim: @claim, heading: "Induction confirmation" %> + <%= render @claim_summary_view, claim: @claim, heading: "Induction confirmation" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/matching_details.html.erb b/app/views/admin/tasks/matching_details.html.erb index 4f47428d79..e384c8f4ae 100644 --- a/app/views/admin/tasks/matching_details.html.erb +++ b/app/views/admin/tasks/matching_details.html.erb @@ -4,7 +4,7 @@
- <%= render "claim_summary", claim: @claim, heading: "Claims with matching details" %> + <%= render @claim_summary_view, claim: @claim, heading: "Claims with matching details" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/payroll_details.html.erb b/app/views/admin/tasks/payroll_details.html.erb index 1b27486cd6..198e56622a 100644 --- a/app/views/admin/tasks/payroll_details.html.erb +++ b/app/views/admin/tasks/payroll_details.html.erb @@ -3,7 +3,7 @@ <%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render "claim_summary", claim: @claim, heading: "Payroll details" %> + <%= render @claim_summary_view, claim: @claim, heading: "Payroll details" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/payroll_gender.html.erb b/app/views/admin/tasks/payroll_gender.html.erb index 207ef04949..6a7b86cef0 100644 --- a/app/views/admin/tasks/payroll_gender.html.erb +++ b/app/views/admin/tasks/payroll_gender.html.erb @@ -5,7 +5,7 @@
- <%= render "claim_summary", claim: @claim, heading: "Payroll gender" %> + <%= render @claim_summary_view, claim: @claim, heading: "Payroll gender" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/qualifications.html.erb b/app/views/admin/tasks/qualifications.html.erb index 039f7d0a2f..34644e9e64 100644 --- a/app/views/admin/tasks/qualifications.html.erb +++ b/app/views/admin/tasks/qualifications.html.erb @@ -4,7 +4,7 @@
- <%= render "claim_summary", claim: @claim, heading: "Qualifications" %> + <%= render @claim_summary_view, claim: @claim, heading: "Qualifications" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/student_loan_amount.html.erb b/app/views/admin/tasks/student_loan_amount.html.erb index 607f6eabad..84d68f5b87 100644 --- a/app/views/admin/tasks/student_loan_amount.html.erb +++ b/app/views/admin/tasks/student_loan_amount.html.erb @@ -4,7 +4,7 @@
- <%= render "claim_summary", claim: @claim, heading: "Student loan amount" %> + <%= render @claim_summary_view, claim: @claim, heading: "Student loan amount" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/student_loan_plan.html.erb b/app/views/admin/tasks/student_loan_plan.html.erb index 806de69b62..5f38310cef 100644 --- a/app/views/admin/tasks/student_loan_plan.html.erb +++ b/app/views/admin/tasks/student_loan_plan.html.erb @@ -4,7 +4,7 @@
- <%= render "claim_summary", claim: @claim, heading: "Student loan plan type" %> + <%= render @claim_summary_view, claim: @claim, heading: "Student loan plan type" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/subject.html.erb b/app/views/admin/tasks/subject.html.erb index 9da4ebe45b..b6d1ea247e 100644 --- a/app/views/admin/tasks/subject.html.erb +++ b/app/views/admin/tasks/subject.html.erb @@ -3,7 +3,7 @@ <%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render "claim_summary", claim: @claim, heading: "Subject check" %> + <%= render @claim_summary_view, claim: @claim, heading: "Subject check" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/teaching_hours.html.erb b/app/views/admin/tasks/teaching_hours.html.erb index 5eac21416b..89f2b57018 100644 --- a/app/views/admin/tasks/teaching_hours.html.erb +++ b/app/views/admin/tasks/teaching_hours.html.erb @@ -3,7 +3,7 @@ <%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render "claim_summary", claim: @claim, heading: "Subject check" %> + <%= render @claim_summary_view, claim: @claim, heading: "Subject check" %>

<%= @current_task_name.humanize %>

diff --git a/app/views/admin/tasks/visa.html.erb b/app/views/admin/tasks/visa.html.erb index 3110ab6a7d..1022fd2937 100644 --- a/app/views/admin/tasks/visa.html.erb +++ b/app/views/admin/tasks/visa.html.erb @@ -3,7 +3,7 @@ <%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render "claim_summary", claim: @claim, heading: "Visa check" %> + <%= render @claim_summary_view, claim: @claim, heading: "Visa check" %>

<%= @current_task_name.humanize %>

diff --git a/spec/features/admin/admin_view_claim_spec.rb b/spec/features/admin/admin_view_claim_spec.rb index 6a64e3f860..122926cdd5 100644 --- a/spec/features/admin/admin_view_claim_spec.rb +++ b/spec/features/admin/admin_view_claim_spec.rb @@ -2,4 +2,5 @@ RSpec.feature "Admin view claim" do Policies.all.each { |policy| it_behaves_like "Admin View Claim Feature", policy } + Policies.all.excluding(Policies::FurtherEducationPayments).each { |policy| it_behaves_like "Admin View Claim logged in with tid", policy } end diff --git a/spec/support/admin_view_claim_feature_shared_examples.rb b/spec/support/admin_view_claim_feature_shared_examples.rb index 56d2218154..4f720f5aa9 100644 --- a/spec/support/admin_view_claim_feature_shared_examples.rb +++ b/spec/support/admin_view_claim_feature_shared_examples.rb @@ -12,17 +12,6 @@ ) } - let!(:claim_logged_in_with_tid) { - eligibility = create(:"#{policy.to_s.underscore}_eligibility", :eligible) - create( - :claim, - :submitted, - :logged_in_with_tid, - policy: policy, - eligibility: eligibility - ) - } - let!(:multiple_claim) { eligibility = create(:"#{policy.to_s.underscore}_eligibility", :eligible) create( @@ -104,7 +93,6 @@ expect(page).to have_content("– Approved") expect(page).to have_content("Approved awaiting payroll") - expect(page).to have_content("Not signed in with DfE Identity") end end @@ -159,17 +147,6 @@ end end - scenario "#{policy} view claim logged in with tid" do - travel_to(@within_academic_year) do - visit admin_claims_path - - find("a[href='#{admin_claim_tasks_path(claim_logged_in_with_tid)}']").click - - expect(page).to have_content("Claim route") - expect(page).to have_content("Signed in with DfE Identity") - end - end - def expect_page_to_have_policy_sections(policy) sections = case policy when Policies::StudentLoans diff --git a/spec/support/admin_view_claim_logged_in_with_tid_feature_shared_examples.rb b/spec/support/admin_view_claim_logged_in_with_tid_feature_shared_examples.rb new file mode 100644 index 0000000000..17366bb176 --- /dev/null +++ b/spec/support/admin_view_claim_logged_in_with_tid_feature_shared_examples.rb @@ -0,0 +1,72 @@ +RSpec.shared_examples "Admin View Claim logged in with tid" do |policy| + let!(:journey_configuration) { create(:journey_configuration, policy.to_s.underscore) } + let(:academic_year) { journey_configuration.current_academic_year } + + let!(:claim_logged_in_with_tid) { + eligibility = create(:"#{policy.to_s.underscore}_eligibility", :eligible) + create( + :claim, + :submitted, + :logged_in_with_tid, + policy: policy, + eligibility: eligibility + ) + } + + let!(:approved_paid_claim) { + eligibility = create(:"#{policy.to_s.underscore}_eligibility", :eligible) + create( + :claim, + :approved, + policy: policy, + eligibility: eligibility + ) + } + let!(:approved_awaiting_payroll_claim) { + eligibility = create(:"#{policy.to_s.underscore}_eligibility", :eligible) + create( + :claim, + :payrollable, + policy: policy, + eligibility: eligibility + ) + } + before do + @signed_in_user = sign_in_as_service_operator + + PayrollRun.create_with_claims!([approved_paid_claim], [], created_by: @signed_in_user) + + # NOTE: mirror claims factory for academic_year attribute "hardcoding" of 2019 + current_academic_year = + if [Policies::EarlyCareerPayments, Policies::LevellingUpPremiumPayments].include?(policy) + academic_year + else + AcademicYear.new(2019) + end + @within_academic_year = Time.zone.local(current_academic_year.start_year, 9, 1) + end + + scenario "#{policy} view claim logged in with tid" do + travel_to(@within_academic_year) do + visit admin_claims_path + + find("a[href='#{admin_claim_tasks_path(claim_logged_in_with_tid)}']").click + + expect(page).to have_content("Claim route") + expect(page).to have_content("Signed in with DfE Identity") + end + end + + scenario "#{policy} filter approved awaiting payroll claims" do + travel_to(@within_academic_year) do + visit admin_claims_path + + select "Approved awaiting payroll", from: "Status" + click_on "Apply filters" + + find("a[href='#{admin_claim_tasks_path(approved_awaiting_payroll_claim)}']").click + + expect(page).to have_content("Not signed in with DfE Identity") + end + end +end