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

{% block title %}License Assignment ID {{ object.pk }}{% endblock %}

{% block breadcrumbs %}
  {{ block.super }}
  {% if object.license.license_type %}
    <li class="breadcrumb-item">
      <a href="{% url 'plugins:netbox_license:licenseassignment_list' %}?license__license_type_id={{ object.license.license_type.pk }}">
      {{ object.license.license_type }}
      </a>
    </li>
  {% endif %}
{% endblock %}
{% block content %}
<div class="row">
  <div class="col-md-6">
    <div class="card">
      <h5 class="card-header">License Details</h5>
      <table class="table table-hover attr-table">
        <tr>
          <th scope="row">License Type</th>
          <td>{{ object.license.license_type|linkify }}</td>
        </tr>
        <tr>
          <th scope="row">Product Code</th>
          <td>{{ object.license.license_type.product_code|linkify|placeholder }}</td>
        </tr>
        <tr>
          <th scope="row">License Manufacturer</th>
          <td>{{ object.license.license_type.manufacturer|linkify|placeholder }}</td>
        </tr>
        <tr>
          <th scope="row">License Key</th>
          <td class="font-monospace">{{ object.license|linkify }}</td>
        </tr>
        <tr>
          <th scope="row">Serial Number</th>
          <td class="font-monospace">{{ object.license.serial_number|placeholder }}</td>
        </tr>
        <tr>
          <th scope="row">Volume Type</th>
          <td>{{ object.license.license_type.get_volume_type_display }}</td>
        </tr>
        <tr>
          <th scope="row">Parent License</th>
          <td>{{ object.license.parent_license|linkify|default:"None" }}</td>
        </tr>
        <tr>
          <th scope="row">Purchase Date</th>
          <td>{{ object.license.purchase_date|date:"Y-m-d" }}</td>
        </tr>
        <tr>
          <th scope="row">Expiry Date</th>
          <td>{{ object.license.expiry_date|date:"Y-m-d" }}</td>
        </tr>
      </table>
    </div>
  </div>

  <!-- Assignment Details -->
  <div class="col-md-6">
    <div class="card">
      <h5 class="card-header">Assignment Details</h5>
      <table class="table table-hover attr-table">
        <tr>
          <th scope="row">Device</th>
          <td>{{ object.device|linkify|placeholder }}</td>
        </tr>
        <tr>
          <th scope="row">Device Manufacturer</th>
          <td>{{ object.device.device_type.manufacturer|linkify|placeholder }}</td>
          {# Alternatively: <td>{{ object.device_manufacturer|linkify|placeholder }}</td> #}
        </tr>
        <tr>
          <th scope="row">Assigned On</th>
          <td>{{ object.assigned_on|date:"Y-m-d" }}</td>
        </tr>
        <tr>
          <th scope="row">Volume</th>
          <td>{{ object.volume }}</td>
        </tr>
        <tr>
          <th scope="row">Description</th>
          <td>{{ object.description|placeholder }}</td>
        </tr>
      </table>
    </div>
  </div>
</div>
{% endblock %}
