{% extends 'base.html' %}
{% block content %}

{% if bt_error %}
    <table bgcolor='#d98797'>
        <tr>
            <td>
                {{ bt_error }}
            </td>
        </tr>
    </table>
{% endif %}
<br>

{% if bt_dev %}
    <form action='{{url_for('myCar_bluetooth_connect')}}' method='post'>


    <table class="pure-table pure-table-horizontal">
    <tr>
        <th>ID</th><th>Alias</th><th>MAC Address</th><th>RSSI</th><th>connect</th>
    </tr>
    {% for dev in bt_dev %}
        <tr>
            <td>{{ loop.index }}</td><td>{{ dev.Alias }}</td><td>{{ dev.Address }}</td><td>{{dev.RSSI}}</td><td>{% if dev.RSSI == None %}
                    <img src='{{ url_for('static', filename='img/nok.png') }}' width='30px' height='30px'>
                {% else %}
                    <button class="pure-button" formmethod='post' name='bt_dst_mac' value='{{ dev.Address }}'><img src='{{ url_for('static', filename='img/wireless.png') }}' width='30px' height='30px'></button>
                {% endif %}</td>
        </tr>
    {% endfor %}
    </table>
    </form>
{% else %}
    Bluetooth seems to be off
{% endif %}

{% endblock %}
