Просмотр исходного кода

修改礼品卡切换货币的问题

llp 1 неделя назад
Родитель
Сommit
01f8c30db4

+ 2 - 0
packages/Longyi/Gift/src/Database/Migrations/2026_04_01_230815_add_giftcard_fields_to_cart_table.php

@@ -14,6 +14,7 @@ return new class extends Migration
         Schema::table('cart', function (Blueprint $table) {
             $table->string('giftcard_number', 191)->nullable()->after('applied_cart_rule_ids');
             $table->decimal('giftcard_amount', 10, 2)->nullable()->after('giftcard_number');
+            $table->decimal('base_giftcard_amount', 10, 2)->nullable()->after('base_giftcard_amount');
         });
     }
 
@@ -25,6 +26,7 @@ return new class extends Migration
         Schema::table('cart', function (Blueprint $table) {
             $table->dropColumn('giftcard_number');
             $table->dropColumn('giftcard_amount');
+            $table->dropColumn('base_giftcard_amount');
         });
     }
 };

+ 2 - 1
packages/Longyi/Gift/src/Database/Migrations/2026_04_01_230829_add_giftcard_fields_to_orders_table.php

@@ -14,6 +14,7 @@ return new class extends Migration
         Schema::table('orders', function (Blueprint $table) {
             $table->string('giftcard_number', 191)->nullable()->after('coupon_code');
             $table->decimal('giftcard_amount', 10, 2)->nullable()->after('giftcard_number');
+            $table->decimal('base_giftcard_amount', 10, 2)->nullable()->after('base_giftcard_amount');
         });
     }
 
@@ -23,7 +24,7 @@ return new class extends Migration
     public function down(): void
     {
         Schema::table('orders', function (Blueprint $table) {
-            $table->dropColumn(['giftcard_number', 'giftcard_amount']);
+            $table->dropColumn(['giftcard_number', 'giftcard_amount', 'base_giftcard_amount']);
         });
     }
 };

+ 2 - 1
packages/Longyi/Gift/src/Database/Migrations/2026_04_01_230841_add_giftcard_info_to_invoices_table.php

@@ -14,6 +14,7 @@ return new class extends Migration
         Schema::table('invoices', function (Blueprint $table) {
             $table->string('giftcard_number', 191)->nullable()->after('grand_total'); // Choose the appropriate position for the column
             $table->decimal('giftcard_amount', 10, 2)->nullable()->after('giftcard_number'); // Using 'nullable' because not all invoices may use a giftcard
+            $table->decimal('base_giftcard_amount', 10, 2)->nullable()->after('base_giftcard_amount'); // Using 'nullable' because not all invoices may use a giftcard
         });
     }
 
@@ -23,7 +24,7 @@ return new class extends Migration
     public function down(): void
     {
         Schema::table('invoices', function (Blueprint $table) {
-            $table->dropColumn(['giftcard_number', 'giftcard_amount']);
+            $table->dropColumn(['giftcard_number', 'giftcard_amount', 'base_giftcard_amount']);
         });
     }
 };

+ 21 - 7
packages/Longyi/Gift/src/Listeners/GiftHandler.php

@@ -19,18 +19,32 @@ class GiftHandler
     ) {}
 
     /**
-     * Save the transaction data for online payment.
+     * Apply gift card to cart.
      *
-     * @param  \Webkul\Sales\Models\Invoice  $invoice
+     * @param  \Webkul\Checkout\Models\Cart  $cart
      * @return void
      */
     public function applyGiftCard($cart)
     {
-        $giftCardAmount = $cart->giftcard_amount ?? 0;
-        if ($giftCardAmount) {
-            $cart->grand_total = max(0, round($cart->grand_total - $giftCardAmount, 2));
-            $cart->base_grand_total = max(0, round($cart->base_grand_total - core()->convertToBasePrice($giftCardAmount), 2));
-            $cart->save();
+        if (!$cart || !$cart->giftcard_number) {
+            return;
         }
+        // 获取礼品卡对象
+        $giftCard = GiftCards::where('giftcard_number', $cart->giftcard_number)->first();
+        if (!$giftCard) {
+            return;
+        }
+        $remainingAmountInCurrentCurrency = core()->convertPrice($giftCard->remaining_giftcard_amount);
+        if ($cart->grand_total <= $remainingAmountInCurrentCurrency) {
+            $cart->giftcard_amount = $cart->grand_total - 0.01;
+        } else {
+            $cart->giftcard_amount = $remainingAmountInCurrentCurrency;
+        }
+        $usableAmount = $cart->giftcard_amount;
+        $giftCardAmountInBaseCurrency = core()->convertToBasePrice($usableAmount);
+        $cart->base_giftcard_amount = $giftCardAmountInBaseCurrency;
+        $cart->grand_total = max(0, round($cart->grand_total - $usableAmount, 2));
+        $cart->base_grand_total = max(0, round($cart->base_grand_total - $giftCardAmountInBaseCurrency, 2));
+        $cart->save();
     }
 }

+ 1 - 0
packages/Longyi/Gift/src/Listeners/InvoiceHandler.php

@@ -27,6 +27,7 @@ class InvoiceHandler
             ->update([
                 'giftcard_number' => $order->giftcard_number,
                 'giftcard_amount' => $order->giftcard_amount,
+                'base_giftcard_amount' => $order->base_giftcard_amount,
             ]);
     }
 }

+ 0 - 7
packages/Longyi/Gift/src/Models/GiftCards.php

@@ -39,13 +39,6 @@ class GiftCards extends Model implements GiftCardsContract
         }
         $cart = cart()->getCart();
         $cart->giftcard_number = $giftcard->giftcard_number;
-        $remainingGiftcardAmount = core()->convertPrice($giftcard->remaining_giftcard_amount);
-        // 计算可以使用的礼品卡金额
-        if ($cart->grand_total <= $remainingGiftcardAmount) {
-            $cart->giftcard_amount = $cart->grand_total - 0.01;
-        } else {
-            $cart->giftcard_amount = $giftcard->remaining_giftcard_amount;
-        }
         $cart->save();
         return true;
     }

+ 0 - 1
packages/Longyi/Gift/src/Providers/EventServiceProvider.php

@@ -20,7 +20,6 @@ class EventServiceProvider extends ServiceProvider
             $viewRenderEventManager->addTemplate('gift::components.giftcard-cartsummary');
         });
         Event::listen('bagisto.shop.customers.account.orders.view.information.discount.after', 'Longyi\Gift\Listeners\OrderViewHandler@renderGiftCardInfo');
-        Event::listen('bagisto.admin.sales.order.view.discount.after', 'Longyi\Gift\Listeners\OrderViewHandler@renderGiftCardInfo');
         Event::listen('sales.invoice.save.after', 'Longyi\Gift\Listeners\InvoiceHandler@saveAfter');
         Event::listen('sales.order.cancel.after', 'Longyi\Gift\Listeners\OrderCancelHandler@afterCancelOrder');
     }

+ 2 - 1
packages/Longyi/Gift/src/Repositories/CustomInvoiceRepository.php

@@ -38,6 +38,7 @@ class CustomInvoiceRepository extends BaseInvoiceRepository
         $invoice->base_discount_amount += $invoice->order->base_shipping_discount_amount;
 
         $invoice->giftcard_amount += $invoice->order->giftcard_amount;
+        $invoice->base_giftcard_amount += $invoice->order->base_giftcard_amount;
         $invoice->giftcard_number = $invoice->order->giftcard_number;
 
         if ($invoice->order->shipping_tax_amount) {
@@ -75,7 +76,7 @@ class CustomInvoiceRepository extends BaseInvoiceRepository
         }
 
         $invoice->grand_total = $invoice->sub_total + $invoice->tax_amount + $invoice->shipping_amount - $invoice->discount_amount - $invoice->giftcard_amount;
-        $invoice->base_grand_total = $invoice->base_sub_total + $invoice->base_tax_amount + $invoice->base_shipping_amount - $invoice->base_discount_amount - $invoice->giftcard_amount;
+        $invoice->base_grand_total = $invoice->base_sub_total + $invoice->base_tax_amount + $invoice->base_shipping_amount - $invoice->base_discount_amount - $invoice->base_giftcard_amount;
 
         $invoice->save();
 

+ 1 - 1
packages/Longyi/Gift/src/Resources/views/sales/invoices/view.blade.php

@@ -367,7 +367,7 @@
                         <!-- Giftcard Amount -->
                         @if ($order->giftcard_amount > 0)
                             <p class="text-gray-600 dark:text-gray-300 !leading-5">
-                                -  {{ core()->formatBasePrice($invoice->giftcard_amount) }}
+                                -  {{ core()->formatBasePrice($invoice->base_giftcard_amount) }}
                             </p>
                         @endif
 

+ 952 - 0
packages/Longyi/Gift/src/Resources/views/sales/orders/view.blade.php

@@ -0,0 +1,952 @@
+<x-admin::layouts>
+    <x-slot:title>
+        @lang('admin::app.sales.orders.view.title', ['order_id' => $order->increment_id])
+    </x-slot>
+
+    <!-- Header -->
+    <div class="grid">
+        <div class="flex items-center justify-between gap-4 max-sm:flex-wrap">
+            {!! view_render_event('bagisto.admin.sales.order.title.before', ['order' => $order]) !!}
+
+            <div class="flex items-center gap-2.5">
+                <p class="text-xl font-bold leading-6 text-gray-800 dark:text-white">
+                    @lang('admin::app.sales.orders.view.title', ['order_id' => $order->increment_id])
+                </p>
+
+                <!-- Order Status -->
+                <span class="label-{{ $order->status }} text-sm mx-1.5">
+                    @lang("admin::app.sales.orders.view.$order->status")
+                </span>
+            </div>
+
+            {!! view_render_event('bagisto.admin.sales.order.title.after', ['order' => $order]) !!}
+
+            <!-- Back Button -->
+            <a
+                href="{{ route('admin.sales.orders.index') }}"
+                class="transparent-button hover:bg-gray-200 dark:text-white dark:hover:bg-gray-800"
+            >
+                @lang('admin::app.account.edit.back-btn')
+            </a>
+        </div>
+    </div>
+
+    <div class="flex-wrap items-center justify-between mt-5 gap-x-1 gap-y-2">
+        <div class="flex gap-1.5">
+            {!! view_render_event('bagisto.admin.sales.order.page_action.before', ['order' => $order]) !!}
+
+            @if (
+                $order->canReorder()
+                && bouncer()->hasPermission('sales.orders.create')
+                && core()->getConfigData('sales.order_settings.reorder.admin')
+            )
+                <a
+                    href="{{ route('admin.sales.orders.reorder', $order->id) }}"
+                    class="transparent-button px-1 py-1.5 hover:bg-gray-200 dark:text-white dark:hover:bg-gray-800"
+                >
+                    <span class="text-2xl icon-cart"></span>
+
+                    @lang('admin::app.sales.orders.view.reorder')
+                </a>
+            @endif
+
+            @if (
+                $order->canInvoice()
+                && bouncer()->hasPermission('sales.invoices.create')
+                && $order->payment->method !== 'paypal_standard'
+            )
+                @include('admin::sales.invoices.create')
+            @endif
+
+            @if (
+                $order->canShip()
+                && bouncer()->hasPermission('sales.shipments.create')
+            )
+                @include('admin::sales.shipments.create')
+            @endif
+
+            @if (
+                $order->canRefund()
+                && bouncer()->hasPermission('sales.refunds.create')
+            )
+                @include('admin::sales.refunds.create')
+            @endif
+
+            @if (
+                $order->canCancel()
+                && bouncer()->hasPermission('sales.orders.cancel')
+            )
+                <form
+                    method="POST"
+                    ref="cancelOrderForm"
+                    action="{{ route('admin.sales.orders.cancel', $order->id) }}"
+                >
+                    @csrf
+                </form>
+
+                <div
+                    class="transparent-button px-1 py-1.5 hover:bg-gray-200 dark:text-white dark:hover:bg-gray-800"
+                    @click="$emitter.emit('open-confirm-modal', {
+                        message: '@lang('admin::app.sales.orders.view.cancel-msg')',
+                        agree: () => {
+                            this.$refs['cancelOrderForm'].submit()
+                        }
+                    })"
+                >
+                    <span
+                        class="text-2xl icon-cancel"
+                        role="presentation"
+                        tabindex="0"
+                    >
+                    </span>
+
+                    <a href="javascript:void(0);">
+                        @lang('admin::app.sales.orders.view.cancel')
+                    </a>
+                </div>
+            @endif
+
+            {!! view_render_event('bagisto.admin.sales.order.page_action.after', ['order' => $order]) !!}
+        </div>
+
+        <!-- Order details -->
+        <div class="mt-3.5 flex gap-2.5 max-xl:flex-wrap">
+            <!-- Left Component -->
+            <div class="flex flex-col flex-1 gap-2 max-xl:flex-auto">
+                {!! view_render_event('bagisto.admin.sales.order.left_component.before', ['order' => $order]) !!}
+
+                <div class="bg-white rounded box-shadow dark:bg-gray-900">
+                    <div class="flex justify-between p-4">
+                        <p class="mb-4 text-base font-semibold text-gray-800 dark:text-white">
+                            @lang('Order Items') ({{ count($order->items) }})
+                        </p>
+
+                        <p class="text-base font-semibold text-gray-800 dark:text-white">
+                            @lang('admin::app.sales.orders.view.grand-total', ['grand_total' => core()->formatBasePrice($order->base_grand_total)])
+                        </p>
+                    </div>
+
+                    <!-- Order items -->
+                    <div class="grid">
+                        @foreach ($order->items as $item)
+                            {!! view_render_event('bagisto.admin.sales.order.list.before', ['order' => $order]) !!}
+
+                            <div class="flex justify-between gap-2.5 border-b border-slate-300 px-4 py-6 dark:border-gray-800">
+                                <div class="flex gap-2.5">
+                                    @if($item?->product?->base_image_url)
+                                        <img
+                                            class="relative h-[60px] max-h-[60px] w-full max-w-[60px] rounded"
+                                            src="{{ $item?->product->base_image_url }}"
+                                        >
+                                    @else
+                                        <div class="relative h-[60px] max-h-[60px] w-full max-w-[60px] rounded border border-dashed border-gray-300 dark:border-gray-800 dark:mix-blend-exclusion dark:invert">
+                                            <img src="{{ bagisto_asset('images/product-placeholders/front.svg') }}">
+
+                                            <p class="absolute bottom-1.5 w-full text-center text-[6px] font-semibold text-gray-400">
+                                                @lang('admin::app.sales.invoices.view.product-image')
+                                            </p>
+                                        </div>
+                                    @endif
+
+                                    <div class="grid place-content-start gap-1.5">
+                                        <p
+                                            class="text-base font-semibold text-gray-800 break-all dark:text-white"
+                                            v-pre
+                                        >
+                                            {{ $item->name }}
+                                        </p>
+
+                                        <div class="flex flex-col place-items-start gap-1.5">
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.amount-per-unit', [
+                                                    'amount' => core()->formatBasePrice($item->base_price),
+                                                    'qty'    => $item->qty_ordered,
+                                                ])
+                                            </p>
+
+                                            @if (isset($item->additional['attributes']))
+                                                @foreach ($item->additional['attributes'] as $attribute)
+                                                    <p
+                                                        class="text-gray-600 dark:text-gray-300"
+                                                        v-pre
+                                                    >
+                                                        @if (
+                                                            ! isset($attribute['attribute_type'])
+                                                            || $attribute['attribute_type'] !== 'file'
+                                                        )
+                                                            {{ $attribute['attribute_name'] }} : {{ $attribute['option_label'] }}
+                                                        @else
+                                                            {{ $attribute['attribute_name'] }} :
+
+                                                            <a
+                                                                href="{{ Storage::url($attribute['option_label']) }}"
+                                                                class="text-blue-600 hover:underline"
+                                                                download="{{ File::basename($attribute['option_label']) }}"
+                                                            >
+                                                                {{ File::basename($attribute['option_label']) }}
+                                                            </a>
+                                                        @endif
+                                                    </p>
+                                                @endforeach
+                                            @endif
+
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.sku', ['sku' => $item->sku])
+                                            </p>
+
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                {{ $item->qty_ordered ? trans('admin::app.sales.orders.view.item-ordered', ['qty_ordered' => $item->qty_ordered]) : '' }}
+
+                                                {{ $item->qty_invoiced ? trans('admin::app.sales.orders.view.item-invoice', ['qty_invoiced' => $item->qty_invoiced]) : '' }}
+
+                                                {{ $item->qty_shipped ? trans('admin::app.sales.orders.view.item-shipped', ['qty_shipped' => $item->qty_shipped]) : '' }}
+
+                                                {{ $item->qty_refunded ? trans('admin::app.sales.orders.view.item-refunded', ['qty_refunded' => $item->qty_refunded]) : '' }}
+
+                                                {{ $item->qty_canceled ? trans('admin::app.sales.orders.view.item-canceled', ['qty_canceled' => $item->qty_canceled]) : '' }}
+                                            </p>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <div class="grid gap-1 place-content-start">
+                                    <div class="">
+                                        <p class="flex items-center justify-end text-base font-semibold text-gray-800 gap-x-1 dark:text-white">
+                                            {{ core()->formatBasePrice($item->base_total + $item->base_tax_amount - $item->base_discount_amount) }}
+                                        </p>
+                                    </div>
+
+                                    <div class="flex flex-col place-items-start items-end gap-1.5">
+                                        @if (core()->getConfigData('sales.taxes.sales.display_prices') == 'including_tax')
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.price', ['price' => core()->formatBasePrice($item->base_price_incl_tax)])
+                                            </p>
+                                        @elseif (core()->getConfigData('sales.taxes.sales.display_prices') == 'both')
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.price-excl-tax', ['price' => core()->formatBasePrice($item->base_price)])
+                                            </p>
+
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.price-incl-tax', ['price' => core()->formatBasePrice($item->base_price_incl_tax)])
+                                            </p>
+                                        @else
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.price', ['price' => core()->formatBasePrice($item->base_price)])
+                                            </p>
+                                        @endif
+
+                                        <p class="text-gray-600 dark:text-gray-300">
+                                            @lang('admin::app.sales.orders.view.tax', [
+                                                'percent' => number_format($item->tax_percent, 2) . '%',
+                                                'tax'     => core()->formatBasePrice($item->base_tax_amount)
+                                            ])
+                                        </p>
+
+                                        @if ($order->base_discount_amount > 0)
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.discount', ['discount' => core()->formatBasePrice($item->base_discount_amount)])
+                                            </p>
+                                        @endif
+
+                                        @if (core()->getConfigData('sales.taxes.sales.display_subtotal') == 'including_tax')
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.sub-total', ['sub_total' => core()->formatBasePrice($item->base_total_incl_tax)])
+                                            </p>
+                                        @elseif (core()->getConfigData('sales.taxes.sales.display_subtotal') == 'both')
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.sub-total-excl-tax', ['sub_total' => core()->formatBasePrice($item->base_total)])
+                                            </p>
+
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.sub-total-incl-tax', ['sub_total' => core()->formatBasePrice($item->base_total_incl_tax)])
+                                            </p>
+                                        @else
+                                            <p class="text-gray-600 dark:text-gray-300">
+                                                @lang('admin::app.sales.orders.view.sub-total', ['sub_total' => core()->formatBasePrice($item->base_total)])
+                                            </p>
+                                        @endif
+                                    </div>
+                                </div>
+                            </div>
+
+                            {!! view_render_event('bagisto.admin.sales.order.list.after', ['order' => $order]) !!}
+
+                        @endforeach
+                    </div>
+
+                    <div class="flex justify-end flex-auto p-4 mt-4">
+                        <div class="grid gap-2 text-sm max-w-max">
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.subtotal.before') !!}
+
+                            <!-- Sub Total -->
+                            @if (core()->getConfigData('sales.taxes.sales.display_subtotal') == 'including_tax')
+                                <div class="flex justify-between w-full gap-x-5">
+                                    <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                        @lang('admin::app.sales.orders.view.summary-sub-total-incl-tax')
+                                    </p>
+
+                                    <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatBasePrice($order->base_sub_total_incl_tax) }}
+                                    </p>
+                                </div>
+                            @elseif (core()->getConfigData('sales.taxes.sales.display_subtotal') == 'both')
+                                <div class="flex justify-between w-full gap-x-5">
+                                    <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                        @lang('admin::app.sales.orders.view.summary-sub-total-excl-tax')
+                                    </p>
+
+                                    <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatBasePrice($order->base_sub_total) }}
+                                    </p>
+                                </div>
+
+                                <div class="flex justify-between w-full gap-x-5">
+                                    <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                        @lang('admin::app.sales.orders.view.summary-sub-total-incl-tax')
+                                    </p>
+
+                                    <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatBasePrice($order->base_sub_total_incl_tax) }}
+                                    </p>
+                                </div>
+                            @else
+                                <div class="flex justify-between w-full gap-x-5">
+                                    <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                        @lang('admin::app.sales.orders.view.summary-sub-total')
+                                    </p>
+
+                                    <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatBasePrice($order->base_sub_total) }}
+                                    </p>
+                                </div>
+                            @endif
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.subtotal.after') !!}
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.shipping.before') !!}
+
+                            <!-- Shipping And Handling -->
+                            @if ($haveStockableItems = $order->haveStockableItems())
+                                @if (core()->getConfigData('sales.taxes.sales.display_subtotal') == 'including_tax')
+                                    <div class="flex justify-between w-full gap-x-5">
+                                        <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                            @lang('admin::app.sales.orders.view.shipping-and-handling-incl-tax')
+                                        </p>
+
+                                        <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                            {{ core()->formatBasePrice($order->base_shipping_amount_incl_tax) }}
+                                        </p>
+                                    </div>
+                                @elseif (core()->getConfigData('sales.taxes.sales.display_shipping_amount') == 'both')
+                                    <div class="flex justify-between w-full gap-x-5">
+                                        <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                            @lang('admin::app.sales.orders.view.shipping-and-handling-excl-tax')
+                                        </p>
+
+                                        <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                            {{ core()->formatBasePrice($order->base_shipping_amount) }}
+                                        </p>
+                                    </div>
+
+                                    <div class="flex justify-between w-full gap-x-5">
+                                        <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                            @lang('admin::app.sales.orders.view.shipping-and-handling-incl-tax')
+                                        </p>
+
+                                        <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                            {{ core()->formatBasePrice($order->base_shipping_amount_incl_tax) }}
+                                        </p>
+                                    </div>
+                                @else
+                                    <div class="flex justify-between w-full gap-x-5">
+                                        <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                            @lang('admin::app.sales.orders.view.shipping-and-handling')
+                                        </p>
+
+                                        <p class="font-semibold !leading-5 text-gray-600 dark:text-gray-300">
+                                            {{ core()->formatBasePrice($order->base_shipping_amount) }}
+                                        </p>
+                                    </div>
+                                @endif
+                            @endif
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.shipping.after') !!}
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.tax-amount.before') !!}
+
+                            <!-- Tax Amount -->
+                            <div class="flex justify-between w-full gap-x-5">
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.summary-tax')
+                                </p>
+
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    {{ core()->formatBasePrice($order->base_tax_amount) }}
+                                </p>
+                            </div>
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.tax-amount.after') !!}
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.discount.before') !!}
+
+                            <!-- Discount -->
+                            <div class="flex justify-between w-full gap-x-5">
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.summary-discount')
+                                </p>
+
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    {{ core()->formatBasePrice($order->base_discount_amount) }}
+                                </p>
+                            </div>
+                            @if (isset($order) && $order->giftcard_number && $order->giftcard_amount > 0)
+                                <div class="flex w-full justify-between gap-x-5">
+                                    <p>
+                                        @lang('gift::app.giftcard.applied')
+
+                                        @if ($order->giftcard_number)
+                                            ({{ $order->giftcard_number }})
+                                        @endif
+                                    </p>
+
+                                    <p>
+                                        - {{ core()->formatPrice($order->base_giftcard_amount) }}
+                                    </p>
+                                </div>
+                            @endif
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.discount.after') !!}
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.grand-total.before') !!}
+
+                            <!-- Grand Total -->
+                            <div class="flex justify-between w-full gap-x-5">
+                                <p class="text-base font-semibold !leading-5 text-gray-800 dark:text-white">
+                                    @lang('admin::app.sales.orders.view.summary-grand-total')
+                                </p>
+
+                                <p class="text-base font-semibold !leading-5 text-gray-800 dark:text-white">
+                                    {{ core()->formatBasePrice($order->base_grand_total) }}
+                                </p>
+                            </div>
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.grand-total.after') !!}
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.total-paid.before') !!}
+
+                            <!-- Total Paid -->
+                            <div class="flex justify-between w-full gap-x-5">
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.total-paid')
+                                </p>
+
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    {{ core()->formatBasePrice($order->base_grand_total_invoiced) }}
+                                </p>
+                            </div>
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.total-paid.after') !!}
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.total-refunded.before') !!}
+
+                            <!-- Total Refund -->
+                            <div class="flex justify-between w-full gap-x-5">
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.total-refund')
+                                </p>
+
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    {{ core()->formatBasePrice($order->base_grand_total_refunded) }}
+                                </p>
+                            </div>
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.total-refunded.after') !!}
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.total-due.before') !!}
+
+                            <!-- Total Due -->
+                            <div class="flex justify-between w-full font-semibold gap-x-5">
+                                <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.total-due')
+                                </p>
+
+                                @if($order->status !== 'canceled')
+                                    <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatBasePrice($order->base_total_due) }}
+                                    </p>
+                                @else
+                                    <p class="!leading-5 text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatBasePrice(0.00) }}
+                                    </p>
+                                @endif
+                            </div>
+
+                            {!! view_render_event('bagisto.admin.sales.order.view.total-due.after') !!}
+
+                        </div>
+                    </div>
+                </div>
+
+                <!-- Customer's comment form -->
+                <div class="bg-white rounded box-shadow dark:bg-gray-900">
+                    <p class="p-4 pb-0 text-base font-semibold text-gray-800 dark:text-white">
+                        @lang('admin::app.sales.orders.view.comments')
+                    </p>
+
+                    <x-admin::form action="{{ route('admin.sales.orders.comment', $order->id) }}">
+                        <div class="p-4">
+                            <div class="mb-2.5">
+                                <x-admin::form.control-group>
+                                    <x-admin::form.control-group.control
+                                        type="textarea"
+                                        id="comment"
+                                        name="comment"
+                                        rules="required"
+                                        :label="trans('admin::app.sales.orders.view.comments')"
+                                        :placeholder="trans('admin::app.sales.orders.view.write-your-comment')"
+                                        rows="3"
+                                    />
+
+                                    <x-admin::form.control-group.error control-name="comment" />
+                                </x-admin::form.control-group>
+                            </div>
+
+                            <div class="flex items-center justify-between">
+                                <label
+                                    class="flex w-max cursor-pointer select-none items-center gap-1 p-1.5"
+                                    for="customer_notified"
+                                >
+                                    <input
+                                        type="checkbox"
+                                        name="customer_notified"
+                                        id="customer_notified"
+                                        value="1"
+                                        class="hidden peer"
+                                    >
+
+                                    <span
+                                        class="text-2xl rounded-md cursor-pointer icon-uncheckbox peer-checked:icon-checked peer-checked:text-blue-600"
+                                        role="button"
+                                        tabindex="0"
+                                    >
+                                    </span>
+
+                                    <p class="flex items-center font-semibold text-gray-600 cursor-pointer gap-x-1 hover:text-gray-800 dark:text-gray-300 dark:hover:text-gray-100">
+                                        @lang('admin::app.sales.orders.view.notify-customer')
+                                    </p>
+                                </label>
+
+                                <button
+                                    type="submit"
+                                    class="secondary-button"
+                                    aria-label="{{ trans('admin::app.sales.orders.view.submit-comment') }}"
+                                >
+                                    @lang('admin::app.sales.orders.view.submit-comment')
+                                </button>
+                            </div>
+                        </div>
+                    </x-admin::form>
+
+                    <span class="block w-full border-b dark:border-gray-800"></span>
+
+                    <!-- Comment List -->
+                    @foreach ($order->comments()->orderBy('id', 'desc')->get() as $comment)
+                        <div class="grid gap-1.5 p-4">
+                            <p
+                                class="text-base leading-6 text-gray-800 break-all dark:text-white"
+                                v-pre
+                            >
+                                {{ $comment->comment }}
+                            </p>
+
+                            <!-- Notes List Title and Time -->
+                            <p class="flex items-center gap-2 text-gray-600 dark:text-gray-300">
+                                @if ($comment->customer_notified)
+                                    <span class="text-2xl text-blue-600 bg-blue-100 rounded-full icon-done h-fit"></span>
+
+                                    @lang('admin::app.sales.orders.view.customer-notified', ['date' => core()->formatDate($comment->created_at, 'Y-m-d H:i:s a')])
+                                @else
+                                    <span class="text-2xl text-red-600 bg-red-100 rounded-full icon-cancel-1 h-fit"></span>
+
+                                    @lang('admin::app.sales.orders.view.customer-not-notified', ['date' => core()->formatDate($comment->created_at, 'Y-m-d H:i:s a')])
+                                @endif
+                            </p>
+                        </div>
+
+                        <span class="block w-full border-b dark:border-gray-800"></span>
+                    @endforeach
+                </div>
+
+                {!! view_render_event('bagisto.admin.sales.order.left_component.after', ['order' => $order]) !!}
+            </div>
+
+            <!-- Right Component -->
+            <div class="flex w-[360px] max-w-full flex-col gap-2 max-sm:w-full">
+                {!! view_render_event('bagisto.admin.sales.order.right_component.before', ['order' => $order]) !!}
+
+                <!-- Customer and address information -->
+                <x-admin::accordion>
+                    <x-slot:header>
+                        <p class="p-2.5 text-base font-semibold text-gray-600 dark:text-gray-300">
+                            @lang('admin::app.sales.orders.view.customer')
+                        </p>
+                    </x-slot>
+
+                    <x-slot:content v-pre>
+                        <div class="{{ $order->billing_address ? 'pb-4' : '' }}">
+                            <div class="flex flex-col gap-1.5">
+                                <p
+                                    class="font-semibold text-gray-800 dark:text-white"
+                                    v-pre
+                                >
+                                    {{ $order->customer_full_name }}
+                                </p>
+
+                                {!! view_render_event('bagisto.admin.sales.order.customer_full_name.after', ['order' => $order]) !!}
+
+                                <p
+                                    class="text-gray-600 dark:text-gray-300"
+                                    v-pre
+                                >
+                                    {{ $order->customer_email }}
+                                </p>
+
+                                {!! view_render_event('bagisto.admin.sales.order.customer_email.after', ['order' => $order]) !!}
+
+                                <p
+                                    class="text-gray-600 dark:text-gray-300"
+                                    v-pre
+                                >
+                                    @lang('admin::app.sales.orders.view.customer-group') : {{ $order->is_guest ? core()->getGuestCustomerGroup()?->name : ($order->customer->group->name ?? '') }}
+                                </p>
+
+                                {!! view_render_event('bagisto.admin.sales.order.customer_group.after', ['order' => $order]) !!}
+                            </div>
+                        </div>
+
+                        <!-- Billing Address -->
+                        @if ($order->billing_address)
+                            <span class="block w-full border-b dark:border-gray-800"></span>
+
+                            <div class="{{ $order->shipping_address ? 'pb-4' : '' }}">
+
+                                <div class="flex items-center justify-between">
+                                    <p class="py-4 text-base font-semibold text-gray-600 dark:text-gray-300">
+                                        @lang('admin::app.sales.orders.view.billing-address')
+                                    </p>
+                                </div>
+
+                                @include ('admin::sales.address', ['address' => $order->billing_address])
+
+                                {!! view_render_event('bagisto.admin.sales.order.billing_address.after', ['order' => $order]) !!}
+                            </div>
+                        @endif
+
+                        <!-- Shipping Address -->
+                        @if ($order->shipping_address)
+                            <span class="block w-full border-b dark:border-gray-800"></span>
+
+                            <div class="flex items-center justify-between">
+                                <p class="py-4 text-base font-semibold text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.shipping-address')
+                                </p>
+                            </div>
+
+                            @include ('admin::sales.address', ['address' => $order->shipping_address])
+
+                            {!! view_render_event('bagisto.admin.sales.order.shipping_address.after', ['order' => $order]) !!}
+                        @endif
+                    </x-slot>
+                </x-admin::accordion>
+
+                <!-- Order Information -->
+                <x-admin::accordion>
+                    <x-slot:header>
+                        <p class="p-2.5 text-base font-semibold text-gray-600 dark:text-gray-300">
+                            @lang('admin::app.sales.orders.view.order-information')
+                        </p>
+                    </x-slot>
+
+                    <x-slot:content>
+                        <div class="flex justify-start w-full gap-5">
+                            <div class="flex flex-col gap-y-1.5">
+                                <p class="text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.order-date')
+                                </p>
+
+                                <p class="text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.order-status')
+                                </p>
+
+                                <p class="text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.channel')
+                                </p>
+                            </div>
+
+                            <div class="flex flex-col gap-y-1.5">
+                                {!! view_render_event('bagisto.admin.sales.order.created_at.before', ['order' => $order]) !!}
+
+                                <!-- Order Date -->
+                                <p class="text-gray-600 dark:text-gray-300">
+                                    {{core()->formatDate($order->created_at) }}
+                                </p>
+
+                                {!! view_render_event('bagisto.admin.sales.order.created_at.after', ['order' => $order]) !!}
+
+                                <!-- Order Status -->
+                                <p class="text-gray-600 dark:text-gray-300">
+                                    {{$order->status_label}}
+                                </p>
+
+                                {!! view_render_event('bagisto.admin.sales.order.status_label.after', ['order' => $order]) !!}
+
+                                <!-- Order Channel -->
+                                <p class="text-gray-600 dark:text-gray-300">
+                                    {{$order->channel_name}}
+                                </p>
+
+                                {!! view_render_event('bagisto.admin.sales.order.channel_name.after', ['order' => $order]) !!}
+                            </div>
+                        </div>
+                    </x-slot>
+                </x-admin::accordion>
+
+                <!-- Payment and Shipping Information-->
+                <x-admin::accordion>
+                    <x-slot:header>
+                        <p class="p-2.5 text-base font-semibold text-gray-600 dark:text-gray-300">
+                            @lang('admin::app.sales.orders.view.payment-and-shipping')
+                        </p>
+                    </x-slot>
+
+                    <x-slot:content>
+                        <div>
+                            <!-- Payment method -->
+                            <p class="font-semibold text-gray-800 dark:text-white">
+                                {{ core()->getConfigData('sales.payment_methods.' . $order->payment->method . '.title') }}
+                            </p>
+
+                            <p class="text-gray-600 dark:text-gray-300">
+                                @lang('admin::app.sales.orders.view.payment-method')
+                            </p>
+
+                            <!-- Currency -->
+                            <p
+                                class="pt-4 font-semibold text-gray-800 dark:text-white"
+                                v-pre
+                            >
+                                {{ $order->order_currency_code }}
+                            </p>
+
+                            <p class="text-gray-600 dark:text-gray-300">
+                                @lang('admin::app.sales.orders.view.currency')
+                            </p>
+
+                            @php $additionalDetails = \Webkul\Payment\Payment::getAdditionalDetails($order->payment->method); @endphp
+
+                                <!-- Additional details -->
+                            @if (! empty($additionalDetails))
+                                <p
+                                    class="pt-4 font-semibold text-gray-800 dark:text-white"
+                                    v-pre
+                                >
+                                    {{ $additionalDetails['title'] }}
+                                </p>
+
+                                <p
+                                    class="text-gray-600 dark:text-gray-300"
+                                    v-pre
+                                >
+                                    {{ $additionalDetails['value'] }}
+                                </p>
+                            @endif
+
+                            {!! view_render_event('bagisto.admin.sales.order.payment-method.after', ['order' => $order]) !!}
+                        </div>
+
+                        <!-- Shipping Method and Price Details -->
+                        @if ($order->shipping_address)
+                            <span class="block w-full mt-4 border-b dark:border-gray-800"></span>
+
+                            <div class="pt-4">
+                                <p
+                                    class="font-semibold text-gray-800 dark:text-white"
+                                    v-pre
+                                >
+                                    {{ $order->shipping_title }}
+                                </p>
+
+                                <p class="text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.shipping-method')
+                                </p>
+
+                                <p class="pt-4 font-semibold text-gray-800 dark:text-white">
+                                    {{ core()->formatBasePrice($order->base_shipping_amount) }}
+                                </p>
+
+                                <p class="text-gray-600 dark:text-gray-300">
+                                    @lang('admin::app.sales.orders.view.shipping-price')
+                                </p>
+                            </div>
+
+                            {!! view_render_event('bagisto.admin.sales.order.shipping-method.after', ['order' => $order]) !!}
+                        @endif
+                    </x-slot>
+                </x-admin::accordion>
+
+                <!-- Invoice Information-->
+                <x-admin::accordion>
+                    <x-slot:header>
+                        <p class="p-2.5 text-base font-semibold text-gray-600 dark:text-gray-300">
+                            @lang('admin::app.sales.orders.view.invoices') ({{ count($order->invoices) }})
+                        </p>
+                    </x-slot>
+
+                    <x-slot:content>
+                        @forelse ($order->invoices as $index => $invoice)
+                            <div class="grid gap-y-2.5">
+                                <div>
+                                    <p class="font-semibold text-gray-800 dark:text-white">
+                                        @lang('admin::app.sales.orders.view.invoice-id', ['invoice' => $invoice->increment_id ?? $invoice->id])
+                                    </p>
+
+                                    <p class="text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatDate($invoice->created_at, 'd M, Y H:i:s a') }}
+                                    </p>
+                                </div>
+
+                                <div class="flex gap-2.5">
+                                    <a
+                                        href="{{ route('admin.sales.invoices.view', $invoice->id) }}"
+                                        class="text-sm text-blue-600 transition-all hover:underline"
+                                    >
+                                        @lang('admin::app.sales.orders.view.view')
+                                    </a>
+
+                                    <a
+                                        href="{{ route('admin.sales.invoices.print', $invoice->id) }}"
+                                        class="text-sm text-blue-600 transition-all hover:underline"
+                                    >
+                                        @lang('admin::app.sales.orders.view.download-pdf')
+                                    </a>
+                                </div>
+                            </div>
+
+                            @if ($index < count($order->invoices) - 1)
+                                <span class="block w-full mt-4 mb-4 border-b dark:border-gray-800"></span>
+                            @endif
+                        @empty
+                            <p class="text-gray-600 dark:text-gray-300">
+                                @lang('admin::app.sales.orders.view.no-invoice-found')
+                            </p>
+                        @endforelse
+                    </x-slot>
+                </x-admin::accordion>
+
+                <!-- Shipment Information-->
+                <x-admin::accordion>
+                    <x-slot:header>
+                        <p class="p-2.5 text-base font-semibold text-gray-600 dark:text-gray-300">
+                            @lang('admin::app.sales.orders.view.shipments') ({{ count($order->shipments) }})
+                        </p>
+                    </x-slot>
+
+                    <x-slot:content>
+                        @forelse ($order->shipments as $shipment)
+                            <div class="grid gap-y-2.5">
+                                <div>
+                                    <!-- Shipment Id -->
+                                    <p class="font-semibold text-gray-800 dark:text-white">
+                                        @lang('admin::app.sales.orders.view.shipment', ['shipment' => $shipment->id])
+                                    </p>
+
+                                    <!-- Shipment Created -->
+                                    <p class="text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatDate($shipment->created_at, 'd M, Y H:i:s a') }}
+                                    </p>
+                                </div>
+
+                                <div class="flex gap-2.5">
+                                    <a
+                                        href="{{ route('admin.sales.shipments.view', $shipment->id) }}"
+                                        class="text-sm text-blue-600 transition-all hover:underline"
+                                    >
+                                        @lang('admin::app.sales.orders.view.view')
+                                    </a>
+                                </div>
+                            </div>
+                        @empty
+                            <p class="text-gray-600 dark:text-gray-300">
+                                @lang('admin::app.sales.orders.view.no-shipment-found')
+                            </p>
+                        @endforelse
+                    </x-slot>
+                </x-admin::accordion>
+
+                <!-- Refund Information -->
+                <x-admin::accordion>
+                    <x-slot:header>
+                        <p class="p-2.5 text-base font-semibold text-gray-600 dark:text-gray-300">
+                            @lang('admin::app.sales.orders.view.refund')
+                        </p>
+                    </x-slot>
+
+                    <x-slot:content>
+                        @forelse ($order->refunds as $refund)
+                            <div class="grid gap-y-2.5">
+                                <div>
+                                    <p class="font-semibold text-gray-800 dark:text-white">
+                                        @lang('admin::app.sales.orders.view.refund-id', ['refund' => $refund->id])
+                                    </p>
+
+                                    <p class="text-gray-600 dark:text-gray-300">
+                                        {{ core()->formatDate($refund->created_at, 'd M, Y H:i:s a') }}
+                                    </p>
+
+                                    <p class="mt-4 font-semibold text-gray-800 dark:text-white">
+                                        @lang('admin::app.sales.orders.view.name')
+                                    </p>
+
+                                    <p
+                                        class="text-gray-600 dark:text-gray-300"
+                                        v-pre
+                                    >
+                                        {{ $refund->order->customer_full_name }}
+                                    </p>
+
+                                    <p class="mt-4 font-semibold text-gray-800 dark:text-white">
+                                        @lang('admin::app.sales.orders.view.status')
+                                    </p>
+
+                                    <p class="text-gray-600 dark:text-gray-300">
+                                        @lang('admin::app.sales.orders.view.refunded')
+
+                                        <span class="font-semibold text-gray-800 dark:text-white">
+                                            {{ core()->formatBasePrice($refund->base_grand_total) }}
+                                        </span>
+                                    </p>
+                                </div>
+
+                                <div class="flex gap-2.5">
+                                    <a
+                                        href="{{ route('admin.sales.refunds.view', $refund->id) }}"
+                                        class="text-sm text-blue-600 transition-all hover:underline"
+                                    >
+                                        @lang('admin::app.sales.orders.view.view')
+                                    </a>
+                                </div>
+                            </div>
+                        @empty
+                            <p class="text-gray-600 dark:text-gray-300">
+                                @lang('admin::app.sales.orders.view.no-refund-found')
+                            </p>
+                        @endforelse
+                    </x-slot>
+                </x-admin::accordion>
+
+                {!! view_render_event('bagisto.admin.sales.order.right_component.after', ['order' => $order]) !!}
+            </div>
+        </div>
+    </div>
+</x-admin::layouts>

+ 1 - 0
packages/Webkul/Admin/src/Http/Resources/CartResource.php

@@ -51,6 +51,7 @@ class CartResource extends JsonResource
             $this->mergeWhen($this->giftcard_number, [
                 'giftcard_number'           => $this->giftcard_number,
                 'giftcard_amount'           => $this->giftcard_amount,
+                'base_giftcard_amount'           => $this->base_giftcard_amount,
                 'remaining_giftcard_amount' => $this->remaining_giftcard_amount,
             ]),
         ];

+ 2 - 2
packages/Webkul/Sales/src/Transformers/OrderResource.php

@@ -74,8 +74,8 @@ class OrderResource extends JsonResource
             'items'                    => OrderItemResource::collection($this->items)->jsonSerialize(),
             $this->mergeWhen($this->giftcard_number, [
                 'giftcard_number'           => $this->giftcard_number,
-                'giftcard_amount'           => $this->giftcard_amount,
-                'remaining_giftcard_amount' => $this->remaining_giftcard_amount,
+                'giftcard_amount'           =>  $this->giftcard_amount,
+                'base_giftcard_amount'           =>  $this->base_giftcard_amount,
             ]),
         ];
     }

+ 1 - 0
packages/Webkul/Shop/src/Http/Resources/CartResource.php

@@ -51,6 +51,7 @@ class CartResource extends JsonResource
             $this->mergeWhen($this->giftcard_number, [
                 'giftcard_number'           => $this->giftcard_number,
                 'giftcard_amount'           => $this->giftcard_amount,
+                'base_giftcard_amount'           => $this->base_giftcard_amount,
                 'formatted_giftcard_amount'           => core()->formatPrice($this->giftcard_amount),
                 'remaining_giftcard_amount' => $this->remaining_giftcard_amount,
                 'formatted_remaining_giftcard_amount' => core()->formatPrice($this->remaining_giftcard_amount),