From 33305e852008cc04291c6a6081914ada6b07f91b Mon Sep 17 00:00:00 2001
From: Lori Bailey <44073106+elceebee@users.noreply.github.com>
Date: Wed, 8 Jan 2025 09:41:40 +0000
Subject: [PATCH] wip
---
app/models/withdrawal_reason.rb | 6 ++++++
app/views/provider_interface/reports/index.html.erb | 6 +++++-
.../reports/withdrawal_reasons_reports/show.html.erb | 2 +-
.../reports/index_provider_user_two_providers_spec.rb | 5 +++++
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/app/models/withdrawal_reason.rb b/app/models/withdrawal_reason.rb
index 9f3d4a8710a..c02c0e03dd4 100644
--- a/app/models/withdrawal_reason.rb
+++ b/app/models/withdrawal_reason.rb
@@ -36,6 +36,12 @@ def self.get_reason_options(reason = '')
end
end
+ def self.all_reasons
+ selectable_reasons.map do |key, value|
+ build_reason(key, value)
+ end&.flatten
+ end
+
def self.build_reason(key, value)
if value == {}
key
diff --git a/app/views/provider_interface/reports/index.html.erb b/app/views/provider_interface/reports/index.html.erb
index 335bec749ce..a5b1a621103 100644
--- a/app/views/provider_interface/reports/index.html.erb
+++ b/app/views/provider_interface/reports/index.html.erb
@@ -35,7 +35,11 @@
<%= govuk_link_to t('page_titles.provider.diversity_report'), provider_interface_reports_provider_diversity_report_path(provider_id: provider) %>
- <%= govuk_link_to t('page_titles.provider.withdrawal_report'), provider_interface_reports_withdrawal_reports_path %>
+ <% if FeatureFlag.active? :new_candidate_withdrawal_reasons %>
+ <%= govuk_link_to t('page_titles.provider.withdrawal_report'), provider_interface_reports_withdrawal_reports_path %>
+ <% else %>
+ <%= govuk_link_to t('page_titles.provider.withdrawal_report'), provider_interface_reports_provider_withdrawal_report_path(provider_id: provider) %>
+ <% end %>
<% end %>
diff --git a/app/views/provider_interface/reports/withdrawal_reasons_reports/show.html.erb b/app/views/provider_interface/reports/withdrawal_reasons_reports/show.html.erb
index 29415e88298..e3958356839 100644
--- a/app/views/provider_interface/reports/withdrawal_reasons_reports/show.html.erb
+++ b/app/views/provider_interface/reports/withdrawal_reasons_reports/show.html.erb
@@ -30,7 +30,7 @@
<%= row.with_cell(
text: t("provider_interface.withdrawal_reasons.show.#{heading}"),
html_attributes: { class: 'withdrawal-reasons-report-table__heading' },
- ) %>
+ ) %>
<% end %>
<% end %>
<% end %>
diff --git a/spec/system/provider_interface/reports/index_provider_user_two_providers_spec.rb b/spec/system/provider_interface/reports/index_provider_user_two_providers_spec.rb
index 976a497a79f..a9bf5795bc0 100644
--- a/spec/system/provider_interface/reports/index_provider_user_two_providers_spec.rb
+++ b/spec/system/provider_interface/reports/index_provider_user_two_providers_spec.rb
@@ -2,6 +2,11 @@
RSpec.describe 'Provider with two providers reports index' do
include DfESignInHelpers
+
+ before do
+ FeatureFlag.deactivate(:new_candidate_withdrawal_reasons)
+ end
+
scenario 'when a provider user has more than one provider' do
given_a_provider_user_with_two_providers_exists
and_i_am_signed_in_as_provider_user