{block name='basket-cart-dropdown'}
    {et_isShopVersionAtLeast value="5.4.0-rc.1" assign='shopIsAtLeast54'}
    {$idPostFix=$idPostFix|default:''}
    <div id="cart-dropdown-container" class="cart-dropdown dropdown-menu dropdown-menu-right" role="button">
        {if !empty($smarty.session.Warenkorb->PositionenArr)}
            {block name='basket-cart-dropdown-cart-items-content'}
                {block name='basket-cart-dropdown-cart-items-content-headline'}
                    <div class="h4">{lang key="basket" section="global"}</div>
                {/block}

                {et_getGlobalSettings assign="etGlobalSettings"}
                {assign var="maxProducts" value=$etGlobalSettings.miniBasketCount}
                {block name='basket-cart-dropdown-cart-items'}
                <div class="dropdown-cart-items">
                    {block name='basket-cart-dropdown-cart-item'}
                        {$basketPositionCounter = 0}
                        {foreach from=$smarty.session.Warenkorb->PositionenArr item="oPosition" name="dropdownCartItems"}
                            {if !$oPosition->istKonfigKind() && ($maxProducts <= 0 || $maxProducts > $basketPositionCounter)}
                                {$basketPositionCounter = $basketPositionCounter + 1}
                                {if $oPosition->nPosTyp == $smarty.const.C_WARENKORBPOS_TYP_ARTIKEL || $oPosition->nPosTyp == $smarty.const.C_WARENKORBPOS_TYP_GRATISGESCHENK}
                                    <div class="dropdown-cart-item dropdown-cart-item-product">
                                        <div class="row">
                                            {block name='basket-cart-dropdown-cart-item-image'}
                                                <div class="col-2 dropdown-cart-item-image">
                                                    <a href="{$oPosition->Artikel->cURLFull}" class="link-discreet" title="{$oPosition->cName|trans|escape:'html'}">
                                                        {include file='snippets/image.tpl'
                                                        item=$oPosition->Artikel
                                                        square=false
                                                        srcSize='sm'
                                                        sizes='auto'}
                                                    </a>
                                                </div>
                                            {/block}
                                            {block name='basket-cart-dropdown-cart-item-details'}
                                                <div class="col-10 dropdown-cart-item-details">
                                                    {block name='basket-cart-dropdown-cart-item-item-name'}
                                                        <div class="dropdown-cart-item-name">
                                                            <a href="{$oPosition->Artikel->cURLFull}" class="link-discreet" title="{$oPosition->cName|trans|escape:'html'}">
                                                                {$oPosition->cName|trans}
                                                            </a>
                                                        </div>
                                                    {/block}
                                                    {block name='basket-cart-dropdown-cart-item-item-quantity'}
                                                        <div class="dropdown-cart-item-quantity">
                                                            {$oPosition->nAnzahl|replace_delim}x
                                                        </div>
                                                    {/block}
                                                    {block name='basket-cart-dropdown-cart-item-item-remove'}
                                                        <div class="dropdown-cart-item-remove">
                                                            <form id="cart-form-mini-{$oPosition@index}{$idPostFix}" method="post" action="{get_static_route id='warenkorb.php'}" class="jtl-validate label-slide">
                                                                {csrf_token}
                                                                <input type="hidden" name="wka" value="1"/>
                                                                <button type="submit"
                                                                        class="btn btn-link cart-items-delete-button droppos"
                                                                        name="dropPos"
                                                                        value="{$oPosition@index}"
                                                                        title="{lang key='delete'}"
                                                                >
                                                                    <span class="{et_getIcon key="remove"}"></span> {lang key='delete'}
                                                                </button>
                                                            </form>
                                                        </div>
                                                    {/block}
                                                    {block name='basket-cart-dropdown-cart-item-item-price'}
                                                        <div class="dropdown-cart-item-price h4">
                                                            {if $oPosition->istKonfigVater()}
                                                                {$oPosition->cKonfigpreisLocalized[$NettoPreise][$smarty.session.cWaehrungName]}
                                                            {else}
                                                                {$oPosition->cEinzelpreisLocalized[$NettoPreise][$smarty.session.cWaehrungName]}
                                                            {/if}
                                                        </div>
                                                    {/block}
                                                </div>
                                            {/block}
                                        </div>
                                    </div>
                                {else}
                                    <div class="dropdown-cart-item dropdown-cart-item-other">
                                        <div class="row">
                                            {block name='basket-cart-dropdown-cart-item-no-item-count'}
                                                <div class="col-12 dropdown-cart-item-details">
                                                    <div class="dropdown-cart-item-name">
                                                        {$oPosition->cName|trans}
                                                    </div>
                                                    <div class="dropdown-cart-item-quantity">
                                                        {$oPosition->nAnzahl|replace_delim}x
                                                    </div>
                                                    {block name='basket-cart-dropdown-cart-item-noitem-price'}
                                                        <div class="dropdown-cart-item-price h4 ml-auto">
                                                            {$oPosition->cEinzelpreisLocalized[$NettoPreise][$smarty.session.cWaehrungName]}
                                                        </div>
                                                    {/block}
                                                </div>
                                            {/block}
                                        </div>
                                    </div>
                                {/if}
                                {elseif !$oPosition->istKonfigKind()}
                                {$basketPositionCounter = $basketPositionCounter + 1}
                            {/if}
                        {/foreach}
                    {/block}
                </div>
                {/block}
                {block name='basket-cart-dropdown-items-item-overflow-notice'}
                {if $maxProducts > 0 && $basketPositionCounter > $maxProducts}
                    {$difference = $basketPositionCounter - $maxProducts}
                    <div class="dropdown-cart-overflow">
                        + {$difference} {if $difference === 1}{et_language key="et360_dropdown_cart_more_singular"}{else}{et_language key="et360_dropdown_cart_more_plural"}{/if}
                    </div>
                {/if}
                {/block}
                {block name='basket-cart-dropdown-total'}
                    <ul class="list-unstyled">
                        {if $NettoPreise}
                            {block name='basket-cart-dropdown-cart-item-net'}
                                <li class="cart-dropdown-total-item">
                                    <div class="h4">
                                        {if empty($smarty.session.Versandart)}
                                            {lang key='subtotal' section='account data'}
                                        {else}
                                            {lang key='totalSum'}
                                        {/if} ({lang key='net'}) <span class="cart-dropdown-total-item-price">{$WarensummeLocalized[$NettoPreise]}</span>
                                    </div>
                                </li>
                            {/block}
                        {/if}
                        {if $Einstellungen.global.global_steuerpos_anzeigen !== 'N' && isset($Steuerpositionen) && count($Steuerpositionen) > 0}
                            {block name='basket-cart-dropdown-cart-item-tax'}
                                {foreach $Steuerpositionen as $Steuerposition}
                                    <li class="cart-dropdown-total-item">
                                        {$Steuerposition->cName}
                                        <span class="cart-dropdown-total-item-price">{$Steuerposition->cPreisLocalized}</span>
                                    </li>
                                {/foreach}
                            {/block}
                        {/if}
                        {block name='basket-cart-dropdown-cart-item-customer-credit'}
                            {if isset($smarty.session.Bestellung->GuthabenNutzen) && $smarty.session.Bestellung->GuthabenNutzen == 1}
                                <li class="cart-dropdown-total-item customer-credit">
                                    {lang key='useCredit' section='account data'}
                                    <span class="cart-dropdown-total-item-price">{$smarty.session.Bestellung->GutscheinLocalized}</span>
                                </li>
                            {/if}
                        {/block}
                        {block name='basket-cart-dropdown-cart-item-total'}
                            <li class="cart-dropdown-total-item">
                                <div class="h4">
                                    {if empty($smarty.session.Versandart)}
                                        {lang key='subtotal' section='account data'}
                                    {else}
                                        {lang key='totalSum'}
                                    {/if} <span class="cart-dropdown-total-item-price">{$WarensummeLocalized[0]}</span>
                                </div>
                            </li>
                        {/block}
                        {block name='basket-cart-dropdown-cart-item-favourable-shipping'}
                            {if $favourableShippingString !== '' && empty($smarty.session.Versandart)}
                                <li class="cart-dropdown-total-item">{$favourableShippingString}</li>
                            {/if}
                        {/block}
                    </ul>
                {/block}
                {block name='basket-cart-dropdown-buttons'}
                    <div class="row cart-dropdown-buttons">
                        <div class="col-12 col-lg-6">
                            {include file="widgets/base/button.tpl" variant="cart" classes="btn-block cart-dropdown-cart" title="{lang key='gotoBasket'}" href="{get_static_route id='warenkorb.php'}" label="{lang key='gotoBasket'}"}
                        </div>
                        <div class="col-12 col-lg-6">
                            {include file="widgets/base/button.tpl" variant="checkout" classes="btn-block cart-dropdown-next" title="{lang key='nextStepCheckout' section='checkout'}" href="{get_static_route id='bestellvorgang.php'}?wk=1" label="{lang key='nextStepCheckout' section='checkout'}"}
                        </div>
                        <div class="col-12 et-dropdown-cart-payment-method-buttons">
                            <div id="amapay-basket-dropdown{$idPostFix}" class="amapay-basket-dropdown"></div>
                        </div>
                    </div>
                {/block}
                {if !empty($WarenkorbVersandkostenfreiHinweis)}
                    {block name='basket-cart-dropdown-shipping-free-hint'}
                        <ul class="cart-dropdown-shipping-notice list-icons font-size-sm">
                            <li>
                                <a class="popup"
                                   href="{if !empty($oSpezialseiten_arr) && isset($oSpezialseiten_arr[$smarty.const.LINKTYP_VERSAND])}{$oSpezialseiten_arr[$smarty.const.LINKTYP_VERSAND]->getURL()}{else}#{/if}"
                                   data-toggle="tooltip"
                                   data-placement="bottom"
                                   title="{lang key='shippingInfo' section='login'}"><i class="{et_getIcon key="info"}"></i></a>
                                {$WarenkorbVersandkostenfreiHinweis|truncate:160:"..."}
                            </li>
                        </ul>
                    {/block}
                {/if}
                {block name='basket-cart-dropdown-shipping-include-free-hint'}
                    {if $shopIsAtLeast54}
                        {include file='basket/freegift_hint.tpl'}
                    {/if}
                {/block}
            {/block}
        {else}
            {block name='basket-cart-dropdown-hint-empty'}
                <a class="dropdown-item cart-dropdown-empty" href="{get_static_route id='warenkorb.php'}" rel="nofollow" title="{lang section='checkout' key='emptybasket'}">
                    {lang section='checkout' key='emptybasket'}
                </a>
            {/block}
        {/if}
    </div>
{/block}
