@php // Currency symbol and position $symbol = session('currency_symbol', '$'); $shortcut = session('currency_shortcut', 'USD'); function formatCurrency($symbol, $shortcut, $amount) { if ($shortcut == 'USD') { return $symbol . ' ' . number_format($amount, 2); } if ($shortcut == 'INR') { return $symbol . ' ' . number_format($amount, 2); } if ($shortcut == 'AED') { return number_format($amount, 2) . ' ' . $symbol; } // default return $symbol . ' ' . number_format($amount, 2); } @endphp My Orders | Uthhan Global @include('layouts.header')

My Orders

{{ $orders->count() ? $orders->count() . ' order(s) found' : 'No orders yet' }}
@forelse($orders as $order) @php $items = $order->items; $firstItem = $items->first(); @endphp @if($firstItem) @php // total quantity in this order $totalQty = $items->sum('product_quantity'); // order-level currency data $symbol = $firstItem->converted_currency_symbol ?? session('currency_symbol', '$'); $shortcut = session('currency_shortcut', 'USD'); // SUBTOTAL = sum of each item line total (converted) $subtotalConverted = $items->sum(function ($item) { if (!is_null($item->sub_total_converted)) { return (float) $item->sub_total_converted; } $rate = $item->converted_currency_value ?? (float) session('currency_rate', 1); $qty = $item->product_quantity ?? 1; $base = ($item->product_price ?? 0) * $qty; return $base * $rate; }); // SHIPPING (converted) – from first row (order-level) $shippingConverted = $firstItem->shipping_charge_total_converted ?? ( ($firstItem->shipping_charge_converted ?? 0) + ($firstItem->fuel_surcharge_converted ?? 0) + ($firstItem->gst_converted ?? 0) + ($firstItem->payment_gateway_charge_converted ?? 0) ); // DISCOUNT (converted) $discountConverted = $firstItem->discounted_per ?? 0; // GRAND TOTAL (converted) $grandTotalConverted = $firstItem->final_amount_converted ?? ($subtotalConverted + $shippingConverted - $discountConverted); // For product display – show first product + count $productTitle = $firstItem->product_name; if ($items->count() > 1) { $productTitle .= ' +' . ($items->count() - 1) . ' more'; } $productImage = $firstItem->product_image ? asset($firstItem->product_image) : asset('img/shop-cart/cp-1.jpg'); $orderStatusRaw = $order->order_status ?? $order->status ?? 'pending'; $statusSlug = strtolower($orderStatusRaw); $statusClass = 'order-status-pending'; if (in_array($statusSlug, ['completed', 'paid'])) { $statusClass = 'order-status-completed'; } elseif (in_array($statusSlug, ['cancelled', 'failed'])) { $statusClass = 'order-status-cancelled'; } @endphp {{-- Product cell --}} {{-- Qty --}} {{-- Status --}} {{-- Price = subtotal of products --}} {{-- Total = subtotal + shipping/charges - discount (grand total) --}} {{-- Action --}} @endif @empty @endforelse
Product Qty Status Price (Subtotal) Total (With Charges) Action
{{ $productTitle }}
Order #{{ $order->order_id }}
{{ optional($order->created_at)->format('d M, Y') }}
{{ $totalQty }} {{ strtoupper($orderStatusRaw) }} {{ formatCurrency($symbol, $shortcut, $subtotalConverted) }} {{ formatCurrency($symbol, $shortcut, $grandTotalConverted) }} View Details
You haven’t placed any orders yet.
@include('layouts.footer') {{-- Search popup etc... --}}
+
script src="{{ asset('js/jquery-ui.min.js') }}">