{block name='checkout-coupon-form'}
    {assign var="couponPosition" value=$couponPosition|default:''}
    {et_isShopVersionAtLeast value="5.1.0" assign='shopIsAtLeast51'}

    {if $KuponMoeglich == 1}
        {if $couponPosition === 'inAffix'}
            <div id="coupon-form">
                <form method="post" action="{get_static_route id='bestellvorgang.php'}" class="form jtl-validate checkout-coupon-form coupon-form label-slide">
                    {csrf_token}
                    {block name='et-checkout-coupon-form-form-content-position-affix'}
                        {block name='checkout-coupon-form-form-content'}
                            <input type="hidden" name="pruefekupon" value="1" />
                            {formgroup label-for="couponCode" label="{if $shopIsAtLeast51}{lang key='couponCodePlaceholder' section='checkout'}{else}{lang key='couponCode' section='account data'}{/if}" class="mw-100{if !empty($invalidCouponCode)} has-error{/if}"}
                                <input type="text"
                                    name="Kuponcode"
                                    maxlength="32"
                                    value="{if !empty($Kuponcode)}{$Kuponcode}{/if}"
                                    id="kupon"
                                    placeholder="{if $shopIsAtLeast51}{lang key='couponCodePlaceholder' section='checkout'}{else}{lang key='couponCode' section='account data'}{/if}"
                                    aria-label="{if $shopIsAtLeast51}{lang key='couponCodePlaceholder' section='checkout'}{else}{lang key='couponCode' section='account data'}{/if}"
                                    required
                                    class="form-control"
                                    />
                            {/formgroup}
                            {include file="widgets/base/button.tpl" type="submit" value="1" variant="secondary" classes="btn-block" label="{if $shopIsAtLeast51}{lang key='couponSubmit' section='checkout'}{else}{lang key='useCoupon' section='checkout'}{/if}"}
                        {/block}
                    {/block}
                </form>
            </div>
        {else}
            <form method="post" action="{get_static_route id='bestellvorgang.php'}" class="form jtl-validate checkout-coupon-form coupon-form label-slide">
                {csrf_token}
                {block name='et-checkout-coupon-form-form-content-position-other'}
                    {block name='checkout-coupon-form-form-content'}
                        <input type="hidden" name="pruefekupon" value="1" />
                        <fieldset>
                            <div class="row">
                                {if $shopIsAtLeast51}
                                    <div class="col-12">
                                        {block name='checkout-coupon-form-desc'}
                                            <p class="credit-description">{lang key='couponFormDesc' section='checkout'}</p>
                                        {/block}
                                    </div>
                                {/if}
                                <div class="col-12">
                                    {block name='checkout-coupon-form-btn'}
                                        <div class="input-group">
                                            <input type="text"
                                                   name="Kuponcode"
                                                   maxlength="32"
                                                   value="{if !empty($Kuponcode)}{$Kuponcode}{/if}"
                                                   id="kupon"
                                                   placeholder="{if $shopIsAtLeast51}{lang key='couponCodePlaceholder' section='checkout'}{else}{lang key='couponCode' section='account data'}{/if}"
                                                   aria-label="{if $shopIsAtLeast51}{lang key='couponCodePlaceholder' section='checkout'}{else}{lang key='couponCode' section='account data'}{/if}"
                                                   required
                                                   class="form-control"
                                            />
                                            <div class="input-group-append">
                                                {include file="widgets/base/button.tpl" type="submit" value="1" variant="primary" label="{if $shopIsAtLeast51}{lang key='couponSubmit' section='checkout'}{else}{lang key='useCoupon' section='checkout'}{/if}"}
                                            </div>
                                        </div>
                                    {/block}
                                </div>
                            </div>
                        </fieldset>
                    {/block}
                {/block}
            </form>
        {/if}
    {/if}
{/block}