{#**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 *#}
{% extends '@WebProfiler/Profiler/layout.html.twig' %}

{% block toolbar %}
    {% if 'unknown' == collector.symfonyState %}
        {% set block_status = '' %}
        {% set symfony_version_status = 'Unable to retrieve information about the Symfony version.' %}
    {% elseif 'eol' == collector.symfonyState %}
        {% set block_status = 'red' %}
        {% set symfony_version_status = 'This Symfony version will no longer receive security fixes.' %}
    {% elseif 'eom' == collector.symfonyState %}
        {% set block_status = 'yellow' %}
        {% set symfony_version_status = 'This Symfony version will only receive security fixes.' %}
    {% elseif 'dev' == collector.symfonyState %}
        {% set block_status = 'yellow' %}
        {% set symfony_version_status = 'This Symfony version is still in the development phase.' %}
    {% else %}
        {% set block_status = '' %}
        {% set symfony_version_status = '' %}
    {% endif %}

    {% set icon %}
        <span class="sf-toolbar-label"><img src="{{ asset('themes/new-theme/img/glyph.png') }}" /></span>
        <span class="sf-toolbar-value">{{ collector.applicationversion }}</span>
    {% endset %}

    {% set text %}
        <div class="sf-toolbar-info-group">
            <div class="sf-toolbar-info-piece">
                <b>{{ collector.applicationname }}</b>
                <span>{{ collector.applicationversion }}</span>
            </div>

            <div class="sf-toolbar-info-piece">
                <b>Profiler token</b>
                <span>
                    {% if profiler_url %}
                        <a href="{{ profiler_url }}">{{ collector.token }}</a>
                    {% else %}
                        {{ collector.token }}
                    {% endif %}
                </span>
            </div>

            <div class="sf-toolbar-info-piece">
                <b>Symfony</b>
                <span>
                    <a href="https://symfony.com/doc/{{ collector.symfonyversion }}/index.html" rel="help">
                        Read Symfony {{ collector.symfonyversion }} Docs
                    </a>
                </span>
            </div>
        </div>
        <div class="sf-toolbar-info-group">
            <div class="sf-toolbar-info-piece sf-toolbar-info-php">
                <b>PHP version</b>
                <span{% if collector.phpversionextra %} title="{{ collector.phpversion ~ collector.phpversionextra }}"{% endif %}>
                    {{ collector.phpversion }}
                    &nbsp; <a href="{{ path('_profiler_phpinfo') }}">View phpinfo()</a>
                </span>
            </div>

            <div class="sf-toolbar-info-piece sf-toolbar-info-php-ext">
                <b>PHP Extensions</b>
                <span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasxdebug ? 'green' : 'red' }}">xdebug</span>
                <span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasapcu ? 'green' : 'red' }}">APCu</span>
                <span class="sf-toolbar-status sf-toolbar-status-{{ collector.haszendopcache ? 'green' : 'red' }}">OPcache</span>
            </div>

            <div class="sf-toolbar-info-piece">
                <b>PHP SAPI</b>
                <span>{{ collector.sapiName }}</span>
            </div>
        </div>

        <div class="sf-toolbar-info-group">
            <div class="sf-toolbar-info-piece">
                <b>Resources</b>
                <span>
                    {% set appVersion = collector.applicationversion|join()[:1] %}
                    <a href="https://devdocs.prestashop.com/{{ appVersion }}/" rel="help">
                        Read PrestaShop {{ collector.applicationversion }} Docs
                    </a>
                </span>
            </div>
        </div>
    {% endset %}

    {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status, additional_classes: 'sf-toolbar-block-right', block_attrs: 'title="' ~ symfony_version_status ~ '"' }) }}
{% endblock %}

{% block menu %}
    <span class="label label-status-{{ collector.symfonyState == 'eol' ? 'red' : collector.symfonyState in ['eom', 'dev'] ? 'yellow' : '' }}">
        <span class="icon">{{ include('@WebProfiler/Icon/config.svg') }}</span>
        <strong>Configuration</strong>
    </span>
{% endblock %}

{% block panel %}
    {% if collector.applicationname %}
        {# this application is not the Symfony framework #}
        <h2>Project Configuration</h2>

        <div class="metrics">
            <div class="metric">
                <span class="value">{{ collector.applicationname }}</span>
                <span class="label">Application name</span>
            </div>

            <div class="metric">
                <span class="value">{{ collector.applicationversion }}</span>
                <span class="label">Application version</span>
            </div>
        </div>

        <p>
            Based on <a class="text-bold" href="https://symfony.com">Symfony {{ collector.symfonyversion }}</a>
        </p>
    {% else %}
        <h2>Symfony Configuration</h2>

        <div class="metrics">
            <div class="metric">
                <span class="value">{{ collector.symfonyversion }}</span>
                <span class="label">Symfony version</span>
            </div>

            {% if 'n/a' != collector.appname %}
                <div class="metric">
                    <span class="value">{{ collector.appname }}</span>
                    <span class="label">Application name</span>
                </div>
            {% endif %}

            {% if 'n/a' != collector.env %}
                <div class="metric">
                    <span class="value">{{ collector.env }}</span>
                    <span class="label">Environment</span>
                </div>
            {% endif %}

            {% if 'n/a' != collector.debug %}
                <div class="metric">
                    <span class="value">{{ collector.debug ? 'enabled' : 'disabled' }}</span>
                    <span class="label">Debug</span>
                </div>
            {% endif %}
        </div>

        {% set symfony_status = { dev: 'Unstable Version', stable: 'Stable Version', eom: 'Maintenance Ended', eol: 'Version Expired' } %}
        {% set symfony_status_class = { dev: 'warning', stable: 'success', eom: 'warning', eol: 'error' } %}
        <table>
            <thead class="small">
                <tr>
                    <th>Symfony Status</th>
                    <th>Bugs {{ collector.symfonystate in ['eom', 'eol'] ? 'were' : 'are' }} fixed until</th>
                    <th>Security issues {{ collector.symfonystate == 'eol' ? 'were' : 'are' }} fixed until</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="font-normal">
                        <span class="label status-{{ symfony_status_class[collector.symfonystate] }}">{{ symfony_status[collector.symfonystate]|upper }}</span>
                    </td>
                    <td class="font-normal">{{ collector.symfonyeom }}</td>
                    <td class="font-normal">{{ collector.symfonyeol }}</td>
                    <td class="font-normal">
                        <a href="https://symfony.com/roadmap?version={{ collector.symfonyminorversion }}#checker">View roadmap</a>
                    </td>
                </tr>
            </tbody>
        </table>
    {% endif %}

    <h2>PHP Configuration</h2>

    <div class="metrics">
        <div class="metric">
            <span class="value">{{ collector.phpversion }}{% if collector.phpversionextra %} <span class="unit">{{ collector.phpversionextra }}</span>{% endif %}</span>
            <span class="label">PHP version</span>
        </div>

        <div class="metric">
            <span class="value">{{ collector.phparchitecture }} <span class="unit">bits</span></span>
            <span class="label">Architecture</span>
        </div>

        <div class="metric">
            <span class="value">{{ collector.phpintllocale }}</span>
            <span class="label">Intl locale</span>
        </div>

        <div class="metric">
            <span class="value">{{ collector.phptimezone }}</span>
            <span class="label">Timezone</span>
        </div>
    </div>

    <div class="sf-toolbar-info-group">
        <div class="sf-toolbar-info-piece">
          <b>Resources</b>
          <span>
            {% set appVersion = collector.applicationversion|join()[:1] %}
              <a href="https://devdocs.prestashop.com/{{ appVersion }}/" rel="help">
                  Read PrestaShop {{ collector.applicationversion }} Docs
              </a>
          </span>
        </div>
    </div>
    <div class="metrics">
        <div class="metric">
            <span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.haszendopcache ? 'yes' : 'no') ~ '.svg') }}</span>
            <span class="label">OPcache</span>
        </div>

        <div class="metric">
            <span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.hasapcu ? 'yes' : 'no') ~ '.svg') }}</span>
            <span class="label">APCu</span>
        </div>

        <div class="metric">
            <span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.hasxdebug ? 'yes' : 'no') ~ '.svg') }}</span>
            <span class="label">Xdebug</span>
        </div>
    </div>

    <p>
        <a href="{{ path('_profiler_phpinfo') }}">View full PHP configuration</a>
    </p>

    {% if collector.bundles %}
        <h2>Enabled Bundles <small>({{ collector.bundles|length }})</small></h2>
        <table>
            <thead>
                <tr>
                    <th class="key">Name</th>
                    <th>Path</th>
                </tr>
            </thead>
            <tbody>
                {% for name in collector.bundles|keys|sort %}
                <tr>
                    <th scope="row" class="font-normal">{{ name }}</th>
                    <td class="font-normal">{{ profiler_dump(collector.bundles[name]) }}</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    {% endif %}
{% endblock %}
