{block name='checkout-step5-confirmation-form'}
    {et_isShopVersionAtLeast value="5.5.0-rc.1" assign='shopIsAtLeast55'}
    {$agbWrbCheckboxPosition=$agbWrbCheckboxPosition|default:'default'}
    <form method="post" name="agbform" id="complete_order" action="{get_static_route id='bestellabschluss.php'}" class="jtl-validate">
        {csrf_token}
        <input type="hidden" name="abschluss" value="1" />
        <input type="hidden" id="comment-hidden" name="kommentar" value="" />

        {if $agbWrbCheckboxPosition !== 'beforeButton'}
            {* Form Actions *}
            {block name='checkout-step5-confirmation-order-items-actions'}
                {include file="widgets/base/button.tpl" type="submit" id="complete-order-button" variant="checkout" classes="btn-block submit_once" label="{lang key='orderLiableToPay' section='checkout'}"}
            {/block}
        {/if}

        {block name='checkout-step5-confirmation-form-content'}
            {* AGB Content *}
            {lang key='agb' assign='agb'}
            {if !empty($AGB->cAGBContentHtml)}
                {block name='checkout-step5-confirmation-modal-agb-html'}
                    <div class="modal" tabindex="-1" id="agb-modal" role="dialog">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h5 class="modal-title">{$agb}</h5>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="{if $shopIsAtLeast55}{lang section='aria' key='close'}{else}Close{/if}">
                                        <i class="{et_getIcon key="close"}"></i>
                                    </button>
                                </div>
                                <div class="modal-body">
                                    {$AGB->cAGBContentHtml}
                                </div>
                            </div>
                        </div>
                    </div>
                {/block}
            {elseif !empty($AGB->cAGBContentText)}
                {block name='checkout-step5-confirmation-modal-agb-text'}
                    <div class="modal" tabindex="-1" id="agb-modal" role="dialog">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h5 class="modal-title">{$agb}</h5>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="{if $shopIsAtLeast55}{lang section='aria' key='close'}{else}Close{/if}">
                                        <i class="{et_getIcon key="close"}"></i>
                                    </button>
                                </div>
                                <div class="modal-body">
                                    {$AGB->cAGBContentText}
                                </div>
                            </div>
                        </div>
                    </div>
                {/block}
            {/if}

            {* WRB Content *}
            {if $Einstellungen.kaufabwicklung.bestellvorgang_wrb_anzeigen == 1}
                {lang key='wrb' section='checkout' assign='wrb'}
                {lang key='wrbform' assign='wrbform'}
                {if !empty($AGB->cWRBContentHtml)}
                    {block name='checkout-step5-confirmation-modal-wrb-html'}
                        <div class="modal" tabindex="-1" id="wrb-modal" role="dialog">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title">{$wrb}</h5>
                                        <button type="button" class="close" data-dismiss="modal" aria-label="{if $shopIsAtLeast55}{lang section='aria' key='close'}{else}Close{/if}">
                                            <i class="{et_getIcon key="close"}"></i>
                                        </button>
                                    </div>
                                    <div class="modal-body">
                                        {$AGB->cWRBContentHtml}
                                    </div>
                                </div>
                            </div>
                        </div>
                    {/block}
                {elseif !empty($AGB->cWRBContentText)}
                    {block name='checkout-step5-confirmation-modal-wrb-text'}
                        <div class="modal" tabindex="-1" id="wrb-modal" role="dialog">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title">{$wrb}</h5>
                                        <button type="button" class="close" data-dismiss="modal" aria-label="{if $shopIsAtLeast55}{lang section='aria' key='close'}{else}Close{/if}">
                                            <i class="{et_getIcon key="close"}"></i>
                                        </button>
                                    </div>
                                    <div class="modal-body">
                                        {$AGB->cWRBContentText}
                                    </div>
                                </div>
                            </div>
                        </div>
                    {/block}
                {/if}
                {if !empty($AGB->cWRBFormContentHtml)}
                    {block name='checkout-step5-confirmation-modal-wrb-form-html'}
                        <div class="modal" tabindex="-1" id="wrb-form-modal" role="dialog">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title">{$wrbform}</h5>
                                        <button type="button" class="close" data-dismiss="modal" aria-label="{if $shopIsAtLeast55}{lang section='aria' key='close'}{else}Close{/if}">
                                            <i class="{et_getIcon key="close"}"></i>
                                        </button>
                                    </div>
                                    <div class="modal-body">
                                        {$AGB->cWRBFormContentHtml}
                                    </div>
                                </div>
                            </div>
                        </div>
                    {/block}
                {elseif !empty($AGB->cWRBFormContentText)}
                    {block name='checkout-step5-confirmation-modal-wrb-form-text'}
                        <div class="modal" tabindex="-1" id="wrb-form-modal" role="dialog">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title">{$wrbform}</h5>
                                        <button type="button" class="close" data-dismiss="modal" aria-label="{if $shopIsAtLeast55}{lang section='aria' key='close'}{else}Close{/if}">
                                            <i class="{et_getIcon key="close"}"></i>
                                        </button>
                                    </div>
                                    <div class="modal-body">
                                        {$AGB->cWRBFormContentText}
                                    </div>
                                </div>
                            </div>
                        </div>
                    {/block}
                {/if}
            {/if}

            {* AGB/WRB Notice *}
            {block name='checkout-step5-confirmation-alert-agb'}
                {if !empty($AGB)}
                    <div class="checkout-confirmation-legal-notice">
                        <p>{$AGB->agbWrbNotice}</p>
                    </div>
                {/if}
            {/block}

            {if !isset($smarty.session.cPlausi_arr)}
                {assign var=plausiArr value=[]}
            {else}
                {assign var=plausiArr value=$smarty.session.cPlausi_arr}
            {/if}

            {* Include Checkboxes *}
            {hasCheckBoxForLocation bReturn="bCheckBox" nAnzeigeOrt=$nAnzeigeOrt cPlausi_arr=$plausiArr cPost_arr=$cPost_arr}
            {if $bCheckBox}
                {block name='checkout-step5-confirmation-include-checkbox'}
                    {include file='snippets/checkbox.tpl' nAnzeigeOrt=$nAnzeigeOrt cPlausi_arr=$plausiArr cPost_arr=$cPost_arr}
                {/block}
            {/if}
        {/block}

        {if $agbWrbCheckboxPosition === 'beforeButton'}
            {* Form Actions *}
            {block name='checkout-step5-confirmation-order-items-actions'}
                {include file="widgets/base/button.tpl" type="submit" id="complete-order-button" variant="checkout" classes="btn-block submit_once" label="{lang key='orderLiableToPay' section='checkout'}"}
            {/block}
        {/if}

    </form>
{/block}