{% extends 'layouts/admin.twig' %}

{% block content %}

    <ul class="breadcrumbs el">
        <li><a href="/admin/">Home</a> /</li>
        <li class="end">Dashboard</li>
    </ul>

    <h1>
        Secure Website Admin Area
    </h1>

    <p>
        Welcome to {{ config('app.name') }} secure admin area.
        Please select from one of the options on the left hand side to
        begin administering the site.
    </p>

    <p>
        Please do not hesitate to contact
        <a href="http://www.mtcmedia.co.uk/" target="_blank">mtc.</a>
        at any time for technical support.
    </p>

    {% include 'admin/messages.twig' %}

    {% if settings.ADVANCED_STATS_ENABLED or settings.GRAPH_STATS_ENABLED %}
        <div id="dashboardStats">

            {% if settings.GRAPH_STATS_ENABLED and graphs|length > 0 %}
                <script type="text/javascript" src="/core/js/jsapi_visualization_corechart.js"></script>
                {% set col_count = graphs|length % 2 == 0 ? 2 : 3 %}
                <div class="el cols{{ col_count }}">
                    {% for graph in graphs %}
                        <div class="col el {{ loop.index0 % col_count == 0 ? 'first' : '' }}">
                            <h3>{{ graph.name }}</h3>
                            <div class="el graph js_dashboardStat"
                                 id="{{ graph.id }}"
                                 data-url="{{ graph.url }}">
                                <i class="fa fa-circle-o-notch fa-spin fa-3x dashboardIcon"></i>
                            </div>
                        </div>
                    {% endfor %}
                </div>
            {% endif %}

            {% if settings.ADVANCED_STATS_ENABLED and numeric_stats|length > 0 %}

                <form action="" method="post" id="dashboard-dates">
                    <div class="row">
                        <input type="text"
                               class="datepicker short"
                               name="start_date"
                               id="start-date"
                               placeholder="DD/MM/YYYY"
                               value="{{ start_date }}"/>
                        <span class="between-dates"> to </span>
                        <input type="input"
                               class="datepicker short"
                               name="end_date"
                               id="end-date"
                               placeholder="DD/MM/YYYY"
                               value="{{ end_date }}"/>
                        <input type="submit" name="go-dashboard" id="filter-dates" value="Filter"/>
                    </div>
                </form>

                {% set col_count = numeric_stats|length % 3 == 0 ? 3 : 2 %}
                <div class="el cols{{ col_count }}">
                    {% for stats in numeric_stats %}
                        <div class="col el numeric_stats js_dashboardStatListing {{ loop.index0 % col_count == 0 ? 'first' : '' }}"
                             id="{{ stats.id }}"
                             data-url="{{ stats.url }}">
                            <i class="fa fa-circle-o-notch fa-spin fa-3x dashboardIcon"></i>
                        </div>
                    {% endfor %}
                </div>
            {% endif %}
        </div>
    {% endif %}
{% endblock %}
