@php $tracker = $yearlyTracker ?? []; $year = (int) ($tracker['year'] ?? now()->year); $months = $tracker['months'] ?? []; $yearOptions = $tracker['year_options'] ?? [$year]; $yearLinks = $yearLinks ?? []; $fmt = function (array $metric): string { $actual = (float) ($metric['actual'] ?? 0); $formatted = ! empty($metric['money']) ? number_format($actual, 0) : number_format($actual, 0); return $formatted; }; $fmtTarget = function (array $metric): string { $target = (float) ($metric['target'] ?? 0); return ! empty($metric['money']) ? number_format($target, 0) : number_format($target, 0); }; $fmtPct = function (array $metric): string { if (empty($metric['show_pct'])) { return ''; } $pct = (float) ($metric['pct'] ?? 0); if (abs($pct - round($pct)) < 0.05) { return number_format($pct, 0).'%'; } return number_format($pct, 1).'%'; }; $columns = [ 'new' => 'New Loans', 'repeat' => 'Repeat Loans', 'performing' => 'Performing', 'arrears' => 'Arrears', 'revenue' => 'Revenue', 'gross' => 'Gross disbursement', ]; @endphp
@foreach ($columns as $label) @endforeach @foreach ($columns as $ignored) @endforeach @forelse ($months as $index => $row) @foreach (array_keys($columns) as $key) @php $metric = $row['metrics'][$key] ?? ['target' => 0, 'actual' => 0, 'pct' => 0, 'money' => false, 'show_pct' => true]; @endphp @endforeach @empty @endforelse
@if (! empty($yearLinks['prev']) && $year > 2020) ‹ {{ $year - 1 }} @endif {{ $tracker['title'] ?? ($year.' Performance') }} @if (! empty($yearLinks['next']) && $year < now()->year + 1) {{ $year + 1 }} › @endif
Month{{ $label }}
Target Actual
{{ $row['label'] }}{{ $fmtTarget($metric) }} {{ $fmt($metric) }} @if (! empty($metric['show_pct'])) {{ $fmtPct($metric) }} @endif
No yearly target data for this scope.