@extends('layouts.app') @section('title', 'Orders') @section('content') @php $pills = filter_pills([ 'status' => ['Status', collect(\App\Models\Order::STATUSES)->map(fn ($s) => $s[0])->all()], 'pay' => ['Payment', ['unpaid' => 'Unpaid', 'partial' => 'Partly paid', 'paid' => 'Paid']], 'client_id' => ['Client', fn ($id) => optional($clients->firstWhere('id', $id))->name ?? $id], 'from' => ['From', fn ($d) => pretty_date($d)], 'to' => ['To', fn ($d) => pretty_date($d)], ]); $filtered = count($pills) > 0 || request()->filled('q'); $totalAll = array_sum($statusCounts->all()); @endphp @can('data.export') Export @endcan @can('orders.create') New order @endcan
All {{ $totalAll }} @foreach (\App\Models\Order::STATUSES as $key => [$label]) {{ $label }} {{ $statusCounts[$key] ?? 0 }} @endforeach
@forelse ($orders as $o) @php($open = ! in_array($o->status, ['delivered', 'cancelled'])) @empty @endforelse @if ($orders->total() > 0) @endif
Progress Actions
{{ $o->order_no }} {{ $o->client->name }} {{ $o->order_date->format('d M Y') }} {{ $o->delivery_date?->format('d M Y') ?? '—' }} @if ($open && $o->delivery_date?->isPast())overdue@endif @php($pg = $o->progressPercent())
{{ $pg }}%
{{ money($o->total) }} {{ $o->isCancelled() ? '—' : money($o->due()) }}
  • View
  • @can('orders.edit')
  • Edit
  • @endcan @can('amounts.view')
  • Invoice
  • @endcan @unless ($o->isCancelled()) @can('payments.create')
  • Receive payment
  • @endcan @endunless @can('orders.delete')
  • @endcan
    @can('orders.create') Create the first order @endcan
    All {{ $orders->total() }} matching {{ \Illuminate\Support\Str::plural('order', $orders->total()) }} (excl. cancelled) {{ money($sums['total']) }} {{ money($sums['paid']) }} paid {{ money($sums['due']) }}
    @endsection