@php $statusBadge = [ 'DRAFT' => 'slate', 'SENT' => 'sky', 'PARTIAL' => 'amber', 'PAID' => 'emerald', 'OVERDUE' => 'rose', 'VOID' => 'slate', ]; $freqBadge = ['weekly' => 'sky', 'monthly' => 'violet', 'quarterly' => 'amber', 'yearly' => 'emerald']; $kindLabel = ['space' => __('Space rent'), 'wifi' => __('WiFi'), 'service' => __('Service'), 'other' => __('Other')]; $kindBadge = ['space' => 'violet', 'wifi' => 'cyan', 'service' => 'amber', 'other' => 'slate']; // Nav tabs across the different sorts of income. $tabMeta = [ 'all' => ['label' => __('All Income'), 'icon' => 'queue-list'], 'sales' => ['label' => __('Sales Receipts'), 'icon' => 'currency-dollar'], 'invoices' => ['label' => __('Income Invoices'), 'icon' => 'document-currency-dollar'], 'other' => ['label' => __('Other Income'), 'icon' => 'gift'], 'clients' => ['label' => __('Clients & Rentals'), 'icon' => 'building-office'], ]; // Stream badge (used in the unified All-Income ledger). $typeMeta = [ 'sales' => ['label' => __('Sales'), 'color' => 'indigo'], 'income' => ['label' => __('Income invoice'), 'color' => 'cyan'], 'other' => ['label' => __('Other'), 'color' => 'violet'], 'refund' => ['label' => __('Refund'), 'color' => 'rose'], ]; @endphp
{{-- Cashflow segmented control: Income (in) / Expenses (out). These two share one "Cashflow" sidebar entry; the toggle is how you move between them. --}} @if ($canManageCategories) {{ __('Categories') }} @endif @if ($canManage) {{ __('Add Client') }} {{ __('Income Invoice') }} @endif {{-- Comprehensive reporting-period filter, drives every card and table below. Segmented buttons on wide screens, dropdown on small ones. --}}
@php [$pStart, $pEnd, $pLabel] = $this->periodRange(); @endphp

{{ __('Reporting period') }}

{{ $pLabel }}

{{-- Segmented buttons (md and up) --}} {{-- Dropdown (small screens) --}} @if ($period === 'custom')
–
@endif
@foreach ($metrics as $m) @php $tone = $m['delta'] === null ? 'muted' : ($m['delta'] >= 0 ? 'up' : 'down'); $pill = ['up' => 'bg-emerald-50 text-emerald-700', 'down' => 'bg-rose-50 text-rose-700', 'muted' => 'bg-slate-100 text-slate-500'][$tone]; @endphp

{{ $m['label'] }}

{{ $m['value'] }}

@if ($m['delta'] !== null) {{ number_format(abs($m['delta']), 0) }}% {{ $m['deltaLabel'] }} @else {{ $m['sub'] }} @endif
@endforeach
@foreach ($tabMeta as $key => $meta) @endforeach
@if ($tab === 'all')
{{ __('Export') }}
@forelse ($allIncome as $row)
{{ $typeMeta[$row['type']]['label'] ?? ucfirst($row['type']) }} {{ optional($row['date'])->format('Y-m-d') }}

{{ $row['party'] }}

@if ($row['link_url']) {{ $row['link_label'] }} @else

{{ $row['description'] }}

@endif

{{ $row['sign'] < 0 ? '−' : '' }}{{ $row['currency'] }} {{ number_format($row['amount'], 2) }}

{{ $baseCode }} {{ number_format($row['base'], 2) }}

@empty
@endforelse
{{ __('Rows per page') }}
{{ $allIncome->links() }}
@elseif ($tab === 'sales')
{{ __('Export') }}
@forelse ($salesReceipts as $p) @php $inv = $p->invoice; @endphp

{{ $inv?->payerName() ?: '—' }}

@if ($inv) {{ $inv->invoice_number }} @endif

{{ $p->paid_at?->format('Y-m-d') }} · {{ $p->channel }}

{{ $inv?->currency_code }} {{ number_format((float) $p->amount, 2) }}

@empty
@endforelse
{{ __('Rows per page') }}
{{ $salesReceipts->links() }}
@elseif ($tab === 'invoices')

{{ __('Billed income.') }} {{ __('Rent, WiFi, services and one-offs raised as a real invoice to a client, with a due date, reminders and a Pay action, just like a sales bill.') }}

@if ($canManage) {{ __('Raise due now') }} @endif {{ __('Export') }}
@forelse ($invoices as $invoice)
{{ $invoice->invoice_number }}

{{ $invoice->payerName() ?: '—' }}

{{ $invoice->currency_code }} {{ number_format((float) $invoice->total, 2) }}

{{ __('Due') }} {{ $invoice->due_date?->format('Y-m-d') ?: '—' }} · {{ __('Bal') }} {{ number_format((float) $invoice->balance_due, 2) }}

@if ($canRecordPayment && $invoice->status !== 'VOID' && (float) $invoice->balance_due > 0.01) @endif @if ($canManage) @endif @if ($canDelete && ! $invoice->isDeletionLocked()) @endif
@empty
@endforelse
{{ __('Rows per page') }}
{{ $invoices->links() }}
@elseif ($tab === 'other')

{{ __('Unbilled income.') }} {{ __('Money that came in without an invoice, asset-sale proceeds, cash-up surplus and legacy charges. Recorded directly, often system-generated, with no invoice document.') }}

{{ __('Export') }}
@forelse ($otherIncome as $o) @php [$srcUrl, $srcLabel] = $this->otherIncomeSourceLink($o); @endphp
@if ($srcUrl) {{ $srcLabel }} @else

{{ $o->source_label ?: __('Other income') }}

@endif

{{ $o->description }}

{{ optional($o->received_on ?? $o->due_on)->format('Y-m-d') }}

@if ($o->isReceived()){{ __('Received') }}@else{{ __('Outstanding') }}@endif

{{ $o->currency_code }} {{ number_format((float) $o->amount, 2) }}

@empty
@endforelse
{{ __('Rows per page') }}
{{ $otherIncome->links() }}
@else

{{ __('Clients & Rentals') }}

{{ __('Recurring clients auto-raise and email their invoice ahead of each due date.') }}

@if ($canManage)
{{ __('Raise due now') }} {{ __('Add Client') }}
@endif
@forelse ($tenants as $tenant)

{{ $tenant->name }}

{{ $kindLabel[$tenant->kind] ?? ucfirst($tenant->kind) }}

{{ $tenant->currency_code }} {{ number_format((float) $tenant->rent_amount, 2) }} / {{ $tenant->frequency }}

@if ($tenant->arrears_base > 0)

{{ __('Arrears') }}: {{ $tenant->base_code }} {{ number_format($tenant->arrears_base, 2) }}

@endif

@if ($tenant->status === 'active'){{ __('Active') }}@else{{ __('Ended') }}@endif

@if ($canManage) @if ($tenant->status === 'active') @endif @endif @if ($canDelete) @endif
@empty
@endforelse
@endif
{{ __('Create Income Invoice') }}
{{ __('Cancel') }} {{ __('Create Invoice') }}
{{ __('Record Payment') }} @if ($payInvoice)— {{ $payInvoice->invoice_number }}@endif @if ($payInvoice)
{{ __('Client') }}{{ $payInvoice->payerName() ?: '—' }}
{{ __('Balance') }}{{ $payInvoice->currency_code }} {{ number_format((float) $payInvoice->balance_due, 2) }}
@endif
@if ($payInvoice && $payAccounts->isEmpty())

{{ __('No active account in :c, create one under Treasury.', ['c' => $payInvoice->currency_code]) }}

@endif

{{ __('Bank/EcoCash fee this account skims off the deposit. Booked as a bank charge. Leave blank if none.') }}

@if ($paySurcharge > 0)
{{ __('A surcharge of :amount will be added in treasury (invoice balance unaffected).', ['amount' => number_format($paySurcharge, 2)]) }}
@endif
{{ __('Cancel') }} {{ __('Record Payment') }}
{{ $tenantEditingId ? __('Edit Client') : __('Add Client') }}
@if ($t_auto_invoice)

{{ __('Then a reminder 2 days before the due date and again on the due date if unpaid.') }}

@endif

{{ __('First invoice is due on this date, then every period.') }}

@if ($tenantEditingId)
@endif
{{ __('Cancel') }} {{ __('Save') }}
{{ __('Income Categories') }}

{{ $editingCategoryId ? __('Edit Category') : __('Add Category') }}

{{ $editingCategoryId ? __('Update') : __('Add') }} @if ($editingCategoryId) @endif
@if ($categories->isNotEmpty())
@foreach ($categories as $category)
{{ $category->name }} @unless ($category->is_active){{ __('Inactive') }}@endunless
@endforeach
@else

{{ __('No categories yet. Add one above.') }}

@endif
{{ __('Done') }}