@extends('b2bportal::storefront.layouts.app') @php $primary = $orders->first(); $totals = [ 'subtotal' => $orders->sum('subtotal'), 'discount' => $orders->sum('discount_total'), 'tax' => $orders->sum('tax_total'), 'shipping' => $orders->sum('shipping_total'), 'grand' => $orders->sum('grand_total'), ]; $currency = config('constants.currency_symbol', '₹'); $badgeMap = [ 'pending'=>'bg-yellow-100 text-yellow-800','confirmed'=>'bg-blue-100 text-blue-800', 'processing'=>'bg-blue-100 text-blue-800','shipped'=>'bg-indigo-100 text-indigo-800', 'delivered'=>'bg-green-100 text-green-800','cancelled'=>'bg-red-100 text-red-700', 'refunded'=>'bg-gray-100 text-gray-700', ]; @endphp @section('title', 'Order ' . ($primary->order_number ?? '') . ' — ' . ($business->name ?? 'B2B Portal')) @section('content')
@include('b2bportal::storefront.components.account-nav')
← All orders

Order {{ $primary->order_number ?? '#'.$primary->id }}

Placed {{ optional($primary->placed_at)->format('d M Y · H:i') }} · Payment: {{ strtoupper($primary->payment_method_used) }} @if($primary->transaction && $primary->transaction->payment_status) · {{ $primary->transaction->payment_status }} @endif
@if(session('status'))
{{ session('status') }}
@endif @if($errors->any())
    @foreach($errors->all() as $e)
  • {{ $e }}
  • @endforeach
@endif {{-- ============================ SHIPPING TIMELINE ============================ --}}

Order status

    @foreach($timeline as $step)
  1. {{ $step['label'] }}
    @if($step['at'])
    {{ \Illuminate\Support\Carbon::parse($step['at'])->format('d M Y · H:i') }}
    @endif
  2. @endforeach
@if($primary->tracking_number)
Shipment tracking
{{ $primary->carrier ?? 'Courier' }}: {{ $primary->tracking_number }} @if($primary->tracking_url) · Track shipment ↗ @endif
@endif
{{-- ============================ PAYMENT ============================ --}} @if($primary->payment_method_used === 'upi' && optional($primary->transaction)->payment_status !== 'paid')

💳 Complete UPI payment

@if($paymentIntent && $paymentIntent['configured'])
UPI QR
Scan with any UPI app
Pay {{ $currency }}{{ number_format($paymentIntent['amount'], 2) }} to {{ $paymentIntent['upi_id'] }} ({{ $paymentIntent['payee_name'] }})
@foreach($paymentIntent['apps'] as $app)
{{ $app['label'] }}
Tap to open
@endforeach
Or open any installed UPI app →

After paying, enter your UTR and upload the payment screenshot so we can verify quickly.

@csrf
@if($primary->payment_proof_path) View previously uploaded proof @else @endif
@else
UPI is enabled but the merchant hasn't configured a UPI ID. Contact support.
@endif
@elseif($primary->payment_method_used === 'upi' && optional($primary->transaction)->payment_status === 'paid')
✅ UPI payment verified. Thank you!
@endif {{-- ============================ SHIPMENTS ============================ --}} @foreach($orders as $order)
{{ $order->order_number ?? 'Shipment #'.$order->id }}
Ships from location #{{ $order->location_id }} · {{ $order->status }}
{{ $currency }}{{ number_format($order->grand_total, 2) }}
@if($order->transaction_id) Download invoice @endif
@foreach(($order->cart_snapshot ?? []) as $line) @endforeach
Item Qty Unit Subtotal
{{ $line['name'] ?? '—' }} {{ $line['quantity'] ?? 0 }} {{ $currency }}{{ number_format($line['unit_price'] ?? 0, 2) }} {{ $currency }}{{ number_format($line['subtotal'] ?? 0, 2) }}
Subtotal
{{ $currency }}{{ number_format($order->subtotal, 2) }}
@if($order->discount_total > 0)
Discount
−{{ $currency }}{{ number_format($order->discount_total, 2) }}
@endif
Tax
{{ $currency }}{{ number_format($order->tax_total, 2) }}
Shipping
{{ $currency }}{{ number_format($order->shipping_total, 2) }}
@endforeach
Order total {{ $currency }}{{ number_format($totals['grand'], 2) }}
{{-- Address --}}

Shipping address

@php $addr = is_array($primary->shipping_address) ? $primary->shipping_address : (json_decode($primary->shipping_address ?? '{}', true) ?: []); @endphp
{{ $addr['name'] ?? '' }}
{{ $addr['line1'] ?? '' }}
@if(!empty($addr['line2'])) {{ $addr['line2'] }}
@endif {{ $addr['city'] ?? '' }}, {{ $addr['state'] ?? '' }} {{ $addr['pincode'] ?? '' }}
📞 {{ $addr['phone'] ?? '' }}
@endsection