{extends "index.tpl"}

{block "css-entry" append}
   {encore_entry_link_tags entry='cart'}
   {if $ctrl.logged}
      {encore_entry_link_tags entry='user'}
   {/if}
{/block}

{block "meta-robots"}
   <meta name="robots" content="noindex, nofollow">
{/block}

{block "main-class"}container container-narrow {if $ctrl.logged}main-account{/if}{/block}

{block content}
   {if !$ctrl.logged}
      <h1>{t}Objednávka č.{/t} {$body.order.order_no}</h1>
      {include "account/orderView-inner.tpl"}
   {else}
      <h1>{t}Objednávka č.{/t} {$body.order.order_no}</h1>
      <div class="account-wrapper">
         {include "account/account-sidemenu.tpl"}
         <div class="account-content">
            {include "account/orderView-inner.tpl"}
         </div>
      </div>
   {/if}
{/block}


{block conteant}
   {change_currency currency=$body.order->currency}
      <div class="page-orderview">

         {block "products"}
            <h2>{t}Objednané zboží{/t}</h2>
            <div class="table-cart">
               {foreach $body.order.items as $product}
                  <div class="product">
                     <div class="product-inner display-table" data-cart="row">
                        <div class="col-xxs-1 product-image text-center">
                           {if $product.id_product}
                              <a title="{t}Zobrazit zboží{/t}"
                                 href="{url s=product IDproduct=$product.id_product TITLE=$product.descr}">
                                 <img src="{get_photo id=$product.photo|default:0 image=2}" alt="{$product.descr}"
                                      class="img-responsive">
                              </a>
                           {else}
                              <img src="{get_photo id=$product.photo|default:0 image=2}" alt=""
                                   class="img-responsive">
                           {/if}
                        </div>
                        <div class="col-xxs-7 product-title">
                           {if $product.id_product}
                              <a title="{t}Zobrazit zboží{/t}"
                                 href="{url s=product IDproduct=$product.id_product TITLE=$product.descr}">{$product.descr}</a>
                           {else}
                              {$product.descr}
                           {/if}

                           {$cf = $body.order->getSecurityCode()}
                           {get_order_coupons order=$body.order assign='order_coupons'}
                           {if !empty($order_coupons[$product.id])}
                              <br>
                              {t}Kód{/t}:
                              {foreach $order_coupons[$product.id] as $coupon}
                                 {$coupon_url = path('kupshop_orderingbundle_pdfcoupon', ['id_order' => $body.order.id, 'id_coupon' => $coupon.id, 'cf' => $cf], 0)}
                                 <a href="{$coupon_url}" target="_blank">{$coupon.code}</a>{if !$coupon@last},{/if}
                              {/foreach}
                           {/if}
                        </div>
                        <div class="col-xxs-2 product-pieces">
                           {if $product.id_product}
                              {$product.pieces} {t}ks{/t}
                           {/if}
                        </div>
                        <div class="col-xxs-2 product-price-total">
                           {$product.total_price.value_with_vat|format_price}
                        </div>
                     </div>
                  </div>
               {/foreach}
            </div>
         {/block}

      </div>
   {/change_currency}
{/block}

