{% extends 'layouts/base.html' %}

{% block content %}
    <h1>Статистика</h1>
    <form method="POST">
        {% csrf_token %}
        <h4><input {% if user.selected_project.stats_link %}value="{{ user.selected_project.stats_link }}"{% endif %} name="link" placeholder="Ссылка на статистику" /> <input {% if user.selected_project.stats_cron %} value="{{ user.selected_project.stats_cron }}"{% endif %} name="cron" placeholder="CRON"/> Включено <input name="enabled" type="checkbox" {% if user.selected_project.stats_enabled %}checked{% endif %} /> <button type="submit" class="btn btn-primary">Сохранить</button> </h4>
    </form>
    {% if err %}
        <div class="alert alert-danger" role="alert">
          Ошибка валидации!
        </div>
    {% endif %}
    <table class="table">
        <thead>
            <th>Время</th>
            {% for time in times %}
                <th>{{ time.date.day }}-{{ time.date.month }}<br>{{ time.hour }}:{% if time.minute < 10 %}0{% endif %}{{ time.minute }}</th>
            {% endfor %}
        </thead>
        <tbody>
            {% for row in data %}
                <tr>
                    {% for item in row %}
                        <td>
                            {{ item }}
                        </td>
                    {% endfor %}
                </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock %}