{{-- Search Bar --}}
@foreach($machines as $m) @endforeach
{{-- 日期範圍 --}}
{{-- Table (Desktop) --}} {{-- Mobile Cards (xl:hidden) --}}
@forelse($invoices as $invoice)
@php $status = 'valid'; if (empty($invoice->invoice_no)) $status = 'failed'; if ($invoice->rtn_code === 'void') $status = 'void'; $statusMap = [ 'valid' => ['label' => __('Valid'), 'color' => 'emerald'], 'void' => ['label' => __('Void'), 'color' => 'rose'], 'failed' => ['label' => __('Failed'), 'color' => 'rose'], 'refunded' => ['label' => __('Refunded'), 'color' => 'slate'], ]; $s = $statusMap[$status] ?? ['label' => $status, 'color' => 'slate']; @endphp {{-- Card Header --}}

{{ $invoice->invoice_no }}

{{ $invoice->invoice_date }}

{{ ($invoice->machine_time ?? $invoice->created_at)->format('Y-m-d H:i:s') }}

{{-- Info Grid --}}

{{ __('Machine') }}

{{ $invoice->machine->name ?? ($invoice->order->machine->name ?? 'Unknown') }}

{{ $invoice->machine->serial_no ?? ($invoice->order->machine->serial_no ?? '---') }}

{{ __('Amount') }}

${{ number_format($invoice->amount, 0) }}

{{ __('Associated Order') }}

{{ $invoice->order->order_no ?? '---' }}

{{ __('Machine Time') }}

{{ ($invoice->machine_time ?? $invoice->created_at)->format('Y-m-d H:i:s') }}

{{-- Action Buttons --}}
@empty
@endforelse
{{-- Pagination --}}
{{ $invoices->links('vendor.pagination.luxury', ['page_param' => 'invoices_page']) }}