Skip to content

Commit

Permalink
Update details page tab with Ratifying provider
Browse files Browse the repository at this point in the history
  • Loading branch information
inulty-dfe committed Dec 16, 2024
1 parent 4be8032 commit 150ec63
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions app/views/publish/courses/_basic_details_tab.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,41 @@
end
end

if Settings.features.provider_partnerships
heading = "Ratifying provider"
partners = @provider.accredited_partners
add_provider_text = "Add at least one accredited partner"
add_provider_link = publish_provider_recruitment_cycle_provider_partnerships_path(@course.provider_code, @course.recruitment_cycle_year)
select_partner_text = 'Select an accredited partner'
select_partner_link = ratifying_provider_publish_provider_recruitment_cycle_course_path(@course.provider_code, @course.recruitment_cycle_year, @course.course_code)
change_partner_link = ratifying_provider_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)
# select_partner_link = ratifying_provider_publish_provider_recruitment_cycle_course_path(@course.provider_code, @course.recruitment_cycle_year, @course.course_code)
else
heading = "Accredited provider"
partners = @provider.accredited_providers
add_provider_text = "Add at least one accredited provider"
add_provider_link = publish_provider_recruitment_cycle_accredited_providers_path(@course.provider_code, @course.recruitment_cycle_year)
select_partner_text = 'Select an accredited provider'
select_partner_link = accredited_provider_publish_provider_recruitment_cycle_course_path(@course.provider_code, @course.recruitment_cycle_year, @course.course_code)
change_partner_link = accredited_provider_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)
end

unless @provider.accredited_provider?
summary_list.with_row(html_attributes: { data: { qa: "course__accredited_provider" } }) do |row|
row.with_key { "Accredited provider" }
row.with_key { heading }
row.with_value { course.accrediting_provider&.provider_name }
if course.is_published? || course.is_withdrawn?
row.with_action
elsif !course.accrediting_provider.nil?
row.with_action(href: accredited_provider_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code),
row.with_action(href: change_partner_link,
visually_hidden_text: "accredited provider")
elsif @provider.accredited_providers.any?
elsif partners.any?
row.with_value do
"<div class=\"govuk-inset-text app-inset-text--narrow-border app-inset-text--important\">#{govuk_link_to('Select an accredited provider', accredited_provider_publish_provider_recruitment_cycle_course_path(@course.provider_code, @course.recruitment_cycle_year, @course.course_code))}</div>".html_safe
"<div class=\"govuk-inset-text app-inset-text--narrow-border app-inset-text--important\">#{govuk_link_to(select_partner_text, select_partner_link)}</div>".html_safe
end
else
row.with_value do
"<div class=\"govuk-inset-text app-inset-text--narrow-border app-inset-text--important\">#{govuk_link_to('Add at least one accredited provider', publish_provider_recruitment_cycle_accredited_providers_path(@course.provider_code, @course.recruitment_cycle_year))}</div>".html_safe
"<div class=\"govuk-inset-text app-inset-text--narrow-border app-inset-text--important\">#{govuk_link_to(add_provider_text, add_provider_link)}</div>".html_safe
end
end
end
Expand Down

0 comments on commit 150ec63

Please sign in to comment.