{#
 # This file is part of SolidInvoice package.
 #
 # (c) Pierre du Plessis <open-source@solidworx.co>
 #
 # This source file is subject to the MIT license that is bundled
 # with this source code in the file LICENSE.
 #}

{% extends '@SolidInvoiceCore/Layout/base.html.twig' %}

{% block scripts %}
    {% set script = block("script") ?? null %}

    {% if script is not empty %}
        <script>
            {{ script|raw }}
        </script>
    {% endif %}
{% endblock %}

{% block header %}
    {% include "@SolidInvoiceCore/Menu/top.html.twig" with {"title" : block('title') ?? '', "header_content" : header_content|default('')} %}
{% endblock header %}

{% block footer %}
    <small>{{ "powered_by"|trans }} <a href="http://solidinvoice.co">{{ constant('SolidInvoice\\CoreBundle\\SolidInvoiceCoreBundle::APP_NAME') }}</a> - {{ app_version }}</small>
{% endblock footer %}

{% block body_bottom %}
    <div id="modal-container" class="modal" tabindex="-1"></div>
{% endblock body_bottom %}

{% block body %}
    <aside class="main-sidebar sidebar-dark-primary elevation-4">
        <a class="brand-link" href="{{ url('_dashboard') }}">
            {{ app_logo() }}

            <span class="brand-text font-weight-light">
                {{ company_name() }}
            </span>
        </a>

        <section class="sidebar">
            <div class="user-panel mt-3 pb-3 mb-3 d-flex">
                <div class="image">
                    {#<img src="http://t2.tagstat.com/im/people/silhouette_m_300.png" class="img-circle" alt="User Image">#}
                    {#<img src="https://gravatar.com/avatar/{{ app.user.email|md5 }}?d=mm" class="img-circle" alt="User Image">#}
                </div>
                <div class="info text-white">
                    <p>{{ app.user.userIdentifier }}</p>
                    <a href="{{ path('_profile') }}">{{ icon('envelope') }} {{ app.user.email }}</a>
                </div>
            </div>

            {{ knp_menu_render('sidebar', {}, 'solidinvoice') }}

            {% if block('sidebar') is defined %}
                <nav class="mt-2">
                    {{ block('sidebar') }}
                </nav>
            {% endif %}
        </section>
    </aside>

    <div class="content-wrapper">
        {% if block('heading') is defined and block('heading')|trim is not empty %}
            <section class="content-header">
                {{  block('heading') }}
            </section>
        {% endif %}

        <section class="content pt-4">
            {% include "@SolidInvoiceCore/flash.html.twig" %}

            {{ block('content') is defined ? block('content') }}
        </section>
    </div>
{% endblock body %}
