<% issue = local_assigns[:issue] || @issue %>
<% settings = Setting.plugin_redmine_ux_toolkit || {} %>
<% issue_quality_enabled = settings.fetch('enable_issue_quality_check', '0').to_s == '1' %>

<% if issue&.new_record? && issue_quality_enabled %>
  <% min_subject_length = settings.fetch('issue_quality_min_subject_length', '8').to_i %>
  <% min_description_length = settings.fetch('issue_quality_min_description_length', '30').to_i %>
  <% min_subject_length = 8 unless (1..1000).cover?(min_subject_length) %>
  <% min_description_length = 30 unless (1..1000).cover?(min_description_length) %>

  <div class="ux-toolkit-issue-quality-check"
       data-min-subject-length="<%= min_subject_length %>"
       data-min-description-length="<%= min_description_length %>"
       data-check-subject-short="<%= settings.fetch('issue_quality_check_subject_short', '1').to_s == '1' ? '1' : '0' %>"
       data-check-description-empty="<%= settings.fetch('issue_quality_check_description_empty', '1').to_s == '1' ? '1' : '0' %>"
       data-check-description-short="<%= settings.fetch('issue_quality_check_description_short', '1').to_s == '1' ? '1' : '0' %>"
       data-check-assignee-missing="<%= settings.fetch('issue_quality_check_assignee_missing', '1').to_s == '1' ? '1' : '0' %>"
       data-check-priority-missing="<%= settings.fetch('issue_quality_check_priority_missing', '1').to_s == '1' ? '1' : '0' %>"
       data-message-heading="<%= l(:text_ux_toolkit_issue_quality_warning_heading) %>"
       data-message-subject-short="<%= l(:text_ux_toolkit_issue_quality_subject_short) %>"
       data-message-description-empty="<%= l(:text_ux_toolkit_issue_quality_description_empty) %>"
       data-message-description-short="<%= l(:text_ux_toolkit_issue_quality_description_short) %>"
       data-message-assignee-missing="<%= l(:text_ux_toolkit_issue_quality_assignee_missing) %>"
       data-message-priority-missing="<%= l(:text_ux_toolkit_issue_quality_priority_missing) %>"
       style="display:none;">
    <p><strong></strong></p>
    <ul></ul>
  </div>
<% end %>
