<% define_admin_breadcrumbs do %>
  <% add_admin_breadcrumb('疑修排行榜', admins_path) %>
<% end %>


<div class="box search-form-container user-list-form">
  <%= form_tag(admins_issues_rank_index_path, method: :get, class: 'form-inline search-form flex-1', id: 'issue-rank-date-form') do %>
    <div class="input-group">
      <span class="input-group-text">开始日期</span>
      <input class="form-control datetimepicker" type="text" name="begin_date" value="<%= params[:begin_date] || (Date.yesterday - 7.days).to_s%>" aria-label="选择日期">
    </div>
    <div class="input-group">
      <span class="input-group-text">截止日期</span>
      <input class="form-control datetimepicker" type="text" name="end_date" value="<%= params[:end_date] || Date.yesterday.to_s%>" aria-label="选择日期">
    </div>
  <% end %>
</div>

<div class="box admin-list-container issue-rank-list-container">
  <%= render partial: 'admins/issues_rank/shared/data_list', locals: { statistics: @statistics } %>
</div>
<script>
  $(".datetimepicker").on('change', function() {
    $("#issue-rank-date-form").submit()
  });
  $(".datetimepicker").on('change', function() {
    $("#issue-rank-date-form").submit()
  });
  $('.datetimepicker').datetimepicker({
    language: 'zh-CN', // 中文语言包
    autoclose: 1, // 选中日期后自动关闭
    format: 'yyyy-mm-dd', // 日期格式
    minView: "month", // 最小日期显示单元，这里最小显示月份界面，即可以选择到日
    todayBtn: 1, // 显示今天按钮
    todayHighlight: 1, // 显示今天高亮
  });
</script>