{block name='snippets-withdrawal-form'}
    {et_isShopVersionAtLeast value="5.7.0-rc.3" assign='shopIsAtLeast57'}
    {et_isShopVersionAtLeast value="5.7.1" assign='shopIsAtLeast571'}
    {if $shopIsAtLeast57}
        {if !empty($withdrawalErrors)}
            <div role="alert" class="alert alert-danger alert-dismissable" aria-live="assertive" aria-atomic="true">
                <button type="button" aria-label="{lang key="close" section="aria"}" class="close" data-dismiss="alert">
                    <i class="{et_getIcon key="close"}"></i>
                </button>
                {lang key='fillOut'}
            </div>
        {/if}
        {block name='et-withdrawal-form'}
            <form method="post" action="" class="withdrawal-form jtl-validate label-slide">
                {csrf_token}
                {honeypot}
                {block name='et-withdrawal-form-content'}
                    <div class="required-info">{lang key='requiredInfo'}</div>
                    <hr>
                    <input type="hidden" name="withdrawal" value="1"/>
                    {block name='et-withdrawal-form-fieldset-contact'}
                        <fieldset class="et-boxed-content">
                            <div class="row">
                                <div class="col col-12 col-lg-4">
                                    {block name='et-withdrawal-form-legend-contact'}
                                        <div class="h3">{lang key='contact'}</div>
                                    {/block}
                                </div>
                                <div class="col col-12 col-lg-8">
                                    <div class="row">
                                        <div class="col col-12">
                                            {formgroup label="{lang key='name'}"
                                            label-for="withdrawal_name"
                                            class="{if isset($withdrawalErrors.name)}has-error{/if}"}
                                            {if isset($withdrawalErrors.name)}
                                                <div class="form-error-msg" aria-live="assertive" role="alert">
                                                    <i class="fas fa-exclamation-triangle"></i> {lang key='fillOut'}
                                                </div>
                                            {/if}
                                                <input type="text" id="withdrawal_name" name="withdrawal_name" required
                                                       placeholder=" "
                                                       value="{$withdrawalValues.name|default:''}"/>
                                            {/formgroup}
                                        </div>
                                        <div class="col col-12">
                                            {formgroup label="{if $shopIsAtLeast571}{lang key='revocationOrderNumber' section='global'}{else}{lang key='yourOrderId' section='checkout'}{/if}"
                                            label-for="withdrawal_order"
                                            description="{if isset($Kunde) && $Kunde->kKunde > 0}<a href=\"{get_static_route id='jtl.php'}?bestellungen=1\" target=\"_blank\">{lang key='orderOverview' section='account data'}</a>{elseif $shopIsAtLeast571}<span>{lang key='revocationOrderNumberDesc' section='global'}</span>{/if}"}
                                                <input type="text" id="withdrawal_order" name="withdrawal_order" required
                                                       placeholder=" " value="{$withdrawalValues.orderNumber|default:''}"/>
                                            {/formgroup}
                                        </div>
                                        <div class="col col-12">
                                            {formgroup label="{lang key='email' section='account data'}"
                                            label-for="withdrawal_email"
                                            class="{if isset($withdrawalErrors.email)}has-error{/if}"}
                                            {if isset($withdrawalErrors.email)}
                                                <div class="form-error-msg" aria-live="assertive" role="alert">
                                                    <i class="fas fa-exclamation-triangle"></i> {lang key='invalidEmail'}
                                                </div>
                                            {/if}
                                                <input type="email" id="withdrawal_email" name="withdrawal_email" required
                                                       placeholder=" " value="{$withdrawalValues.email|default:''}">
                                            {/formgroup}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                    {/block}
                    {block name='et-withdrawal-form-fieldset-comment'}
                        <fieldset class="et-boxed-content">
                            <div class="row">
                                <div class="col col-12 col-lg-4">
                                    {block name='et-withdrawal-form-legend-contact'}
                                        <div class="h3">{lang key='comment' section='productDetails'}</div>
                                    {/block}
                                </div>
                                <div class="col col-12 col-lg-8">
                                    {formgroup label="{lang key='comment' section='productDetails'}" label-for="withdrawal_comment"}
                                        <textarea
                                                id="withdrawal_comment"
                                                name="withdrawal_comment"
                                                rows="5"
                                                placeholder=" ">{$withdrawalValues.comment|default:''}</textarea>
                                    {/formgroup}
                                </div>
                            </div>
                        </fieldset>
                    {/block}
                    {if (!isset($smarty.session.bAnti_spam_already_checked) || $smarty.session.bAnti_spam_already_checked !== true)
                    && isset($Einstellungen.kunden.widerruf_abfragen_captcha) && $Einstellungen.kunden.widerruf_abfragen_captcha !== 'N'
                    && JTL\Session\Frontend::getCustomer()->getID() === 0}
                        {block name='withdrawal-form-captcha'}
                            <div class="row">
                                <div class="col col-12 col-md-6">
                                    {formgroup class="simple-captcha-wrapper {if isset($withdrawalErrors.captcha) && $withdrawalErrors.captcha != false} has-error{/if}"}
                                    {captchaMarkup getBody=true}
                                    {/formgroup}
                                </div>
                            </div>
                        {/block}
                    {/if}
                    {block name='et-withdrawal-form-submit'}
                        <div class="row">
                            <div class="col col-12 col-md-4 ml-auto-util">
                                {include file="widgets/base/button.tpl" type="submit" variant="primary" classes="btn-block" label="{lang key='sendWithdrawal' section='global'}"}
                            </div>
                        </div>
                    {/block}
                {/block}
            </form>
        {/block}
    {/if}
{/block}
