@include('layouts.header')
@php use Carbon\Carbon; $currency = session('currency_shortcut', 'INR'); $symbol = session('currency_symbol', '₹'); // Raw status from DB (can have emoji / HTML entities) $rawStatus = trim($orderStatus ?? 'pending'); // 👈 use $orderStatus, not $order->order_status $status = mb_strtolower($rawStatus, 'UTF-8'); // 1) Decode HTML entities (pending🕓 → pending⏳) $decodedStatus = html_entity_decode($rawStatus, ENT_QUOTES, 'UTF-8'); // 2) Remove emoji / symbols so we only keep letters, numbers & spaces // "pending⏳" → "pending" // "In Progress☛" → "In Progress" $plainStatus = preg_replace('/[^\p{L}\p{N}\s]/u', '', $decodedStatus); // 3) Lowercase for comparison $statusForCheck = mb_strtolower($plainStatus, 'UTF-8'); // Progress + unified label $showProgressBar = true; $progressPercent = 0; $progressLabel = ''; $normalizedStatus = 'Pending'; // helper $contains = function ($needle) use ($statusForCheck) { return mb_strpos($statusForCheck, mb_strtolower($needle, 'UTF-8')) !== false; }; // Cancelled / failed → hide bar & set label if ($contains('cancel')) { $showProgressBar = false; $normalizedStatus = 'Cancelled'; // 100% → Success / Completed / Paid } elseif ($contains('success') || $contains('completed') || $contains('paid')) { $progressPercent = 100; $normalizedStatus = 'Success'; // 75% → Delivered } elseif ($contains('delivered')) { $progressPercent = 75; $normalizedStatus = 'Delivered'; // 50% → In Progress / Processing / Out for Delivery } elseif ($contains('in progress') || $contains('processing') || $contains('out for delivery')) { $progressPercent = 50; $normalizedStatus = 'Out for Delivery'; // 25% → Default Pending } else { $progressPercent = 25; $normalizedStatus = 'Pending'; } // Label for progress bar (clean text) $progressLabel = $normalizedStatus; // Label for "Order Status" line (you can choose = decoded or normalized) $orderStatusLabel = $decodedStatus; // will show emoji // or use: $orderStatusLabel = $normalizedStatus; // plain text only // Placed date $orderDate = null; if (!empty($order->order_created_at)) { try { $orderDate = Carbon::parse($order->order_created_at); } catch (\Throwable $e) { $orderDate = null; } } elseif (!empty($order->created_at)) { $orderDate = $order->created_at instanceof Carbon ? $order->created_at : Carbon::parse($order->created_at); } @endphp

Order #{{ $order->order_id }}

{{-- 🔵 ORDER PROGRESS BAR (only if allowed) --}} @if($showProgressBar) @php // Background color for wrapper $progressBg = 'bg-warning'; // default if ($normalizedStatus === 'Success') { $progressBg = 'bg-success'; } elseif ($normalizedStatus === 'Delivered') { $progressBg = 'bg-orange'; } elseif ($normalizedStatus === 'Out for Delivery') { $progressBg = 'bg-info'; } elseif ($normalizedStatus === 'Cancelled') { $progressBg = 'bg-danger'; } @endphp
{{ $progressLabel }}
@endif
{{-- Order Summary --}}
Order Summary
  • Order ID: #{{ $order->order_id }}
  • @php $txnId = $order->transaction_id ?? $order->payment_id ?? $order->razorpay_payment_id ?? null; @endphp @if($txnId)
  • Transaction ID: {{ $txnId }}
  • @endif
  • Items: {{ $order->items->sum('product_quantity') }}
  • Payment Status: {{ ucfirst($order->user_payment_status ?? 'pending') }}
  • Order Status: {{ $normalizedStatus }}
  • @if($normalizedStatus == 'Cancelled')
  • Cancelled Reason: {{ ucfirst($orderListRow->cancel_remarks) }}
  • @endif
  • Placed on: @if($orderDate) {{ $orderDate->format('d M, Y h:i A') }} (IST) @else - @endif
  • Payment Method: {{ $order->user_payment_type }}
{{-- Shipping Address --}}
Shipping Address
  • {{ $order->user_name }}
  • @if($order->user_phone) Phone No: {{ $order->user_country_code ? '+' . $order->user_country_code . ' ' : '' }} {{ $order->user_phone }}
    @endif Address: {{ $order->user_address }}
    City: {{ $order->user_city }}, State: {{ $order->user_state }}
    Zipcode: {{ $order->user_pincode }}
    Country: {{ $order->country }}
  • @if($order->user_email)
  • {{ $order->user_email }}
  • @endif
{{-- Billing & Payment --}}
Billing & Payment
    @if(!empty($order->user_payment_type))
  • Payment Method: {{ $order->user_payment_type }}
  • @endif @if($order->user_payment_id)
  • Payment ID: {{ $order->user_payment_id }}
  • @endif
  • Subtotal: {{ $symbol }} {{ number_format($order->subtotal_amount, 2) }}
  • @if($order->discount_amount > 0)
  • Discount: - {{ $symbol }} {{ number_format($order->discount_amount, 2) }}
  • @endif @if($order->shipping_amount > 0)
  • Shipping: {{ $symbol }} {{ number_format($order->shipping_amount, 2) }}
  • @endif
Grand Total
{{ $symbol }} {{ number_format($order->grand_total, 2) }}
{{-- Order Items Table --}}

Items in this Order

@foreach($order->items as $item) @php $qty = $item->product_quantity ?? 1; $rate = $item->converted_currency_value ?? (float) session('currency_rate', 1); $basePrice = $item->product_price ?? 0; if (!is_null($item->sub_total_converted)) { $lineSubtotalConverted = (float) $item->sub_total_converted; } elseif (!is_null($item->sub_total)) { $lineSubtotalConverted = (float) $item->sub_total * $rate; } else { $lineSubtotalConverted = ($basePrice * $qty) * $rate; } $unitPriceConverted = $qty > 0 ? $lineSubtotalConverted / $qty : $lineSubtotalConverted; $img = $item->product_image ? asset($item->product_image) : asset('img/product/default.jpg'); @endphp @endforeach
Product Details Qty Price Total
{{ $item->product_name }}
{{ $item->product_category }}
{{ $qty }} {{ $symbol }} {{ number_format($unitPriceConverted, 2) }} {{ $symbol }} {{ number_format($lineSubtotalConverted, 2) }}
{{-- Back to orders --}}
@include('layouts.footer')
+