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

{% block title %}{{ object.name|default:object }}{% endblock %}

{% block breadcrumbs %}
  <li><a href="{% url 'plugins:netbox_optics:opticalgridtype_list' %}">Optical Grid Types</a></li>
  <li>{{ object.name }}</li>
{% endblock %}

{% block buttons %}
  {% if perms.netbox_optics.change_opticalgridtype %}
    <a href="{% url 'plugins:netbox_optics:opticalgridtype_edit' pk=object.pk %}" class="btn btn-warning">
      <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
    </a>
  {% endif %}
  {% if perms.netbox_optics.delete_opticalgridtype %}
    <a href="{% url 'plugins:netbox_optics:opticalgridtype_delete' pk=object.pk %}" class="btn btn-danger">
      <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
    </a>
  {% endif %}
{% endblock %}


{% block content %}
<div class="row">
    <div class="col-md-12">
        <div class="row">
            <div class="col-md-6">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <strong>Optical Grid Type</strong>
                    </div>
                    <table class="table table-hover panel-body attr-table">
                        <tr>
                            <td>Name</td>
                            <td>{{ object.name }}</td>
                        </tr>
                        <tr>
                            <td>Spacing</td>
                            <td>{{ object.spacing }} GHz</td>
                        </tr>
                        <tr>
                            <td>Description</td>
                            <td>{{ object.description|default:"<span class='text-muted'>None</span>" }}</td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="col-md-6">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <strong>Allowed Wavelengths</strong>
                    </div>
                    <div class="panel-body">
                        {% if object.allowed_wavelengths.all %}
                            <ul class="list-unstyled">
                                {% for wavelength in object.allowed_wavelengths.all %}
                                    <li><a href="{% url 'plugins:netbox_optics:opticalgridtypewavelength' pk=wavelength.pk %}">{{ wavelength.value }} nm</a></li>
                                {% endfor %}
                            </ul>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
