{!! Theme::section('theme/user.purchase.menu',['page'=>'products']) !!}
{!! Theme::section('theme/user.purchase.purchase-sub-menu',['subpage'=>'products']) !!} @if(count($orders)>0) @php $cpShipments = $cpShipments ?? []; @endphp @if(count($orders) > 0) @foreach($orders as $order) @php $orderDetails = !empty($order->details) ? $order->details : []; $orderDetailsCount = is_countable($orderDetails) ? count($orderDetails) : 0; $business = null; $orderRowBg = ($loop->iteration % 2 === 1) ? '#f2f2f2' : '#ffffff'; if($order->currency=="INR"){ $currencyIcon=""; } else{ $currencyIcon=""; } $businessName=""; $businessUrl=""; if($order->to_user_id){ $user=\Auth::user()->present()->getUserById($order->to_user_id); if($user){ $businessName=$user->fullname; $businessUrl=$user->present()->url(); } } if ($orderDetailsCount > 0) { $tmp = $orderDetails[0]; if ($tmp && isset($tmp->community_business_id) && (int) $tmp->community_business_id !== 0) { $business = \Auth::user()->present()->getStoreById($tmp->community_business_id); } else { $business = \Auth::user()->present()->getStoreById($tmp->community_id ?? 0); } if (!empty($business)) { $businessName = $business->title; $businessUrl = URL::route('store', ['slug' => $business->slug]); } } $orderAmountSaved = (float) preg_replace('/[^0-9.\-]/', '', (string) ($order->amount ?? 0)); $orderTaxCandidates = [ ['title' => trim((string) ($order->product_tax_name ?? '')), 'perc' => (float) preg_replace('/[^0-9.\-]/', '', (string) ($order->product_tax ?? 0))], ['title' => trim((string) ($order->product_tax_name_1 ?? '')), 'perc' => (float) preg_replace('/[^0-9.\-]/', '', (string) ($order->product_tax_1 ?? 0))], ['title' => trim((string) ($order->product_tax_name_2 ?? '')), 'perc' => (float) preg_replace('/[^0-9.\-]/', '', (string) ($order->product_tax_2 ?? 0))], ]; $trackingItems = []; $trackingSeen = []; $pushTracking = function ($tracking, $source) use (&$trackingItems, &$trackingSeen) { $tracking = trim((string) $tracking); if ($tracking === '' || strtoupper($tracking) === 'PROCESSING') { return; } $key = strtoupper($tracking); if (isset($trackingSeen[$key])) { return; } $trackingSeen[$key] = true; $trackingItems[] = [ 'tracking' => $tracking, 'source' => $source, ]; }; $pushTracking($order->tracking_number ?? '', 'order'); if ($orderDetailsCount > 0) { foreach ($orderDetails as $tmpDetail) { $pushTracking($tmpDetail->tracking_number ?? '', 'item'); } } if (!empty($cpShipments) && !empty($order->order_id) && isset($cpShipments[$order->order_id])) { $pushTracking($cpShipments[$order->order_id], 'cp'); } $shippingService = trim((string) ($order->shipping_service_name ?? ($order->shipping_service_code ?? ($order->cp_service_code ?? '')))); $orderDateTime = trim((string) ($order->order_date_time ?? '')); $isValidOrderDateTime = ($orderDateTime !== '' && $orderDateTime !== '0000-00-00 00:00:00' && strtotime($orderDateTime)); @endphp @if($orderDetailsCount > 0) @foreach($orderDetails as $dtlsIndex => $dtls) @if($dtlsIndex === 0) @endif @endforeach @else @endif @endforeach @else @endif
{{trans('mytransactions.order-details')}} Cost {{ trans('mytransactions.seller') }} Logistics
@if($dtlsIndex === 0) {{ trans('mytransactions.transaction-id') }}: {{$order->transaction_id}}
{{ trans('mytransactions.date') }}: {{date("d F, Y",strtotime($order->created_at))}}

@endif @if($dtls->product) @php $product = $dtls->product; $productUrl = ''; if (!empty($business) && !empty($business->slug)) { $productUrl = URL::route('store', ['slug' => $business->slug])."/product/".$product->id; } else { $productUrl = \URL::route('productbuy',['id'=>$product->id]); } @endphp @if(!empty($product->image1)) @endif
{{$product->product_name}} @if(!empty($dtls->product_size)) ({{$dtls->product_size}}) @endif @if(!empty($dtls->product_color)) {{$dtls->product_color}} @endif

Quantity: {{$dtls->quantity}}

@else Item #{{$dtls->id ?? ''}} @endif
@php $qty = (float) preg_replace('/[^0-9.\-]/', '', (string) ($dtls->quantity ?? 0)); $unitPrice = (float) preg_replace('/[^0-9.\-]/', '', (string) ($dtls->price ?? 0)); $discountPerc = (float) preg_replace('/[^0-9.\-]/', '', (string) ($dtls->discount ?? 0)); $lineTotalAfter = (float) preg_replace('/[^0-9.\-]/', '', (string) ($dtls->amount ?? 0)); $lineShipping = (float) preg_replace('/[^0-9.\-]/', '', (string) ($dtls->shipping_cost ?? 0)); $lineSubtotal = round($unitPrice * $qty, 2); $lineDiscount = 0.0; if ($discountPerc > 0 && $lineSubtotal > 0) { $lineDiscount = round(($discountPerc / 100) * $lineSubtotal, 2); } $itemTaxLines = []; $lineTaxTotal = 0.0; if (!empty($orderTaxCandidates) && $lineTotalAfter > 0) { foreach ($orderTaxCandidates as $candidate) { $perc = (float) ($candidate['perc'] ?? 0); if ($perc > 0) { $title = trim((string) ($candidate['title'] ?? '')); $title = $title !== '' ? $title : trans('mytransactions.tax'); $percLabel = rtrim(rtrim(number_format($perc, 2, '.', ''), '0'), '.'); $amount = round(($lineTotalAfter * $perc / 100), 2); if ($amount > 0) { $itemTaxLines[] = ['title' => $title, 'perc_label' => $percLabel, 'amount' => $amount]; $lineTaxTotal = round($lineTaxTotal + $amount, 2); } } } } $lineGrandTotal = round($lineTotalAfter + $lineTaxTotal + max(0.0, $lineShipping), 2); @endphp Price:
Per Unit: {!! $currencyIcon !!} {{number_format($unitPrice, 2, '.', ',')}}
Qty: {{number_format($qty, 0, '.', ',')}}
Subtotal: {!! $currencyIcon !!} {{number_format($lineSubtotal, 2, '.', ',')}}
@if($lineDiscount > 0) Discount ({{$discountPerc}}%): - {!! $currencyIcon !!} {{number_format($lineDiscount, 2, '.', ',')}}
@endif @if(!empty($itemTaxLines)) @foreach($itemTaxLines as $line) {{$line['title']}} ({{$line['perc_label']}}%): {!! $currencyIcon !!} {{number_format($line['amount'], 2, '.', ',')}}
@endforeach @endif @if($lineShipping > 0) {{ trans('mytransactions.shipping') }}: {!! $currencyIcon !!} {{number_format($lineShipping, 2, '.', ',')}}
@endif Total: {!! $currencyIcon !!} {{number_format($lineGrandTotal, 2, '.', ',')}}
@if($businessName) {{$businessName}} @endif @if(!empty($business)) @php $storeAddr1 = trim((string) ($business->address_1 ?? ($business->address ?? ''))); $storeCity = trim((string) ($business->city ?? '')); $storeZip = trim((string) ($business->zip ?? ($business->postal_code ?? ''))); $storeState = trim((string) ($business->state ?? '')); $storeCountry = trim((string) ($business->country ?? '')); $storePhone = trim((string) ($business->phone ?? ($business->mobile ?? ''))); @endphp @if($storeAddr1 || $storeCity || $storeState || $storeCountry || $storeZip || $storePhone)

Seller/Store address

@if($storeAddr1){{$storeAddr1}}
@endif @if($storeCity){{$storeCity}}@endif @if($storeZip){{$storeCity ? ',' : ''}} {{$storeZip}}@endif
@if($storeState){{$storeState}}@endif @if($storeCountry){{$storeState ? ',' : ''}} {{$storeCountry}}@endif @if($storePhone)
{{ trans('mytransactions.cell') }}: {{$storePhone}}@endif @endif @endif
@if($shippingService !== '')

Shipping Method: {{ e($shippingService) }}

@endif @if(!empty($trackingItems)) @foreach($trackingItems as $tIndex => $tRow) @if($tIndex > 0)
@endif

Tracking No: {{ e($tRow['tracking']) }}

{{ trans('mytransactions.track-package') }} @endforeach @endif
@if((int) $order->delivery_option === 1)
{{ trans('mytransactions.pickup') }}
@if($isValidOrderDateTime) {{ trans('mytransactions.date') }}: {{date("d F Y",strtotime($orderDateTime))}}
{{ trans('mytransactions.time') }}: {{date("H:i A",strtotime($orderDateTime))}}
@endif {{ trans('mytransactions.cell') }}: {{$order->mobile}} @if(!empty($order->picked_by))

{{ trans('mytransactions.picked-by') }}:
{{$order->picked_by}}
@if(!empty($order->picked_date) && $order->picked_date !== '0000-00-00 00:00:00' && strtotime($order->picked_date)) {{ trans('mytransactions.date') }}: {{date("d F Y",strtotime($order->picked_date))}}
{{ trans('mytransactions.time') }}: {{date("H:i A",strtotime($order->picked_date))}}
@endif @endif @else
@if($isValidOrderDateTime) {{ trans('mytransactions.date') }}: {{date("d F Y",strtotime($orderDateTime))}}
{{ trans('mytransactions.time') }}: {{date("H:i A",strtotime($orderDateTime))}}
@endif

Buyer Shipping Address:

{{$order->full_name}}
@if($order->address_1){{$order->address_1}}
@endif @if($order->city){{$order->city}},@endif {{$order->zip}}
@if($order->state){{$order->state}},@endif {{$order->country}}
{{ trans('mytransactions.cell') }}: {{$order->mobile}} @endif
Order Total:
{!! $currencyIcon !!}{{ number_format($orderAmountSaved, 2, '.', ',') }}
{{ trans('mytransactions.transaction-id') }}: {{$order->transaction_id}}
{{ trans('mytransactions.date') }}: {{date("d F, Y",strtotime($order->created_at))}}

No products found for this order.
- - -
{{ trans('mytransactions.no-data-found') }}
{!! $orders->appends(request()->except('page'))->render() !!} @else
{{ trans('mytransactions.no-data-found') }} @endif


{!! Theme::section('page.profile.products.cp-tracking') !!}