{block name='layout-footer'}
    {et_getSetting section="GroupGlobal" assign="et_global"}
    {et_isShopVersionAtLeast value="5.2.0-beta" assign='shopIsAtLeast52'}
    {et_isShopVersionAtLeast value="5.4.0-rc.1" assign='shopIsAtLeast54'}
    {et_isShopVersionAtLeast value="5.5.0-rc.1" assign='shopIsAtLeast55'}

    {block name='layout-footer-content-all-closingtags'}

        {block name='layout-footer-content-closingtag'}
            {opcMountPoint id='opc_content' title='Default Area' inContainer=false}
            </div>{* /content *}
        {/block}

        {block name='layout-footer-content-wrapper-closingtag'}
            </div>{* /content-wrapper*}
        {/block}
    {/block}

    {block name='layout-footer-main-wrapper-closingtag'}
        </main> {* /mainwrapper *}
    {/block}

    {block name='layout-footer-content'}
        {if !$bExclusive}
            {* Footer *}
            <footer id="footer">
                {if $nSeitenTyp === $smarty.const.PAGE_BESTELLVORGANG}
                    {et_renderGrid id="footer_checkout" fallbackId="footer_main"}
                {else}
                    {et_renderGrid id="footer_main"}
                {/if}
                {block name='layout-footer-additional'}{/block}
                {block name='et-layout-footer-vat-credits'}
                    <div id="vat-credits">
                        <meta itemprop="copyRightHolder" content="{$meta_copyright|strip_tags|escape:'html'}" />
                        <div class="container">
                            <div class="row">
                                {assign var=isBrandFree value=JTL\Shop::isBrandfree()}
                                    {block name='layout-footer-copyright-brand'}
                                    <div class="col-12 col-md-4 text-center text-md-left order-2 order-md-1 small">
                                        {if !isset($et_global.brandFreeEnabled) || !$et_global.brandFreeEnabled}
                                            Made with &#9829; with <a href="https://www.easytemplate360.de" target="_blank" rel="noopener nofollow">easyTemplate360</a>
                                        {/if}
                                    </div>
                                    <div class="col-12 col-md-4 text-center order-1 order-md-2">
                                        <div class="footnote-vat small">
                                            {if $NettoPreise == 1}
                                                {lang key='footnoteExclusiveVat' assign='footnoteVat'}
                                            {else}
                                                {lang key='footnoteInclusiveVat' assign='footnoteVat'}
                                            {/if}
                                            {if isset($oSpezialseiten_arr[$smarty.const.LINKTYP_VERSAND])}
                                                {if $Einstellungen.global.global_versandhinweis === 'zzgl'}
                                                    {lang key='footnoteExclusiveShipping' printf=$oSpezialseiten_arr[$smarty.const.LINKTYP_VERSAND]->getURL() assign='footnoteShipping'}
                                                {elseif $Einstellungen.global.global_versandhinweis === 'inkl'}
                                                    {lang key='footnoteInclusiveShipping' printf=$oSpezialseiten_arr[$smarty.const.LINKTYP_VERSAND]->getURL() assign='footnoteShipping'}
                                                {/if}
                                            {/if}
                                            {block name='footer-vat-notice'}
                                               * {$footnoteVat}{if isset($footnoteShipping)}{$footnoteShipping}{/if}
                                            {/block}
                                        </div>
                                    </div>
                                    <div class="col-12 col-md-4 text-center text-md-right order-3 small" id="system-credits">
                                        {if !$isBrandFree}
                                            Powered by <a href="https://jtl-url.de/jtlshop" title="JTL-Shop" target="_blank" rel="noopener nofollow">JTL-Shop</a>
                                        {/if}
                                    </div>
                                {/block}
                            </div>
                        </div>
                    </div>
                {/block}
                {block name='layout-footer-scroll-top'}
                    {et_getDevice assign='et_device'}
                    {if $et_device === 'desktop' && $et_global.scrollToTopEnabled}
                        {include file='snippets/scroll_top.tpl'}
                    {/if}
                    {if ($et_device === 'phone' || $et_device === 'tablet') && $et_global.scrollToTopMobileEnabled}
                        {include file='snippets/scroll_top.tpl'}
                    {/if}
                {/block}
            </footer>
        {/if}
    {/block}

    {block name='layout-footer-io-path'}
        <div id="jtl-io-path" data-path="{$ShopURL}"{if $shopIsAtLeast54} data-endpoint="/io"{/if} class="d-none"></div>
    {/block}
    {* JavaScripts *}
    {block name='layout-footer-js'}
        {$dbgBarBody}
        {captchaMarkup getBody=false}
        {* TODO: Removed lazy loading work around - do we need to fix attribute loading=lazy on all images? *}
        {block name="et-layout-footer-js-lazysizes"}
            {if file_exists("{$currentTemplateDirFullPath}js/lazysizes.min.js")}
                <script src="{$ShopURL}/{$currentTemplateDir}js/lazysizes.min.js"></script>
            {elseif !empty($parentTemplateDir)}
                <script src="{$ShopURL}/{$parentTemplateDir}js/lazysizes.min.js"></script>
            {/if}
        {/block}
        {block name="et-layout-footer-js-globals"}
            {strip}
                {et_getSetting section="breakpoints" assign="et_breakpoints"}
                {et_getGlobalSettings assign="et_globalSettings"}
                <script type="text/javascript">
                    {* This may be required by 3rd party plugins / NOVA default functions *}
                    window.globals = {
                        breakpoints: {
                            xs: 0,
                            sm: {$et_breakpoints.smMin},
                            md: {$et_breakpoints.mdMin},
                            lg: {$et_breakpoints.lgMin},
                            xl: {$et_breakpoints.xlMin}
                        }, {* Icons to be used by JS scripts - mostly fileinput *}
                        icons: {
                            remove: '{et_getIcon key='remove'}',
                            upload: '{et_getIcon key='upload'}',
                            redo: '{et_getIcon key='redo'}',
                            download: '{et_getIcon key='download'}',
                            zoom: '{et_getIcon key='zoom'}',
                            drag: '{et_getIcon key='drag'}',
                            loading: '{et_getIcon key='loading'}',
                            add: '{et_getIcon key='add'}',
                            complete: '{et_getIcon key='complete'}',
                            missingInput: '{et_getIcon key='missingInput'}',
                            file: '{et_getIcon key='file'}',
                            navigationPrevious: '{et_getIcon key='navigationPrevious'}',
                            navigationNext: '{et_getIcon key='navigationNext'}',
                            fileinputToggleHeader: '{et_getIcon key='fileinputToggleHeader'}',
                            fullscreen: '{et_getIcon key='fullscreen'}',
                            borderless: '{et_getIcon key='borderless'}',
                            close: '{et_getIcon key='close'}',
                            browse: '{et_getIcon key='browse'}',
                            cancel: '{et_getIcon key='cancel'}',
                            pause: '{et_getIcon key='pause'}',
                            rotate: '{et_getIcon key='rotate'}'
                        },
                        global: {
                            pushToBasketAction: '{$et_globalSettings.pushToBasketAction}'
                        },
                        lang: {
                            ariaClose: '{if $shopIsAtLeast55}{lang key="close" section="aria"}{else}Close{/if}',
                            ariaPrev: '{if $shopIsAtLeast55}{lang key="prev" section="aria"}{else}Previous{/if}',
                            ariaNext: '{if $shopIsAtLeast55}{lang key="next" section="aria"}{else}Next{/if}',
                        },
                        jtl_token: '{$smarty.session.jtl_token}',
                        skipProductPageVisits: {if $shopIsAtLeast54}true{else}false{/if}, {* This flag controls if the article JS should do something with the page_visits counter, see SHOP-7545 *}
                        postCodeTypeahead: {if $shopIsAtLeast55}true{else}false{/if} {* Shop 5.5 comes with a different type of typeahead logic for cities and zip codes, this flag controls which logic is used by global.js *}
                    };
                </script>
            {/strip}
        {/block}
        {block name="et-layout-footer-jtlsearch-fix"}
            {if isset($jtl_search_align) && isset($jtl_search_frontendURL)}
                {* This fixes a problem where JTL Search does not bind to the correct input field on phones as it tries to bind to the wrong, non-existant input - see layout/footer.tpl in the jtl_search-Plugin *}
                {* Also registers JTL search on an optional in menu search box *}
                {inline_script}
                    <script>
                        window.addEventListener('load',function () {
                            if (typeof $.fn.jtl_search !== 'undefined') {
                                $('#search-header-menu-main').jtl_search({
                                    'align' : '{$jtl_search_align}',
                                    'url' : '{$jtl_search_frontendURL}'
                                });
                                {if $isMobile && !$isTablet}
                                    $('#search-header').jtl_search({
                                        'align' : '{$jtl_search_align}',
                                        'url' : '{$jtl_search_frontendURL}'
                                    });
                                {/if}
                            }
                        });
                    </script>
                {/inline_script}
            {/if}
        {/block}
    {/block}
    {block name='layout-footer-consent-manager'}
        {if !$shopIsAtLeast55 && $Einstellungen.consentmanager.consent_manager_active === 'Y' && !$isAjax && $consentItems->isNotEmpty()}
            <input id="consent-manager-show-banner" type="hidden" value="{$Einstellungen.consentmanager.consent_manager_show_banner}">
            {include file='snippets/consent_manager.tpl'}
            {inline_script}
                <script>
                    setTimeout(function () {
                        $('#consent-manager, #consent-settings-btn').removeClass('d-none');
                    }, 100)
                    document.addEventListener('consent.updated', function(e) {
                        $.post('{$ShopURLSSL}/{if $shopIsAtLeast52}_updateconsent{/if}', {
                                'action': 'updateconsent',
                                'jtl_token': '{$smarty.session.jtl_token}',
                                'data': e.detail
                            }
                        );
                    });
                    {if !isset($smarty.session.consents)}
                        document.addEventListener('consent.ready', function(e) {
                            document.dispatchEvent(new CustomEvent('consent.updated', { detail: e.detail }));
                        });
                    {/if}
                    window.CM = new ConsentManager({
                        version: {$smarty.session.consentVersion|default:1}
                    });
                    var trigger = document.querySelectorAll('.trigger')
                    var triggerCall = function (e) {
                        e.preventDefault();
                        let type = e.target.dataset.consent;
                        if (CM.getSettings(type) === false) {
                            CM.openConfirmationModal(type, function () {
                                let data = CM._getLocalData();
                                if (data === null) {
                                    data = {
                                        settings: {
                                            // intentionally empty
                                        }
                                    };
                                }
                                data.settings[type] = true;
                                document.dispatchEvent(new CustomEvent('consent.updated', {
                                    detail: data.settings
                                }));
                            });
                        }
                    }
                    for (let i = 0; i < trigger.length; ++i) {
                        trigger[i].addEventListener('click', triggerCall)
                    }
                </script>
            {/inline_script}
        {/if}
    {/block}
    {* Bootstrap responsive toolkit detection DIVs - we shortcut the responsive toolkitplaceholder  and just add it here instead of having JS append it on each page load *}
    <div class="responsive-bootstrap-toolkit"></div>
    </body>
    </html>
{/block}
