@props(['invoice' => null, 'status' => null])
@if ($invoice)
@php
// Headline is whether it is paid; Draft and Overdue ride along as tags,
// so an issued invoice nobody has paid reads "Unpaid", never "Sent".
$key = $invoice->displayStatus();
$color = ['UNPAID' => 'amber', 'PARTIAL' => 'sky', 'PAID' => 'emerald', 'VOID' => 'slate'][$key] ?? 'slate';
@endphp
merge(['class' => 'inline-flex flex-wrap items-center gap-1']) }}>
{{ $invoice->displayLabel() }}
@if ($invoice->isOverdue())
{{ __('Overdue') }}
@endif
@if ($invoice->isDraft())
{{ __('Draft') }}
@endif
@else
@php
// The original raw-status pill, kept for any caller that passes `status`.
$styles = [
'DRAFT' => 'bg-slate-100 text-slate-700 ring-slate-500/15',
'SENT' => 'bg-accent-50 text-accent-700 ring-accent-600/15',
'PARTIAL' => 'bg-brand-yellow-50 text-brand-yellow-800 ring-brand-yellow-600/20',
'PAID' => 'bg-emerald-50 text-emerald-700 ring-emerald-600/15',
'OVERDUE' => 'bg-brand-red-50 text-brand-red-700 ring-brand-red-600/15',
'VOID' => 'bg-slate-100 text-slate-400 line-through ring-slate-300/30',
];
$class = $styles[$status] ?? 'bg-slate-100 text-slate-700 ring-slate-500/15';
@endphp
merge(['class' => "inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-semibold uppercase tracking-wide ring-1 ring-inset {$class}"]) }}>
{{ $status }}
@endif