<% settings = Setting.plugin_redmine_ux_toolkit || {} %>
<% assign_to_me_enabled = settings.fetch('enable_assign_to_me_button', '1').to_s != '0' %>
<% assign_to_me_and_start_enabled = settings.fetch('enable_assign_to_me_and_start_button', '0').to_s == '1' %>
<% assign_to_me_and_start_status_id = settings['assign_to_me_and_start_status_id'].to_s %>
<% quick_status_actions_enabled = settings.fetch('enable_quick_status_actions', '0').to_s == '1' %>
<% quick_status_action_status_ids = Array(settings['quick_status_action_status_ids']).map(&:to_s) %>

<p>
  <strong><%= l(:label_ux_toolkit_issue_quick_actions) %></strong>
</p>

<p>
  <%= hidden_field_tag 'settings[enable_assign_to_me_button]', '0', id: nil %>
  <%= check_box_tag 'settings[enable_assign_to_me_button]',
                    '1',
                    assign_to_me_enabled,
                    id: 'settings_enable_assign_to_me_button' %>
  <%= label_tag 'settings_enable_assign_to_me_button',
                l(:label_ux_toolkit_enable_assign_to_me_button) %>
  <em class="info"><%= l(:text_ux_toolkit_enable_assign_to_me_button_help) %></em>
</p>

<p>
  <%= hidden_field_tag 'settings[enable_assign_to_me_and_start_button]', '0', id: nil %>
  <%= check_box_tag 'settings[enable_assign_to_me_and_start_button]',
                    '1',
                    assign_to_me_and_start_enabled,
                    id: 'settings_enable_assign_to_me_and_start_button' %>
  <%= label_tag 'settings_enable_assign_to_me_and_start_button',
                l(:label_ux_toolkit_enable_assign_to_me_and_start_button) %>
  <em class="info"><%= l(:text_ux_toolkit_enable_assign_to_me_and_start_button_help) %></em>
</p>

<p>
  <%= label_tag 'settings_assign_to_me_and_start_status_id',
                l(:label_ux_toolkit_assign_to_me_and_start_status) %>
  <%= select_tag 'settings[assign_to_me_and_start_status_id]',
                 options_from_collection_for_select(IssueStatus.sorted, :id, :name, assign_to_me_and_start_status_id),
                 include_blank: true,
                 id: 'settings_assign_to_me_and_start_status_id' %>
  <em class="info"><%= l(:text_ux_toolkit_assign_to_me_and_start_status_help) %></em>
</p>

<p>
  <%= hidden_field_tag 'settings[enable_quick_status_actions]', '0', id: nil %>
  <%= check_box_tag 'settings[enable_quick_status_actions]',
                    '1',
                    quick_status_actions_enabled,
                    id: 'settings_enable_quick_status_actions' %>
  <%= label_tag 'settings_enable_quick_status_actions',
                l(:label_ux_toolkit_enable_quick_status_actions) %>
  <em class="info"><%= l(:text_ux_toolkit_enable_quick_status_actions_help) %></em>
</p>

<p>
  <%= label_tag 'settings_quick_status_action_status_ids',
                l(:label_ux_toolkit_quick_status_action_statuses) %>
  <%= hidden_field_tag 'settings[quick_status_action_status_ids][]', '', id: nil %>
  <%= select_tag 'settings[quick_status_action_status_ids][]',
                 options_from_collection_for_select(IssueStatus.sorted, :id, :name, quick_status_action_status_ids),
                 multiple: true,
                 size: [[IssueStatus.count, 8].min, 1].max,
                 id: 'settings_quick_status_action_status_ids' %>
  <em class="info"><%= l(:text_ux_toolkit_quick_status_action_statuses_help) %></em>
</p>
