@extends('layouts.app') @section('title', 'Dashboard') @section('heading', 'Collection overview') @section('content') @php $metricCards = [ ['Active invoice value', 'active_value', 'bi-receipt', 'blue', 'Value currently in collection'], ['Outstanding amount', 'outstanding', 'bi-wallet2', 'violet', 'Balance still to be collected'], ['Overdue amount', 'overdue', 'bi-exclamation-triangle', 'red', 'Past expected payment date'], ['Paid this month', 'paid_this_month', 'bi-check2-circle', 'green', 'Payments received this month'], ]; $highPriorityCount = $priorities->filter(fn ($invoice) => $invoice->is_overdue || ($invoice->promised_payment_date?->lt(today()) && $invoice->outstanding_amount > 0))->count(); @endphp

LIVE PORTFOLIO

Good {{ now()->hour < 12 ? 'morning' : (now()->hour < 17 ? 'afternoon' : 'evening') }}, {{ str(auth()->user()->name)->before(' ')->ucfirst() }}.

Here is what needs your attention across the invoice portfolio.

Live dataUpdated {{ now()->format('h:i A') }}

Portfolio summary

Financial position across invoices you can access

@foreach ($metricCards as [$label, $key, $icon, $tone, $help])

{{ $label }}

LKR{{ number_format($metrics[$key], 0) }} {{ $help }}
@endforeach

Attention needed

Time-sensitive follow-ups and collection risks

Red items need immediate review
{{ $metrics['followups_today'] }}Follow-ups todayScheduled for today
{{ $metrics['followups_week'] }}Due this weekIncluding today
{{ $metrics['missed_promises'] }}Missed promisesPayment date passed
{{ $metrics['stale'] }}No update in 7+ daysFollow-up may be needed
{{ $metrics['older_than_30'] }}Pending 30+ daysLong-running invoices

Priority queue

@if($highPriorityCount){{ $highPriorityCount }} high@endif

Invoices ordered by promised and expected payment dates

ImmediateMonitor
@forelse ($priorities as $invoice) @php $high = $invoice->is_overdue || ($invoice->promised_payment_date?->lt(today()) && $invoice->outstanding_amount > 0); $followupOverdue = $invoice->next_followup_date?->lt(today()); $followupToday = $invoice->next_followup_date?->isToday(); @endphp @empty @endforelse
Invoice & customerOutstandingStatusAgeOwnerNext follow-upPriority
{{ strtoupper(substr($invoice->customer->company_name, 0, 1)) }}{{ $invoice->invoice_number }}{{ $invoice->customer->company_name }} {{ $invoice->currency }} {{ number_format($invoice->outstanding_amount, 0) }}of {{ number_format($invoice->total_amount, 0) }} {{ $invoice->status->label() }} {{ (int) $invoice->invoice_date->diffInDays(today()) }} days{{ $invoice->ageing_bucket }} bucket {{ strtoupper(substr($invoice->assignee->name, 0, 1)) }}{{ $invoice->assignee->name }} @if($invoice->next_followup_date){{ $followupToday ? 'Today' : $invoice->next_followup_date->format('d M Y') }}@elseNot scheduled@endif {{ $high ? 'High' : 'Monitor' }}

No active invoices

Invoices requiring attention will appear here.

@if ($priorities->isNotEmpty())@endif
@endsection