{% extends "base.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}

{% load bootstrap %}
{% load i18n %}
{% load extras %}

{% block content %}

  <h3>{{ title }}</h3>

  {% if not device_access_points %}
    <p>{% trans "No Wi-Fi device detected." %}</p>
  {% else %}
    <div class="row">
      <div class="col-md-6">
        {% for device in device_access_points %}
          {% if device_access_points|length > 1 %}
            <h4>
              {% blocktrans trimmed with interface_name=device.interface_name %}
                Device: {{ interface_name }}
              {% endblocktrans %}
            </h4>
          {% endif %}
          <p>
            {% trans "Last scanned: " %}
            {% if device.last_scan_time %}
              {{ device.last_scan_time|timesince }}
            {% else %}
              {% trans "never" %}
            {% endif %}
            {% if device.scan_requested %}
              {% icon 'spinner' class='svg-icon spin' %}
            {% endif %}
          </p>
          <div class="list-group list-group-two-column">
            {% for access_point in device.access_points %}
              <div class="list-group-item">
                <span class="primary">
                  <a href="{% url 'networks:add_wifi' access_point.ssid_string device.interface_name %}">
                     {{ access_point.ssid_string }}
                  </a>
                </span>

                <span class="badge text-bg-secondary secondary">
                  {{ access_point.strength }}%
                </span>
              </div>
            {% empty %}
              <p>
                {% trans "No Wi-Fi networks found." %}
              </p>
            {% endfor %}
          </div>
        {% endfor %}
      </div>
    </div>
  {% endif %}

{% endblock %}
