<!-- shared/_linux_device_information starts -->
<div class="contentBox">
  <header>
    <div class="flex-cols">
      <%= title(device) %>
      <button type="button" id="copyBasicInfo" style="margin-left: auto;"><%= t('devices.show.copy_basic_info') %></button>
    </div>
  </header>
  <div class="contents">
  <table>
    <tr>
      <th><%= t("activeldap.attributes.device.dn") %></th>
      <td><%= h (device.dn.to_s.split(',').join(',<wbr>')).html_safe %></td>
    </tr>

    <tr>
      <th>FQDN</th>
      <td><%= h @fqdn %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceManufacturer") %></th>
      <td><%= h device.puavoDeviceManufacturer %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceModel") %></th>
      <td><%= h device.puavoDeviceModel %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.serialNumber") %></th>
      <td><%= h device.serialNumber %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.macAddress") %></th>
      <td><%= multiple_value(device.macAddress) %></td>
    </tr>

    <% if device.classes.include?('puavoPrinter') || device.classes.include?('puavoOtherDevice') %>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.ipHostNumber") %></th>
      <td><%= h device.ipHostNumber %></td>
    </tr>
    <% end %>

    <% unless device.classes.include?('puavoPrinter') || device.classes.include?('puavoOtherDevice') || device.classes.include?('puavoServer') %>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDevicePrimaryUser") %></th>
      <td><%= h link_to_user_by_dn(device.puavoDevicePrimaryUser) %></td>
    </tr>
    <% end %>

    <% unless device.classes.include?('puavoServer') || device.classes.include?('puavoPrinter') || device.classes.include?('puavoOtherDevice') %>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceBootMode") %></th>
      <td><%= h t("shared.boot_mode_#{device.puavoDeviceBootMode}") %></td>
    </tr>
    <% end %>

    <% unless device.classes.include?('puavoPrinter') || device.classes.include?('puavoOtherDevice') %>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoPrinterDeviceURI") %></th>
      <td><%= h device.puavoPrinterDeviceURI %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoPrinterPPD") %></th>
      <td><%= h model_name_from_ppd(device.puavoPrinterPPD) %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDefaultPrinter") %></th>
      <td><%= h device.puavoDefaultPrinter %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceDefaultAudioSource") %></th>
      <td><%=h device.puavoDeviceDefaultAudioSource %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceDefaultAudioSink") %></th>
      <td><%= h device.puavoDeviceDefaultAudioSink %></td>
    </tr>

    <% if device.class == Device %>
      <%= render :partial => 'shared/allow_guest_and_personal_device', :locals => { :object => device } %>
    <% end %>

    <% if ["laptop", "wirelessaccesspoint"].include?(device.puavoDeviceType) %>
      <%= render :partial => 'shared/automatic_image_updates', :locals => { :object => device } %>
    <% end %>

    <% if device.puavoDeviceType == "laptop" %>
      <tr>
        <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoPersonallyAdministered") %></th>
        <td><%= translate_boolean_value(device.puavoPersonallyAdministered) %></td>
      </tr>
    <% end %>
    <% end %>

    <tr>
      <th><%= t('last_ldap_auth_date') %></th>
      <td><%= h device['authTimestamp'] %></td>
    </tr>

    <tr>
      <th><%= t('ldap_create_time') %></th>
      <td><%= h device['createTimestamp'] %></td>
    </tr>

    <tr>
      <th><%= t('ldap_modify_time') %></th>
      <td><%= h device['modifyTimestamp'] %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.description") %></th>
      <td><%= html_escape(device.description.to_s) %></td>
    </tr>

    <tr>
      <th><%= t('activeldap.attributes.device.puavoNotes') %></th>
      <td><%= format_notes(device.puavoNotes) %></td>
    </tr>
  </table>
<%= end_box %>

<% unless device.classes.include?('puavoServer') || device.classes.include?('puavoPrinter') || device.classes.include?('puavoOtherDevice') %>
<%= start_box t('shared.autopoweroff') %>
  <table>
    <%= render :partial => 'shared/auto_power_off_settings', :locals => { :object => device } %>
  </table>
<%= end_box %>
<% end %>

<%= render :partial => 'shared/purchase_information', :locals => { :device => device} %>

<%= start_box t('shared.location') %>
  <table>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoLocationName") %></th>
      <td><%= h device.puavoLocationName %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoLatitude") %></th>
      <td><%= h device.puavoLatitude %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoLongitude") %></th>
      <td><%= h device.puavoLongitude %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.device.puavoTimezone") %></th>
      <td><%= h humanize_timezone(device.puavoTimezone) %></td>
    </tr>
  </table>
<%= end_box %>

<% if (device.classes | ['puavoNetbootDevice', 'puavoLocalbootDevice', 'puavoServer']).count < (device.classes.count + 3) %>
<%= start_box t('shared.display_settings') %>
  <table>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceMonitorsXML") %></th>
      <td><small><pre><%= h device.puavoDeviceMonitorsXML %></pre></small></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceXrandr") %></th>
      <td><%= safe_join(Array(device.puavoDeviceXrandr), "<br>".html_safe) %></td>
    </tr>
  </table>
<%= end_box %>

<%= start_box t('shared.kernel_settings') %>
  <table>
    <% if device.puavoDeviceType == "laptop" %>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceCurrentImage") %></th>
      <td>
        <% if @releases.include?(device.puavoDeviceCurrentImage) %>
        <%= h device.puavoDeviceCurrentImage %> (<span class="releaseName"><%= @releases[device.puavoDeviceCurrentImage] %></span>)</li>
        <% else %>
        <%= h device.puavoDeviceCurrentImage %>
        <% end %>
      </td>
    </tr>
    <% end %>

    <% if ["thinclient", "fatclient", "laptop", "ltspserver", "bootserver"].include?(device.puavoDeviceType) %>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceImage") %></th>
      <td>
        <% if @releases.include?(device.puavoDeviceImage) %>
        <%= h device.puavoDeviceImage %> (<span class="releaseName"><%= @releases[device.puavoDeviceImage] %></span>)</li>
        <% else %>
        <%= h device.puavoDeviceImage %>
        <% end %>
      </td>
    </tr>
    <% end %>

    <% if device.puavoDeviceType == "thinclient" %>
    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceBootImage") %></th>
      <td><%= h device.puavoDeviceBootImage %></td>
    </tr>
    <% end %>

    <% if device.puavoDeviceType == "bootserver" %>
    <tr>
      <th><%= t('activeldap.attributes.server.puavoDeviceAvailableImage') %></th>
      <td>
        <% if device.puavoDeviceAvailableImage %>
        <ul>
          <% Array(device.puavoDeviceAvailableImage).sort.each do |i| %>
          <% if @releases.include?(i) %>
          <li><%= h i %> (<span class="releaseName"><%= @releases[i] %></span>)</li>
          <% else %>
          <li><%= h i %></li>
          <% end %>
          <% end %>
        </ul>
        <% end %>
      </td>
    </tr>
    <% end %>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoImageSeriesSourceURL") %></th>
      <td><%= h value_or_default_value_by_parent(device, "puavoImageSeriesSourceURL") %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceKernelVersion") %></th>
      <td><%= h device.puavoDeviceKernelVersion %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.puavoDeviceKernelArguments") %></th>
      <td><%= h device.puavoDeviceKernelArguments %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.#{device.class.to_s.downcase}.hostCertificates") %></th>
      <td>
      <% if device.hostCertificates %>
        <%= t(".certificate_status_true") %>
      <% else %>
        <%= t(".certificate_status_false") %>
      <% end %>
      </td>
    </tr>
  </table>
<%= end_box %>

<%= render :partial => 'shared/mountpoint', :locals => { :object => device } %>

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