{{-- ============ Header ============ --}}
SANBS CRM
South African National Blood Service — Donor Relations
Dashboard Report
{{ $role_label }} view
{{-- ============ Meta strip ============ --}} @foreach ([ 'Scope' => $scope, 'Period' => $period, 'Generated by' => $generated_by, 'Generated at' => $generated_at->format('d M Y, H:i'), ] as $metaLabel => $metaValue) @endforeach
{{ $metaLabel }}
{{ $metaValue }}
{{-- ============ KPI cards ============ --}} @php $kpiConfig = [ 'total_active_tickets' => ['label' => 'Total Active Tickets', 'accent' => '#DA291C'], 'total_blood_drives' => ['label' => 'Upcoming Drives', 'accent' => '#E11D48'], 'total_site_contacts' => ['label' => 'Total Site Contacts', 'accent' => '#2563EB'], 'national_conversion_rate' => ['label' => 'Conversion Rate', 'accent' => '#059669'], 'acknowledgement_sla' => ['label' => 'Acknowledgement SLA', 'accent' => '#D97706'], 'upcoming_events' => ['label' => 'Upcoming Events', 'accent' => '#0284C7'], 'active_drps' => ['label' => 'Active DRPs', 'accent' => '#7C3AED'], 'stakeholder_meeting_sla' => ['label' => 'Stakeholder Meeting SLA', 'accent' => '#4F46E5'], ]; @endphp
Key Performance Indicators
@foreach (array_chunk(array_keys($kpiConfig), 4) as $row) @foreach ($row as $key) @endforeach @endforeach
{{ $kpiConfig[$key]['label'] }}
{{ $kpis[$key]['value'] ?? '—' }}
{{ $kpis[$key]['subtitle'] ?? '' }}
{{-- ============ Pipeline analytics ============ --}} @php $stages = $pipeline_analytics['stages'] ?? []; $maxStageTotal = max(1, collect($stages)->max('total') ?? 1); @endphp @if (!empty($stages))
Pipeline Analytics
@foreach ($stages as $stage) @endforeach
Stage Volume Tickets Avg Days Conversion
{{ $stage['label'] ?? '-' }} @if (!empty($stage['bottleneck'])) Bottleneck @endif
{{ $stage['total'] ?? 0 }} {{ $stage['avg_days'] ?? '-' }} {{ $stage['conversion_rate'] ?? 0 }}%
@endif {{-- ============ Zone leaderboard (SNM/Admin) ============ --}} @if (!empty($zone_leaderboard))
Zone Performance Leaderboard
@foreach ($zone_leaderboard as $zoneRow) @endforeach
# Zone HDR Branches DRPs Open Tickets Conversion Score
{{ $zoneRow['rank'] ?? '-' }} {{ $zoneRow['name'] ?? '-' }} {{ $zoneRow['hdr_name'] ?? '-' }} {{ $zoneRow['branch_count'] ?? 0 }} {{ $zoneRow['drp_count'] ?? 0 }} {{ $zoneRow['open_tickets'] ?? 0 }} {{ $zoneRow['conversion_rate'] ?? 0 }}% {{ $zoneRow['score'] ?? 0 }}
@endif {{-- ============ Branch health (SNM/Admin) ============ --}} @if (!empty($branch_health)) @php $riskStyles = [ 'low' => ['bg' => '#ECFDF5', 'text' => '#047857', 'label' => 'Healthy'], 'medium' => ['bg' => '#FFFBEB', 'text' => '#B45309', 'label' => 'Watch'], 'high' => ['bg' => '#FEF2F2', 'text' => '#B91C1C', 'label' => 'Critical'], ]; @endphp
Branch Health Matrix
@if (!empty($branch_health_header))
{{ $branch_health_header }}
@endif @foreach ($branch_health as $branchRow) @php $risk = $riskStyles[$branchRow['risk'] ?? 'low'] ?? $riskStyles['low']; @endphp @endforeach
Branch Zone DRP Open Tickets Conversion Status
{{ $branchRow['name'] ?? '-' }} {{ $branchRow['zone'] ?? '-' }} {{ $branchRow['drp_name'] ?? '-' }} {{ $branchRow['open_tickets'] ?? 0 }} {{ $branchRow['conversion_rate'] ?? 0 }}% {{ $risk['label'] }}
@endif {{-- ============ Ticket categories (HDR/DRP) ============ --}} @if (!empty($ticket_categories)) @php $maxCategory = max(1, max(array_values((array) $ticket_categories))); @endphp
Workload by Ticket Category
@foreach ((array) $ticket_categories as $categoryName => $categoryCount) @endforeach
Category Volume Tickets
{{ $categoryName }}
{{ $categoryCount }}
@endif {{-- ============ Site contact insights ============ --}} @if (!empty($site_contact_insights))
Site Contact Insights
Total Contacts
{{ $site_contact_insights['total'] ?? 0 }}
Repeat Hosts
{{ $site_contact_insights['repeat_hosts'] ?? 0 }}
Top Organisations
{{ count($site_contact_insights['top_orgs'] ?? []) }}
@php $topOrgs = collect($site_contact_insights['top_orgs'] ?? [])->take(8); $maxOrgTickets = max(1, $topOrgs->max('tickets') ?? 1); @endphp @if ($topOrgs->isNotEmpty()) @foreach ($topOrgs as $org) @endforeach
Organisation Drive Requests Tickets
{{ $org['organization'] ?? '-' }}
{{ $org['tickets'] ?? 0 }}
@endif
@endif {{-- ============ Footer ============ --}}
SANBS CRM — Confidential. Generated from live dashboard data. {{ $generated_at->format('d M Y H:i') }}