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

{% block content %}
<table class="table table-hover">
  <tr>
    <th colspan="2">Physical</th>
  </tr>
  {% if object.manufacturer is not None %}
  <tr>
    <td>Manufacturer</td>
    <td><a href="{% url 'manufacturer-detail' object.manufacturer.slug %}">{{ object.manufacturer }}</a></td>
  </tr>
  {% endif %}
  <tr>
    <td>Model</td>
    <td>{{ object.model }}</td>
  </tr>
  {% if object.disambiguation is not None %}
  <tr>
    <td>Disambiguation</td>
    <td>{{ object.disambiguation }}</td>
  </tr>
  {% endif %}
  {% if object.mount is not None %}
  <tr>
    <td>Mount</td>
    <td><a href="{% url 'mount-detail' object.mount.slug %}">{{ object.mount }}</a></td>
  </tr>
  {% else %}
  <tr>
    <td>Lens</td>
    <td>{{ object.lens_manufacturer }} {{ object.lens_model_name }}</td>
  </tr>
  <!--
  aperture_blades
closest_focus
coating
elements
exif_lenstype
filter_thread
formula
groups
hood
image_circle
lens_manufacturer
lens_model
magnification
max_aperture
max_focal_length
min_aperture
min_focal_length
nominal_max_angle_diag
nominal_min_angle_diag
rectilinear
zoom
-->
  {% endif %}
  {% if object.format is not None %}
  <tr>
    <td>Format</td>
    <td><a href="{% url 'format-detail' object.format.id %}">{{ object.format }}</a>
    </td>
  </tr>
  {% endif %}
  {% if object.introduced is not None %}
  <tr>
    <td>Marketed</td>
    <td>{{ object.introduced }}{% if object.discontinued is not None %}-{{ object.discontinued }}{% endif %}</td>
  </tr>
  {% endif %}
  {% if object.body_type is not None %}
  <tr>
    <td>Body type</td>
    <td>{{ object.body_type }}</td>
  </tr>
  {% endif %}
  {% if object.weight is not None %}
  <tr>
    <td>Weight</td>
    <td>{{ object.weight }}g</td>
  </tr>
  {% endif %}
  {% if object.negative_size is not None %}
  <tr>
    <td>Negative size</td>
    <td><a href="{% url 'negativesize-detail' object.negative_size.id %}">{{ object.negative_size }}</a></td>
  </tr>
  {% endif %}



  <tr>
    <th colspan="2">Focus</th>
  </tr>
  {% if object.focus_type is not None %}
  <tr>
    <td>Focus type</td>
    <td>{{ object.focus_type }}</td>
  </tr>
  {% endif %}
  {% if object.autofocus_points is not None %}
  <tr>
    <td>Autofocus points</td>
    <td>{{ object.af_points }}</td>
  </tr>
  {% endif %}
  {% if object.viewfinder_coverage is not None %}
  <tr>
    <td>Viewfinder coverage</td>
    <td>{{ object.viewfinder_coverage }}%</td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Metering</th>
  </tr>
  {% if object.metering is not None %}
  <tr>
    <td>Metering</td>
    <td>{{ object.metering|yesnoicon }}</td>
  </tr>
  {% endif %}
  {% if object.metering %}
  {% if object.metering_type is not None %}
  <tr>
    <td>Metering type</td>
    <td>{{ object.metering_type }}</td>
  </tr>
  {% endif %}
  {% if object.meter_min_ev is not None %}
  <tr>
    <td>Meter EV</td>
    <td>{{ object.meter_min_ev }}-{{ object.meter_max_ev }}</td>
  </tr>
  {% endif %}
  {% if object.metering_modes is not None %}
  <tr>
    <td>Metering modes</td>
    <td>
      {{ object.metering_modes.all|join:", " }}
    </td>
  </tr>
  {% endif %}
  {% endif %}
  {% if object.min_iso is not None %}
  <tr>
    <td>ISO</td>
    <td>{{ object.min_iso }}-{{ object.max_iso }}</td>
  </tr>
  {% endif %}
  {% if object.exposure_programs is not None %}
  <tr>
    <td>Exposure programs</td>
    <td>
      {{ object.exposure_programs.all|join:", " }}
    </td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Shutter</th>
  </tr>
  {% if object.shutter_type is not None %}
  <tr>
    <td>Shutter type</td>
    <td>{{ object.shutter_type }}</td>
  </tr>
  {% endif %}
  {% if object.shutter_model is not None %}
  <tr>
    <td>Shutter model</td>
    <td>{{ object.shutter_model }}</td>
  </tr>
  {% endif %}
  {% if object.bulb is not None %}
  <tr>
    <td>Bulb</td>
    <td>{{ object.bulb|yesnoicon }}</td>
  </tr>
  {% endif %}
  {% if object.time is not None %}
  <tr>
    <td>Time</td>
    <td>{{ object.time|yesnoicon }}</td>
  </tr>
  {% endif %}
  {% if object.shutter_speeds is not None %}
  <tr>
    <td>Shutter speeds</td>
    <td>
      {{ object.shutter_speeds.all|dictsort:"shutter_speed"|join:", " }}
    </td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Film transport</th>
  </tr>
  {% if object.power_drive is not None %}
  <tr>
    <td>Power drive</td>
    <td>{{ object.power_drive|yesnoicon }}</td>
  </tr>
  {% endif %}
  {% if object.continuous_fps is not None %}
  <tr>
    <td>Continuous fps</td>
    <td>{{ object.continuous_fps }}</td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Power</th>
  </tr>
  {% if object.battery_qty is not None %}

  <tr>
    <td>Batteries</td>
    <td>{{ object.battery_qty }}
      {% if object.battery_type is not None %} &times; <a
        href="{% url 'battery-detail' object.battery_type.slug %}">{{ object.battery_type }}</a>{% endif %}
    </td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Flash</th>
  </tr>
  {% if object.int_flash is not None %}
  <tr>
    <td>Internal flash</td>
    <td>{{ object.int_flash|yesnoicon }}</td>
  </tr>
  <tr>
    <td>Internal flash guide number</td>
    <td>{{ object.int_flash_gn }}</td>
  </tr>
  {% endif %}
  {% if object.external_flash is not None %}
  <tr>
    <td>External flash</td>
    <td>{{ object.ext_flash|yesnoicon }}</td>
  </tr>
  <tr>
    <td>PC sync</td>
    <td>{{ object.pc_sync|yesnoicon }}</td>
  </tr>
  {% endif %}
  {% if object.shoe is not None %}
  <tr>
    <td>Shoe</td>
    <td>{{ object.shoe }}</td>
  </tr>
  {% endif %}
  {% if object.x_sync %}
  <tr>
    <td>X-sync speed</td>
    <td>{{ object.x_sync }}</td>
  </tr>
  {% endif %}
  {% if object.flash_metering is not None %}
  <tr>
    <td>Flash metering</td>
    <td>{{ object.flash_metering|yesnoicon }}</td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Features</th>
  </tr>
  {% if object.dof_preview is not None %}
  <tr>
    <td>DoF preview</td>
    <td>{{ object.dof_preview|yesnoicon }}</td>
  </tr>
  {% endif %}
  {% if object.mirror_lockup is not None %}
  <tr>
    <td>Mirror lock-up</td>
    <td>{{ object.mirror_lockup|yesnoicon }}</td>
  </tr>
  {% endif %}
  {% if object.tripod is not None %}
  <tr>
    <td>Tripod</td>
    <td>{{ object.tripod|yesnoicon }}</td>
  </tr>
  {% endif %}
  {% if object.cable_release is not None %}
  <tr>
    <td>Cable release</td>
    <td>{{ object.cable_release|yesnoicon }}</td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Misc</th>
  </tr>
  {% if object.notes is not None %}
  <tr>
    <td>Notes</td>
    <td>{{ object.notes }}</td>
  </tr>
  {% endif %}
  {% if object.series is not None %}
  <tr>
    <td>Series</td>
    <td>
      {% if object.series is None %}
      <ul>
        {% for series in object.series.all %}
        <li>{{ series.name }}</li>
        {% endfor %}
      </ul>
      {% endif %}
    </td>
  </tr>
  {% endif %}
  {% if object.created_at is not None %}
  <tr>
    <td>Created</td>
    <td>{{ object.created_at }}{% if object.created_by is not None %} by {{ object.created_by }}{% endif %}</td>
  </tr>
  {% endif %}
  {% if object.updated_at is not None %}
  <tr>
    <td>Last updated</td>
    <td>{{ object.updated_at }}{% if object.updated_by is not None %} by {{ object.updated_by }}{% endif %}</td>
  </tr>
  {% endif %}
</table>

<a data-toggle="collapse" href="#collapseCameras" role="button" aria-expanded="false" aria-controls="collapseCameras">
  Cameras</a>
<div class="collapse" id="collapseCameras">
  <table class="table table-hover">
    <tr>
      <th>Acquired</th>
      <th>cost</th>
      <th>serial</th>
      <th>datecode</th>
      <th>manufactured</th>
      <th>own</th>
      <th>lens</th>
      <th>notes</th>
      <th>lost</th>
      <th>lost_price</th>
      <th>source</th>
      <th>condition</th>
      <th>condition_notes</th>
      <th>display_lens</th>
    </tr>
    {% for camera in cameramodel.camera_set.all %}
    <tr>
      <td>{{ camera.acquired }}</td>
      <td>{{ camera.cost }}</td>
      <td><code>{{ camera.serial }}</code></td>
      <td><code>{{ camera.datecode }}</code></td>
      <td>{{ camera.manufactured }}</td>
      <td>{{ camera.own }}</td>
      <td>{{ camera.lens }}</td>
      <td>{{ camera.notes }}</td>
      <td>{{ camera.lost }}</td>
      <td>{{ camera.lost_price }}</td>
      <td>{{ camera.source }}</td>
      <td>{{ camera.condition }}</td>
      <td>{{ camera.condition_notes }}</td>
      <td>{{ camera.display_lens }}</td>
    </tr>
    {% endfor %}
  </table>
</div>
{% endblock %}