{% extends "base.html" %}

{% from "macros.html" import diagram with context %}

{% block title %}Period{% endblock %}

{% block content_title %}Period{% endblock %}

{% block content %}
{{ diagram("period", intervals, current) }}
<div class="container has-text-centered">
    <form action="period" method="post">
        <div class="field has-addons has-addons-centered mx-2">
            <div class="control">
                <input class="input" type="date" name="date" value="{{ today }}" required="required" />
            </div>
            <div class="control">
                <div class="select">
                    <select name="intensity">
                        <option>0</option>
                        <option>1</option>
                        <option>2</option>
                        <option>3</option>
                        <option>4</option>
                    </select>
                </div>
            </div>
            <div class="control">
                <input class="button is-success" type="submit" value="Submit"/>
            </div>
        </div>
    </form>
</div>
<div class="table-container mt-4">
    <table class="table is-fullwidth is-narrow is-striped has-text-centered">
        <thead>
            <tr>
                <th>Date</th>
                <th>Intensity</th>
            </tr>
        </thead>
        <tbody>
            {% for datetime, intensity in period %}
            <tr>
                <td>{{ datetime.date() }}</td>
                <td>{{ intensity }}</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}

{% set parent_page = 'index_view' %}
