{% extends 'generic/object.html' %}
{% load helpers %}
{% load humanize %}
{% load plugins %}

{% block title %}Firmware Assignment ID {{ object.id }}{% endblock %}

{% block breadcrumbs %}
{% if object.device or object.module or object.inventory_item %}
  {{ block.super }}
  <li class="breadcrumb-item">
    <a href="{% url 'plugins:netbox_firmware:firmwareassignment_list' %}?{{ object.kind }}_id={{ object.hardware.pk }}&manufacturer_id={{object.hardware_type.manufacturer.id}}">{{ object.hardware_type.manufacturer }} {{ object.hardware }}</a>
  </li>
{% endif %}
{% endblock %}

{% block content %}
  <div class="row mb-3">
    <div class="col col-md-6">
      <div class="card">
        <h5 class="card-header">Firmware Assignment</h5>
        <table class="table table-hover attr-table">
          <tr>
            <th scope="row">Ticket Number</th>
            <td>{{ object.ticket_number|placeholder }}</td>
          </tr>
          <tr>
            <th scope="row">Description</th>
            <td>{{ object.description|placeholder }}</td>
          </tr>
          <tr>
            <th scope="row">Patch Date</th>
            <td>{{ object.patch_date|date:"d-m-Y" }}</td>
          </tr>
          <tr>
            <th scope="row">Comment</th>
            <td>{{ object.comment|placeholder }}</td>
          </tr>
        </table>
      </div>

      <div class="card">
        <h5 class="card-header">Hardware</h5>
        <table class="table table-hover attr-table">
          <tr>
            <th scope="row">Firmware</th>
            <td><a href="{{ object.firmware.get_absolute_url }}">{{ object.firmware|placeholder }}</a></td>
          </tr>
          <tr>
            <th scope="row">Manufacturer</th>
            <td><a href="{{ object.manufacturer.get_absolute_url }}">{{ object.manufacturer|placeholder }}</a></td>
          </tr>
          {% if object.device %}
            <tr>
              <th scope="row">Device</th>
              <td><a href="{{ object.device.get_absolute_url }}">{{ object.device|placeholder }}</a></td>
            </tr>
            <tr>
              <th scope="row">Device Type</th>
              <td><a href="{{ object.device_type.get_absolute_url }}">{{ object.device_type|placeholder }}</a></td>
            </tr>
            <tr>
              <th scope="row">Device Serial Number</th>
              <td><p>{{ object.device_sn|placeholder }}</p></td>
            </tr>
          {% elif object.module %}
            <tr>
              <th scope="row">Module</th>
              <td><a href="{{ object.module.get_absolute_url }}">{{ object.module|placeholder }}</a></td>
            </tr>
            <tr>
              <th scope="row">Module Owner</th>
              <td><a href="{{ object.module_device.get_absolute_url }}">{{ object.module_device|placeholder }}</a></td>
            </tr>
            <tr>
              <th scope="row">Module Type</th>
              <td><a href="{{ object.module_type.get_absolute_url }}">{{ object.module_type|placeholder }}</a></td>
            </tr>
            <tr>
              <th scope="row">Module Serial Number</th>
              <td><p>{{ object.module_sn|placeholder }}</p></td>
            </tr>
          {% endif %}
        </table>
      </div>

      {% include 'inc/panels/custom_fields.html' %}
      {% plugin_left_page object %}
    </div>
    <div class="col col-md-6">
      {% include 'inc/panels/comments.html' %}
      {% plugin_right_page object %}
    </div>
  </div>
  <div class="row mb-3">
    <div class="col col-md-12">
      {% plugin_full_width_page object %}
    </div>
  </div>
{% endblock content %}