<!-- shared/_main_information starts -->
<div class="basicInfo">
  <div class="basicInfoImage">
    <% path = device.class == Server ? image_server_path(device) : image_device_path(@school, device) %>
    <%= image_tag( device.jpegPhoto.nil? ? "computer.png" : path, class: "image", skip_pipeline: true ) %>
  </div>

  <div class="basicInfoDetails">
    <h1><%= h device.puavoHostname %> <span class="fqdn">(<%= h @fqdn %> <button id="copyFQDN"><%= t('link.copy') %></button>)</span></h1>

    <% if device.class == Device && device.puavoDeviceType == 'laptop' && device.puavoDisplayName %>
    <p class="infoTitle"><%= t('activeldap.attributes.device.puavoDisplayName') %></p>
    <p class="infoValue"><%= h device.puavoDisplayName %></p>
    <% end %>

    <% if controller_name == "devices" %>
    <p class="infoTitle"><%= t('activeldap.attributes.device.puavoDeviceType') %></p>
    <p class="infoValue"><%= Puavo::CONFIG["device_types"][device.puavoDeviceType]["label"][I18n.locale.to_s] %></p>
    <% end %>

    <% unless device.puavoTag.empty? %>
    <p class="infoTitle"><%= t('activeldap.attributes.device.puavoTag') %></p>
    <p class="infoValue"><%= h device.puavoTag %></p>
    <% end %>

    <% if @full_puavoconf && !@full_puavoconf.empty? %>
    <p class="infoTitle"><%= t('activeldap.attributes.device.puavoConf') %></p>

    <select id="changeVisibleConfig" class="margin-left-25px margin-top-5px" autocomplete="off">
      <option value="directly_set"><%= t('puavoconf_table.show.directly_set') %></option>
      <option value="effective"><%= t('puavoconf_table.show.effective') %></option>
      <option value="effective_overrides"><%= t('puavoconf_table.show.effective_overrides') %></option>
      <option value="all"><%= t('puavoconf_table.show.all') %></option>
    </select>

    <button id="copyPuavoconf"><%= t('link.copy_to_clipboard') %></button>

    <div id="puavoConfOutput">
    <%= render partial: 'shared/puavoconf', locals: { puavoconf: @full_puavoconf, type: 'dev' } %>
    </div>
    <% end %>

    <% if @puavomenu_data %>
    <p class="infoTitle"><%= t('activeldap.attributes.puavoMenuDataPreview') %></p>
    <ul class="infoValue">
      <% if @puavomenu_data[:categories] %>
      <li><strong><%= t('puavomenu_editor.preview.categories_title') %>:</strong> <%= @puavomenu_data[:categories].join(', ') %></li>
      <% end %>
      <% if @puavomenu_data[:menus] %>
      <li><strong><%= t('puavomenu_editor.preview.menus_title') %>:</strong> <%= @puavomenu_data[:menus].join(', ') %></li>
      <% end %>
      <% if @puavomenu_data[:programs] %>
      <li><strong><%= t('puavomenu_editor.preview.programs_title') %>:</strong> <%= @puavomenu_data[:programs].join(', ') %></li>
      <% end %>
    </ul>
    <% end %>

    <% unless device.classes.include?('puavoPrinter') ||  device.classes.include?('puavoOtherDevice') %>
    <% unless device.puavoDeviceStatus.nil? %>
    <p class="infoTitle"><%= t('activeldap.attributes.device.puavoDeviceStatus') %></p>
    <p class="infoValue"><%= h device.puavoDeviceStatus %></p>
    <% end %>
    <% end %>

    <% if @previous_reset_fulfilled %>
    <p class="infoTitle"><%= t('devices.index.previous_reset_fulfilled') %>:</p>
    <p class="infoValue"><%= @previous_reset_fulfilled %></p>
    <% end %>

    <% if @reset %>
    <%= render partial: 'shared/reset' %>
    <% end %>
  </div>
</div>

<!-- shared/_main_information ends -->
