{% load kegweblib %}
<div class="kb-tapbox">
  <div class="kb-tapbox-header">
    <h2><a href="{% url kb-keg kbsite.url keg.seqn %}">{% if keg.tap %}{{ keg.tap.name }}: {% endif %} {{ keg.type.name }}</a></h2>
    <span class="kb-byline">{{ keg.size.name }}, tapped {% timeago keg.startdate %}</span>
  </div>
  <div class="kb-tapbox-content">
    <table border="0">
      <tr>
        <td align="center" valign="center">
          {% include "kegweb/keg-image.html" %}
        </td>
        <td valign="top">
          <div class="kb-tapbox-detail">
            <div class="kb-tapbox-stats">
              <p>
                <b>Total Poured</b>:
                {% volume keg.served_volume %}
                {% if keg.is_empty %}
                  (empty!)
                {% else %}
                  ({% volume keg.remaining_volume %} remain)
                {% endif %}
                {% chart keg_volume keg 320 50 %}
                </p>

              {% if keg.tap %}
              {% if keg.tap.temperature_sensor %}
              <p>
                <b>Temperature</b>:
                {{ keg.tap.Temperature.TempC|floatformat:1}}&deg;C /
                {{ keg.tap.Temperature.TempF|floatformat:1}}&deg;F
              {% chart sensor keg.tap.temperature_sensor 320 50 %}
              </p>
              {% endif %}
              {% endif %}
            </div>
          </div>
        </td>
      </tr>
    </table>

  </div>
</div>

