<script>
   {$user = getAdminUser()}
   {$isLocalDev = ($smarty.server.SERVER_NAME == 'www.kupshop.local' || $smarty.server.SERVER_NAME == 'kupshop.local')}

   {block "wpjtoolbar-blocek-config"}
   var blocek_config = {
      urlPrefix: '{$cfg.Addr.full_original|default:'/'}{$cfg.Path.admin}',
      isDevelopment: {if isDevelopment() && $isLocalDev}true{else}false{/if},
      isWpjAdmin: {if $user.superuser}true{else}false{/if},
      adminUser: "{$user.login|escape:'javascript' nofilter}",
      version: "{$header.wpjToolbar.blocek_version}",
      {if $cfg.local_blocek }
      bundleUrl: "{$cfg.local_blocek}",
      {/if}
      allowHtml: {if $dbcfg.blocek_allow_html == 'Y'}true{else}false{/if},
      language: '{if $cfg.Lang.language_admin == 'english'}en{else}cs{/if}',
      felanguage: '{$ctrl.active_language}'
   };
   {/block}
</script>

{encore_entry_link_tags entry='wpj_toolbar'}
{encore_entry_script_tags entry='wpj_toolbar'}

<div id="wpj-header" style="display: none">
   <ul>
      <li>
         <a id="adminEdit" href="{$header.wpjToolbar.url}" class="wpjheader-button wpjheader-button-green {*settings*}
            {if $header.wpjToolbar.url}enabled{else}disabled{/if}" 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}{/if}</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 !$header.wpjToolbar.indexed_filter}style="display: none;"{/if}>
             <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>
       {/if}
      {if $module.TRANSLATIONS}
         <li>
            {get_contexts language=1 assign="contexts"}
            {if $header.wpjToolbar.translateUrl && $contexts.language->getDefaultId() !== $contexts.language->getActiveId()}
               {$url = "{$header.wpjToolbar.translateUrl}&sourceLanguage={$contexts.language->getDefaultId()}&language={$contexts.language->getActiveId()}"}
            {/if}
            <a href="{$url}" class="translate edit_button {if $url}enabled{else}disabled{/if}" target="_blank"
               title="{'translate_page_content'|translate:'toolbar':false:true}"
               data-title="{$header.wpjToolbar.translateTitle}">{'btn_translate'|translate:'toolbar':false:true}</a>
         </li>
      {/if}
      <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>
      {if $isLocalDev}
         <li><label><input type="checkbox" data-debug="SymfonyToolbar" name="wpjSymfonyToolbarDebug">{'symfony_toolbar'|translate:'toolbar':false:true}</label></li>
      {/if}
      <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>
         {/if}
         {if $header.wpjToolbar.tpl_theme}
            <li class="superadmin">theme: {$header.wpjToolbar.tpl_theme}</li>
         {/if}
         {get_contexts language=1 country=1 currency=1 user=1 assign="contexts"}
         <li class="superadmin">Country: {if $contexts['country']}{$contexts['country']->getActive()->name}{/if}</li>
         <li class="superadmin">Language: {if $contexts['language']}{$contexts['language']->getActiveId()}{/if}</li>
         <li class="superadmin">Currency: {if $contexts['currency']}{$contexts['currency']->getActiveId()}{/if}</li>
         <li class="superadmin">User: {if $contexts['user']}{$contexts['user']->getActive()->email}{/if}</li>
         <li class="superadmin">UserType: {if $contexts['user']}{implode(', ', array_keys($contexts['user']->getTypes()))}{/if}</li>
         {if $module.PRICE_LEVELS}
            {get_contexts pricelevel=1 assign="priceLevelContext"}
            <li class="superadmin">PriceLevel: {if $priceLevelContext['pricelevel']}{$priceLevelContext['pricelevel']->getActiveId()} - {$priceLevelContext['pricelevel']->getActive()->name}{/if}</li>
         {/if}
         {if $module.PRICELISTS}
            {get_contexts pricelist=1 assign="priceListContext"}
            <li class="superadmin">PriceList: {if $priceListContext['pricelist']}{$priceListContext['pricelist']->getActiveId()} - {$priceListContext['pricelist']->getActive()->name}{/if}</li>
         {/if}
      {/if}
   </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"}{/block}
