<% page_title t('titles.organisation') %>

<h1><%= @organisation.o %></h1>

<%= start_box t('.title'), extraClasses="fullWidth" %>
  <table class="shrinkHeadingColumn">
    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.o") %></th>
      <td><%= h @organisation.o %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoEduOrgAbbreviation") %></th>
      <td><%= h @organisation.puavoEduOrgAbbreviation %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.description") %></th>
      <td><%= h @organisation.description %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoOrganisationOID") %></th>
      <td><%= h @organisation.puavoOrganisationOID %></td>
    </tr>

    <tr>
      <th><%= t('activeldap.attributes.ldap_organisation.puavoNotes')  %></th>
      <td class="noWrap"><%= format_notes(@organisation.puavoNotes) %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.telephoneNumber") %></th>
      <td><%=h @organisation.telephoneNumber %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.facsimileTelephoneNumber") %></th>
      <td><%= @organisation.facsimileTelephoneNumber %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.l") %></th>
      <td><%= @organisation.l %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.street") %></th>
      <td><%= @organisation.street %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.postOfficeBox") %></th>
      <td><%= @organisation.postOfficeBox %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.postalAddress") %></th>
      <td><%= @organisation.postalAddress %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.postalCode") %></th>
      <td><%= @organisation.postalCode %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.st") %></th>
      <td><%= @organisation.st %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoLocale") %></th>
      <td>
        <%= h language_by_locale(@organisation.puavoLocale) %><br />
        <i><%= t("old_preferred_language", language: @organisation.preferredLanguage) %></i>
      </td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoTimezone") %></th>
      <td><%= h humanize_timezone(@organisation.puavoTimezone) %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoKeyboardLayout") %></th>
      <td><%= h @organisation.puavoKeyboardLayout %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoKeyboardVariant") %></th>
      <td><%= h @organisation.puavoKeyboardVariant %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoAutomaticImageUpdates") %></th>
      <td><%= h translate_boolean_value(@organisation.puavoAutomaticImageUpdates) %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.eduOrgHomePageURI") %></th>
      <td><%= @organisation.eduOrgHomePageURI %></td>
    </tr>

    <%= render :partial => 'shared/auto_power_off_settings', :locals => { :object => @organisation } %>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoDeviceImage") %></th>
      <td>
        <%= @organisation.puavoDeviceImage %>
        <% if @release %> <span class="releaseName">(<%= @release %>)</span><% end %>
      </td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoImageSeriesSourceURL") %></th>
      <td><%= h multiple_value(@organisation.puavoImageSeriesSourceURL) %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoConf") %></th>
      <td>
        <%= render partial: 'shared/puavoconf', locals: { puavoconf: @full_puavoconf, type: 'org' } %>
      </td>
    </tr>

    <tr>
      <th><%= t('ldap_create_time') %></th>
      <td class="noWrap"><%= h @created %></td>
    </tr>

    <tr>
      <th><%= t('ldap_modify_time')  %></th>
      <td class="noWrap"><%= h @modified %></td>
    </tr>

    <tr>
      <th><%= t("activeldap.attributes.ldap_organisation.puavoBillingInfo") %></th>
      <td>
        <% Array(@organisation.puavoBillingInfo).each do |billing_info| %>
          <div><%= h billing_info %></div>
        <% end %>
      </td>
    </tr>

    <% if @puavomenu_data %>
    <tr>
      <th><%= t('activeldap.attributes.puavoMenuDataPreview') %></th>
      <td>
        <ul>
        <% 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>
      </td>
    </tr>
    <% end %>
  </table>
<%= end_box %>

<% content_for :page_tools do %>
<%=
toolbar do |tb|
  tb.link t('link.edit'),
          href: edit_organisation_path,
          icon: 'pencil'
end %>
<% end %>
