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

<table>
    <tr>
        <td>
            <button class="selected" onclick="location.href = '/override';">override</button>
        </td>
    </tr>
    <tr>
        <td>
            <button class="unselected" onclick="location.href = '/config';">config</button>
        </td>  
    </tr>
    <tr>
        <td>
            <button class="unselected" onclick="location.href = '/discord';">discord</button>
        </td>
    </tr>
    <tr>
        <td>
            <button class="unselected" onclick="location.href = '/proxy';">proxy</button>
        </td>  
    </tr>
    <tr>
        <td>
            <button class="unselected" onclick="location.href = '/logs';">logs</button>
        </td>  
    </tr>
    <tr>
        <td>
            <button class="unselected" onclick="location.href = '/grafana';">stats</button>
        </td>  
    </tr>
    <tr>
        <td>
            <button class="unselected" onclick="location.href = '/settings';">settings</button>
        </td>
    </tr>
</table>
{% endblock %}

{% block content %}

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

<form method="post" action="/override/">
    <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" 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 %}