@extends('layouts.vendor') @section('page-title', 'Orders') @push('styles') @endpush @section('content')
{{-- Page Header --}} {{-- Stats Row --}}
@php $vendor = auth()->user()->vendor; $totalOrders = $orders->total(); $pendingCount = $orders->where('status', 'pending')->count(); $processingCount = $orders->where('status', 'processing')->count(); $deliveredCount = $orders->where('status', 'delivered')->count(); $totalEarnings = $orders->sum(function($o) use ($vendor) { return $o->items->where('vendor_id', $vendor->id)->sum('vendor_earnings'); }); @endphp
Total Orders {{ $totalOrders }}
Pending {{ $pendingCount }}
Processing {{ $processingCount }}
Earnings {{ price($totalEarnings) }}
{{-- Orders Table --}}
All Orders
@forelse($orders as $order) @empty @endforelse
Order # Customer Date Items Earnings Status Actions
{{ $order->order_number }} {{ $order->customer->name }} {{ $order->created_at->format('M d, Y') }} {{ $order->items->where('vendor_id', auth()->user()->vendor->id)->sum('quantity') }} {{ price($order->items->where('vendor_id', auth()->user()->vendor->id)->sum('vendor_earnings')) }} {{ ucfirst($order->status) }}
View @if($order->status === 'pending')
@csrf @method('PATCH')
@elseif($order->status === 'processing')
@csrf @method('PATCH')
@elseif($order->status === 'shipped')
@csrf @method('PATCH')
@endif

No orders yet

@if($orders->hasPages())
{{ $orders->links() }}
@endif
@endsection