{% extends "network/base.html" %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% load l10n %}
{% load static %}
{% load crispy_forms_tags %}

{% block title-page %}{{ switch_port_pk }} | {% trans "switch port" %}{% endblock %}

{% block content %}
<div class="page-header">
  <a href="{% url "network.switch_port_delete" pk=switch_port_pk %}" class="btn btn-danger pull-right"><i class="fa fa-times-circle"></i> {% trans "Delete this switchport" %}</a>
  <h2>Welp <small>dunno what to write here</small></h2>
</div>
<div class="row">
  <div class="col-sm-5">
    {% crispy form %}
  </div>
  <style>
    .ethernet-devices-mini-table tr td:last-child {
      width: 1px;
    }
  </style>
  <div class="col-sm-5 col-sm-offset-1">
    <h3>{% trans "Ethernet Devices" %}</h3>
      <hr />
      {% if devices %}
        <table class="table table-condensed table-bordered ethernet-devices-mini-table">
        {% for i in devices %}
          <tr>
            <td>{{ i }}</td>
            <td>
              <a href="{% url "network.remove_switch_port_device" pk=switch_port_pk device_pk=i.pk %}"><i class="fa fa-times"></i></a>
            </td>
          </tr>
        {% endfor %}
        </table>
      {% else %}
        {% trans "No ethernet device" %}
      {% endif %}
      <hr />
      <form action="{% url "network.add_switch_port_device" pk=switch_port_pk %}" method="POST">
        {% csrf_token %}
          <div class="input-group">
            <input type="text" class="form-control" name="device_name" placeholder="{% trans "Name" %}"/>
              <div class="input-group-btn">
                <input type="submit" value="{% trans "Add new Ethernet Device" %}" class="btn btn-default"></input>
              </div>
            </div><!-- input-group -->
        </form>
  </div>
</div>
{% endblock %}
