{% extends "detail.html" %}

{% block content %}
<table class="table table-hover">
  {% if object.format is not None %}
  <tr>
    <td>Film format</td>
    <td><a href="{% url 'format-detail' object.format.id %}">{{ object.format }}</a></td>
  </tr>
  {% endif %}
  {% if object.filmstock is not None %}
  <tr>
    <td>Filmstock</td>
    <td><a href="{% url 'filmstock-detail' object.filmstock.slug %}">{{ object.filmstock }}</a></td>
  </tr>
  {% endif %}
  {% if object.purchase_date is not None %}
  <tr>
    <td>Purchase date</td>
    <td>{{ object.purchase_date }}</td>
  </tr>
  {% endif %}
  {% if object.cost is not None %}
  <tr>
    <td>Cost</td>
    <td>{{ object.cost }}</td>
  </tr>
  {% endif %}
  {% if object.source is not None %}
  <tr>
    <td>Source</td>
    <td>{{ object.source }}</td>
  </tr>
  {% endif %}
  {% if object.batch is not None %}
  <tr>
    <td>Batch code</td>
    <td>{{ object.batch }}</td>
  </tr>
  {% endif %}
  {% if object.expiry is not None %}
  <tr>
    <td>Expiry date</td>
    <td>{{ object.expiry }}</td>
  </tr>
  {% endif %}
</table>

<a data-toggle="collapse" href="#collapseFilms" role="button" aria-expanded="false" aria-controls="collapseFilms">
  Films cut from this bulk film
</a>
<div class="collapse" id="collapseFilms">
  <table class="table table-hover">
    <tr>
      <th>Film ID</th>
      <th>Title</th>
    </tr>
    {% for film in bulkfilm.film_set.all %}
    <tr>
      <td><a href="{% url 'film-detail' film.id_owner %}">{{ film.id_owner }}</a></td>
      <td>{{ film.title }}</td>
    </tr>
    {% endfor %}
  </table>
</div>
{% endblock %}
