{% extends "detail.html" %}
{% load static %}
{% load boolicontag %}

{% block content %}
<table class="table table-hover">
  <tr>
    <th colspan="2" id="summary"><img src="{% static "svg/summary.svg" %}" width="30" height="30" alt="Summary">&nbsp;<a
        href="#">Summary</a></th>
  </tr>
  {% if object.format is not None %}
  <tr>
    <td>Film format</td>
    <td><a href="{% url 'schema: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 'schema:filmstock-detail' object.filmstock.slug %}">{{ object.filmstock }}</a></td>
  </tr>
  {% endif %}
  {% if object.length is not None %}
  <tr>
    <td>Length</td>
    <td>{{ object.length }}m</td>
  </tr>
  {% endif %}
  {% if object.finished is not None %}
  <tr>
    <td>Finished</td>
    <td><code>{{ object.finished|boolicontag }}</code></td>
  </tr>
  {% endif %}
  {% if object.batch is not None %}
  <tr>
    <td>Batch code</td>
    <td><code>{{ object.batch }}</code></td>
  </tr>
  {% endif %}
  {% if object.expiry is not None %}
  <tr>
    <td>Expiry date</td>
    <td>{{ object.expiry }}</td>
  </tr>
  {% endif %}

  <tr>
    <th colspan="2" id="ownership"><img src="{% static "svg/ownership.svg" %}" width="30" height="30"
        alt="Ownership">&nbsp;<a href="#ownership">Ownership</a></th>
  </tr>
  {% 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 %}
</table>

{% if user.is_authenticated %}
<h4>Films cut from this bulk film</h4>
<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 'schema:film-detail' film.id_owner %}">{{ film.id_owner }}</a></td>
    <td>{{ film.title }}</td>
  </tr>
  {% endfor %}
</table>
{% endif %}
{% endblock %}
