<% page_title t('titles.organisation'), t('titles.servers'), @server.cn %>

<%= render :partial => 'shared/main_information', :locals => { :device => @server} %>

<%= render :partial => 'shared/linux_device_information', :locals => { :device => @server} %>

<%= render :partial => 'devices/hwinfo', :locals => { :rawInfo => @server.puavoDeviceHWInfo } %>

<%= start_box t('.automounts'), extraClass="fullWidth" %>
  <% if Array(@server.puavoExport).empty? %>
  <p class="empty"><%= t('.no_automounts') %></p>
  <% else %>
  <table>
    <tr>
      <th><%= t("activeldap.attributes.#{@server.class.to_s.downcase}.puavoExport") %></th>
      <td><%= safe_join(Array(@server.puavoExport), "<br>".html_safe)  %></td>
    </tr>
  </table>
  <% end %>
<%= end_box %>

<% unless Array(@server.puavoSchool).empty? %>
<%= start_box t('servers.school_limit.title'), extraClass="fullWidth" %>
  <table id="serverSchoolLimitBox">
    <% @server.forced_schools.each do |status, school| %>
    <tr>
      <td>
      <% if status %>
        <%= link_to school.displayName, school_path(school)  %>
      <% else %>
        <p style="color: red;"><em><%= t('servers.school_limit.missing_school', :school => school) %></em></p>
      <% end %>
      </td>
      </tr>
    <% end %>
    </table>
<%= end_box %>
<% end %>

<% content_for :tools do %>
<ul>
  <li>
    <%= link_to edit_server_path(@server), class: 'btn' do %>
      <i class="icon-pencil"></i><%= t('link.edit') %>
    <% end %>
  </li>

  <% if @server.hostCertificates %>
  <li>
    <%= link_to revoke_certificate_server_path(@server),  data: { confirm: t('general_confirm') }, method: :delete, class: 'btn btn-danger' do %>
      <i class="icon-cancel"></i><%= t('link.set_install_mode') %>
    <% end %>
  </li>
</ul>
<% end %>
<% end %>

<script>
const ALL_PUAVOCONF = <%= raw JSON.pretty_generate(@full_puavoconf) %>;
</script>

<% content_for :javascript do %>
<%= render partial: 'shared/copy_text.js' %>
<%= render partial: 'shared/copy_basic_info.js', locals: { device: @server } %>
<%= render partial: 'shared/puavoconf_table.js', locals: { select: 'div.basicInfo select#changeVisibleConfig', container: 'div.basicInfo div#puavoConfOutput', type: 'dev' } %>
<% end %>
