@extends('admin.layout.master') @section('css') @endsection @section('css') @endsection @section('content')
{{-- start order details --}}
{{ __('admin.show') }} - {{ __('admin.product_order') }}

{{ __('admin.order_num') }}
{{ $order->order_num??'' }}
{{ __('admin.category') }}
{{ $order->category?->name??'' }}
@if($order->subCategory)
{{ __('admin.sub_category') }}
{{ $order->subCategory->name??'' }}
@endif @if($order->provider)
{{ __('admin.provider_name') }}
{{ $order->provider->name??'' }}
@endif
{{ __('admin.order_status') }}
{{ $order->StatusText??'' }}
@if(!$order->parent_id)
{{ __('admin.pay_type') }}
{{ $order->PayTypeText??'' }}
{{ __('admin.order_pay_status') }}
{{ $order->PayStatusText }}
@endif @if($order->delivery_type)
{{ __('admin.delivery_type') }}
@if($order->delivery_type == 'delivery') {{ __('admin.delivery') }} @else {{ __('admin.pickup') }} @endif
@endif @if($order->lat && $order->lng)
{{ __('admin.location') }}
{{ $order->map_desc ?? '-' }}
@endif
{{ __('admin.order_date') }}
{{ \Carbon\Carbon::parse($order->created_at)->format('d/m/Y H:i') }}
@if(!$order->parent_id)
{{ __('admin.vat_value') }}
{{ $order->vat_amount . ' ' . __('admin.SAR') }}
{{ __('admin.admin_commission') }}
{{ $order->admin_commission . ' ' . __('admin.SAR') }}
@endif {{-- //coupon --}} @if ($order->coupon_num !== null)
{{ __('admin.coupon_num') }}
{{ $order->coupon_num }}
@endif @if ($order->coupon_type !== null)
{{ __('admin.coupon_type') }}
{{ $order->coupon_type }}
@endif @if ($order->coupon_value !== null)
{{ __('admin.coupon_value') }}
{{ $order->coupon_value }}
@endif
{{ __('admin.products_price') }}
{{ $order->total_products . ' ' . __('admin.SAR') }}
@if($order->deliver_price > 0)
{{ __('admin.delivery_price') }}
{{ $order->deliver_price . ' ' . __('admin.SAR') }}
@endif @if(!$order->parent_id)
{{ __('admin.final_total_price') }}
{{ $order->final_total . ' ' . __('admin.SAR') }}
@endif {{-- Return Deduction Information (for return orders) --}} @if($order->parent_id && $order->return_deduction_percentage > 0)
{{ __('admin.return_deduction_percentage') }}
{{ number_format($order->return_deduction_percentage, 2) . ' %' }}
@php $deductionAmount = $order->final_total * ($order->return_deduction_percentage / 100); $userWillTake = $order->final_total - $deductionAmount; @endphp
{{ __('admin.deduction_amount') }}
{{ number_format($deductionAmount, 2) . ' ' . __('admin.SAR') }}
{{ __('admin.user_will_take') }}
{{ number_format($userWillTake, 2) . ' ' . __('admin.SAR') }}
@endif {{-- Deposit Information --}} @if($order->deposit_amount > 0)
{{ __('admin.deposit_amount') }}
{{ number_format($order->deposit_amount, 2) . ' ' . __('admin.SAR') }}
@if($order->deposit_percentage > 0)
{{ __('admin.deposit_percentage') }}
{{ number_format($order->deposit_percentage, 2) . ' %' }}
@endif
{{ __('admin.deposit_paid') }}
@if($order->deposit_paid) {{ __('admin.yes') }} @else {{ __('admin.no') }} @endif
@if($order->remaining_amount > 0)
{{ __('admin.remaining_amount') }}
{{ number_format($order->remaining_amount, 2) . ' ' . __('admin.SAR') }}
@endif @endif @if($order->notes)
{{ __('admin.notes') }}
@endif {{-- //canceled --}} @if ($order->status == \App\Enums\OrderStatusEnum::PRODUCTS_CANCELED && $order->cancel_reason_id !== null)
{{ __('admin.cancel_reason') }}
@endif {{-- Order Products Section --}} @if($order->orderProducts && $order->orderProducts->count() > 0)
{{ __('admin.order_products') }}
@foreach($order->orderProducts as $orderProduct) @endforeach
{{ __('admin.product_name') }} {{ __('admin.variant') }} {{ __('admin.quantity') }} {{ __('admin.unit_price') }} {{ __('admin.total_price') }} {{ __('admin.supplies') }}
{{ $orderProduct->product->name ?? '-' }} @if($orderProduct->variant) @if($orderProduct->variant->sku)
{{ __('admin.sku') }}: {{ $orderProduct->variant->sku ?? '-' }}
@endif @php // Use saved product price from order $savedProductPrice = $orderProduct->product_price ?? null; @endphp @if($savedProductPrice && $savedProductPrice > 0)
{{ __('admin.price') }}: {{ number_format($savedProductPrice, 2) }} {{ __('admin.SAR') }} ({{ __('admin.price_per_unit') }}) {{ __('admin.order_price') }}
@endif @if($orderProduct->variant->options && $orderProduct->variant->options->count() > 0)
{{ __('admin.options') }}: @foreach($orderProduct->variant->options as $option) {{ $option->feature->name ?? '' }}: {{ $option->name ?? '-' }} @endforeach
@elseif($orderProduct->variant->variantOptions && $orderProduct->variant->variantOptions->count() > 0)
{{ __('admin.options') }}: @foreach($orderProduct->variant->variantOptions as $variantOption) @if($variantOption->featureOption) {{ $variantOption->featureOption->feature->name ?? '' }}: {{ $variantOption->featureOption->name ?? '-' }} @endif @endforeach
@endif @else - @endif
{{ $orderProduct->quantity ?? '-' }} @php // Use saved product price from order $savedProductPrice = $orderProduct->product_price ?? null; @endphp @if($savedProductPrice && $savedProductPrice > 0) {{ number_format($savedProductPrice, 2) }} {{ __('admin.SAR') }} {{ __('admin.order_price') }} @else - @endif @php $quantity = $orderProduct->quantity ?? 1; $savedProductPrice = $orderProduct->product_price ?? 0; $totalProductPrice = $savedProductPrice * $quantity; @endphp @if($savedProductPrice > 0) {{ number_format($totalProductPrice, 2) }} {{ __('admin.SAR') }} @else - @endif @if($orderProduct->supplies && $orderProduct->supplies->count() > 0) @foreach($orderProduct->supplies as $supply) @php $supplyQuantity = $supply->pivot->quantity ?? 1; // Use saved supply price from order, fallback to supply price if not saved $savedSupplyPrice = $supply->pivot->price ?? null; $supplyPrice = $savedSupplyPrice ?? (float) ($supply->price ?? 0); $supplyTotal = $supplyPrice * $supplyQuantity; @endphp
{{ $supply->name }} ({{ $supplyQuantity }}) - {{ number_format($supplyTotal, 2) }} {{ __('admin.SAR') }} @if($savedSupplyPrice) {{ __('admin.order_price') }} @endif
@endforeach @else - @endif
@endif
{{-- end order details --}} {{-- user details --}}
{{ __('admin.user_details') }}

{{ __('admin.name') }}
{{ $order?->user?->name }}
{{ __('admin.phone') }}
{{ $order?->user?->full_phone }}
{{ __('admin.email') }}
{{ $order->user->email ?? '' }}
{{ __('admin.ban_status') }}
@if ($order?->user?->is_blocked)
{{ __('admin.Prohibited') }}
@else
{{ __('admin.Unspoken') }}
@endif
{{ __('admin.activation') }}
@if ($order?->user?->active)
{{ __('admin.active') }}
@else
{{ __('admin.disactive') }}
@endif
{{-- end user details --}} {{-- provider details --}} @if($order->provider)
{{ __('admin.provider_details') }}

{{ __('admin.name') }}
{{ $order->provider->name }}
{{ __('admin.phone') }}
{{ $order->provider->full_phone }}
{{ __('admin.ban_status') }}
@if ($order->provider->is_blocked)
{{ __('admin.Prohibited') }}
@else
{{ __('admin.Unspoken') }}
@endif
{{ __('admin.activation') }}
@if ($order->provider->active)
{{ __('admin.active') }}
@else
{{ __('admin.disactive') }}
@endif
@endif {{-- end provider details --}} {{-- rate --}} @if ($order->rates && $order->rates->count() > 0)
{{ __('admin.order_rate') }}

@foreach($order->rates as $rate) @endforeach
{{ __('admin.rate') }} {{ __('admin.comment') }}
{{ $rate->rate ?? '' }} {{ $rate->comment ?? '' }}
@endif {{-- rate --}} {{-- start map --}} @if($order->delivery_type == 'delivery' && $order->lat && $order->lng)
{{ __('admin.location') }}


@endif {{-- end map --}}
@endsection @section('js') @if($order->delivery_type == 'delivery' && $order->lat && $order->lng) {{-- //////map --}} @endif @endsection