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

      {include "block.messages.tpl"}

      {if $body.error != ''}
         <div class="alert alert-info" role="alert">
            {$body.error nofilter}
         </div>
      {/if}

      {block "order-payment"}
         {if $body.payment and $body.payment->hasOnlinePayment() and $body.order->isActive() and !$body.order->isPaid()}
            {$body.payment->getOrderViewDescription() nofilter}
         {/if}
      {/block}

      <h3>{t}Detail objednávky{/t}</h3>

      <div class="orderview-row">
         <div class="column">
            <p class="title-default">{t}Datum objednání{/t}</p>
            {$body.order.date_created|date_format:"%d.%m.%Y"}
         </div>

         <div class="column">
            <p class="title-default">{t}Stav objednávky{/t}</p>
            {if $body.order.status_storno}
               {t}Objednávka stornována{/t}
            {else}
               {$body.order.status_text}
            {/if}
         </div>

         {$deliveryType = $body.order->getDeliveryType()}
         {if $deliveryType}
            <div class="column">
               <p class="title-default"> {t}Doprava a platba{/t}</p>

               <ul>
                  <li>{$deliveryType->delivery}
                     {$delivery = $deliveryType->getDelivery()}
                     {if $delivery and $delivery->printDeliveryInfo()}
                        - {$delivery->printDeliveryInfo() nofilter}
                     {/if}
                  </li>
                  {$payment = $deliveryType->getPayment()}
                  {if $payment}
                     <li>{$payment->getName() nofilter} </li>
                  {/if}
               </ul>
            </div>
         {/if}

      </div>

      <div class="orderview-row">
         <div class="column">
            <p class="title-default">{t}Kontaktní údaje{/t}</p>
            <ul>
               <li><strong>{$body.order.invoice_name} {$body.order.invoice_surname}</strong></li>
               {if $body.order.invoice_firm}
                  <li>{$body.order.invoice_firm}</li>
               {/if}
               <li>{$body.order.invoice_email}</li>
               <li>{$body.order.invoice_phone}</li>
            </ul>
         </div>


         {if $body.order.invoice_street}
            <div class="column">
               <p class="title-default">{t}Adresa{/t}</p>
               <ul>
                  <li>{$body.order.invoice_street}</li>

                  {if $body.order.invoice_custom_address}
                     <li>{$body.order.invoice_custom_address}</li>
                  {/if}
                  <li>{$body.order.invoice_zip} {$body.order.invoice_city}</li>

                  {if $body.order.invoice_state}
                     <li>{$body.order.invoice_state}</li>
                  {/if}

                  <li>{$cfg.Order.Countries[$body.order.invoice_country]}</li>
               </ul>
            </div>
         {/if}
      </div>

      {block "order-note"}
         {if $body.order.note_user}
            <p class="title-default">{t}Poznámka k objednávce{/t}</p>
            <p>{$body.order.note_user|escape:'htmlall'|nl2br nofilter}</p>
         {/if}

         {if $body.order.noteAdmin}
            <p>{t}Poznámka pro zákazníka{/t}</p>
            <p class="title-default">{$body.order.noteAdmin}</p>
         {/if}
      {/block}

      <h3>{t}Objednané zboží{/t}</h3>

      {include "account/orderView.products.tpl"}

      {block "discounts"}
         {get_order_items_discounts order=$body.order assign='itemsDiscounts'}
         {if $itemsDiscounts}
            <div class="row">
               <div class="col-xs-6">
                  <h3>* {t}Aplikované slevy{/t}</h3>
                  <table class="price-box table" style="float: left;">
                     {$totalDiscounts = DecimalConstants::zero()}
                     {foreach $itemsDiscounts as $discount}
                        <tr>
                           <td>{$discount.name}</td>
                           <td><span class="pull-right">{$discount.totalPrice|format_price:"ceil=no;decimal=dynamic"}</span></td>
                        </tr>
                        {$totalDiscounts = $totalDiscounts->add($discount.totalPrice)}
                     {/foreach}
                     <tr>
                        <td class="strong"><b>{t}Celkem jste ušetřili{/t}</b></td>
                        <td class="strong"><b><span class="pull-right">{$totalDiscounts|format_price:"ceil=no;decimal=dynamic"}</span></b></td>
                     </tr>
                  </table>
               </div>
            </div>
         {/if}
      {/block}

      <div class="d-flex">
         <div class="price-box">
            {block "pricebox-without-vat"}
               {if $dbcfg.shop_vat_payer}
                  <div class="price-box-row">
                     <p>{t}Cena bez DPH{/t}</p>
                     <p>{$body.order.total_price_array.value_without_vat|format_price:"ceil=no"}</p>
                  </div>
               {/if}
            {/block}
            <div class="price-box-row total-price">
               <p class="total-price">{t}Cena celkem{/t}</p>
               <p>
                  {block "pricebox-with-vat"}
                     {$body.order.total_price_array|format_price}
                  {/block}
               </p>
            </div>
         </div>
      </div>

      {block "order-custom-data"}{/block}

      {block "history"}
         <div class="orderview-history">
            <h3>{t}Historie objednávky{/t}</h3>

            <table class="table">
               <thead>
               <tr>
                  <th>{t}Datum{/t}</th>
                  <th>{t}Stav{/t}</th>
               </tr>
               </thead>
               <tbody>
               {foreach $body.order->getHistory() as $history}
                  <tr>
                     <td>{$history.date|date_format:"%d.%m.%Y"}<br>
                        {$history.date|date_format:"%H:%M"}</td>
                     <td>{$history.status_text}</td>
                  </tr>
               {/foreach}
               </tbody>
            </table>
         </div>
      {/block}
   </div>
{/change_currency}
