{block name='checkout-step0-login-or-register'}
    {et_isShopVersionAtLeast value="5.4.0-rc.1" assign='shopIsAtLeast54'}
    {* Error Alerts *}
    {block name='checkout-step0-login-or-register-alert'}
        {if !empty($fehlendeAngaben) && !$alertNote}
            <div class="alert alert-danger" role="alert">{lang key='mandatoryFieldNotification' section='errorMessages'}</div>
        {/if}
        {if isset($fehlendeAngaben.email_vorhanden) && $fehlendeAngaben.email_vorhanden == 1}
            <div class="alert alert-danger" role="alert">{lang key='emailAlreadyExists' section='account data'}</div>
        {/if}
        {if isset($fehlendeAngaben.formular_zeit) && $fehlendeAngaben.formular_zeit == 1}
            <div class="alert alert-danger" role="alert">{lang key='formToFast' section='account data'}</div>
        {/if}
    {/block}

    <div class="row" id="register-customer">
        {block name='checkout-step0-login-or-register-main'}
            <div class="{block name="checkout-step0-login-or-register-main-class"}col col-12 col-lg-9{/block}">
                {block name='checkout-step0-login-or-register-main-content'}
                    <div class="row">
                        {* Existing Customer -> Login Form *}
                        <div id="existing-customer" class="col col-12 checkout-existing-customer">
                            <div class="{block name='checkout-step0-login-or-register-checkout-existing-customer-wrapper-classes'}existing-customer-wrapper et-boxed-content{/block}">
                                {block name='checkout-step0-login-or-register-checkout-existing-customer'}
                                    <div class="et-checkout-existing-customer">
                                        {block name='checkout-step0-login-or-register-headline-form-login-content'}
                                            <div class="checkout-existing-customer-heading h3">{lang key='alreadyCustomer'}</div>
                                        {/block}

                                        {if isset($loginOpenByDefault) && !$loginOpenByDefault}
                                            {block name='checkout-step0-login-or-register-headline-form-login-button'}
                                                {include file="widgets/base/button.tpl" type="button" classes="toggle-login" variant="primary" label="{lang key="login" section="checkout"}"}
                                            {/block}
                                        {/if}
                                    </div>
                                {/block}

                                {block name='checkout-step0-login-or-register-form-login'}
                                    <form method="post" action="{get_static_route id='bestellvorgang.php'}" class="jtl-validate label-slide" id="order_register_or_login" {if isset($loginOpenByDefault) && !$loginOpenByDefault} style="display:none;"{/if}>
                                        {csrf_token}

                                        {block name='checkout-step0-login-or-register-fieldset-form-login-content'}
                                            <fieldset>
                                                {block name='checkout-step0-login-or-register-include-customer-login'}
                                                    {if $shopIsAtLeast54 && $showTwoFAForm|default:false}
                                                        {include file='snippets/two_fa_login.tpl'}
                                                    {else}
                                                        {include file='register/form/customer_login.tpl'}
                                                    {/if}
                                                {/block}
                                            </fieldset>
                                        {/block}
                                    </form>
                                {/block}

                                {block name='checkout-step0-login-or-hr'}
                                    {* <hr class="checkout-existing-customer-hr" /> *}
                                {/block}
                            </div>
                        </div>

                        {* New Customer -> Register Form *}
                        <div class="col col-12" id="customer">
                            {block name='checkout-step0-login-or-register-form'}
                                <form method="post" action="{get_static_route id='bestellvorgang.php'}" class="form checkout-register-form jtl-validate label-slide" id="form-register">
                                    {csrf_token}

                                    {block name='checkout-step0-login-or-register-include-customer-account'}
                                        {include file='register/form/customer_account.tpl' checkout=1 step="formular"}
                                    {/block}
                                    {block name='checkout-step0-login-or-register-include-inc-shipping-address'}
                                        {include file='checkout/inc_shipping_address.tpl'}
                                    {/block}
                                    {block name='checkout-step0-login-or-register-form-submit'}
                                        <div class="row checkout-button-row">
                                            {if isset($oSpezialseiten_arr[$smarty.const.LINKTYP_DATENSCHUTZ])}
                                            {block name='checkout-step0-login-or-register-modal-privacy'}
                                                {* Moved to inc_billing_address_form.tpl to custom checkboxes *}
                                            {/block}
                                            {/if}
                                            {block name='checkout-step0-login-or-register-submit-button'}
                                                <div class="col col-12 col-md-5 col-xl-4 checkout-button-row-submit">
                                                    <input type="hidden" name="checkout" value="1" />
                                                    <input type="hidden" name="form" value="1" />
                                                    <input type="hidden" name="editRechnungsadresse" value="0" />
                                                    {include file="widgets/base/button.tpl" type="submit" classes="d-none btn-block submit_once" variant="primary" label="{lang key='sendCustomerData' section='account data'}"}
                                                </div>
                                            {/block}
                                        </div>
                                    {/block}
                                </form>
                            {/block}
                        </div>
                    </div>
                {/block}
            </div>
        {/block}
        {block name='checkout-step0-login-or-register-sidebar'}
            <div class="col col-12 col-lg-3 ml-auto">
                {include file="widgets/snippets/checkout_sidebar.tpl" context="checkout_step0"}
            </div>
        {/block}
    </div>

    {* Inline Scripts  *}
    {block name='checkout-step0-login-or-register-scripts'}
        {inline_script}<script>
            $(function() {
                $('.et-checkout-existing-customer .toggle-login').on('click', function(e) {
                    e.preventDefault();
                    $('#order_register_or_login').slideDown();
                    $(this).attr('disabled','disabled');
                    return false;
                });
            });
        </script>{/inline_script}
    {/block}
{/block}
