@extends('layouts.seller') @section('content')
Back

Order Information

@php $successOrders = \App\Models\Order::where('user_id', $order->user_id) ->whereIn('status', [7, 8]) ->count(); @endphp

Tracking Number: {{ $order->tracking_no }}

Date Ordered : {{ $order->created_at->format('F j, Y h:i A') }}

@if ($order->status == '8')

Date Completed : {{ $order->updated_at->format('F j, Y h:i A') }}

@endif
{{$order->user->name}} {{$order->user->last_name}}
{{$order->user->email}}
{{$order->user->phone}}
{{ $successOrders }} successful order out of {{ $successOrders }}
@foreach ($order->orderItems as $item) @if ($item->order->delivery_option == 2) @php $address = \App\Models\Addresses::find($item->order->addresses_id); @endphp @if($address) {{ $address->barangay }}, {{ $address->municipal }}, {{ $address->streets }} @else Address not found @endif

{{ $item->order->streets }}
{{ $item->order->description }}
@elseif ($item->order->delivery_option == 1)
For Pickup
@php $product = $order->orderItems->first()->product; $shopstreets = $product->user->shop->streets; $shopMunicipal = $product->user->shop->municipal ?? 'N/A'; $shopBarangay = $product->user->shop->barangay ?? 'N/A'; @endphp {{ $shopstreets }} {{ $shopBarangay }}, {{ $shopMunicipal }}
@endif @endforeach
@foreach ($order->orderItems as $item) @endforeach
Name Quantity Price Image
{{$item->product->name}} {{$item->qty}} @php // Fetch the price that is not the latest in terms of timestamp $activePrice = $item->product->productPrices() ->where('is_active', 1) ->where('created_at', '<', $item->created_at) // Compare timestamps ->orderBy('created_at', 'desc') // Order by descending timestamp ->first(); @endphp @if ($activePrice) ₱{{ number_format($activePrice->price, 2, '.', ',') }} @else No price available @endif @if ($item->product->product_images->isNotEmpty()) Product Image @else Image not found @endif
@php // Calculate grand total $grandTotal = 0; // Calculate subtotal foreach ($order->orderItems as $item) { if ($item->status == 0) { // Fetch the price based on timestamp comparison $activePrice = $item->product->productPrices() ->where('is_active', 1) ->where('created_at', '<', $item->created_at) // Compare timestamps ->orderBy('created_at', 'desc') // Order by descending timestamp ->first(); $originalPrice = $activePrice ? $activePrice->price : 0; $subtotal = $originalPrice * $item->qty; $grandTotal += $subtotal; } } @endphp

Grand Total: ₱{{ number_format($grandTotal, 2, '.', ',') }}

@if ($order->delivery_option == 1) @if ($order->status == '0') Pending @elseif ($order->status == '1') Approved Order @elseif ($order->status == '2') Packed @elseif ($order->status == '3') Ready for Pickup @elseif ($order->status == '7') Completed @elseif ($order->status == '8') Order Recieved @else Unknown Status @endif @else @if ($order->status == '0') Pending @elseif ($order->status == '1') Approved Order @elseif ($order->status == '2') Packed @elseif ($order->status == '3') Ready for Delivery @elseif ($order->status == '4') Order has been assigned to a rider @elseif ($order->status == '5') Order has been picked up @elseif ($order->status == '6') Order is on the way @elseif ($order->status == '7') Completed @elseif ($order->status == '8') Order Recieved @else Unknown Status @endif @endif



@if ($order->delivery_option == 1) For Pickup @elseif ($order->delivery_option == 2) For Delivery @endif
@if (in_array($order->status, [0, 1, 2])) @endif @if ($order->status == 8 || $order->status == 7) @if ($order->delivery_option == 2) View POD @endif @endif
@endsection