{% extends "page-twocol.html" %}
{% load kegweblib %}
{% load humanize %}

{% block title %}{{ session.GetTitle }} | {{ block.super}}{% endblock %}
{% block pagetitle %}
  {{ session.GetTitle }}
  <small>{{ session.start_time|date:"l, F jS, P" }}</small>
{% endblock %}

{% block col-1 %}

{% with session.events.timeline as events %}
{% include 'kegweb/includes/timeline.html' %}
{% endwith %}

{% endblock col-1 %}



{% block col-2 %}
<table class="table table-condensed table-bordered">
  <thead>
    <tr>
      <th colspan="2">
        Session Summary
      </th>
    </tr>
  </thead>
  <tbody>
    {% with session.keg_chunks.all as keg_chunks %}
    <tr>
      <th>Keg{{keg_chunks.count|pluralize}}</th>
      <td>
        {% for chunk in keg_chunks %}
          {% if chunk.keg %}
            <a href="{% url "kb-keg" chunk.keg.id %}">Keg #{{ chunk.keg.id }} ({{ chunk.keg.type }})</a><br>
          {% endif %}
        {% endfor %}
      </td>
    </tr>
    {% endwith %}

    <tr>
      <th>Total</th>
      <td>
        {{ session.drinks.count }} pours,
        {% volume session.volume_ml %}
      </td>
    </tr>

    <tr>
      <th>Drinkers</th>
      <td>
        {{ stats.registered_drinkers|length }}
        drinker{{ stats.registered_drinkers|length|pluralize }}
      </td>
    </tr>
  </tbody>
</table>

{% chart users_by_volume stats 300 250 %}
<br/>

{% with session.UserChunksByVolume as chunks %}
{% if chunks %}
<table class="table table-bordered table-striped table-condensed table-hover">
  <thead>
    <tr>
      <th>
        Drinker
      </th>
      <th>
        Volume
      </th>
    </tr>
  </thead>
  <tbody>
    {% for chunk in session.UserChunksByVolume %}
    <tr>
      <th>{% drinker_name chunk.user %}</th>
      <td>{% volume chunk.volume_ml %}</td>
    </tr>
    {% endfor %}
  </tbody>
</table>
{% endif %}
{% endwith %}
{% endblock col-2 %}
