{extends "index.tpl"}

{block "meta-robots"}
   <meta name="robots" content="noindex, follow">
{/block}

{block "css-entry" append}
   {encore_entry_link_tags entry='user'}
{/block}

{block "main"}
    {block "tpl-vars"}
        {$tpl_vars.registration_v = $cfg.tpl.user.version}
        {$tpl_vars.disallowEditB2B = $isB2BUser and $dbcfg.b2b.disallowEditB2B == "Y"}
    {/block}

   {if $body.newUser and $tpl_vars.registration_v == 2}
      {include "user/user.new.v2.tpl"}
   {elseif $body.newUser}
      {include "user/user.new.tpl"}
   {else}
      {include "user/user.edit.tpl"}
   {/if}
{/block}

{block "js-entry" append}
   {encore_entry_script_tags entry='user'}
{/block}

{block "js-dynamic-load" append}
   {asset_compile}
      <script src="/common/static/bootstrapvalidator/js/bootstrapValidator.js"></script>
      <script src="/common/static/bootstrapvalidator/js/language/{$ctrl.active_language_code}.js"></script>
   {/asset_compile}

   {if findModule('recaptcha','registration') and findModule('recaptcha','site_invisible') and $body.newUser}
      {include "block.recaptcha.invisible.tpl"}
      {captchaScript}
   {/if}
{/block}

{block analytics append}
   {if $dbcfg.analytics.foxentry.ID}
      {get_contexts country=1 assign="country_contexts"}
      {$active_country = $country_contexts.country->getActive()}
      {if $active_country.id|in_array:['CZ', 'SK', 'PL']}
         <!-- Foxentry start -->
         <script type="text/javascript" async>
            var Foxentry;
            (function () {
               var e = document.querySelector("script"), s = document.createElement('script');
               s.setAttribute('type', 'text/javascript');
               s.setAttribute('async', 'true');
               s.setAttribute('src', 'https://cdn.foxentry.cz/lib');
               e.parentNode.appendChild(s);
               s.onload = function () {
                  Foxentry = new FoxentryBase('{$dbcfg.analytics.foxentry.ID}');
               }
            })();
         </script>
         <!-- Foxentry end -->
      {/if}
   {/if}

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