@foreach($subIndexScores as $trait)
@php
$traitInterp = \App\Models\Category::getScoreInterpretation($trait['trait_score']);
@endphp
{{-- Trait header --}}
{{ $trait['category_icon'] }}
{{ $trait['category_name'] }}
{{ $traitInterp['label'] }}
{{ round($trait['trait_score']) }}%
Trait Average
{{-- Sub-indices --}}
@foreach($trait['indices'] as $idx)
@php
$idxInterp = \App\Models\Category::getScoreInterpretation($idx['favorability']);
$diffFromTrait = round($idx['favorability'] - $trait['trait_score'], 1);
$diffColor = $diffFromTrait >= 3 ? '#16a34a' : ($diffFromTrait <= -3 ? '#dc2626' : '#6b7280');
@endphp
{{ $idx['name'] }}
{{-- Trait average marker --}}
{{ round($idx['favorability']) }}%
{{ $diffFromTrait >= 0 ? '+' : '' }}{{ $diffFromTrait }}
x={{ $idx['mean'] }}
@endforeach
@endforeach
{{-- Legend --}}
Favorability = % rating 4-5 on 5-point scale
|
Vertical line = trait average
|
+/- = difference from trait average
|
x = mean score (out of 5)