{% extends "base.html" %}

{% block title %}Found Devices{% endblock %}
{% block header_title %}Scan Results{% endblock %}
{% block id %}scan{% endblock %}

{% block content %}
    <ul data-role="listview">
        {% for camera in devices %}
            {% if camera.state %}
                {% set theme='data-theme="e"' %}
            {% else %}
                {% set theme="" %}
            {% endif %}
            <li data-icon="gear" {{ theme }} >
                <a href="/setup.html?address={{camera.address}}">
                    <h3>{{ camera.name }}</h3>
                    <p>{{ camera.address }}</p>
                </a>
            </li>
        {% else %}
        <li data-icon="refresh">
            <a href="javascript: doReload();">
                {% if error %}
                    <h3>Something went wrong while scanning</h3>
                    <p><strong>Reason:</strong>{{ error }}
                {% else %}
                    <h3>No devices where found</h3>
                {% endif %}
                <p>Scan Again</p>
            </a>
        </li>
        {% endfor %}
    </ul>
{% endblock %}
