@extends('admin.admin_dashboard') @section('admin') @php $selectedBranch = $branchId; $branchName = $branches->firstWhere('id', $selectedBranch)?->name ?? 'All branches'; @endphp
{{-- Hero --}}
CH-SACCO Live @if($highlights['pending_drafts'] ?? 0) {{ $highlights['pending_drafts'] }} draft{{ $highlights['pending_drafts'] > 1 ? 's' : '' }} pending @endif

MSC Performance Dashboard

{{ $canViewAll ? ($selectedBranch ? $branchName : 'All branches — combined totals') : $branchName }} · {{ $year }} @if($highlights['latest_report_date'] ?? null) · Latest report {{ $highlights['latest_report_date'] }} @endif

@if($canCreate) New report @endif @if($canViewReports) Downloads All reports @endif
{{-- Filters --}}
@if($canViewAll)
@endif
@if($canViewReports)
@include('admin.chs.msc.partials.download-section', [ 'branches' => $branches, 'canViewAll' => $canViewAll, 'canViewSummary' => $canViewSummary, 'selectedBranch' => $selectedBranch, 'selectedYear' => $year, ])
@endif {{-- KPI row --}}
@foreach($kpis as $kpi)
{{ $kpi['label'] }}
0
{{ $kpi['delta_label'] ?? '' }}
@endforeach
@php $isOrgScope = empty($selectedBranch); $membershipChartHint = $isOrgScope ? 'Line = combined total across all branches at each month-end. Bars = new members reported that month.' : 'Line = total members at month-end for this branch. Bars = new members in that month\'s report.'; @endphp {{-- Stats strip --}}

{{ $membershipChartHint }}

Month-end cumulative total{{ $isOrgScope ? ' (all branches)' : '' }}.

Month-end cumulative total{{ $isOrgScope ? ' (all branches)' : '' }}.

@if($canViewSummary && count($branchComparison))
@endif
@forelse($compliance as $row)
{{ $row['branch'] }} {{ $row['submitted_this_month'] ? 'This month ✓' : 'Pending' }}
{{ $row['year_submissions'] }} submissions · {{ $row['compliance_pct'] }}% YTD pace
@empty

No compliance data for this scope.

@endforelse
@forelse($recentReports as $report) @empty @endforelse
Date Branch Status By
{{ $report->report_date?->format('d M Y') }} {{ $report->branch->name ?? '—' }} {{ $report->creator->name ?? '—' }} @if($canViewReports) Open @endif
No reports yet.
@endsection @push('styles') @endpush @push('vendor-scripts') @endpush @push('scripts') @include('admin.chs.msc.partials.dashboard-scripts', [ 'membershipTrend' => $membershipTrend, 'savingsTrend' => $savingsTrend, 'shareCapitalTrend' => $shareCapitalTrend, 'reportsByMonth' => $reportsByMonth, 'branchComparison' => $branchComparison, 'canViewSummary' => $canViewSummary, 'chartContext' => $chartContext ?? ['scope' => 'org', 'branch_name' => 'All branches'], 'dataUrl' => route('msc.dashboard.data'), ]) @endpush