<!-- shared/_external_services starts -->
<% if @is_school %>
<h1><%= t('external_services.title_school') %></h1>
<% else %>
<h1><%= t('external_services.title_organisation') %></h1>
<% end %>

<p><%= t('external_services.description') %></p>

<p><%= t('external_services.activation') %></p>

<% if !@is_school && @super_owner %>
<div class="genericWarning">
    <p class="margin-0"><%= t('external_services.you_can_edit_services') %></p>
    <a href="/users/organisation_external_services/edit" class="btn"><%= t('external_services.edit_services') %></a>
</div>
<% end %>

<% if @external_services.empty? %>

<% if @is_school %>
<p class="genericNotice"><%= t('external_services.no_services_school') %></p>
<% else %>
<p class="genericNotice"><%= t('external_services.no_services_organisation') %></p>
<% end %>

<% else %>
<% @external_services.sort { |a, b| a[:name].downcase <=> b[:name].downcase }.each do |es| %>

<h2><%= es[:name] %></h2>

<% if es[:org_level] %>
<p class="genericNotice"><%= t('external_services.organisation_wide_activation') %></p>
<% end %>

<% if es[:trusted] %>
<p class="genericWarning"><%= t('external_services.requires_verified_email') %></p>
<% end %>

<% if es[:description] %>
<p><%= es[:description] %></p>
<% end %>

<% if es[:url] %>
<p><a href="<%= es[:url] %>" target="_new"><%= t("external_services.additional_info") %></a></p>
<% end %>

<table class="editForm">
  <tr>
    <th>Domain</th>
    <td><%= es[:domains].join("<br>").html_safe %></td>
  </tr>

  <tr>
    <th><%= t("external_services.email") %></th>
    <td><%= es[:email] %></td>
  </tr>

  <tr>
    <th><%= t("external_services.path_prefix") %></th>
    <td><%= es[:prefix] %></td>
  </tr>

  <tr>
    <th>DN</th>
    <td><%= es[:dn] %></td>
  </tr>

  <tr>
    <th><%= t('ldap_create_time') %></th>
    <td><%= es[:created] %></td>
  </tr>
</table>
<% end %>

<% end %>
<!-- shared/_external_services ends -->
