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

{% 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>{% if object.lens_manufacturer is not None %}{{ object.lens_manufacturer }}
      {% endif %}{{ object.lens_model_name }}
    </td>
  </tr>


  {% if object.lens_manufacturer is not None %}
  <tr>
    <td>Lens manufacturer</td>
    <td><a href="{% url 'manufacturer-detail' object.lens_manufacturer.slug %}">{{ object.lens_manufacturer }}</a></td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Optics</th>
  </tr>
  {% if object.zoom is not None %}
  <tr>
    <td>Zoom</td>
    <td>{{ object.zoom|boolicontag }}</td>
  </tr>
  {% endif %}
  {% if object.min_focal_length is not None %}
  <tr>
    <td>Focal length</td>
    <td>
      {{ object.min_focal_length }}{% if object.zoom is not False and object.max_focal_length is not None %}-{{ object.max_focal_length }}{% endif %}mm
    </td>
  </tr>
  {% endif %}
  {% if object.closest_focus is not None %}
  <tr>
    <td>Closest focus</td>
    <td>{{ object.closest_focus }}cm</td>
  </tr>
  {% endif %}
  {% if object.max_aperture is not None %}
  <tr>
    <td>Aperture</td>
    <td>
      <em>f</em>/{{ object.max_aperture }}{% if object.max_aperture is not None %}-{{ object.min_aperture }}{% endif %}
    </td>
  </tr>
  {% endif %}
  {% if object.elements is not None and object.groups is not None %}
  <tr>
    <td>Elements/Groups</td>
    <td>{{ object.elements }}/{{ object.groups }}</td>
  </tr>
  {% else %}
  {% if object.elements is not None %}
  <tr>
    <td>Elements</td>
    <td>{{ object.elements }}</td>
  </tr>
  {% endif %}
  {% if object.groups is not None %}
  <tr>
    <td>Groups</td>
    <td>{{ object.groups }}</td>
  </tr>
  {% endif %}
  {% endif %}
  {% if object.nominal_max_angle_diag is not None %}
  <tr>
    <td>Diagonal angle of view</td>
    <td>
      {{ object.nominal_max_angle_diag }}{% if object.zoom is not False and object.nominal_min_angle_diag is not None %}-{{ object.nominal_min_angle_diag }}{% endif %}&deg;
    </td>
  </tr>
  {% endif %}
  {% if object.rectilinear is not None %}
  <tr>
    <td>Rectilinear</td>
    <td>{{ object.rectilinear|boolicontag }}</td>
  </tr>
  {% endif %}
  {% if object.magnification is not None %}
  <tr>
    <td>Maximum magnification</td>
    <td>{{ object.magnification }}&times;</td>
  </tr>
  {% endif %}
  {% if object.negative_size is not None %}
  {% endif %}
  {% if object.aperture_blades is not None %}
  <tr>
    <td>Aperture blades</td>
    <td>{{ object.aperture_blades }}</td>
  </tr>
  {% endif %}
  {% if object.image_circle is not None %}
  <tr>
    <td>Image circle</td>
    <td>{{ object.image_circle }}mm</td>
  </tr>
  {% endif %}
  {% if object.formula is not None %}
  <tr>
    <td>Formula</td>
    <td>{{ object.formula }}</td>
  </tr>
  {% endif %}


  <tr>
    <th colspan="2">Features</th>
  </tr>
  {% if object.filter_thread is not None %}
  <tr>
    <td>Filter thread</td>
    <td>{{ object.filter_thread }}mm</td>
  </tr>
  {% endif %}
  {% if object.coating is not None %}
  <tr>
    <td>Coating</td>
    <td>{{ object.coating }}</td>
  </tr>
  {% endif %}
  {% if object.hood is not None %}
  <tr>
    <td>Hood</td>
    <td>{{ object.hood }}</td>
  </tr>
  {% endif %}
  {% if object.exif_lenstype is not None %}
  <tr>
    <td>EXIF Lens type</td>
    <td>{{ object.exif_lenstype }}</td>
  </tr>
  {% endif %}


  {% 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|boolicontag }}</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>
      <ul class="list-inline">{% for meteringmode in object.metering_modes.all %}
        <li class="list-inline-item">{{ meteringmode }}</li>
        {% endfor %}
      </ul>
    </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>
      <ul class="list-inline">{% for exposureprogram in object.exposure_programs.all %}
        <li class="list-inline-item">{{ exposureprogram }}</li>
        {% endfor %}
      </ul>
    </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|boolicontag }}</td>
  </tr>
  {% endif %}
  {% if object.time is not None %}
  <tr>
    <td>Time</td>
    <td>{{ object.time|boolicontag }}</td>
  </tr>
  {% endif %}
  {% if object.shutter_speeds is not None %}
  <tr>
    <td>Shutter speeds</td>
    <td>
      <ul class="list-inline">{% for shutter_speed in object.shutter_speeds.all %}
        <li class="list-inline-item">{{ shutter_speed }}</li>
        {% endfor %}
      </ul>
    </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|boolicontag }}</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|boolicontag }}</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|boolicontag }}</td>
  </tr>
  <tr>
    <td>PC sync</td>
    <td>{{ object.pc_sync|boolicontag }}</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|boolicontag }}</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|boolicontag }}</td>
  </tr>
  {% endif %}
  {% if object.mirror_lockup is not None %}
  <tr>
    <td>Mirror lock-up</td>
    <td>{{ object.mirror_lockup|boolicontag }}</td>
  </tr>
  {% endif %}
  {% if object.tripod is not None %}
  <tr>
    <td>Tripod</td>
    <td>{{ object.tripod|boolicontag }}</td>
  </tr>
  {% endif %}
  {% if object.cable_release is not None %}
  <tr>
    <td>Cable release</td>
    <td>{{ object.cable_release|boolicontag }}</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.url is not None %}
  <tr>
    <td>URL</td>
    <td><a href="{{ object.url }}">{{ object.url }}</a></td>
  </tr>
  {% endif %}
  {% if object.tags is not None %}
  <tr>
    <td>Tags</td>
    <td>{% for tag in object.tags.all %}
      <a class="btn btn-outline-primary" href="{% url 'tag-detail' tag|lower %}" role="button">{{ tag }}</a>
      {% endfor %}</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>

{% if related %}
<h4>Similar camera models</h4>
<ul>
  {% for relateditem in related %}
  <li><a href="{% url 'cameramodel-detail' relateditem.slug %}">{{ relateditem }}</a></li>
  {% endfor %}
</ul>
{% endif %}

{% if user.is_authenticated %}
{% if mine %}
<h4>In your collection</h4>
<table class="table table-hover">
  <tr>
    <th>ID</th>
    <th>Serial</th>
    <th>Manufactured</th>
    <th>Own</th>
  </tr>
  {% for camera in mine %}
  <tr>
    <td><a href="{% url 'camera-detail' camera.id_owner %}">#{{ camera.id_owner }}</a></td>
    <td><code>{{ camera.serial }}</code></td>
    <td>{{ camera.manufactured }}</td>
    <td>{{ camera.own|boolicontag }}</td>
  </tr>
  {% endfor %}
</table>
{% endif %}
{% endif %}
{% endblock %}

{% block moreactions %}
<form action="{% url 'camera-create' %}">
  <input type="hidden" name="cameramodel" value="{{ object.id }}">
  <button class="btn btn-primary" type="submit">Add to collection</button>
</form>
{% endblock %}
