{% if mux_maps %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <strong>Mux Port Map</strong>
            <span class="pull-right">
                {% if mux_span %}
                    <a href="{{ mux_span.get_absolute_url }}" class="btn btn-xs btn-default">{{ mux_span }}</a>
                {% else %}
                    <span class="text-muted">No span</span>
                {% endif %}
            </span>
        </div>
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>Port</th>
                    <th>Wavelength</th>
                    <th>Connection</th>
                </tr>
            </thead>
            <tbody>
                {% for mapping in mux_maps %}
                    <tr>
                        <td>
                            <a href="{{ mapping.port.get_absolute_url }}">{{ mapping.port.name }}</a>
                        </td>
                        <td>
                            <a href="{{ mapping.wavelength.get_absolute_url }}">{{ mapping.wavelength.value }} nm</a>
                        </td>
                        <td>
                            {% if mapping.connection %}
                                <a href="{{ mapping.connection.get_absolute_url }}">{{ mapping.connection }}</a>
                            {% else %}
                            <a href="{% url 'plugins:netbox_optics:opticalconnection_add' %}?wavelength={{ mapping.wavelength.id }}" class="btn btn-xs btn-success">
                                <span class="label label-success">Free</span>
                            </a>
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
{% endif %}
