{extends file='page.tpl'}

{block name='page_content_container' prepend}
    <section id="content-hook_order_confirmation" class="card w-full">
      <div class="card-block w-full">
        <div class="w-full flex">
          <div class="w-full p-8 flex flex-col gap-2 border border-gray-600">

            {block name='order_confirmation_header'}
              <div class="h1 card-title flex items-center gap-4 text-2xl">
                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-checks" width="32" height="32" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 12l5 5l10 -10" /><path d="M2 12l5 5m5 -5l5 -5" /></svg>
                {l s='Your order is confirmed.' d='Shop.Theme.Checkout'}
              </div>
            {/block}

            <span class="pl-12">
              {l s='An email has been sent to your mail address %email%.' d='Shop.Theme.Checkout' sprintf=['%email%' => $customer.email]}
              {if $order.details.invoice_url}
                {* [1][/1] is for a HTML tag. *}
                {l
                  s='You can also [1]download your invoice[/1]'
                  d='Shop.Theme.Checkout'
                  sprintf=[
                    '[1]' => "<a href='{$order.details.invoice_url}'>",
                    '[/1]' => "</a>"
                  ]
                }
              {/if}
            </span>

            {block name='hook_order_confirmation'}
              <div class="hidden">
                {$HOOK_ORDER_CONFIRMATION nofilter}
              </div>
            {/block}

          </div>
        </div>
      </div>
    </section>
{/block}

{block name='page_content_container'}
  <section id="content" class="page-content page-order-confirmation card w-full">
      <div class="flex flex-col w-full gap-4 mt-8">
        {block name='order_confirmation_table'}
          {include
            file='checkout/_partials/order-confirmation-table.tpl'
            products=$order.products
            subtotals=$order.subtotals
            totals=$order.totals
            labels=$order.labels
            add_product_link=false
          }
        {/block}

        {block name='order_details'}
          <div id="order-details" class="w-full px-8 py-4 md:p-8 border border-gray-600 flex flex-col gap-3">
            <h3 class="text-lg font-semibold">{l s='Order details' d='Shop.Theme.Checkout'}:</h3>
            <div class="w-full flex">
              <div class="w-1/2 md:w-2/3 flex flex-col gap-1">
                <span >Order reference:</span>
                <span >Payment method:</span>
                <span >Shipping method:</span>
              </div>
              <div class="w-1/2 md:w-1/3 flex flex-col items-end gap-1">
                <span>{$order.details.reference}</span>
                <span>{$order.details.payment}</span>
                <span>{$order.carrier.name}</span>
              </div>
          </div>
          </div>
        {/block}

      </div>
  </section>

  {block name='hook_payment_return'}
    {if ! empty($HOOK_PAYMENT_RETURN)}
    <section id="content-hook_payment_return" class="card definition-list">
      <div class="card-block">
        <div class="row">
          <div class="col-md-12">
          </div>
        </div>
      </div>
    </section>
    {/if}
  {/block}

  {block name='customer_registration_form'}
    {if $customer.is_guest}
      <div id="registration-form" class="card">
        <div class="card-block">
          <h4 class="h4">{l s='Save time on your next order, sign up now' d='Shop.Theme.Checkout'}</h4>
          {render file='customer/_partials/customer-form.tpl' ui=$register_form}
        </div>
      </div>
    {/if}
  {/block}

  {block name='hook_order_confirmation_1'}
    {hook h='displayOrderConfirmation1'}
  {/block}

  {block name='hook_order_confirmation_2'}
    <section id="content-hook-order-confirmation-footer" class="mt-8">
      {hook h='displayOrderConfirmation2'}
    </section>
  {/block}
{/block}
