{extends "account/account-wrapper.tpl"}

{block "css-entry" append}
    {encore_entry_link_tags entry='cart'}
{/block}

{block "title"}
   <h1>{$view->getTitle()}</h1>
{/block}

{block "account-content"}
    <div class="page-orderview cart-summary">
      <h2>{t}Detail nákupu{/t}</h2>

      <div class="orderview-row">
         <div class="column">
            <p class="title-default">{t}Datum zakoupení{/t}</p>
            <p>{$body.sale.dateCreated|date_format:"%d.%m.%Y %H:%M"}</p>
         </div>

         <div class="column">
            <p class="title-default">{t}Kód{/t}</p>
            <p>{$body.sale.code}</p>
         </div>

         {$seller = $body.sale->getSeller()}
         {if $seller}
            <div class="column">
               <p class="title-default">{t}Prodejna{/t}</p>
               <ul>
                  <li>{$seller.title}</li>
                  <li>{$seller.street} {$seller.number}</li>
                  <li>{$seller.psc} {$seller.city}</li>
               </ul>
            </div>
         {/if}
      </div>

      {block "sale-note"}{/block}

      <p class="title-default">{t}Zakoupené zboží{/t}</p>

      <div class="order-products order-products-cart">
         {foreach $body.sale.items as $item}
            <div class="product{if !$item.id_product} product-custom{/if}">
                {if $item.id_product}
                    <div class="image">
                       <a href="{url s=product IDproduct=$item.id_product TITLE=$item.product.title}"
                          title="{t}Zobrazit produkt{/t}">
                          <img src="{get_photo photo=$item.product.image size='product_gallery'}"
                               alt="{$item.product.title}" class="img-responsive">
                       </a>
                    </div>
                {/if}
               <div class="title">
                  {block 'product-title'}
                     {if $item.id_product}
                        <a href="{url s=product IDproduct=$item.id_product TITLE=$item.product.title}"
                           title="{t}Zobrazit produkt{/t}">{$item.product.title}</a>
                        <span class="variation">{$item.product.variationTitle}</span>
                     {else}
                        {$item.name}
                     {/if}
                  {/block}
               </div>

               {block "pieces"}
                  <div class="pieces">
                      {$item.pieces} {t}ks{/t}
                  </div>
               {/block}

               {block "item-price"}
                  <div class="price-total">
                     {$item.totalPrice|format_price:"ceil=no;decimal=dynamic"}
                  </div>
               {/block}
            </div>
         {/foreach}
    </div>

      <div class="cart-footer">
         <div class="price-box">
            {block "pricebox-without-vat"}
               {if $dbcfg.shop_vat_payer}
                  <div class="price-box-row">
                     <p>{t}Celková částka bez DPH{/t}</p>
                     <p>{$body.sale.totalPrice|format_price:"ceil=no;withVat=false"}</p>
                  </div>
               {/if}
            {/block}
            {block "pricebox-with-vat"}
               <div class="price-box-row total-price">
                  <p class="total-price">{t}Celková částka s DPH{/t}</p>
                  <p>{$body.sale.totalPrice|format_price:"decimal=dynamic"}</p>
               </div>
            {/block}
         </div>
      </div>

   </div>
{/block}
