{**
 * 2007-2019 PrestaShop and Contributors
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2019 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *}
<div id="order-items" class="w-full flex flex-col gap-6 p-8 border border-gray-600">
  <div class="flex w-full gap-4">
    {block name='order_items_table_head'}
      <h3 class="card-title font-semibold w-1/3 md:w-3/6 text-lg uppercase col-12">{l s='Order items' d='Shop.Theme.Checkout'}</h3>
      <h3 class="card-title max-md:hidden font-semibold w-1/6 text-lg uppercase _desktop-title">{l s='Unit price' d='Shop.Theme.Checkout'}</h3>
      <h3 class="card-title font-semibold w-1/3 md:w-1/6 text-center text-lg uppercase _desktop-title">{l s='Quantity' d='Shop.Theme.Checkout'}</h3>
      <h3 class="card-title font-semibold w-1/3 md:w-1/6 text-right text-lg uppercase _desktop-title">{l s='Total price' d='Shop.Theme.Checkout'}</h3>
    {/block}
  </div>

  <div class="order-confirmation-table flex flex-col gap-8 w-full">
    {block name='order_confirmation_table'}
      {foreach from=$products item=product}
        <div class="flex w-full gap-4">
          <div class="flex w-1/2 gap-8">
            <span class="image max-md:hidden">
              <img class="w-[160px]" src="{$product.cover.medium.url}" />
            </span>
              <div class="flex-1 md:pr-48 pt-4">
                {if $add_product_link}<a href="{$product.url}" target="_blank">{/if}
                  <span class="font-semibold text-lg">{$product.name}</span>
                {if $add_product_link}</a>{/if}
                {if is_array($product.customizations) && $product.customizations|count}
                  {foreach from=$product.customizations item="customization"}
                    <div class="customizations hidden">
                      <a href="#" data-toggle="modal" data-target="#product-customizations-modal-{$customization.id_customization}">{l s='Product customization' d='Shop.Theme.Catalog'}</a>
                    </div>
                    <div class="modal fade customization-modal" id="product-customizations-modal-{$customization.id_customization}" tabindex="-1" role="dialog" aria-hidden="true">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title">{l s='Product customization' d='Shop.Theme.Catalog'}</h4>
                          </div>
                          <div class="modal-body">
                            {foreach from=$customization.fields item="field"}
                              <div class="product-customization-line row">
                                <div class="col-sm-3 col-xs-4 label">
                                  {$field.label}
                                </div>
                                <div class="col-sm-9 col-xs-8 value">
                                  {if $field.type == 'text'}
                                    {if (int)$field.id_module}
                                      {$field.text nofilter}
                                    {else}
                                      {$field.text}
                                    {/if}
                                  {elseif $field.type == 'image'}
                                    <img src="{$field.image.small.url}">
                                  {/if}
                                </div>
                              </div>
                            {/foreach}
                          </div>
                        </div>
                      </div>
                    </div>
                  {/foreach}
                {/if}
                {hook h='displayProductPriceBlock' product=$product type="unit_price"}
              </div>
          </div>
            <div class="w-1/3 md:w-1/6 max-md:hidden font-semibold text-lg pt-4">{$product.price}</div>
            <div class="w-1/3 md:w-1/6 text-center font-semibold text-lg pt-4">{$product.quantity}</div>
            <div class="w-1/3 md:w-1/6 text-right font-bold text-lg pt-4">{$product.price}</div>
        </div>
      {/foreach}

      <hr>
        <div class="w-full flex flex-col gap-2">
            <div class="w-full flex gap-2">
              <div class="flex flex-1 md:pl-4 flex-col gap-2">
                {foreach $subtotals as $subtotal}
                  {if $subtotal.type !== 'tax' && $subtotal.label !== null}
                      <span class="font-semibold w-full">{$subtotal.label}</span>
                  {/if}
                {/foreach}
                {if $subtotals.tax.label !== null}
                    <span class="font-semibold w-full">{l s='%label%:' sprintf=['%label%' => $subtotals.tax.label] d='Shop.Theme.Global'}</span>
                {/if}

                {if !$configuration.display_prices_tax_incl && $configuration.taxes_enabled}
                    <span class="font-semibold">{$totals.total.label}&nbsp;{$labels.tax_short}</span>
                {/if}
              </div>
              <div class="flex flex-col items-end md:pr-4 gap-2">
                {foreach $subtotals as $subtotal}
                  {if $subtotal.type !== 'tax' && $subtotal.label !== null}
                      <span>{if 'discount' == $subtotal.type}-&nbsp;{/if}{$subtotal.value}</span>
                  {/if}
                {/foreach}
                {if $subtotals.tax.label !== null}
                    <span>{$subtotals.tax.value}</span>
                {/if}
                {if !$configuration.display_prices_tax_incl && $configuration.taxes_enabled}
                    <span class="">{$totals.total.value}</span>
                {/if}
              </div>
            </div>
              <div class="w-full flex">
                {if !$configuration.display_prices_tax_incl && $configuration.taxes_enabled}
                  <span class="text-lg font-semibold w-full bg-gray-200 md:pl-4">
                    {$totals.total_including_tax.label}
                  </span>
                {else}
                  <span class="text-lg font-semibold w-full md:pl-4">{$totals.total.label}&nbsp;{if $configuration.taxes_enabled}{$labels.tax_short}{/if}</span>
                {/if}
                {if !$configuration.display_prices_tax_incl && $configuration.taxes_enabled}
                  <span class="text-lg font-semibold bg-gray-200 md:pr-4">{$totals.total_including_tax.value}</span>
                {else}
                  <span class="text-lg font-semibold md:pl-4">{$totals.total.value}</span>
                {/if}
              <div>
          </div>
        </div>
      </div>
    {/block}
  </div>
</div>
