@extends('layouts.app') @section('content')

{{ translate('Order Details') }}

@php $delivery_status = @$order->orderDetails->first()->delivery_status; $payment_status = @$order->payment_status; @endphp
@if(Auth::user()->user_type == 'admin') @else @endif

@if(!empty($order->shipping_address) && $order->shipping_address != 'null')
{{ json_decode(@$order->shipping_address)->name }}
{{ json_decode(@$order->shipping_address)->email }}
{{ json_decode(@$order->shipping_address)->phone }}
{{ json_decode(@$order->shipping_address)->address }} , {{ json_decode(@$order->shipping_address)->city }}, {{ json_decode(@$order->shipping_address)->state }} , {{ json_decode(@$order->shipping_address)->postal_code }}
{{ json_decode(@$order->shipping_address)->country }}
@if ($order->manual_payment && is_array(json_decode(@$order->manual_payment_data, true)))
{{ translate('Payment Information') }}
Name: {{ json_decode(@$order->manual_payment_data)->name }}, Amount: {{ single_price_new(json_decode(@$order->manual_payment_data)->amount) }}, TRX ID: {{ json_decode(@$order->manual_payment_data)->trx_id }}
@endif @else @php $addressInfo = \App\Address::where('user_id', $order->user_id)->first(); $userInfo = \App\User::where('id', $order->user_id)->first(); @endphp @if(!empty($addressInfo))
{{ @$userInfo->name }}
{{ @$userInfo->email }}
{{ @$userInfo->phone }}
{{ @$addressInfo->address }}, {{ @$addressInfo->city }}, {{ @$addressInfo->postal }}
{{ @$addressInfo->country }}

{{ translate('Payment Information') }}
Name: {{ @$userInfo->name }}, Amount: {{ single_price_new($order->grand_total) }}
@endif @endif
{{translate('Order #')}} {{ $order->code }}
{{translate('Order Date')}} @if($order->payment_type == 'letzpay') @php $orderDate = DB::table('order_old_created')->where('id', $order->id)->first(); @endphp {{ @$orderDate->created_at }} @else {{ date('d-m-Y h:i A', $order->date) }} @endif
{{translate('Total amount')}} {{ single_price_new($order->grand_total) }}
{{translate('Payment method')}} {{ ucfirst($payoption) }}
{{translate('Platform')}} {{ ucfirst(str_replace('_', ' ', $order->platform)) }}
{{translate('Download Invoice')}}

{{-- --}} @php $admin_user_id = \App\User::where('user_type', 'admin')->first()->id; @endphp @foreach (@$order->orderDetails as $key => $orderDetail) @php $productInfo = \App\Product::where('id', $orderDetail->product_id)->first(); if(!empty($orderDetail->variation)){ $productStock = \App\ProductStock::with('product')->where('product_id', $orderDetail->product_id)->where('variant', @$orderDetail->variation)->first(); }else{ $productStock = \App\ProductStock::with('product')->where('product_id', $orderDetail->product_id)->first(); } @endphp {{-- --}} @endforeach
# {{translate('Photo')}} {{translate('Description')}} {{translate('Managed By')}} {{translate('Delivery Type')}} {{translate('Qty')}} {{translate('Price')}} {{translate('Total')}} {{translate('Delivery Status')}}
{{ $key+1 }} @if (@$orderDetail->product != null) @else {{ translate('N/A') }} @endif @if (@$orderDetail->product != null) {{ $orderDetail->product->name }} {{ @$orderDetail->variation }}
{{ @$productStock->sku }} @if(!empty(@$orderDetail->awb_number))
AWB Number: {{$orderDetail->awb_number}} @endif @if($orderDetail->rev_awb_number != null)
Rev AWB Number: {{$orderDetail->rev_awb_number}} @endif @else {{ translate('Product Unavailable') }} @endif
@if(@$productInfo->manage_by == 0) Ecom @else {{@$productInfo->productSeller->name}} @endif
@if($orderDetail->order_invoice != "") {{substr(@$orderDetail->order_invoice, 0, -4)}} @endif
@if (@$orderDetail->shipping_type != null && @$orderDetail->shipping_type == 'home_delivery') {{ translate('Home Delivery') }} @elseif (@$orderDetail->shipping_type == 'pickup_point') @if (@$orderDetail->pickup_point != null) {{ @$orderDetail->pickup_point->name }} ({{ translate('Pickup Point') }}) @else {{ translate('Home Delivery') }} @endif @endif {{ @$orderDetail->quantity }} {{ single_price_new(@$orderDetail->price/$orderDetail->quantity) }} {{ single_price_new(@$orderDetail->price) }} @if(@$orderDetail->payment_status == "paid") @if(! empty($orderDetail->rev_awb_number)) (Return)
{{ ucwords($orderDetail->orderDetailStatus->return_delivery_status) ?? 'return' }} @else @if($orderDetail->shipment_service == 'Ecom Express') {{ ucwords(orderStatusInfo(@$orderDetail->delivery_status)) }} @else {{ $orderDetail->delivery_status }} @endif @endif @elseif(@$orderDetail->payment_status == "refunded") {{ ucfirst($orderDetail->delivery_status) }} @elseif(@$orderDetail->payment_status == "failed") {{ translate('Failed') }} @else {{ translate('Pending') }} @endif
@if(@$order->coupon_discount > 0) @endif
{{translate('Sub Total')}} : @if(($order->payment_type == 'letzpay')) {{ single_price_new(@$order->orderDetails->sum('price')) }} @else {{ single_price_new(@$order->orderDetails->sum('price') - @$order->orderDetails->sum('tax')) }} @endif
{{translate('Tax')}} : @if((@$order->payment_type == 'letzpay')) 0.00 @else {{ single_price_new(@$order->orderDetails->sum('tax')) }} @endif
{{translate('Shipping & Handling Charge')}} : {{-- {{ single_price_new(@$order->orderDetails->sum('shipping_cost')) }} --}} @if(@$order->orderDetails->sum('price') < minShippingAmountOrder($order->id)) {{ single_price_new(shippingCharge()) }} @else {{ single_price_new(0) }} @endif
{{translate('Coupon')}} :

( @php if(!is_null(@$order->coupon_id)){ $coupon = \App\Coupon::where('id', $order->coupon_id)->first(); } @endphp {{@$coupon->code}})

{{single_price_new(@$order->coupon_discount)}}
{{translate('TOTAL')}} : {{-- {{ single_price_new(@$order->orderDetails->sum('price') + @$order->orderDetails->sum('shipping_cost')) }} --}} {{ single_price_new(@$order->grand_total) }}
@endsection @section('script') @endsection