<div class="display-cell header-cart">
   <div data-reload="cart-info">
      <a href="{url s=cart}" class="header-icon-link {if $cartInfo.totalPieces}header-icon-link--active{else}header-cart--empty{/if}">
         <i class="fc icons_cart pos-rel">{if $cartInfo.totalPieces}<span class="header-cart-items">{$cartInfo.totalPieces}</span>{/if}</i>
         {t}Košík{/t}
      </a>

      {get_session_value type='added_to_cart' assign='addedToCart'}
      {if $addedToCart}
         {$addedToCart.product->fetchImages(2)}

         {include "block.gtm.tpl" gtm_type="addToCart" addedToCart=$addedToCart inline}
         <div class="focus added-to-cart" data-cart="addedToCartNew">
            <div class="focus-dialog"> {* for vertical centering *}
               <div class="focus-content">
                  <div class="bg-black">
                     <a href="#" class="focus-close" data-focus="close">
                        <span class="fc icons_close_circle"></span>
                     </a>
                     <h2>{t}Do košíku bylo přidáno{/t}</h2>
                  </div>
                  <div class="bg-white">
                     <div class="row focus-added-content">
                        <div class="col-xs-6 focus-added-img">
                           <img src="{get_photo photo=$addedToCart.product.image size=2}" alt="{$addedToCart.product.title}"
                                class="img-responsive">
                        </div>
                        <div class="col-xs-6 focus-added-description">
                           <p><strong>{$addedToCart.pieces} {t}ks{/t}</strong></p>
                           <p>{$addedToCart.product.descr|default:$addedToCart.product.model_section} {$addedToCart.product.model_short_title}</p>
                           <p><strong>{$addedToCart.product.price_array|format_price}{if $addedToCart.pieces > 1} / {t}ks{/t}{/if}</strong>
                           </p>
                        </div>
                     </div>

                     <div class="row focus-added-btns">
                        {block "cartinfo-btns"}
                           <div class="col-xs-6 pull-right">
                              <a href="{url s=cart}" class="btn btn-block btn-primary btn-primary--green">{t}Přejít do košíku{/t}</a>
                           </div>
                           <div class="col-xs-6">
                              <a href="#" class="btn btn-block btn-primary btn-primary--yellow"
                                 data-focus="close">{t}Pokračovat v nákupu{/t}</a>
                           </div>
                        {/block}
                     </div>
                  </div>

                  <div class="bg-black freeshipping">
                     {get_free_delivery assign='freeDelivery'}
                     {* $freedelivery - nastavení v administraci u doprav *}
                     {* $cart.freeshipping - nastavení flagu 'Z' u produktu *}
                     {if $freeDelivery and $freeDelivery->isPositive()}
                        {if $cartInfo.totalPriceWithVat_array.value_with_vat > $freeDelivery or $cart.freeShipping}
                           <p><span>{t}Doprava zdarma{/t}!</span></p>
                        {else}
                           {$freedeliveryvalue = $freeDelivery->sub($cartInfo.totalPriceWithVat_array.value_with_vat)|format_price}
                           {block "cartinfo-freedelivery"}
                              {* @formatter:off *}
                           <p>{t cenaZbyva=$freedeliveryvalue escape=false}Nakupte ještě za&nbsp;<strong>{cenaZbyva}</strong> <strong class="uppercase">a máte dopravu zdarma</strong>{/t}</p>
                           {* @formatter:on *}
                           {/block}
                        {/if}
                     {elseif ($freeDelivery and $freeDelivery->isZero()) or $cart.freeShipping == true}
                        <p><span>{t}Doprava zdarma{/t}!</span></p>
                     {/if}
                  </div>
               </div>
            </div>
         </div>
         <script>
            wpj.onReady.push(function () {
               var $new = $("[data-cart=\"addedToCartNew\"]");
               $("[data-cart=\"addedToCart\"]").replaceWith($new);
               $new.focus().focus("show");
               $new.attr("data-cart", "addedToCart");
            });
         </script>
      {if $dbcfg.analytics.fb_pixel.id and !isDebug()}
         <script>
            fbq("track", "AddToCart", {
               content_ids: ['{$addedToCart.product.code}'],
               content_type: "product",
               currency: '{$ctrl.currency|default:$dbcfg.currency_code}',
               value: {{$addedToCart.product.price_array.price_with_vat -> asFloat()} * $addedToCart.pieces}
            });
         </script>
      {/if}
      {/if}
   </div>
</div>
