{* Nova verze zalozena na flexboxu misto BS gridu,
   pouzita napr. na parfimo.de.
   Pri nasazeni pozor na pregenerovani prekladu, meni se.
*}

<div data-reload="cart">
   {if $body.products}
      <div class="cart-products cart-products--cart">
         {foreach $body.products as $product}
            <div class="cart-row" data-cart="row">
               <div class="product-image">
                  <a title="{t}Zobrazit zboží{/t}" href="{url s=product IDproduct=$product.id TITLE=$product.title}">
                     <img src="{get_photo photo=$product.image size=2}" alt="{$product.title}"
                          class="img-responsive">
                  </a>
               </div>
               <div class="product-gender text-center hidden-md-down">
                  {$gender = $product.sex}
                  {if $gender}
                     <div class="gender gender-cart">
                        {if $gender == 'W'}
                           <i class="fc icons_female" title="{t}Pro ženy{/t}"></i>
                        {elseif $gender == 'M'}
                           <i class="fc icons_male" title="{t}Pro muže{/t}"></i>
                        {elseif $gender == 'U'}
                           <i class="fc icons_unisex" title="{t}Unisex{/t}"></i>
                        {elseif $gender == 'K'}
                           <i class="fc icons_child-gender" title="{t}Pro děti{/t}"></i>
                        {/if}
                     </div>
                  {/if}
               </div>
               <div class="product-title">
                  <a title="{t}Zobrazit zboží{/t}"
                     href="{url s=product IDproduct=$product.id TITLE=$product.title}">{$product.product.descr|default:$product.product.model_section} {$product.title}</a>
                  {*
                    $product.availability rika, jestli jsou vsechny pozadovane kusy jedne polozky skladem.
                    $product.availability == 0 a $product.inStore == 1 znamena, ze je skladem jen cast pozadovanych kusu.
                    availability muze byt 0, 1 a 2
                    2 se pouzive pouze pokud je zpanuty modul sklad dodavatelu (napr KK).
                    Pozor, availability se muze upravit pomoci in_store_show_max
                    Pokud se neodecita ze skladu, availability je 1 pokud deliverytime je 0.
                 *}

                  {if $product.availability == 0 and $product.inStore == 0}
                     <p class="delivery delivery-notinstore">{$product.deliveryTimeText}</p>
                  {elseif $product.availability == 0 and $product.inStore > 0}
                     <p class="delivery delivery-partly">{t pocet=$product.inStore}Skladem pouze {pocet} ks{/t}</p>
                  {elseif $product.availability == 1}
                     <p class="delivery delivery-instore">{$product.deliveryTimeText}
                        {if $product.inStore > 10}
                           {t}více než 10 balení{/t}
                        {elseif $product.inStore < 4}
                           {t}1-3 balení{/t}
                        {else}
                           {t}4-10 balení{/t}
                        {/if}
                     </p>
                  {/if}
               </div>
               <div class="product-price-per-piece">
                  {$product.price.value_with_vat|format_price} / {t}ks{/t}
               </div>
               <div class="product-pieces">
                  <div class="submit-block">
                     <input type="number" min="1" name="products[{$product.idincart}][pieces]"
                            value="{$product.pieces}" class="form-control" maxlength="3"
                            data-bv-excluded="true" data-cart="pieces" title="{t}Počet kusů{/t}">
                     <div class="buy_count">
                        <button type="button" class="fc fc-angle-up plus_unit" data-cart="plus"></button>
                        <button type="button" class="fc fc-angle-down minus_unit" data-cart="minus"></button>
                     </div>
                  </div>
               </div>
               <div class="product-price-total">
                  {$product.totalPrice.value_with_vat|format_price}
               </div>
               <div class="product-delete">
                  <a href="{url s=cart act=erase IDInCart=$product.idincart}"
                     title="{t}Odstranit produkt z košíku{/t}" data-cart="delete"></a>
               </div>
            </div>
         {/foreach}
      </div>

      {* dárky, příplatky *}
      {ifmodule ORDER_DISCOUNT}
         {* sort handlers = [1 - gifts, 0 - charges] *}
      {insert_discounts_actions cart=$body type='full' sort=[1, 0] assign='discountsActions'}
      {foreach $discountsActions as $discountAction}
         {$discountAction nofilter}
      {/foreach}
      {/ifmodule}
   {else}
      <p class="alert alert-info" role="alert">{t}Váš košík je prázdný :({/t}</p>
   {/if}
</div>
