@extends('backend.layouts.master') @section('content') @php $currentIndex = (int) ($order->order_status ?? 0); $nextIndex = $currentIndex + 1; // Do not allow moving to Cancelled (5) or return statuses via next button $nextStatus = ($nextIndex < 5) ? ($status[$nextIndex] ?? null) : null; $deliveryCost = $deliveryDetail ? ($deliveryDetail['delivery_cost'] ?? 0) : 0; @endphp

Order Details

Order Details
{{-- Cancelled --}} @if((int) $order->order_status === 5) @elseif((int) $order->order_status === 6) @elseif((int) $order->order_status === 7) {{-- Can still move forward --}} @elseif ($nextStatus) {{-- Delivered --}} @else Send Feedback Email @endif {{-- Copy Feedback Link (only when Delivered) --}} @if((int) $order->order_status === 4) @endif
@if(($order->fulfillment_type ?? '') === 'pickup') @elseif(($order->fulfillment_type ?? '') === 'delivery') @endif
Booking ID UF-{{ str_pad($order->id, 4, '0', STR_PAD_LEFT) }}
Order Status @php $statusColors = [ 0 => 'primary', 1 => 'info', 2 => 'secondary', 3 => 'warning', 4 => 'success', 5 => 'danger', 6 => 'dark', 7 => 'danger', ]; @endphp {{ $status[$order->order_status] ?? 'Unknown' }}
Contact Person {{ $order->user->name ?? '' }}
Company Name {{ $order->user->company_name ?? '' }}
Vat Number {{ $order->vat_number ?? '' }}
Email Address {{ $order->user->email ?? '' }}
Phone Number {{ admin_phone($order->user->phone_number ?? '') }}
Country {{ $order->user->country ?? '' }}
City {{ $order->user->city ?? '' }}
Complete Address {{ $order->user->complete_address ?? '' }}
Fulfillment Method @if(($order->fulfillment_type ?? '') === 'pickup') Branch Pickup @elseif(($order->fulfillment_type ?? '') === 'delivery') Home Delivery @else — @endif
Pickup Branch @if($order->branch) {{ $order->branch->name }}
{{ $order->branch->city }} @if($order->branch->address)
{{ $order->branch->address }} @endif
@else Branch not set @endif
Delivery Fee {{ config('constants.currency_symbol') }} {{ number_format((float) ($order->delivery_fee ?? 0), 2) }} (Free pickup)
Delivery City {{ $order->delivery_city ?: ($order->user->city ?? '—') }}
Delivery Zone @if(($order->delivery_zone ?? '') === 'jeddah') Jeddah @elseif(($order->delivery_zone ?? '') === 'other') Other (within Saudi Arabia) @elseif(($order->delivery_zone ?? '') === 'international') International @elseif(!empty($order->delivery_zone)) {{ ucfirst($order->delivery_zone) }} @else — @endif
Deliver To @php $shipParts = array_filter([ $order->user->complete_address ?? null, $order->delivery_city ?: ($order->user->city ?? null), $order->user->country ?? null, ]); @endphp @if(count($shipParts)) {{ implode(', ', $shipParts) }} @else — @endif
Customer Country {{ $order->user->country ?? '—' }}
Delivery Fee {{ config('constants.currency_symbol') }} {{ number_format((float) ($order->delivery_fee ?? 0), 2) }} @if((float) ($order->delivery_fee ?? 0) <= 0) (Free) @endif
Booking Date {{ $order->created_at->format('d M Y @ h:i A') }}
Last Updated {{ $order->updated_at->format('d M Y @ h:i A') }}
Special Instructions {!! $order->order_notes ? nl2br(e($order->order_notes)) : 'No instructions provided.' !!}
Action {{-- Cancel Order button (only status 0) --}} @if($order->order_status == 0) @if($order->payment_method === 'bank' && $order->amount_status === 'pending') Bank transfer is still Pending. Go to Payment & Finance tab → Approve or Reject first, then you can cancel. @else @endif @endif
@if((int) $order->order_status === 5)
Order Cancelled
@if($order->refund_notes) @endif @if($order->refund_receipt) @endif
Cancelled By {{ ucfirst($order->cancelled_by) }}
Cancelled At {{ $order->cancelled_at?->format('d M Y @ h:i A') }}
Reason {{ $order->cancel_reason }}
Refund Status @if($order->refund_status === 'pending') Pending @elseif($order->refund_status === 'processed') Processed
Refunded on: {{ $order->refunded_at?->format('d M Y') }} @else Not Applicable @endif
Refund Notes {{ $order->refund_notes }}
Refund Receipt View
@endif
@forelse ($OrderItems as $pdetail) @php $unitPrice = (float) $pdetail->base_price; $customPerUnit = (float) ($pdetail->customisation_price ?? 0); $lineTotal = ($unitPrice + $customPerUnit) * $pdetail->quantity; $colorRow = $pdetail->product?->productColors?->firstWhere('color_name', $pdetail->color); $productImage = $colorRow?->color_image ? asset('storage/products/color_image/' . $colorRow->color_image) : ($pdetail->product?->image ? asset('storage/products/' . $pdetail->product->image) : null); @endphp @empty @endforelse
Sr. No. Image Product Name Product Code Size Color Quantity Unit Price Customisation Sub Total
{{ $loop->iteration }} @if($productImage) {{ $pdetail->name }} @else - @endif {{ $pdetail->name }} {{ $pdetail->product->product_code ?? '-' }} {{ $pdetail->size }} {{ $pdetail->color }} {{ $pdetail->quantity }} {{ number_format($unitPrice, 0) }} {{ $customPerUnit > 0 ? number_format($customPerUnit, 0) : '-' }} {{ number_format($lineTotal, 0) }}
No items found

Product Customisation


@forelse ($OrderItems as $pdetail)

Product Name : {{ $pdetail['name'] }}

{{-- --}}
Product NameSize & Color Quantity Logo Method Logo Style Logo / Text Logo Placements
{{ $pdetail['size'] }} ({{ $pdetail['color'] }}) {{ $pdetail['quantity'] }} {{ $pdetail['logo_method'] ? Str::ucfirst($pdetail['logo_method']) : 'N/A' }} {{ $pdetail['logo_style'] ? Str::ucfirst($pdetail['logo_style']) : 'N/A' }} @if(($pdetail['logo_style'] ?? '') === 'Text' || (!empty($pdetail['logo_text']) && empty($pdetail['logo_file']))) {{ $pdetail['logo_text'] ?: '-' }} @elseif(!empty($pdetail['logo_file'])) View/Download @else - @endif {{ is_array($pdetail['placements']) ? implode(', ', array_column($pdetail['placements'], 'name')) : $pdetail['placements'] }}
@empty @endforelse
{{-- Split from OrderItems --}} @if($customisationTotal > 0) @endif {{-- From Orders table --}} @if($order->discount > 0) @endif @if((float) ($order->payment_fee ?? 0) > 0) @endif @if((float) ($order->store_credit_used ?? 0) > 0) @endif
Order Price {{ config('constants.currency_symbol') }} {{ number_format($baseTotal, 0) }}
Customisation {{ config('constants.currency_symbol') }} {{ number_format($customisationTotal, 0) }}
Subtotal (before discount) {{ config('constants.currency_symbol') }} {{ number_format($baseTotal + $customisationTotal, 0) }}
Discount – {{ config('constants.currency_symbol') }} {{ number_format($order->discount, 0) }}
Subtotal (after discount) {{ config('constants.currency_symbol') }} {{ number_format($order->sub_total, 0) }}
Fulfillment @if(($order->fulfillment_type ?? '') === 'pickup') Branch Pickup @if($order->branch)
{{ $order->branch->name }} — {{ $order->branch->city }}
{{ $order->branch->address }}
@endif @elseif(($order->fulfillment_type ?? '') === 'delivery') Home Delivery @if($order->delivery_city)
{{ $order->delivery_city }}
@endif @else — @endif
Delivery Fee {{ config('constants.currency_symbol') }} {{ number_format($order->delivery_fee ?? 0, 0) }}
Cash Fee {{ config('constants.currency_symbol') }} {{ number_format((float) $order->payment_fee, 0) }}
{{ !empty($order->prices_include_vat) ? 'VAT included (15%)' : 'VAT (15%)' }} {{ config('constants.currency_symbol') }} {{ number_format($order->vat, 0) }}
Total Price {{ config('constants.currency_symbol') }} {{ number_format($order->amount, 0) }}
Payment Method @if($order->payment_method == 'card') Card Payment @elseif($order->payment_method == 'bank') @if(($order->payment_channel ?? '') === 'stc') STC Pay @elseif(($order->payment_channel ?? '') === 'bank_transfer') Bank Transfer @else Bank Transfer Unspecified @endif @if((float) ($order->store_credit_used ?? 0) > 0) + Store Credit @endif @elseif($order->payment_method == 'cod') Cash @if((float) ($order->store_credit_used ?? 0) > 0) + Store Credit @endif @elseif($order->payment_method == 'store_credit') Store Credit @else Unknown @endif
Store Credit Used {{ config('constants.currency_symbol') }} {{ number_format((float) $order->store_credit_used, 2) }}
Amount via {{ $order->payment_method === 'cod' ? 'Cash' : ($order->payment_method === 'store_credit' ? 'Credit' : 'Bank/Other') }} {{ config('constants.currency_symbol') }} {{ number_format(max(0, (float) $order->amount - (float) $order->store_credit_used), 2) }}
Payment Date @php $paymentDate = null; if ($order->payment_method === 'card') { $paymentDate = $order->created_at; } elseif ($order->payment_method === 'store_credit') { $paymentDate = $order->created_at; } elseif ($order->payment_method === 'cod' && $paymentEntry) { $paymentDate = $paymentEntry->created_at; } elseif ($order->payment_method === 'bank' && $order->amount_status === 'succeeded') { $paymentDate = $order->updated_at; // timestamp of approval } @endphp @if ($paymentDate) {{ $paymentDate->format('d M Y @ h:i A') }} @else — @endif
{{-- --}} {{-- PAYMENT STATUS --}} {{-- --}} {{-- PAYMENT RECEIPT (ONLY BANK) --}} @if($order->payment_method == 'bank') {{-- --}} @endif {{-- BANK APPROVAL ACTIONS --}} @if($order->payment_method == 'bank' && $order->amount_status == 'pending') @endif @if($order->payment_method == 'cod' && $order->amount_status != 'succeeded') @endif
Detail Amount / InfoDate
Payment Status @if($order->amount_status == 'succeeded') Paid @elseif($order->amount_status == 'rejected') Rejected @else Pending @endif -
Payment Receipt @if($order->payment_receipt) View Receipt @else No receipt uploaded @endif -
Admin Actions
@csrf
@csrf
Receive Cash
@csrf
@if(!$deliveryDetail)
Add Delivery Details
@csrf
@endif @if($deliveryDetail)
Delivery Details
Delivery Company {{ $deliveryDetail['delivery_company'] }}
Date {{ date('d-m-Y',strtotime($deliveryDetail['d_date'])) }}
Tracking ID {{ $deliveryDetail['tracking_id'] }}
Tracking URL {{ $deliveryDetail['tracking_url'] }}
Delivery Cost {{ number_format($deliveryDetail['delivery_cost']) }}
@endif
Order Queries
No messages yet. Start the conversation.
@csrf
@if(($returnRequests ?? collect())->isNotEmpty())
Return / Refund Request
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @foreach($returnRequests as $returnRequest)
@if($returnRequest->isItemLevel() && (float) $returnRequest->amount_due > 0) @endif @if($returnRequest->isItemLevel() && (float) $returnRequest->amount_refund > 0) @endif @if($returnRequest->isItemLevel() && (float) $returnRequest->exchange_delivery_fee > 0) @endif @if($returnRequest->items->isNotEmpty()) @endif @if($returnRequest->method === 'bank' && ((float) $returnRequest->amount_refund > 0 || $returnRequest->isFull())) @endif @if($returnRequest->admin_notes) @endif @if($returnRequest->rejected_reason) @endif @if(!is_null($returnRequest->restore_stock)) @endif @if($returnRequest->refund_receipt) @endif @if($returnRequest->payment_receipt) @endif @if($returnRequest->approved_at) @endif @if($returnRequest->goods_received_at) @endif @if($returnRequest->shipped_at) @endif @if($returnRequest->processed_at) @endif
Type {{ $returnRequest->typeLabel() }}
Status @if($returnRequest->status === 'pending') Pending @elseif($returnRequest->status === 'approved' && $returnRequest->isItemLevel() && !$returnRequest->goods_received_at) Awaiting goods @elseif($returnRequest->status === 'approved' && $returnRequest->payment_status === 'pending') Awaiting payment @elseif($returnRequest->status === 'approved') Approved @elseif($returnRequest->status === 'rejected') Rejected @else Processed @endif
Method {{ $returnRequest->methodLabel() }}
Amount SAR {{ number_format((float) $returnRequest->amount, 2) }}
Amount PayableSAR {{ number_format((float) $returnRequest->amount_due, 2) }}
Refund AmountSAR {{ number_format((float) $returnRequest->amount_refund, 2) }}
Replacement DeliverySAR {{ number_format((float) $returnRequest->exchange_delivery_fee, 2) }}
Reason {{ $returnRequest->reason }}
Requested At {{ $returnRequest->created_at?->format('d M Y @ h:i A') }}
Items @foreach($returnRequest->items as $line) {{ $line->orderItem->name ?? 'Item' }} ({{ $line->original_size }}{{ $line->new_size ? ' → '.$line->new_size : '' }}) × {{ $line->quantity }} @if(!$loop->last)
@endif @endforeach
Account Holder{{ $returnRequest->account_holder }}
Bank Name{{ $returnRequest->bank_name }}
IBAN{{ $returnRequest->iban }}
Account Number{{ $returnRequest->account_number }}
SWIFT{{ $returnRequest->swift ?: '—' }}
Admin Notes{{ $returnRequest->admin_notes }}
Rejected Reason{{ $returnRequest->rejected_reason }}
Stock Restored{{ $returnRequest->restore_stock ? 'Yes' : 'No' }}
Refund Receipt View Receipt
Customer Payment Receipt View Receipt
Approved At{{ $returnRequest->approved_at->format('d M Y @ h:i A') }}
Goods Received{{ $returnRequest->goods_received_at->format('d M Y @ h:i A') }}
Replacement Shipped{{ $returnRequest->shipped_at->format('d M Y @ h:i A') }}
Processed At{{ $returnRequest->processed_at->format('d M Y @ h:i A') }}
@if($returnRequest->status === 'pending')
@csrf
Approve Request
@if($returnRequest->isFull())
@endif
@csrf
Reject Request
@endif @if($returnRequest->isItemLevel() && $returnRequest->status === 'approved' && !$returnRequest->goods_received_at)
@csrf
Mark Returned Goods as Received

Stock for returned sizes will be restored. Refund / replacement proceeds after this step.

@endif @if($returnRequest->isItemLevel() && $returnRequest->status === 'approved' && $returnRequest->goods_received_at && $returnRequest->payment_status === 'pending')
@csrf
Confirm Customer Payment

Amount due: SAR {{ number_format((float) $returnRequest->amount_due, 2) }}

@endif @if($returnRequest->request_type === 'exchange' && $returnRequest->status === 'approved' && $returnRequest->goods_received_at && $returnRequest->payment_status !== 'pending' && !($returnRequest->method === 'bank' && (float) $returnRequest->amount_refund > 0 && !$returnRequest->refund_receipt))
@csrf
Ship Replacement

Deducts new-size stock and completes the exchange.

@endif @if($returnRequest->status === 'approved' && $returnRequest->method === 'bank' && ($returnRequest->isFull() || ($returnRequest->goods_received_at && (float) $returnRequest->amount_refund > 0 && !$returnRequest->refund_receipt)))
@csrf
Mark Bank Refund as Processed
@endif
@endforeach
@endif
{{-- Cancel Order Modal --}} @endsection @push('js-script') @endpush