{% load kegweblib %}
<div class="kb-tapbox">
  <div class="kb-tapbox-content">
    <table border="0">
      <tr>
        <td align="center" valign="center">
          <div class="kb-tapbox-image">
            {% if keg.type.GetImage %}
            <img src="{{ keg.type.GetImage.thumbnail.url }}">
            {% else %}
            <div style="font-size: 200%; color: #ccc;">?</div>
            <div style="font-size: 8px; color: #ccc;">no image</div>
            {% endif %}
          </div>
        </td>
        <td valign="top">
          <div class="kb-tapbox-detail">
            <div class="kb-tapbox-header">
              {{keg.type.name}}
            </div>
            <div class="kb-tapbox-subheader">
              {{keg.size.name}}
              {% if keg.tap %} - {{ keg.tap.name }}{% endif %}
            </div>

            <div class="kb-tapbox-stats">
              <p>
              <b>Total Poured</b>:
              {{keg.served_volume.ConvertTo.Pint|floatformat:0}} pints
              {% if keg.is_empty %}
                (empty!)
              {% else %}
                ({{keg.remaining_volume.ConvertTo.Pint|floatformat:0}} 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>
      {% if keg.description %}
      <tr>
        <td colspan="2">
        <div class="kb-tapbox-description">
          <i>"{{ keg.description }}"</i>
        </div>
        </td>
      </tr>
      {% endif %}
    </table>

    <div class="kb-tapbox-footer">
      tapped {% timeago keg.startdate %} |
      <a href="{% url pykeg.web.kegweb.views.keg_detail keg.seqn %}">full history &raquo;</a>
    </div>
  </div>
</div>

