<%
  # Redmine plugin for Document Management System "Features"
  #
  # Vít Jonáš <vit.jonas@gmail.com>, Daniel Munn  <dan.munn@munnster.co.uk>, Karel Pičman <karel.picman@kontron.com>
  #
  # This file is part of Redmine DMSF plugin.
  #
  # Redmine DMSF plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General
  # Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
  # later version.
  #
  # Redmine DMSF plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  # more details.
  #
  # You should have received a copy of the GNU General Public License along with Redmine DMSF plugin. If not, see
  # <https://www.gnu.org/licenses/>.
%>

<div class="box tabular dmfs-box-tabular">
  <p class="warning"><%= l(:info_file_locked) %></p>
  <div class="splitcontent">
    <div class="splitcontentleft">
      <p>
        <%= label_tag "committed_files[#{i}][title]", l(:label_title) %>
        <%= text_field_tag "committed_files[#{i}][title]", upload.title, readonly: true %>
      </p>
    </div>
    <div class="splitcontentright">
      <p>
        <%= label_tag "committed_files[#{i}][name]", l(:label_filename) %>
        <%= text_field_tag "committed_files[#{i}][name]", upload.name, readonly: true %>
      </p>
    </div>
  </div>
  <div class="splitcontent">
    <div class="splitcontentleft">
      <p>
        <%= label_tag "committed_files[#{i}][version]", l(:label_dmsf_version) %>
        <%= text_field_tag "committed_files[#{i}][version]",
             "#{DmsfUploadHelper::gui_version(upload.major_version)}.#{DmsfUploadHelper::gui_version(upload.minor_version)}",
             readonly: true %>
      </p>
      <p>
        <%= label_tag "committed_files[#{i}][mime_type]", l(:label_mime) %>
        <%= text_field_tag "committed_files[#{i}][mime_type]", upload.mime_type, readonly: true %>
      </p>
      <p>
        <%= label_tag "committed_files[#{i}][human_size]", l(:label_size) %>
        <%= text_field_tag "committed_files[#{i}][human_size]", number_to_human_size(upload.size), readonly: true %>
      </p>
    </div>
    <div class="splitcontentright">
      <div class="custom_fields">
        <% upload.custom_values.each do |value| %>
          <p>
            <%= label_tag "committed_files[#{i}][#{value.custom_field.id}]", value.custom_field.name %>
            <% value.value = nil if value.custom_field.dmsf_not_inheritable %>
            <%= text_field_tag "committed_files[#{i}][#{value.custom_field.id}]", value.value, readonly: true %>
          </p>
        <% end %>
      </div>
    </div>
  </div>
</div>
