<% define_admin_breadcrumbs do %>
  <% add_admin_breadcrumb('概览', admins_path) %>
<% end %>

<%# cache_if EduSetting.get("open_baidu_tongji").to_s == "true", "/admin/dashboards/#{Time.now.strftime('%Y-%m-%d')}", :expires_in => 1.days do %>
<div class="header bg-gradient-primary pb-8 pt-md-8">
  <div class="container-fluid">
    <div class="header-body">
      <!-- Card stats -->
      <div class="row">
        <%@subject_name.each_with_index do |subject, index| %>
          <div class="col-xl-3 col-lg-6" style="padding-bottom: 15px;">
            <div class="card card-stats mb-4 mb-xl-0">
              <div class="card-body">
                <div class="row">
                  <div class="col">
                    <h5 class="card-title text-uppercase11 text-muted mb-0"><%=subject %></h5>
                    <span class="h2 font-weight-bold mb-0"><%= @subject_data[index] %></span>
                  </div>
                  <div class="col-auto">
                    <div class="icon icon-shape rounded-circle shadow">
                      <i class="fa <%=@subject_icon[index] %>"></i>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        <% end %>

      </div>
    </div>
  </div>
</div>
<%#end %>

<div class="box admin-list-container project-language-list-container">
  <table class="table table-hover text-center subject-list-table">
    <thead class="thead-light">
    <tr>
      <th width="20%">指标名称</th>
      <th width="20%">当日数</th>
      <th width="20%">七日内</th>
      <th width="20%">30日内</th>
      <th width="20%">周用户留存率</th>
    </tr>
    </thead>
    <tbody>
    <tr class="">
      <td>
        <button type="button" class="btn btn-primary" style="font-size:14px;width:85px;padding: 0; height:36px;background-color:#5475fb;border-radius:4px;border-color: #5475fb;">活跃用户</button>
      </td>
      <td><%=@active_user_count %></td>
      <td><%=@weekly_active_user_count %></td>
      <td><%=@month_active_user_count %></td>
      <td><%="#{@weekly_keep_rate.to_f * 100 }%" %></td>
      </td>
    </tr>
    <tr>
      <td>
        <button type="button" class="btn btn-primary" style="font-size:14px;width:85px;padding: 0; height:36px;background-color:#36cfc9;border-radius:4px; border-color: #36cfc9;">新注册用户</button>
      </td>
      <td><%=@day_new_user_count %></td>
      <td><%=@weekly_new_user_count %></td>
      <td><%=@month_new_user_count %></td>
      <td><%="--" %></td>
    </tr>
    <tr>
      <td>
        <button type="button" class="btn btn-primary" style="font-size:14px;width:85px;padding: 0; height:36px;background-color:#f89422;border-radius:4px; border-color: #f89422;">活跃项目</button>
      </td>
      <td><%=@day_active_project_count %></td>
      <td><%=@weekly_active_project_count %></td>
      <td><%=@month_active_project_count %></td>
      <td><%="--" %></td>
    </tr>
    <tr>
      <td>
        <button type="button" class="btn btn-primary" style="font-size:14px;width:85px;padding: 0; height:36px;background-color:#9d74ff;border-radius:4px; border-color: #9d74ff;">新增项目</button>
      </td>
      <td><%=@day_new_project_count %></td>
      <td><%=@weekly_new_project_count %></td>
      <td><%=@month_new_project_count %></td>
      <td><%="--" %></td>
    </tr>
    </tbody>
  </table>
  <% if EduSetting.get("open_baidu_tongji").to_s == "true" %>
  <%= render partial: 'admins/dashboards/baidu_tongji' %>
  <% end %>
</div>
<div id="project-language-modals">
</div>