@extends('layouts.portal') @section('title', 'Analytics') @section('subtitle', 'Revenue, enrollments, exam results, sales pipeline and attendance for the last '.$span.' months.') @section('actions')
@endsection @section('content') @php $series = fn (array $values) => collect($labels)->map(fn ($l, $i) => ['label' => $l, 'value' => $values[$i] ?? 0])->all(); $periodRevenue = array_sum($revenueSeries); $periodEnrol = array_sum($enrollSeries); $funnelOrder = ['new' => 'New', 'contacted' => 'Contacted', 'qualified' => 'Qualified', 'converted' => 'Converted', 'lost' => 'Lost']; $funnelTotal = max(1, array_sum($leadFunnel)); $methodLabel = fn ($m) => ucwords(str_replace('_', ' ', (string) ($m ?: 'other'))); $attTotal = array_sum($attStatus); $attOverall = $attTotal - ($attStatus['excused'] ?? 0) > 0 ? round((($attStatus['present'] ?? 0) + ($attStatus['late'] ?? 0)) / ($attTotal - ($attStatus['excused'] ?? 0)) * 100, 1) : null; @endphp| Batch | Classes | Learners | Average attendance | Below min. |
|---|---|---|---|---|
| {{ $r['batch']->course?->title }} {{ $r['batch']->batch_code }} |
{{ $r['sessions'] }} | {{ $r['learners'] }} | {{ rtrim(rtrim(number_format($r['avg'], 1), '0'), '.') }}% |
@if($r['low']){{ $r['low'] }}@else0@endif |