@extends('layouts.admin') @section('title', $category->name) @section('header', $category->name) @section('subheader', 'Detailed analysis of this engagement dimension') @section('content') @include('company.partials.survey-selector') @include('company.partials.low-volume-warning')
{{ $category->icon }}

{{ $category->name }}

{{ $category->description }}

@php $interpretation = \App\Models\Category::getScoreInterpretation($categoryScore); @endphp
{{ round($categoryScore) }}%
{{ $interpretation['label'] }}

Questions in this Category

{{ $questionData->count() }} questions ranked by favorability

@forelse($questionData as $question) @php $qInterpretation = \App\Models\Category::getScoreInterpretation($question['favorability'] ?? 0); @endphp

{{ $question['text'] }}

Mean: {{ number_format($question['mean'] ?? 0, 2) }} Type: {{ ucfirst(str_replace('_', ' ', $question['type'] ?? 'likert_5')) }}
{{ round($question['favorability'] ?? 0) }}%
favorable
@if(!empty($question['distribution'])) @php $maxScale = ($question['type'] ?? 'likert_5') === 'likert_7' ? 7 : 5; @endphp
@for($i = 1; $i <= $maxScale; $i++) @php $dist = $question['distribution'][$i] ?? ['count' => 0, 'percentage' => 0]; $barColor = match(true) { $maxScale == 7 && $i <= 2 => 'bg-red-400', $maxScale == 7 && $i == 3 => 'bg-orange-400', $maxScale == 7 && $i == 4 => 'bg-gray-400', $maxScale == 7 && $i == 5 => 'bg-lime-400', $maxScale == 7 && $i >= 6 => 'bg-green-400', $maxScale == 5 && $i <= 2 => 'bg-red-400', $maxScale == 5 && $i == 3 => 'bg-gray-400', $maxScale == 5 && $i >= 4 => 'bg-green-400', default => 'bg-gray-400', }; @endphp
{{ $i }}
{{ $dist['percentage'] ?? 0 }}%
@endfor
Strongly Disagree Strongly Agree
@endif
@empty
No questions in this category
@endforelse
Back to Categories
@endsection