{% extends "base.html" %}
{% block left_pannel %}schedule{% endblock %}

{% block content %}

{%if not current_user.is_authenticated %}
    <button class="unselected" onclick="location.href = '/login';">login</button>
{% else %}

<form method="post" action="/schedule/">
    <table>
    {% for i in data %}
        <tr>
            <td>{{data[i]['name']}}</td>
            <td>
                <input type="time" id="{{i}}" name="time{{i}}" value="{{data[i]['time']}}" required>
            </td>
            <td>
                <input type="checkbox" class="toogle" id="switch{{i}}" name="switch{{i}}" {{ "checked" if data[i]['enabled'] == True else "" }} />
                <label for="switch{{i}}">
                    Toggle
                </label>
            </td>

        </tr>
    {% endfor %}

    </table>
        

    <input type="submit"  name="data" value="Update" class="button"/>
</form>
{% endif %}

{%endblock %}