<%# <h3>Activity History</h3> %>

<%# <hr> %>

<div class="row flex activity-history-header">
  <div class="col-sm-4 activity-history--title">
    <h4 class="bold margin-space">Activity History</h4>
  </div>
  <div class="col-sm-8 pull-right activity-history">
    <ul class="nav nav-tabs activity-history-tabs">
      <li class="active"><a data-toggle="tab" href="#tab-1">All</a></li>
      <li class="hide"><a data-toggle="tab" href="#tab-2">Calls</a></li>
      <li class=""><a data-toggle="tab" href="#tab-4">Notes</a></li>
      <li class=""><a data-toggle="tab" href="#tab-outcomes">Task Queues</a></li>
    </ul>
  </div>
</div>

<div class="row">
  <div class="col-sm-12 light-grey-bg">
    <div class="tabs-container">
      <div class="tab-content">
        <div id="tab-1" class="tab-pane active all-activities-tab">
          <div class="panel-body">
            <div class="activity-stream">
              <% if @activities && @activities.all.size > 0 %>
                <%= render 'shared/activity_stream', activities: @activities.all, locals: { hide: false, link: false } %>
              <% else %>
                <p class="default-message">No activity has been recored for this <%= feedable_type %>.</p>
                <%= render 'shared/activity_stream', activities: @activities.all, locals: { hide: true, link: false } %>
              <% end %>
            </div>

            <%= render 'activities/form', feedable_type: feedable_type, feedable_id: feedable_id %>
          </div>
        </div>

        <div id="tab-2" class="tab-pane activity-tab-for-calls">
          <div class="panel-body">
            <div class="activity-stream">
              <% if @activities && @activities.calls.size > 0 %>
                <%= render 'shared/activity_stream', activities: @activities.calls, locals: { hide: false, link: false } %>
              <% else %>
                <p class="default-message">No calls has been recored for this <%= feedable_type %>.</p>
                <%= render 'shared/activity_stream', activities: @activities.calls, locals: { hide: true, link: false } %>
              <% end %>
            </div>
          </div>
        </div>

        <div id="tab-4" class="tab-pane activity-tab-for-notes">
          <div class="panel-body">
            <div class="activity-stream">
              <% if @activities && @activities.notes.size > 0 %>
                <%= render 'shared/activity_stream', activities: @activities.notes, locals: { hide: false, link: false } %>
              <% else %>
                <p class="default-message">No notes has been recored for this <%= feedable_type %>.</p>
                <%= render 'shared/activity_stream', activities: @activities.notes, locals: { hide: true, link: false } %>
              <% end %>
            </div>

            <%= render 'activities/form', feedable_type: feedable_type, feedable_id: feedable_id %>
          </div>
        </div>

        <div id="tab-outcomes" class="tab-pane activity-tab-for-outcomes">
          <div class="panel-body">
            <div class="activity-stream">
              <% if @activities && @activities.outcomes.size > 0 %>
                <%= render 'shared/activity_stream', activities: @activities.outcomes, locals: { hide: false, link: false } %>
              <% else %>
                <p class="default-message">No outcomes have been recored for this <%= feedable_type %>.</p>
                <%= render 'shared/activity_stream', activities: @activities.outcomes, locals: { hide: true, link: false } %>
              <% end %>
            </div>

            <%= render 'activities/form', feedable_type: feedable_type, feedable_id: feedable_id %>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<% unless index %>
  <div class="row">
    <div class="col-sm-12 show-more-button">
      <%= link_to "Show more", activities_path(feedable_type: feedable_type, feedable_id: feedable_id, database_id: @database.id), class: "btn btn-block btn-purple btn-large" %>
    </div>
  </div>
<% end %>
