{extends "ordering.tpl"}

{block "order-content"}
   {$deliveryType = $body->getDeliveryType()}
   <div class="row">
      <div class="col-md-4 col-lg-4">
         {block "form-title-address"}<h3 class="form-title">{t}Kontaktní údaje{/t}</h3>{/block}
         <ul class="summary-list">
            <li><strong>{$body.invoice.name} {$body.invoice.surname}</strong></li>
            {if $body.invoice.firm}
               <li>{$body.invoice.firm}</li>
            {/if}
            <li>{$body.invoice.email}</li>
            <li>{$body.invoice.phone}</li>
         </ul>
      </div>
      {if $body.invoice.street || $body.invoice.city || $body.invoice.zip}
         <div class="col-md-4 col-lg-4">
            <h3 class="form-title">&nbsp;</h3>
            <ul class="summary-list">
               <li>{$body.invoice.street}</li>
               <li>{$body.invoice.city}</li>
               <li>{$body.invoice.zip}</li>
               <li>{$cfg.Order.Countries[$body.invoice.country]}</li>
            </ul>
         </div>
      {/if}
   </div>
   <hr>
   {if $deliveryType}
      {block "form-title-delivery"}<h3 class="form-title">{t}Doprava a platba{/t}</h3>{/block}
      <ul class="summary-list">
         <li>{$deliveryType->delivery}</li>
         {$delivery = $deliveryType->getDelivery()}
         {if $delivery}
            <li>{$delivery->printDeliveryInfo() nofilter}</li>
         {/if}

         {block "payment-class"}
            {* todo: zkontrolovat že se to vypisuje jak má, na CZ i mezinárodních shopech *}
            {* {$payment = $deliveryType->getPayment()}
                {if $payment}
                   <li>{$payment->getName() nofilter}</li>
                {else}
                   <li>{$deliveryType->payment}</li>
                {/if}*}
            <li>{$deliveryType->payment}</li>
         {/block}
      </ul>
      <hr>
   {/if}

   {if $body.note}
      <h2>{t}Poznámka k objednávce{/t}</h2>
      <p>{$body.note|escape:'htmlall'|nl2br nofilter}</p>
      <hr>
   {/if}

   {if $body.register}
      <p>{t}K objednávce Vám vytvoříme nový uživatelský účet{/t} <strong>{$body.invoice.email}</strong></p>
      <hr>
   {/if}

   {if $body.products}
      {block "cart-title-products"}<h2>{t}Zboží{/t}</h2>{/block}

      {block "summary-products"}
         <div class="table-cart summary">
            {foreach $body.products as $product}
               <div class="product">
                  <div class="product-inner display-table" data-cart="row">
                     <div class="col-xxs-1 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="col-xxs-2 text-center hidden-md-down">
                        {$product.product->fetchParameters()}
                        {$gender = $product.product.param.18}
                        {if $gender}
                           <div class="gender gender-cart">
                              {if $gender.value_id == 17}
                                 <i class="fc icons_female" title="{t}Pro ženy{/t}"></i>
                              {elseif $gender.value_id == 16}
                                 <i class="fc icons_male" title="{t}Pro muže{/t}"></i>
                              {elseif $gender.value_id == 22}
                                 <i class="fc icons_unisex" title="{t}Unisex{/t}"></i>
                              {elseif $gender.value_id == 23}
                                 <i class="fc icons_child-gender" title="{t}Pro děti{/t}"></i>
                              {/if}
                           </div>
                        {/if}
                     </div>

                     <div class="col-xxs-5 product-title">
                        <a title="{t}Zobrazit zboží{/t}"
                           href="{url s=product IDproduct=$product.id TITLE=$product.title}">{$product.title}</a>
                        {printAvailability}
                     </div>
                     <div class="col-xxs-1 product-price-per-piece">
                        {$product.price.value_with_vat|format_price} / {t}ks{/t}
                     </div>
                     <div class="col-xxs-1 product-pieces">
                        {$product.pieces} {t}ks{/t}
                     </div>
                     <div class="col-xxs-2 product-price-total">
                        {$product.totalPrice.value_with_vat|format_price}
                     </div>
                  </div>
               </div>
            {/foreach}
         </div>
      {/block}

      <div class="clearfix"></div>
   {else}
      <div class="alert alert-info" role="alert">
         {t}Žádný produkt{/t}
      </div>
   {/if}


   {if $dbcfg.gdpr.enable == 'Y'}
      {include "block.ordering.gdpr.tpl"}
   {/if}


   <div class="summary-checkboxes">
      {if $dbcfg.gdpr.enable != 'Y'}
         {block 'cart-summary-tos'}
            <div class="form-group checkbox">
               <label class="custom-control custom-checkbox" for="tos">
                  <input type="hidden" name="tos" value="0">
                  <input type="checkbox" class="custom-control-input" name="tos" id="tos"
                         data-bv-notempty="true" data-bv-message="{t}Musíte souhlasit s podmínkami{/t}"
                         data-bv-field="tos">
                  <span class="custom-control-indicator"></span>
                  {t}Souhlasím s obchodními podmínkami{/t}
               </label>
               <a href="{url s=page label='shopping-rules'}" target="_blank"> <i
                          class="fc fc-external-link"></i></a>
            </div>
         {/block}
         {block 'cart-summary-newsletter'}
            <input type="hidden" name="news" value="1">
         {/block}
      {/if}
   </div>

   {block 'cart-buttons'}
      {include "ordering/cart-btns.tpl" submitName='SubmitOrder' valueNext='{t}Potvrdit objednávku{/t}'}
   {/block}
{/block}


<script>
   {block onready append}
   {block "header-currency-confirm"}
   $('.header-currency').on('click', 'a', function() {
      return confirm(
              'Změníte-li měnu, budete muset znovu vyplnit způsob dopravy a doručovací adresu. Přejete si pokračovat?');
   });
   {/block}
   {/block}
</script>
