<!DOCTYPE html>

{block utils}
   {$isDealer = $ctrl.dealer == "Y"}
   {if $ctrl}
      {$isB2BUser = $ctrl->isType('b2b') scope='global'}
      {$typeB2BUser = $ctrl->getType('b2b') scope='global'}
   {/if}

   {get_stats type='free_delivery' assign='free_delivery'} {* neni potreba key=$ctrl.currency? *}

   {if isset($body.returnNav)}
      {get_active_category returnNav=$body.returnNav assign='activeCategory'}
      {$breadcrumbs = $activeCategory.breadcrumb|default:$body.returnNav.0}
   {/if}
   {block 'utils-end'}{/block}
{/block}

<html class="no-js lang-{$ctrl.active_language}" {block "html-lang"}lang="{$ctrl.active_language}"{/block}>
<head>
   <meta charset="utf-8">
   {block "meta-author"}
      <meta name="author" content="{$dbcfg.shop_firm_name}">
   {/block}

   <meta name="web_author" content="wpj.cz">

   {block "meta-description"}
      <meta name="description" content="{$header.meta_description|default:$dbcfg.shop_description}">
   {/block}

   {block "meta-robots"}
      {if $cfg.Addr.full|strstr:".wpj.biz" or $cfg.Addr.full|strstr:".wpj.cloud" or $cfg.Addr.full|strstr:".wpjshop.cz"}
         <meta name="robots" content="noindex, nofollow">
      {elseif $smarty.get.full_version or $smarty.get.dynamic_filter}
         <meta name="robots" content="noindex, follow">
      {else}
         <meta name="robots" content="{$header.robots}">
      {/if}
   {/block}

   {if {web_version} == 'desktop'}
      <meta name="viewport" content="width=1280">
   {else}
      <meta name="viewport" content="width=device-width, initial-scale=1">
   {/if}

   <meta property="og:title" content="{$header.pageTitle}">
   {* todo custom FB image + dat tam obrazek produktu na detailu produktu *}
   {block "og-image"}
      <meta property="og:image" content="{static_url url="/templates/images/logo.png" absolute=1}">
   {/block}
   <meta property="og:url" content="{$ctrl.currUrl.Abs}">
   <meta property="og:type" content="website">

   {block "meta-site-name"}
   {/block}

   {block "meta-title"}
      <title>{$header.pageTitle}</title>
   {/block}

   {block css}
      {block fonts}
         <link href="https://fonts.googleapis.com/css?family=Poppins:400,400i,600,600i&display=swap&subset=latin-ext"
               rel="stylesheet">
      {/block}

      {block "css-entry"}
         {encore_entry_link_tags entry='app'}
         {ifmodule "JS_MENU"}
         {encore_entry_link_tags entry='js-menu'}
         {/ifmodule}
      {/block}
   {/block}

   {block canonical}
      {if $smarty.get}
         <link rel="canonical" href="{get_canonical_url}">
      {/if}
   {/block}

   {block 'pagination-data'}
      {if $body.pager.count > 1}
         {if $body.pager.number > 1}
            <link rel="prev" href="{$body.pager->getUrl(["page" => {{$body.pager.number}-1} ])}">
         {/if}
         {if $body.pager.number < $body.pager.count}
            <link rel="next" href="{$body.pager->getUrl(["page" => {{$body.pager.number}+1}])}">
         {/if}
      {/if}
   {/block}

   {block "favicon-base"}
   <link rel="shortcut icon" href="/templates/images/favicon.ico">
   {/block}
   {block "favicons"}{/block}
   <link rel="search" href="{url s=search}" type="text/html">

   {include "block.sentry.tpl"}
   {include "components/js_init.tpl"}
   {block 'js-start'}{/block}

   {foreach $dbcfg.analytics.google_site_verifications as $row}
      <meta name="google-site-verification" content="{$row.value}">
   {/foreach}

   {foreach $dbcfg.analytics.facebook_site_verifications as $row}
      <meta name="facebook-domain-verification" content="{$row.value}">
   {/foreach}

   {foreach $dbcfg.analytics.pinterest_site_verifications as $row}
      <meta name="p:domain_verify" content="{$row.value}"/>
   {/foreach}

   {if $dbcfg.analytics.seznam_webmaster.id}
      <meta name="seznam-wmt" content="{$dbcfg.analytics.seznam_webmaster.id}">
   {/if}

    {if !isDebug()}
      {include "block.ga4.tpl"}
   {/if}
   {include "block.gtm.tpl" gtm_type="gtm"}
   {include "block.gtm.script.tpl"}
</head>
<body>

{function responsiveSwitch}
   {if {web_version} == 'desktop'}
      <a href="{path('kupshop_content_version_switchversion', ['type' => 'default'])}">{t}Mobilní verze{/t}</a>
   {else}
      <a href="{path('kupshop_content_version_switchversion', ['type' => 'desktop'])}">{t}Klasická verze{/t}</a>
   {/if}
{/function}

{include "block.gtm.noscript.tpl"}

{block body}
{/block}

{ifmodule PRODUCTS_SECTIONS}
{block "sections-responsive"}
    {ifmodule "JS_MENU"}
        {insert_js_menu}
    {elsemodule}
        {include "components/sections.responsive.tpl"}
    {/ifmodule}
{/block}
{/ifmodule}

{ifmodule USERS}
{block "focus-login-wrapper"}
   {ifmodule "JS_SHOP"}
      {include "focus/focus.login.tpl" class="focus-login" focus_id="login"}
   {elsemodule}
   {if $ctrl.logged}
      {include "focus/focus.user.tpl" class="focus-user" focus_id="login"}
   {else}
      {include "focus/focus.login.tpl" class="focus-login" focus_id="login"}
   {/if}
   {/ifmodule}
{/block}
{/ifmodule}

{include "components/block.photoswipe.tpl"}

{ifmodule "JS_SHOP"}
   <div id="js-shop"></div>
   {include "components/jsShop.translations.tpl"}
   {include "components/jsShop.config.tpl"}
{/ifmodule}

{block microdata}
   {include "block.schema.tpl"}
{/block}

{block "cookiebar-init"}
   {if $dbcfg.cookie_bar.enable == "Y"}
      {if $dbcfg.cookie_bar.focus == "Y"}
         {include "focus/focus.cookies.tpl" class="focus-cookiebara"}
      {else}
         {include "block.cookie_bar.tpl"}
      {/if}
   {/if}
{/block}

{block "js-end"}
{block "js-polyfills"}
   <script crossorigin="anonymous"
           src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=default%2Cfetch%2CIntersectionObserver"></script>
{/block}
   {block "js-entry"}
      {encore_entry_script_tags entry='app'}
      {ifmodule "JS_SHOP"}
      {encore_entry_script_tags entry='js-shop'}
      {/ifmodule}
      {ifmodule "JS_MENU"}
      {encore_entry_script_tags entry='js-menu'}
      {/ifmodule}
   {/block}

   {block "js-dynamic-load"}
      {* veci co se nedaji includovat do webpacku, protoze se `if`uji v sablone. Napr. preklady bootsrap validator, skript pro zasilkovnu, ... *}
   {/block}
   <script>
      wpj.onReady.processAll();
      {block onready}
      {/block}
   </script>
{/block}

{if $header.wpjToolbar and !$smarty.get.no_toolbar}
   {include "block.wpj_toolbar.tpl"}
{/if}

{block analytics}
   {if !isDebug()}
      {include "block.analytics.tpl" inline}
   {/if}
{/block}
</body>
</html>
