{extends "focus/focus.base.tpl"}

{block "focus-title"}
   {t}Možnosti dopravy{/t}
{/block}

{block "focus-content"}
   {function delivery_row}
      <tr>
         <td class="img">
            {if $delivery.photo}
               {photo photo=$delivery.photo}
            {/if}
         </td>
         <td class="name"><strong>{$delivery.name}</strong></td>
         <td class="date">{$delivery.date|format_date_locale_pretty:'d. L.':null:true}</td>
         <td class="price">
            {if $delivery.price.value_with_vat->asFloat() > 0}
               {$delivery.price.value_with_vat|format_price}
            {else}
               <span class="delivery-0">{t}zdarma{/t}</span>
            {/if}
         </td>
      </tr>
   {/function}
   {get_delivery_dates product=$product assign='deliveries'}

   {if $deliveries|count}
      {* {if !$product->isVirtual()}*}
      <div class="table-wrapper">
         <table>
            <tr>
               <th class="img" colspan="2">{t}Doprava{/t}</th>
               {*<th class="name"></th>*}
               <th class="date">{t}Datum doručení{/t}</th>
               <th class="price">{t}Cena dopravy{/t}</th>
            </tr>
            {foreach $deliveries.list as $delivery}
               {if $delivery->isInPerson()}
                  {$hasInperson = true}{continue}
               {/if}
               {get_incremented_delivery_date date=$delivery.date id_product=$product.id id_variation=$product.variationId assign='deliveryDate'}
               {delivery_row delivery=$delivery}
            {/foreach}

            {*{if $hasInperson}
               {foreach $deliveries.list as $delivery}
                  {if $delivery->isInPerson()}
                     {delivery_row delivery=$delivery}
                  {/if}
               {/foreach}
            {/if}*}
         </table>
      </div>
      {if $delivery.class != 'VirtualDelivery'}
         <p>{t}Termíny doručení závisí na aktuální situaci a kapacitách přepravních společností.{/t}</p>
      {/if}
      {*{/if}*}
   {/if}
{/block}
