@php $cellTone = [ 'paid' => 'bg-emerald-500 text-white hover:bg-emerald-600', 'part' => 'bg-amber-400 text-white hover:bg-amber-500', 'unpaid' => 'bg-rose-500 text-white hover:bg-rose-600', 'waived' => 'bg-slate-200 text-slate-500 hover:bg-slate-300', 'upcoming' => 'bg-white text-slate-400 ring-1 ring-inset ring-slate-300 hover:bg-slate-50', ]; $statusLabel = [ 'paid' => __('Paid'), 'part' => __('Part paid'), 'unpaid' => __('Unpaid'), 'waived' => __('Written off'), 'upcoming' => __('Not yet due'), ]; $statusBadge = ['paid' => 'emerald', 'part' => 'amber', 'unpaid' => 'rose', 'waived' => 'slate', 'upcoming' => 'slate']; $freqLabel = ['weekly' => __('Weekly'), 'monthly' => __('Monthly'), 'quarterly' => __('Quarterly'), 'yearly' => __('Yearly')]; $money = fn ($v) => $base.' '.number_format((float) $v, 2); @endphp
@if ($canManage) {{ __('Add a bill') }} @endif {{-- KPI cards --}}
@foreach ($kpis as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach
{{-- Grid --}}

{{ __('Month by month') }}

{{ __('Click a square to pay it, see what paid it, or write it off. Click a bill for every payment ever made.') }}

@foreach ([6, 12, 24] as $m) @endforeach
@if ($rows->isEmpty())
@else
@foreach ($columns as $col) @endforeach @foreach ($rows as $row) @if (! $row['tracked']) @else @foreach ($row['cells'] as $cell) @endforeach @endif @endforeach
{{ __('Bill') }}{{ $col->format('M') }}{{ $col->format('y') }}{{ __('Owed') }}
{{ $freqLabel[$row['frequency']] ?? $row['frequency'] }} · {{ $row['currency'] }} {{ number_format($row['standing'], 2) }} @if ($row['category']) · {{ $row['category'] }} @endif {{ __('Not tracked yet: a standing estimate with no payments.') }} @if ($canManage) @endif
@forelse ($cell as $p) @empty · @endforelse
{{ $row['outstanding'] > 0 ? $money($row['outstanding']) : '—' }}
@foreach (['paid', 'part', 'unpaid', 'waived', 'upcoming'] as $s) {{ $statusLabel[$s] }} @endforeach
@endif
{{-- History of one bill --}} @isset($history)

{{ $history['label'] }}

{{ __('Every payment ever made on this bill.') }} {{ __('Paid in total :paid', ['paid' => $money($history['paid_total'])]) }}@if ($history['outstanding'] > 0), {{ __(':owed still owed', ['owed' => $money($history['outstanding'])]) }}@endif.

@if ($canManage) {{ __('Edit bill') }} @endif {{ __('Close') }}
@if ($canManage)@endif @forelse ($history['payments'] as $pay) @if ($canManage) @endif @empty @endforelse
{{ __('Paid on') }} {{ __('For') }} {{ __('From') }} {{ __('Note') }} {{ __('Amount') }}{{ __('Actions') }}
{{ $pay->incurred_on?->format('j M Y') }} {{ ($pay->is_recurring ? $pay->incurred_on : ($pay->bill_period_on ?? $pay->incurred_on))?->format('M Y') }} {{ $pay->fundAccount?->name ?? '—' }} {{ $pay->description }} {{ $pay->currency_code }} {{ number_format((float) $pay->amount, 2) }} @unless ($pay->is_recurring || str_starts_with((string) $pay->source_ref, 'recurring_expense:')) @endunless
@if ($canManage)

{{ __('File a payment already in Expenses') }}

{{ __('For rent or a utility keyed as an ordinary expense before this bill existed. Nothing moves in treasury, it only says which month it paid.') }}

{{ __('File it') }}
@if ($candidates->isEmpty())

{{ __('No unfiled expenses with this bill\'s category or supplier.') }}

@endif
@endif
@endisset {{-- ============================================== PERIOD MODAL --}} @isset($period) {{ $periodBill['label'] }} · {{ $period['due_on']->format('j M Y') }} @endisset @isset($period)
{{ $statusLabel[$period['status']] }} {{ __('Usually :amt', ['amt' => $money($period['expected'])]) }} · {{ __('paid :amt', ['amt' => $money($period['paid'])]) }} @if ($period['owing'] > 0) · {{ __(':amt owed', ['amt' => $money($period['owing'])]) }} @endif
@if ($period['payments'])
    @foreach ($period['payments'] as $pay)
  • {{ $pay->incurred_on?->format('j M Y') }} · {{ $pay->fundAccount?->name ?? __('no account') }} {{ $pay->currency_code }} {{ number_format((float) $pay->amount, 2) }}
  • @endforeach
@endif @if ($period['adjustment'])

{{ ($period['adjustment']['kind'] ?? '') === 'waived' ? __('Written off') : __('Settled') }}: {{ $period['adjustment']['reason'] ?? '' }}

@endif @if ($canManage && in_array($period['status'], ['unpaid', 'part', 'upcoming'], true))

{{ __('Record a payment') }}

{{ __('Record payment') }} {{ __('Saving…') }}

{{ __('Nothing was owed for this period') }}

{{ __('Rent waived, service paused. The period stops counting as owed, and the reason is kept.') }}

{{ __('Write off') }}
@endif @if ($canManage && $period['adjustment']) {{ __('Reopen this period') }} @endif
@endisset
{{ __('Close') }}
{{-- ================================================ NEW BILL --}} {{ $editingBillId ? __('Edit bill') : __('Add a recurring bill') }} @if ($showBillModal)
@if ($editingSelfPaid)

{{ __('This bill was set up on Expenses with a payment, so change its amount there.') }}

@endif

{{ __('Every period from this date counts as owed until it is paid. Set it back to when you started paying to bring in the history, then file the old payments against it.') }}

@endif
{{ __('Cancel') }} {{ $editingBillId ? __('Save') : __('Add bill') }}