From 9d9ccbc3312a5c2287ac196459baeaad5bd16a1c Mon Sep 17 00:00:00 2001
From: abhisheks <abhisheks@consultbop.com>
Date: Thu, 7 Dec 2023 02:26:14 +0530
Subject: [PATCH] refactor: update order confirmation page

---
 .../_partials/order-confirmation-table.tpl    | 195 +++++++++---------
 templates/checkout/order-confirmation.tpl     |  55 +++--
 2 files changed, 129 insertions(+), 121 deletions(-)

diff --git a/templates/checkout/_partials/order-confirmation-table.tpl b/templates/checkout/_partials/order-confirmation-table.tpl
index 8708cea..21ffa54 100644
--- a/templates/checkout/_partials/order-confirmation-table.tpl
+++ b/templates/checkout/_partials/order-confirmation-table.tpl
@@ -22,115 +22,124 @@
  * @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="col-md-12">
-  <div class="row">
+<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 h3 col-md-6 col-12">{l s='Order items' d='Shop.Theme.Checkout'}</h3>
-      <h3 class="card-title h3 col-md-2 text-md-center _desktop-title">{l s='Unit price' d='Shop.Theme.Checkout'}</h3>
-      <h3 class="card-title h3 col-md-2 text-md-center _desktop-title">{l s='Quantity' d='Shop.Theme.Checkout'}</h3>
-      <h3 class="card-title h3 col-md-2 text-md-center _desktop-title">{l s='Total products' d='Shop.Theme.Checkout'}</h3>
+      <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">
-
+  <div class="order-confirmation-table flex flex-col gap-8 w-full">
     {block name='order_confirmation_table'}
       {foreach from=$products item=product}
-        <div class="order-line row">
-          <div class="col-sm-2 col-xs-3">
-            <span class="image">
-              <img src="{$product.cover.medium.url}" />
+        <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>
-          <div class="col-sm-4 col-xs-9 details">
-            {if $add_product_link}<a href="{$product.url}" target="_blank">{/if}
-              <span>{$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">
-                  <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 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">
+                      <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>
-                        {/foreach}
+                          <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>
-                  </div>
-                </div>
-              {/foreach}
-            {/if}
-            {hook h='displayProductPriceBlock' product=$product type="unit_price"}
-          </div>
-          <div class="col-sm-6 col-xs-12 qty">
-            <div class="row">
-              <div class="col-xs-4 text-sm-center text-xs-left">{$product.price}</div>
-              <div class="col-xs-4 text-sm-center">{$product.quantity}</div>
-              <div class="col-xs-4 text-sm-center text-xs-right bold">{$product.total}</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.total}</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}
 
-      <table>
-        {foreach $subtotals as $subtotal}
-          {if $subtotal.type !== 'tax' && $subtotal.label !== null}
-            <tr>
-              <td>{$subtotal.label}</td>
-              <td>{if 'discount' == $subtotal.type}-&nbsp;{/if}{$subtotal.value}</td>
-            </tr>
-          {/if}
-        {/foreach}
-
-        {if !$configuration.display_prices_tax_incl && $configuration.taxes_enabled}
-          <tr>
-            <td><span class="text-uppercase">{$totals.total.label}&nbsp;{$labels.tax_short}</span></td>
-            <td>{$totals.total.value}</td>
-          </tr>
-          <tr class="total-value font-weight-bold">
-            <td><span class="text-uppercase">{$totals.total_including_tax.label}</span></td>
-            <td>{$totals.total_including_tax.value}</td>
-          </tr>
-        {else}
-          <tr class="total-value font-weight-bold">
-            <td><span class="text-uppercase">{$totals.total.label}&nbsp;{if $configuration.taxes_enabled}{$labels.tax_short}{/if}</span></td>
-            <td>{$totals.total.value}</td>
-          </tr>
-        {/if}
-        {if $subtotals.tax.label !== null}
-          <tr class="sub taxes">
-            <td><span class="label">{l s='%label%:' sprintf=['%label%' => $subtotals.tax.label] d='Shop.Theme.Global'}</span>&nbsp;<span class="value">{$subtotals.tax.value}</span></td>
-          </tr>
-        {/if}
-      </table>
+                {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>
diff --git a/templates/checkout/order-confirmation.tpl b/templates/checkout/order-confirmation.tpl
index d73a970..22a4af6 100644
--- a/templates/checkout/order-confirmation.tpl
+++ b/templates/checkout/order-confirmation.tpl
@@ -1,18 +1,19 @@
 {extends file='page.tpl'}
 
 {block name='page_content_container' prepend}
-    <section id="content-hook_order_confirmation" class="card">
-      <div class="card-block">
-        <div class="row">
-          <div class="col-md-12">
+    <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'}
-              <h3 class="h1 card-title">
-                <i class="material-icons rtl-no-flip done">&#xE876;</i>{l s='Your order is confirmed' d='Shop.Theme.Checkout'}
-              </h3>
+              <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}
 
-            <p>
+            <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. *}
@@ -25,7 +26,7 @@
                   ]
                 }
               {/if}
-            </p>
+            </span>
 
             {block name='hook_order_confirmation'}
               {$HOOK_ORDER_CONFIRMATION nofilter}
@@ -38,10 +39,8 @@
 {/block}
 
 {block name='page_content_container'}
-  <section id="content" class="page-content page-order-confirmation card">
-    <div class="card-block">
-      <div class="row">
-
+  <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'
@@ -54,23 +53,24 @@
         {/block}
 
         {block name='order_details'}
-          <div id="order-details" class="col-md-4">
-            <h3 class="h3 card-title">{l s='Order details' d='Shop.Theme.Checkout'}:</h3>
-            <ul>
-              <li>{l s='Order reference: %reference%' d='Shop.Theme.Checkout' sprintf=['%reference%' => $order.details.reference]}</li>
-              <li>{l s='Payment method: %method%' d='Shop.Theme.Checkout' sprintf=['%method%' => $order.details.payment]}</li>
-              {if !$order.details.is_virtual}
-                <li>
-                  {l s='Shipping method: %method%' d='Shop.Theme.Checkout' sprintf=['%method%' => $order.carrier.name]}<br>
-                  <em>{$order.carrier.delay}</em>
-                </li>
-              {/if}
-            </ul>
+          <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>
-    </div>
   </section>
 
   {block name='hook_payment_return'}
@@ -79,7 +79,6 @@
       <div class="card-block">
         <div class="row">
           <div class="col-md-12">
-            {$HOOK_PAYMENT_RETURN nofilter}
           </div>
         </div>
       </div>
@@ -103,7 +102,7 @@
   {/block}
 
   {block name='hook_order_confirmation_2'}
-    <section id="content-hook-order-confirmation-footer">
+    <section id="content-hook-order-confirmation-footer" class="mt-8">
       {hook h='displayOrderConfirmation2'}
     </section>
   {/block}