{block name='checkout-index'}
    {et_isShopVersionAtLeast value="5.2.3" assign='shopIsAtLeast523'}
    {block name='checkout-index-include-header'}
        {if !isset($bAjaxRequest) || !$bAjaxRequest}
            {include file='layout/header.tpl'}
        {/if}
    {/block}

    {block name='checkout-index-content'}

        <div id="result-wrapper" data-wrapper="true">
            <div id="checkout">
                {et_renderGrid id="checkout_main"}
            </div>
            {block name='checkout-index-script-location'}
                <script>
                    if (top.location !== self.location) {
                        top.location = self.location.href;
                    }
                </script>
            {/block}
        </div>

        {if (isset($nWarenkorb2PersMerge) && $nWarenkorb2PersMerge === 1)}
            {block name='checkout-index-script-basket-merge'}
                {inline_script}<script>
                    $(window).on('load', function() {
                        $(function() {
                            eModal.addLabel('{lang key='yes' section='global' addslashes=true}', '{lang key='no' section='global' addslashes=true}');
                            var options = {
                                message: '{lang key='basket2PersMerge' section='login' addslashes=true}',
                                label: '{lang key='yes' section='global' addslashes=true}',
                                title: '{lang key='basket' section='global' addslashes=true}'
                            };
                            eModal.confirm(options).then(
                                function() {
                                    window.location = "{get_static_route id='bestellvorgang.php'}?basket2Pers=1&token={$smarty.session.jtl_token}"
                                }{if $shopIsAtLeast523},
                                function() {
                                    window.location = "{get_static_route id='bestellvorgang.php'}?updatePersCart=1&token={$smarty.session.jtl_token}"
                                }{/if}
                            );
                        });
                    });
                </script>{/inline_script}
            {/block}
        {/if}
    {/block}

    {block name='checkout-index-include-footer'}
        {if !isset($bAjaxRequest) || !$bAjaxRequest}
            {include file='layout/footer.tpl'}
        {/if}
    {/block}
{/block}
