@if ($department)
{{ $department->name }} @if ($department->description) {{ $department->description }} @endif Kampus
@if ($this->periods->isNotEmpty())
KPI Period @foreach ($this->periods as $periodOption) @endforeach
@endif
@else
Please select a kampus from the dropdown to view its dashboard.
@endif @if ($period && $kpiSet && $this->firstKpiData) @php $data = $this->firstKpiData; $monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; @endphp {{-- KPIs Achievement Overview --}} @if ($this->allKpisData->isNotEmpty()) @php $totalKpis = $this->allKpisData->count(); $achievedKpis = $this->allKpisData->where('status', 'achieved')->count(); $partialKpis = $this->allKpisData->where('status', 'partial')->count(); $belowKpis = $this->allKpisData->where('status', 'below')->count(); $achievedPercentage = $totalKpis > 0 ? round(($achievedKpis / $totalKpis) * 100, 1) : 0; $partialPercentage = $totalKpis > 0 ? round(($partialKpis / $totalKpis) * 100, 1) : 0; $belowPercentage = $totalKpis > 0 ? round(($belowKpis / $totalKpis) * 100, 1) : 0; @endphp
KPI Achievement Overview {{ $achievedKpis }} of {{ $totalKpis }} KPIs achieved target
@if ($achievedKpis > 0)
@if ($achievedPercentage > 10) {{ $achievedPercentage }}% @endif
@endif @if ($partialKpis > 0)
@if ($partialPercentage > 10) {{ $partialPercentage }}% @endif
@endif @if ($belowKpis > 0)
@if ($belowPercentage > 10) {{ $belowPercentage }}% @endif
@endif
Achieved ≥100% ({{ $achievedKpis }})
Partial 50-99% ({{ $partialKpis }})
Below <50% ({{ $belowKpis }})
@endif {{-- KPIs by Project Overview --}} @if ($this->kpisByProject->isNotEmpty())
Achievement by Project
Achieved ≥100%
Partial 50-99%
Below <50%
@foreach ($this->kpisByProject as $project) @php $total = $project['total']; $achievedPct = $total > 0 ? ($project['achieved'] / $total) * 100 : 0; $partialPct = $total > 0 ? ($project['partial'] / $total) * 100 : 0; $belowPct = $total > 0 ? ($project['below'] / $total) * 100 : 0; $achievementRate = $total > 0 ? round(($project['achieved'] / $total) * 100, 1) : 0; @endphp
{{ $achievementRate }}%
@if ($project['achieved'] > 0)
@if ($achievedPct > 15) {{ $project['achieved'] }} @endif
@endif @if ($project['partial'] > 0)
@if ($partialPct > 15) {{ $project['partial'] }} @endif
@endif @if ($project['below'] > 0)
@if ($belowPct > 15) {{ $project['below'] }} @endif
@endif
{{ $project['project_name'] }} {{ $total }} KPIs
@endforeach
@endif {{-- First KPI Card - Half Width --}}
{{ $data['kpi']->title }} @if ($data['kpi']->description) {{ $data['kpi']->description }} @endif
Target {{ number_format($data['target'], 0) }}{{ $data['kpi']->unit === 'percent' ? '%' : '' }}
Progress {{ number_format($data['total_progress'], 0) }}{{ $data['kpi']->unit === 'percent' ? '%' : '' }}
Monthly Performance
@php // Calculate which month the target was achieved $cumulative = 0; $targetAchievedMonth = null; foreach ($data['monthly_values'] as $month => $value) { $cumulative += $value; if ($cumulative >= $data['target'] && $targetAchievedMonth === null) { $targetAchievedMonth = $month; break; } } @endphp @if ($targetAchievedMonth) 🎯 Target achieved in {{ $this->getMonthName($targetAchievedMonth) }}! Current progress: {{ number_format($data['total_progress'], 0) }}{{ $data['kpi']->unit === 'percent' ? '%' : '' }} ({{ number_format($data['overall_percentage'], 1) }}% of annual target). @endif
@push('scripts') @endpush @elseif ($period && !$kpiSet) No KPI Set has been assigned to this kampus for the selected period. @elseif ($department && $this->periods->isEmpty()) No KPI periods have been assigned to this kampus yet. @endif