<% content_for :before_content do %> <%= govuk_back_link href: schemes_organisation_path(@organisation) %> <% end %> <%= form_with model: @organisation, url: schemes_duplicates_organisation_path(@organisation), method: "post" do |f| %> <%= f.govuk_error_summary %> <% if @duplicate_schemes.any? %> <% if @duplicate_locations.any? %> <% title = "Review these sets of schemes and locations" %> <% else %> <% title = "Review these sets of schemes" %> <% end %> <% else %> <% title = "Review these sets of locations" %> <% end %> <% content_for :title, title %> <% if current_user.support? %> <%= render SubNavigationComponent.new( items: secondary_items(request.path, @organisation.id), ) %> <% end %>

<%= title %>

Since your organisation recently merged, we’ve reviewed your schemes for possible duplicates.

These sets of schemes and locations might be duplicates because they have the same answers for certain fields.

What you need to do

If you need help with this, <%= govuk_link_to "contact the helpdesk (opens in a new tab)", GlobalConstants::HELPDESK_URL, target: "#" %>.

<% if @duplicate_schemes.any? %>

<%= @duplicate_schemes.count == 1 ? "This set" : "These #{@duplicate_schemes.count} sets" %> of schemes might have duplicates

<%= govuk_details(summary_text: "Why are these schemes identified as duplicates?") do %>

These schemes have the same answers for the following fields:

<% end %>

The links below open in a new tab.

<%= govuk_table do |table| %> <%= table.with_head do |head| %> <% head.with_row do |row| %> <% row.with_cell(header: true, text: "Schemes") %> <% end %> <%= table.with_body do |body| %> <% @duplicate_schemes.each do |duplicate_set| %> <% body.with_row do |row| %> <% row.with_cell do %>
    <% duplicate_set.each do |scheme| %>
  1. <%= govuk_link_to scheme.service_name, scheme, target: "#" %>
  2. <% end %>
<% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <% if @duplicate_locations.any? %>

<%= @duplicate_locations.count == 1 ? "This set" : "These #{@duplicate_locations.count} sets" %> of locations might have duplicates

<%= govuk_details(summary_text: "Why are these locations identified as duplicates?") do %>

These locations belong to the same scheme and have the same answers for the following fields:

<% end %>

The links below open in a new tab.

<%= govuk_table do |table| %> <%= table.with_head do |head| %> <% head.with_row do |row| %> <% row.with_cell(header: true, text: "Locations") %> <% row.with_cell(header: true, text: "Scheme") %> <% end %> <%= table.with_body do |body| %> <% @duplicate_locations.each do |duplicate_set| %> <% body.with_row do |row| %> <% row.with_cell do %>
    <% duplicate_set[:locations].each do |location| %>
  1. <%= govuk_link_to location.name, scheme_location_path(location), target: "#" %>
  2. <% end %>
<% end %> <% row.with_cell do %> <%= govuk_link_to duplicate_set[:scheme].service_name, duplicate_set[:scheme], target: "#" %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <%= f.govuk_check_boxes_fieldset :scheme_duplicates_checked, legend: { text: "Have you resolved all duplicates?" } do %> <%= f.govuk_check_box :scheme_duplicates_checked, true, false, multiple: false, checked: false, label: { text: "Yes, none of the schemes and locations above are duplicates" } %> <% end %> <%= f.govuk_submit "Confirm" %>
<% end %>