{% load kegweblib %}
{% with keg.current_tap as tap %}
<div class="row">
  <div class="span9">
    <div class="kb-tapbox">
      <div class="kb-tapbox-header">
        <h3>{% if tap %}{{ tap.name }}: {% endif %} {{ keg.type.name }}</h3>
      </div>

      <div class="kb-tapbox-content">
        <div class="row">
          <div class="span3">
            <div class="kb-tapbox-left">
              {% include "kegweb/keg-image.html" %}
            </div>
          </div>
          <div class="span6">
            <div class="badge">
              <div class="badge-header">
                Total Poured
              </div>
              <div class="badge-content">
                {% volume keg.served_volume %}
                {% if keg.is_empty %}
                  (empty!)
                {% else %}
                  ({% volume keg.remaining_volume %} remain)
                {% endif %}
                {% chart keg_volume keg 300 50 %}
              </div>
            </div>

            <div class="badge">
              {% if tap %}
              {% if tap.temperature_sensor %}
              <div class="badge-header">
                Temperature
              </div>
              <div class="badge-content">
                {{ tap.Temperature.TempC|floatformat:1}}&deg;C /
                {{ tap.Temperature.TempF|floatformat:1}}&deg;F
                {% chart sensor tap.temperature_sensor 300 50 %}
              </div>
              {% endif %}
              {% endif %}
            </div>
          </div>
        </div>
        <div class="kb-tapbox-footer">
          <div class="row">
            <div class="span7">
              {{ keg.size.name }}<br/>
              <small>tapped {% timeago keg.startdate %}</small>
            </div>
            <div class="span2">
              <div style="padding-right: 10px;">
                <a class="btn small info"
                href="{% url kb-keg kbsite.url keg.seqn %}">Full Details &raquo;</a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div> <!-- row -->
</div> <!-- span9 -->
{% endwith %}
