@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
| 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()) }} |
|
||
|
| |||||||||
| All {{ $orders->total() }} matching {{ \Illuminate\Support\Str::plural('order', $orders->total()) }} (excl. cancelled) | {{ money($sums['total']) }} | {{ money($sums['paid']) }} paid | {{ money($sums['due']) }} | ||||||