<div class="row">
  <div class="col s12">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          90-day signups
          <span class="right grey-text">
            <%= number_with_delimiter User.last.id %> total
          </span>
        </div>
        <%= area_chart @reports.pluck(:day, :user_signups), colors: ['#2196F3'] %>
      </div>
    </div>
  </div>
  <div class="col s12">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          Monthly subscriptions
          <span class="right grey-text">
            <%= number_with_delimiter User.where(selected_billing_plan_id: 4).count %> total
          </span>
        </div>
        <%= 
          area_chart [
            { name: 'Started subscriptions', data: @reports.pluck(:day, :new_monthly_subscriptions) },
            { name: 'Ended subscriptions',   data: @reports.pluck(:day, :ended_monthly_subscriptions) }
          ],
          colors: ['#2196F3']
        %>
      </div>
    </div>
  </div>
  <div class="col s12">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          Trimonthly subscriptons
          <span class="right grey-text">
            <%= number_with_delimiter User.where(selected_billing_plan_id: 5).count %> total
          </span>
        </div>
        <%= area_chart [
            { name: 'Started subscriptions', data: @reports.pluck(:day, :new_trimonthly_subscriptions) },
            { name: 'Ended subscriptions',   data: @reports.pluck(:day, :ended_trimonthly_subscriptions) }
          ],
          colors: ['#2196F3'] %>
      </div>
    </div>
  </div>
  <div class="col s12">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          Annual subscriptions
          <span class="right grey-text">
            <%= number_with_delimiter User.where(selected_billing_plan_id: 6).count %> total
          </span>
        </div>
        <%= area_chart [
            { name: 'Started subscriptions', data: @reports.pluck(:day, :new_annual_subscriptions) },
            { name: 'Ended subscriptions',   data: @reports.pluck(:day, :ended_annual_subscriptions) }
          ],
          colors: ['#2196F3'] %>
      </div>
    </div>
  </div>

  <% Rails.application.config.content_types[:all].each do |content_type| %>
    <div class="col s12 m12 l4">
      <div class="card">
        <div class="card-content">
          <div class="card-title">
            New <%= content_type.name.pluralize %>
            <span class="right grey-text"><%= number_with_delimiter content_type.last.id %> total</span>
          </div>
          <%= area_chart @reports.pluck(:day, "#{content_type.name.downcase.pluralize}_created"), colors: [content_type.hex_color] %>
        </div>
      </div>
    </div>
  <% end %>
  <div class="col s12 m12 l4">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New timelines
            <span class="right grey-text"><%= number_with_delimiter Timeline.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :timelines_created), colors: [Timeline.hex_color] %>
      </div>
    </div>
  </div>

  <div class="col s12 m12 l6">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New stream shares
          <span class="right grey-text"><%= number_with_delimiter ContentPageShare.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :stream_shares_created), colors: [ContentPageShare.hex_color] %>
      </div>
    </div>
  </div>
  <div class="col s12 m12 l6">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New stream comments
        </div>
        <%= area_chart @reports.pluck(:day, :stream_comments), colors: [ContentPageShare.hex_color] %>
      </div>
    </div>
  </div>

  <div class="col s12 m12 l6">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New collections
          <span class="right grey-text"><%= number_with_delimiter PageCollection.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :collections_created), colors: [PageCollection.hex_color] %>
      </div>
    </div>
  </div>
  <div class="col s12 m12 l6">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New collection submissions
          <span class="right grey-text"><%= number_with_delimiter PageCollectionSubmission.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :collection_submissions_created), colors: [PageCollection.hex_color] %>
      </div>
    </div>
  </div>

  <div class="col s12 m12 l6">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New discussion threads
          <span class="right grey-text"><%= number_with_delimiter Thredded::Topic.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :thredded_threads_created), colors: ['#2196F3'] %>
      </div>
    </div>
  </div>
  <div class="col s12 m12 l6">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New discussion replies
          <span class="right grey-text"><%= number_with_delimiter Thredded::Post.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :thredded_replies_created), colors: ['#2196F3'] %>
      </div>
    </div>
  </div>

  <div class="col s12 m12 l6">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New private discussions
          <span class="right grey-text"><%= number_with_delimiter Thredded::PrivateTopic.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :thredded_private_messages_created), colors: ['#2196F3'] %>
      </div>
    </div>
  </div>
  <div class="col s12 m12 l6">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New private replies
          <span class="right grey-text"><%= number_with_delimiter Thredded::PrivatePost.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :thredded_private_replies_created), colors: ['#2196F3'] %>
      </div>
    </div>
  </div>

  <div class="col s12 m12 l4">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New documents
          <span class="right grey-text"><%= number_with_delimiter Document.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :documents_created), colors: [Document.hex_color] %>
      </div>
    </div>
  </div>
  <div class="col s12 m12 l4">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          Updated documents
        </div>
        <%= area_chart @reports.pluck(:day, :documents_edited), colors: [Document.hex_color] %>
      </div>
    </div>
  </div>
  <div class="col s12 m12 l4">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          Document revisions
          <span class="right grey-text"><%= number_with_delimiter DocumentRevision.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :document_revisions_created), colors: [Document.hex_color] %>
      </div>
    </div>
  </div>
  <div class="col s12 m12 l4">
    <div class="card">
      <div class="card-content">
        <div class="card-title">
          New document analyses
          <span class="right grey-text"><%= number_with_delimiter DocumentAnalysis.last.id %> total</span>
        </div>
        <%= area_chart @reports.pluck(:day, :document_analyses_created), colors: ['#2196F3'] %>
      </div>
    </div>
  </div>
</div>
