<% settings = Setting.plugin_redmine_ux_toolkit || {} %>
<% attachment_storage = RedmineUxToolkit::Services::AttachmentStorage %>

<div class="ux-toolkit-settings-section">
  <p><strong><%= l(:label_ux_toolkit_attachment_storage) %></strong></p>
  <p class="info"><%= l(:text_ux_toolkit_attachment_storage_help) %></p>

  <p>
    <%= hidden_field_tag 'settings[enable_attachment_trash]', '0', id: nil %>
    <%= check_box_tag 'settings[enable_attachment_trash]',
                      '1',
                      attachment_storage.enabled?(settings),
                      id: 'settings_enable_attachment_trash' %>
    <%= label_tag 'settings_enable_attachment_trash',
                  l(:label_ux_toolkit_enable_attachment_trash) %>
  </p>

  <p>
    <%= label_tag 'settings_attachment_trash_retention_days',
                  l(:label_ux_toolkit_attachment_trash_retention_days) %>
    <%= number_field_tag 'settings[attachment_trash_retention_days]',
                         attachment_storage.retention_days(settings),
                         min: 1,
                         max: 3650,
                         step: 1,
                         id: 'settings_attachment_trash_retention_days',
                         size: 5 %>
  </p>

  <p>
    <%= label_tag 'settings_attachment_trash_cleanup_limit',
                  l(:label_ux_toolkit_attachment_trash_cleanup_limit) %>
    <%= number_field_tag 'settings[attachment_trash_cleanup_limit]',
                         attachment_storage.cleanup_limit(settings),
                         min: 1,
                         max: 500,
                         step: 1,
                         id: 'settings_attachment_trash_cleanup_limit',
                         size: 5 %>
  </p>

  <p>
    <%= l(:label_ux_toolkit_attachment_trash_path) %>:
    <code><%= h(attachment_storage.trash_root) %></code>
  </p>

  <p>
    <%= link_to l(:label_ux_toolkit_manage_attachment_storage),
                ux_toolkit_attachment_storage_path,
                class: 'icon icon-attachment' %>
  </p>
</div>
