<script>

   {% block wpjtoolbar_blocek_config %}
   var blocek_config = {
      urlPrefix: {% if app.environment == 'dev' %}'https://www.kupshop.local/admin/'{% else %}'{{ cfg.Addr.full_original|default('/') }}{{ cfg.Path.admin }}'{% endif %},
      isDevelopment: {% if app.environment == 'dev' %}true{% else %}false{% endif %},
      isWpjAdmin: {% if header.wpjToolbar.user.superuser %}true{% else %}false{% endif %},
      adminUser: "{{ header.wpjToolbar.user.login|escape('js') }}",
      version: "{{ header.wpjToolbar.blocek_version }}",
      allowHtml: {% if dbcfg.blocek_allow_html == 'Y' %}true{% else %}false{% endif %},
      language: '{% if cfg.Lang.language_admin ?? '' == 'english' %}en{% else %}cs{% endif %}',
      {% if cfg.local_blocek is defined %}
         bundleUrl: "{{ cfg.local_blocek }}",
      {% endif %}
      felanguage: '{{ app.locale }}'
   };
   {% endblock %}
</script>

{{ encore_entry_link_tags('wpj_toolbar', encorePackage()) }}
{{ encore_entry_script_tags('wpj_toolbar', encorePackage()) }}

<div id="wpj-header" style="display: none">
   <ul>
      <li>
         <a id="adminEdit" href="{{ header.wpjToolbar.url }}" class="wpjheader-button wpjheader-button-green
            {% if header.wpjToolbar.url %}enabled{% else %}disabled{% endif %}" title="{{ 'open_settings'|translate('toolbar', false, true) }}" target="_blank"
            data-title="{{ header.wpjToolbar.title }}"
            data-edit_button>{% if header.wpjToolbar.title %}{{ header.wpjToolbar.title }}{% else %}{{ 'btn_adjust'|translate('toolbar', false, true) }}{% endif %}</a>
      </li>
      <li id="blocekEdit" style="display: none;">
         <a class="wpjheader-button wpjheader-button-blue" href="#" title="{{ 'edit_page_content'|translate('toolbar', false, true) }}">
            <span class="wpjtoolbar-progress" style="width: 0;"></span>
            <span>{{ 'btn_edit_content'|translate('toolbar', false, true) }}</span>
         </a>
      </li>

       {% if module.INDEXED_FILTER %}
          <li {% if not header.wpjToolbar.indexed_filter ?? false %}style="display: none;"{% endif %}>
             <a id="adminEditIndexed" href="{{ header.wpjToolbar.indexed_filter ?? '' }}" class="filter"
                title="Obsah pro indexovatelné filtry" target="_blank" data-title="Obsah pro indexovatelné filtry"
                data-edit_button>Index. filtr</a>
          </li>
       {% endif %}
      {% if module.TRANSLATIONS %}
         <li>
            {% set url = null %}
{#            {{ "get_contexts" language=1 assign="contexts" }}#}
{#            {% if header.wpjToolbar.translateUrl and contexts.language.getDefaultId() != contexts.language.getActiveId() %}#}
{#               {$url = "{{ header.wpjToolbar.translateUrl }}&sourceLanguage={{ contexts.language.getDefaultId() }}&language={{ contexts.language.getActiveId() }}"}#}
{#            {% endif %}#}
            <a href="{{ url }}" class="translate edit_button {% if url %}enabled{% else %}disabled{% endif %}" target="_blank"
               title="{{ 'translate_page_content'|translate('toolbar', false, true) }}"
               data-title="{{ header.wpjToolbar.translateTitle }}">{{ 'btn_translate'|translate('toolbar', false, true) }}</a>
         </li>
      {% endif %}
      <li><a href="{{ header.wpjToolbar.admin_url }}" class="admin" title="{{ 'open_admin'|translate('toolbar', false, true) }}"
             target="_blank">{{ 'btn_admin'|translate('toolbar', false, true) }}</a></li>
         <li><label><input type="checkbox" data-debug="SEO" name="wpjSEODebug">{{ 'seo_toolbar'|translate('toolbar', false, true) }}</label></li>
      <li><label><input type="checkbox" data-debug="Components" name="wpjComponentsDebug">{{ 'components_toolbar'|translate('toolbar', false, true) }}</label></li>
      {% if app.environment == 'dev' %}
         <li><label><input type="checkbox" data-debug="SymfonyToolbar" name="wpjSymfonyToolbarDebug">{{ 'symfony_toolbar'|translate('toolbar', false, true) }}</label></li>
      {% endif %}
      <li><a href="" class="clear-cache" data-wpjClearCache>{{ 'cache_toolbar'|translate('toolbar', false, true) }}</a></li>
      <li><a href="{{ header.wpjToolbar.admin_url }}launch.php?s=logout.php" class="logout"
             title="{{ 'btn_logout'|translate('toolbar', false, true) }}">{{ header.wpjToolbar.user.login }}</a></li>
      {% if header.wpjToolbar.user.login == "superadmin" %}
         {# <li class="superadmin">Verze: {{ cfg.Program.version.folder|replace('v22.0_', '') }}</li> #}
         <li class="superadmin">DB: {{ cfg.Connection.database|replace({'kupshop_':''}) }}</li>
         <li class="superadmin">view: {{ header.wpjToolbar.view }}</li>
         {% if header.wpjToolbar.template %}
            <li class="superadmin">tpl: {{ header.wpjToolbar.template }}</li>
         {% endif %}
          {% if header.wpjToolbar.tpl_theme %}
             <li class="superadmin">theme: twig_fallback + x</li>
          {% endif %}
      {% endif %}
   </ul>
   <span id="wpj_header_toggler" class="wpjtoolbar-toggler" data-wpjtoolbar-toggler></span>
</div>

<div class="modal" tabindex="-1" role="dialog" id="wpjToolbar_dialog" aria-hidden="true">
   <div class="modal-dialog modal-lg">
      <div class="modal-content">
         <div class="wpjToolbar_dialog">
         </div>
      </div>
   </div>
</div>

{% block wpjtoolbar_js %}{% endblock %}
