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

{% block content %}
<table class="table table-hover">
  <tr>
    <th colspan="2" id="basics"><img src="{% static "svg/misc.svg" %}" width="30" height="30" alt="Misc"> <a
        href="#basics">Basics</a></th>
  </tr>
  {% if object.filmstock is not None %}
  <tr>
    <td>Filmstock</td>
    <td><a href="{% url 'filmstock-detail' object.filmstock.slug %}">{{ object.filmstock }}</a></td>
  </tr>
  {% if object.filmstock.iso %}
  <tr>
    <td>Box speed</td>
    <td>ISO {{ object.filmstock.iso }}</td>
  </tr>
  {% endif %}
  {% endif %}
  {% 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.status is not None %}
  <tr>
    <td>Status</td>
    <td>{{ object.status }}</td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2" id="exposure"><img src="{% static "svg/camera.svg" %}" width="30" height="30" alt="Exposure"> <a
        href="#exposure">Exposure</a></th>
  </tr>
  {% if object.date_loaded is not None %}
  <tr>
    <td>Date loaded</td>
    <td>{{ object.date_loaded }}</td>
  </tr>
  {% endif %}  
  {% if object.camera is not None %}
  <tr>
    <td>Camera</td>
    <td><a href="{% url 'camera-detail' object.camera.id_owner %}">{{ object.camera }}</a></td>
  </tr>
  {% endif %}
  {% if object.frames is not None %}
  <tr>
    <td>Frames</td>
    <td>{{ object.frames }}</td>
  </tr>
  {% endif %}
  {% if object.exposed_at is not None %}
  <tr>
    <td>Exposed at</td>
    <td>ISO {{ object.exposed_at }}</td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2" id="development"><img src="{% static "svg/developer.svg" %}" width="30" height="30" alt="Development"> <a
        href="#development">Development</a></th>
  </tr>
  {% if object.developer is not None %}
  <tr>
    <td>Developer</td>
    <td><a href="{% url 'developer-detail' object.developer.slug %}">{{ object.developer }}</a></td>
  </tr>
  {% endif %}
  {% if object.date_processed is not None %}
  <tr>
    <td>Date processed</td>
    <td>{{ object.date_processed }}</td>
  </tr>
  {% endif %}
  {% if object.directory is not None %}
  <tr>
    <td>Directory</td>
    <td><code>{{ object.directory }}</code></td>
  </tr>
  {% endif %}
  {% if object.dev_uses is not None %}
  <tr>
    <td>Developer uses</td>
    <td>{{ object.dev_uses }}</td>
  </tr>
  {% endif %}
  {% if object.dev_time is not None %}
  <tr>
    <td>Development time</td>
    <td>{{ object.dev_time }}</td>
  </tr>
  {% endif %}
  {% if object.dev_temp is not None %}
  <tr>
    <td>Development temperature</td>
    <td>{{ object.dev_temp }}°C</td>
  </tr>
  {% endif %}
  {% if object.dev_n is not None %}
  <tr>
    <td>Development compensation</td>
    <td>{{ object.dev_n }}</td>
  </tr>
  {% endif %}
  {% if object.development_notes %}
  <tr>
    <td>Development notes</td>
    <td>{{ object.development_notes|linebreaks }}</td>
  </tr>
  {% endif %}
  {% if object.bulk_film is not None %}
  <tr>
    <td>Bulk film</td>
    <td>{{ object.bulk_film }}</td>
  </tr>
  {% endif %}
  {% if object.bulk_film_loaded is not None %}
  <tr>
    <td>Bulk film loaded</td>
    <td>{{ object.bulk_film_loaded }}</td>
  </tr>
  {% endif %}
  {% if object.film_batch is not None %}
  <tr>
    <td>Batch code</td>
    <td><code>{{ object.film_batch }}</code></td>
  </tr>
  {% endif %}
  {% if object.expiry_date is not None %}
  <tr>
    <td>Expiry date</td>
    <td>{{ object.expiry_date }}</td>
  </tr>
  {% endif %}
  {% if object.purchase_date is not None %}
  <tr>
    <td>Purchase date</td>
    <td>{{ object.purchase_date }}</td>
  </tr>
  {% endif %}
  {% if object.price is not None %}
  <tr>
    <td>Price</td>
    <td>{{ object.price }}</td>
  </tr>
  {% endif %}
  {% if object.processed_by is not None %}
  <tr>
    <td>Processed by</td>
    <td><a href="{% url 'person-detail' object.processed_by.id_owner %}">{{ object.processed_by }}</a></td>
  </tr>
  {% endif %}

  
  <tr>
    <th colspan="2" id="archive"><img src="{% static "svg/archive.svg" %}" width="30" height="30" alt="Archive"> <a
        href="#archive">Archive</a></th>
  </tr>
  {% if object.archive is not None %}
  <tr>
    <td>Archive</td>
    <td><a href="{% url 'archive-detail' object.archive.id_owner %}">{{ object.archive }}</a></td>
  </tr>
  {% endif %}
</table>

{% if film.negative_set.all %}
<h4>Negatives</h4>
<table class="table table-hover">
  <tr>
    <th>Frame</th>
    <th>Caption</th>
    <th>Date</th>
  </tr>
  {% for negative in film.negative_set.all %}
  <tr>
    <td>{{ negative.frame }}</td>
    <td>{{ negative.caption }}</td>
    <td>{{ negative.date }}</td>
  </tr>
  {% endfor %}
</table>
{% endif %}
{% endblock %}

{% block moreactions %}
{% if object.status == "Available" %}<li><a class="btn btn-primary" href="{% url 'film-load' object.id_owner %}" role="button">Load this film into a camera</a></li>{% endif %}
{% if object.status == "Loaded" %}<li><a class="btn btn-primary" href="{% url 'film-develop' object.id_owner %}" role="button">Develop this film</a></li>{% endif %}
{% if object.status == "Developed" %}<li><a class="btn btn-primary" href="{% url 'film-archive' object.id_owner %}" role="button">Archive this film</a></li>{% endif %}
{%endblock%}
