@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
| 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)
@else
Branch not set
@endif
{{ $order->branch->address }} @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 |
| 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 |
| Product Name | --}}Size & 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'] }} |
| 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 |
| Detail | Amount / Info | {{--Date | --}}
|---|---|---|
| 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 | ||
| Receive Cash | ||
| 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']) }} |
| 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 Payable | SAR {{ number_format((float) $returnRequest->amount_due, 2) }} |
| Refund Amount | SAR {{ number_format((float) $returnRequest->amount_refund, 2) }} |
| Replacement Delivery | SAR {{ 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') }} |