@extends("admin.layouts.app") @section("title", __("admin.invoices.title")) @section("content")
@foreach([ "all" => __('common.form.all'), "unpaid" => __('admin.invoices.filter_unpaid'), {{-- Was missing: an invoice moves here when the customer files a transfer notification, and it showed under no tab at all - an invoice waiting for approval must be in plain sight. --}} "payment_pending" => __('admin.invoices.filter_payment_pending'), "paid" => __('admin.invoices.filter_paid'), "overdue" => __('admin.invoices.filter_overdue'), "cancelled" => __('admin.invoices.filter_cancelled'), "draft" => __('admin.invoices.filter_draft'), ] + (\App\Support\AutoCharge::enabled() {{-- Not a status. The invoices whose automatic card payment was sent and whose outcome could not be established, which is where the dashboard count links to. Offered only where the shop collects by card: a tab for something that cannot happen is worse than no tab. --}} ? [\App\Http\Controllers\Admin\InvoiceController::CHARGE_REVIEW_FILTER => __('admin.invoices.filter_charge_review')] : []) as $val => $label) @php $isActive = (request("status","unpaid") === $val); @endphp $val]) }}" style="display:inline-block;padding:8px 16px;font-size:13px;text-decoration:none;color:{{ $isActive ? "#1a4d80" : "#666" }};font-weight:{{ $isActive ? "700" : "400" }};border-bottom:{{ $isActive ? "3px solid #1a4d80" : "3px solid transparent" }};margin-bottom:-1px;"> {{ $label }} @endforeach
@include('admin.partials.list-filters', ['filters' => $filters, 'action' => route('admin.invoices.index'), 'keep' => ['status' => request('status')]])
@csrf
{{ __('admin.invoices.bulk_actions') }}:
@forelse($invoices as $invoice) @php $badgeClass = match(strtolower($invoice->status ?? "")) { "active", "paid" => "badge-paid", "pending", "payment_pending" => "badge-pending", "unpaid" => "badge-unpaid", "overdue" => "badge-overdue", "suspended" => "badge-suspended", "terminated" => "badge-terminated", "cancelled" => "badge-cancelled", "fraud" => "badge-fraud", "draft" => "badge-draft", "refunded" => "badge-refunded", default => "badge-cancelled", }; $statusKey = strtolower($invoice->status ?? ""); $statusLabel = $statusKey === "overdue" ? __('common.status.unpaid') . '/' . __('common.status.overdue') : (__('common.status.' . $statusKey) !== 'common.status.' . $statusKey ? __('common.status.' . $statusKey) : ucfirst($invoice->status ?? "")); $badgeStyle = $statusKey === "overdue" ? "background:#fff3cd !important;color:#856404 !important;" : ""; @endphp @empty @endforelse
{!! $filters->sortLink('invoice_num', __('common.table.invoice_num')) !!} {{ __('common.table.client') }} {!! $filters->sortLink('date', __('common.table.date')) !!} {!! $filters->sortLink('due', __('common.table.due_date')) !!} {!! $filters->sortLink('total', __('common.table.total')) !!} {{ __('common.table.status') }} {{ __('common.table.actions') }}
#{{ $invoice->invoice_num ?? $invoice->id }} @if($invoice->client) client_id) }}" style="color:#337ab7;text-decoration:none;">{{ $invoice->client->full_name }} @else N/A @endif {{ $invoice->date?->format(date_fmt()) ?? "-" }} {{ $invoice->due_date?->format(date_fmt()) ?? "-" }} {{ dual_money_fmt($invoice->total, $invoice) }} {{ $statusLabel }} {{ __('common.actions.view') }}
{{ __('admin.invoices.no_invoices') }}
{{ $invoices->withQueryString()->links() }}
@endsection