@extends('layouts.admin') @section('title', 'Heatmap') @section('header', 'Department × Category Heatmap') @section('subheader', 'Compare engagement scores across departments and dimensions') @section('content') @include('company.partials.survey-selector') @include('company.partials.low-volume-warning')
@if(count($heatmapData['data']) > 0)
Strong (75%+) Healthy (65-74%) Moderate (55-64%) Needs Work (45-54%) Critical (<45%)
@foreach($heatmapData['categories'] as $cat) @endforeach @foreach($heatmapData['data'] as $row) @foreach($heatmapData['categories'] as $cat) @php $score = $row[$cat['slug']] ?? null; if ($score !== null) { if ($score >= 75) { $bgColor = 'bg-green-500'; $textColor = 'text-white'; } elseif ($score >= 65) { $bgColor = 'bg-lime-400'; $textColor = 'text-gray-800'; } elseif ($score >= 55) { $bgColor = 'bg-yellow-400'; $textColor = 'text-gray-800'; } elseif ($score >= 45) { $bgColor = 'bg-orange-400'; $textColor = 'text-white'; } else { $bgColor = 'bg-red-500'; $textColor = 'text-white'; } } else { $bgColor = 'bg-gray-100'; $textColor = 'text-gray-400'; } @endphp @endforeach @endforeach
Department {{ $cat['icon'] }} {{ Str::limit($cat['name'], 10) }}
{{ $row['department'] }}
{{ $score !== null ? round($score).'%' : '-' }}

Top Performing Areas

@php $topScores = collect(); foreach ($heatmapData['data'] as $row) { foreach ($heatmapData['categories'] as $cat) { $score = $row[$cat['slug']] ?? null; if ($score !== null && $score >= 70) { $topScores->push([ 'department' => $row['department'], 'category' => $cat['name'], 'icon' => $cat['icon'], 'score' => $score, ]); } } } $topScores = $topScores->sortByDesc('score')->take(5); @endphp @if($topScores->count() > 0)
    @foreach($topScores as $item)
  • {{ $item['icon'] }} {{ $item['department'] }} - {{ $item['category'] }} {{ round($item['score']) }}%
  • @endforeach
@else

No areas scoring 70% or above

@endif

Areas Needing Attention

@php $lowScores = collect(); foreach ($heatmapData['data'] as $row) { foreach ($heatmapData['categories'] as $cat) { $score = $row[$cat['slug']] ?? null; if ($score !== null && $score < 60) { $lowScores->push([ 'department' => $row['department'], 'category' => $cat['name'], 'icon' => $cat['icon'], 'score' => $score, ]); } } } $lowScores = $lowScores->sortBy('score')->take(5); @endphp @if($lowScores->count() > 0)
    @foreach($lowScores as $item)
  • {{ $item['icon'] }} {{ $item['department'] }} - {{ $item['category'] }} {{ round($item['score']) }}%
  • @endforeach
@else

No areas scoring below 60%

@endif
@else

Heatmap Not Available

Department breakdown requires at least 5 responses per department to protect anonymity. @if(isset($analytics))

Total responses: {{ $analytics->total_responses }} @endif

Either no department data was collected, or all departments have fewer than 5 responses.

@endif
@endsection