|
|
|
<% item_label = format_label(@pagy.count, "managing agents") %>
|
|
|
|
|
|
|
|
<% if current_user.support? %>
|
|
|
|
<%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %>
|
|
|
|
<%= render SubNavigationComponent.new(
|
|
|
|
items: secondary_items(request.path, @organisation.id),
|
|
|
|
) %>
|
|
|
|
<% if !@organisation.active? %>
|
|
|
|
<%= govuk_notification_banner(title_text: "Important") do %>
|
|
|
|
<p class="govuk-notification-banner__heading govuk-!-width-full" style="max-width: fit-content">
|
|
|
|
This organisation is deactivated.
|
|
|
|
<p>
|
|
|
|
You cannot add any new managing agents.
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<h2 class="govuk-visually-hidden">Managing Agents</h2>
|
|
|
|
<p class="govuk-body">A managing agent can submit logs for this organisation.</p>
|
|
|
|
<% if @total_count == 0 %>
|
|
|
|
<p class="govuk-body">This organisation does not currently have any managing agents.</p>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<% if !@organisation.active? %>
|
|
|
|
<%= govuk_notification_banner(title_text: "Important") do %>
|
|
|
|
<p class="govuk-notification-banner__heading govuk-!-width-full" style="max-width: fit-content">
|
|
|
|
This organisation is deactivated.
|
|
|
|
<p>
|
|
|
|
You cannot add any new managing agents.
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<%= render partial: "organisations/headings", locals: { main: "Your managing agents", sub: current_user.organisation.name } %>
|
|
|
|
<p class="govuk-body">A managing agent can submit logs for this organisation.</p>
|
|
|
|
<% if @total_count == 0 %>
|
|
|
|
<p class="govuk-body">This organisation does not currently have any managing agents.</p>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% if (current_user.support? || current_user.data_coordinator?) && @organisation.active? %>
|
|
|
|
<%= govuk_button_link_to "Add a managing agent", managing_agents_add_organisation_path, html: { method: :get } %>
|
|
|
|
<% end %>
|
|
|
|
<% if @total_count != 0 %>
|
|
|
|
<%= render SearchComponent.new(current_user:, search_label: "Search for a managing agent", value: @searched) %>
|
|
|
|
<%= render partial: "organisation_relationships/related_org_list", locals: {
|
|
|
|
related_orgs: @managing_agents,
|
|
|
|
title: "Managing agents",
|
|
|
|
pagy: @pagy,
|
|
|
|
searched: @searched,
|
|
|
|
item_label:,
|
|
|
|
search_item: "managing agents",
|
|
|
|
total_count: @total_count,
|
|
|
|
remove_path: ->(org_id) { managing_agents_remove_organisation_path(target_organisation_id: org_id) },
|
|
|
|
} %>
|
|
|
|
<%= render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "managing agents" } %>
|
|
|
|
<% end %>
|