{{-- Feedback for one session (Admin / Head of Operations only): how attendees answered each question (bars, with the "please explain" notes and written answers underneath), then every individual response. From SessionFeedbackController@session: $session (trainer), $feedback, $attended, $questions --}} @extends('layouts.app') @section('title', 'Session Feedback') @section('content') @include('partials.flash') @php use App\Support\SessionFeedbackForm as Form; $role = auth()->user()->primaryRole(); $n = $feedback->count(); $scores = $feedback->pluck('overall')->map(fn ($o) => Form::RATING_SCORE[$o] ?? null)->filter(); $avg = $scores->isEmpty() ? null : $scores->avg(); $bySection = collect($questions)->groupBy('section', true); @endphp arrow_back All session feedback

{{ $session->title }}

{{ $session->session_date->format('l, j F Y') }} · {{ $session->trainerName() ?? 'No trainer' }} · {{ $session->format === 'online' ? 'Online' : ($session->location ?: 'Face to face') }}

{{ $n }}/{{ $attended }}

responded

{{ $avg ? number_format($avg, 1) : '—' }}

rating / 4

{{ $n ? round($feedback->where('recommend', 'yes')->count() / $n * 100) : 0 }}%

would recommend

{{-- Summary per question --}}
@foreach(Form::sections() as $sn => $sec) @continue(! $bySection->has($sn))
{{ $sn }}

{{ $sec['title'] }}

@foreach($bySection[$sn] as $key => $q)

{{ $q['q'] }}

@if($q['type'] === 'choice') @php $counts = $feedback->map(fn ($f) => $f->answer($key))->filter()->countBy(); $answered = $counts->sum(); @endphp
@foreach($q['options'] as $ov => $ol) @php $c = $counts[$ov] ?? 0; $pct = $answered ? round($c / $answered * 100) : 0; $neg = Form::isNegative($key, $ov); @endphp
{{ $ol }} {{ $c }} · {{ $pct }}%
@endforeach
@php $notes = $feedback->filter(fn ($f) => $f->note($key)); @endphp @if($notes->isNotEmpty())
    @foreach($notes as $f)
  • “{{ $f->note($key) }}” — {{ $f->user->name }} ({{ Form::label($key, $f->answer($key)) }})
  • @endforeach
@endif @else @php $texts = $feedback->filter(fn ($f) => filled($f->answer($key))); @endphp @forelse($texts as $f)

“{{ $f->answer($key) }}” — {{ $f->user->name }}

@empty

No written answers.

@endforelse @endif
@endforeach
@endforeach
{{-- Individual responses --}}
@endsection