@extends('layouts.admin') @section('title', 'Dashboard') @section('heading', 'Administration Overview') @use('App\Models\InternEvaluation', 'E') @use('App\Models\InternHospitalAllocation', 'Allocation') @section('content') @php // Workflow stages for the cycle chart — palette validated (CVD + contrast) with the dataviz validator. $stages = [ 'with_slmc' => ['Received by SLMC', '#059669', 'ri-lock-2-line'], 'director' => ['With director', '#4f46e5', 'ri-hospital-line'], 'returned' => ['Returned', '#ea580c', 'ri-arrow-go-back-line'], 'consultant' => ['With consultant', '#2563eb', 'ri-stethoscope-line'], 'draft' => ['Draft', '#94a3b8', 'ri-draft-line'], 'not_started' => ['Not started', '#e2e8f0', 'ri-time-line'], ]; $typeChip = ['main' => 'bg-white text-slmc', 'repeat' => 'bg-orange-500 text-white']; $cycleState = ['completed' => 'bg-emerald-400', 'current' => 'bg-white', 'upcoming' => 'bg-white/20']; $scope = $batch ? $batch->name : 'All batches'; @endphp {{-- ═════════ Batch filter (parent) ═════════ --}}
New batch
{{-- ═════════ Batch summary ═════════ --}}
@if($batch)
{{ $batch->typeLabel() }} batch · {{ $batch->year }} {{ $batch->code }}

{{ $batch->name }}

{{ $batch->starts_on->format('j M Y') }} – {{ $batch->ends_on->format('j M Y') }}

{{-- Cycle timeline --}}
Internship year progress{{ $batch->progressPercent() }}%
@foreach($batch->cycles as $c)
@php $pct = $c->state() === 'completed' ? 100 : ($c->state() === 'current' ? max(4, round($c->starts_on->diffInDays(now()) / max(1, $c->starts_on->diffInDays($c->ends_on)) * 100)) : 0); @endphp

Q{{ $c->quarter }} · P{{ $c->period }} @if($c->state() === 'current')Now@endif

@endforeach
@else

All batches

SLMC internship programme

Combined figures across every main and repeat batch. Choose a batch above to focus on one intake.

@foreach([['Batches', $batches->count()], ['Active', $batches->where('is_active', true)->count()]] as [$l, $v])

{{ $l }}

{{ $v }}

@endforeach
@endif
{{-- ═════════ KPIs ═════════ --}}
@foreach($kpis as [$label, $value, $icon, $tint, $url, $sub])

{{ number_format($value) }}

{{ $label }}

@if($sub)

{{ $sub }}

@endif
@endforeach
{{-- ═════════ Cycle progress chart ═════════ --}}

Evaluation progress by cycle

{{ $scope }} · {{ number_format($internCount) }} interns, one evaluation each per cycle

All evaluations
{{-- Legend --}} @if($internCount === 0)
No interns are allocated to {{ $batch ? 'this batch' : 'any batch' }} yet.
@else {{-- Table view --}}
Show as table
@foreach($stages as [$label])@endforeach @foreach($cycles as $q => $counts) @foreach($stages as $key => $s)@endforeach @endforeach
Cycle{{ $label }}
Evaluation {{ $q }}{{ $counts[$key] }}
@endif
{{-- ═════════ Needs attention ═════════ --}}

Needs attention

{{ $scope }}

Workflow totals

{{-- ═════════ Hospitals ═════════ --}}

Hospitals

{{ $batch ? 'Hospitals with interns in this batch' : 'Top hospitals by placements' }}

View all
@forelse($hospitals as $h) @empty @include('admin.partials.empty', ['cols' => 5, 'message' => 'No hospitals in this batch yet', 'icon' => 'ri-hospital-line']) @endforelse
HospitalInternsTo SLMC

{{ $h->name }}

{{ $h->code }}{{ $h->district ? ' · '.$h->district : '' }}

{{ $h->interns_count }} {{ $h->received_count }}
{{-- ═════════ Recent activity ═════════ --}}

Recent activity

@endsection