<% page_title t('titles.schools'), @school.displayName, t('titles.admins') %>

<h1><%= t('.title') %></h1>

<%= start_box t('.current') %>
  <table id="this_school_admin_users">
    <% if @current_admins.empty? %>
    <tr><td><%= t('.no_admins') %></td></tr>
    <% else %>
    <% Array(@current_admins).each do |a| %>
    <% u = a[:user] %>
    <% if u.puavoRemovalRequestTime %>
    <tr class="groupUserMarkedForDeletion">
    <% else %>
    <tr>
    <% end %>
      <td>
        <%= render(:partial => 'shared/owners_and_admins',
                   :locals => { :user => u, :schools => a[:schools] }) %>
      </td>
      <td><%= link_to(t('link.remove') + ' ►',
                      remove_school_admin_school_path(@school, u),
                      method: :put,
                      id: "remove_user_#{u.id}",
                      class: 'btn') %></td>
    </tr>
    <% end %>
    <% end %>
  </table>
<%= end_box %>

<%= start_box t('.available') %>
  <table id="other_admin_users">
    <% if @available_admins.empty? %>
    <tr><td><%= t('.none_left') %></td></tr>
    <% else %>
    <% Array(@available_admins).each do |a| %>
    <% u = a[:user] %>
    <% if u.puavoRemovalRequestTime %>
    <tr class="groupUserMarkedForDeletion">
    <% else %>
    <tr>
    <% end %>
      <td>
        <%= render(:partial => 'shared/owners_and_admins',
                   :locals => { :user => u, :schools => a[:schools] }) %>
      </td>
      <td>
        <%= link_to('◄ ' + t('link.add'),
                    add_school_admin_school_path(@school, u),
                    method: :put,
                    id: "add_user_#{u.id}",
                    class: 'btn') %>
      </td>
    </tr>
    <% end %>
    <% end %>
  </table>
<%= end_box %>

<hr>
