{% load helpers %}
{% load i18n %}
{% if terminations.0 %}
  <table class="table table-hover panel-body attr-table">
    {% if terminations.0.device %}
      {# Device component #}
      <tr>
        <td>{% trans "Site" %}</td>
        <td>{{ terminations.0.device.site|linkify }}</td>
      </tr>
      <tr>
        <td>{% trans "Location" %}</td>
        <td>{{ terminations.0.device.location|linkify|placeholder }}</td>
      </tr>
      <tr>
        <td>{% trans "Rack" %}</td>
        <td>{{ terminations.0.device.rack|linkify|placeholder }}</td>
      </tr>
      <tr>
        <td>{{ terminations.0|meta:"verbose_name"|capfirst }}</td>
        <td>
          {% for term in terminations %}
	    {{term.device|linkify}}
	    <i class="mdi mdi-chevron-right" aria-hidden="true"></i>
	    {{ term|linkify }}
	    {% if not forloop.last %}<br/>{% endif %}
          {% endfor %}
        </td>
      </tr>
    {% elif terminations.0.power_panel %}
      {# Power feed #}
      <tr>
        <td>{% trans "Site" %}</td>
        <td>{{ terminations.0.power_panel.site|linkify }}</td>
      </tr>
      <tr>
        <td>{% trans "Power Panel" %}</td>
        <td>{{ terminations.0.power_panel|linkify }}</td>
      </tr>
      <tr>
        <td>{{ terminations.0|meta:"verbose_name"|capfirst }}</td>
        <td>
          {% for term in terminations %}
            {{ term|linkify }}{% if not forloop.last %},{% endif %}
          {% endfor %}
        </td>
      </tr>
    {% elif terminations.0.circuit %}
      {# Circuit termination #}
      <tr>
        <td>{% trans "Provider" %}</td>
        <td>{{ terminations.0.circuit.provider|linkify }}</td>
      </tr>
      <tr>
        <td>{% trans "Circuit" %}</td>
        <td>
          {% for term in terminations %}
            {{ term.circuit|linkify }} ({{ term }}){% if not forloop.last %},{% endif %}
          {% endfor %}
        </td>
      </tr>
    {% endif %}
  </table>
{% else %}
  <span class="text-muted">{% trans "No termination" %}</span>
{% endif %}
