{{-- Assign Sessions — SM / RM / Office Manager books their team onto upcoming sessions. From TeamSessionController@index: $sessions, $teamCount, $requiredTitles, $stillNeed DataTable with a filter toolbar (search, training, format, when, spaces, quick chips). --}} @extends('layouts.app') @section('title', 'Assign Sessions') @section('content') @php $tsRole = auth()->user()->primaryRole(); $isRm = in_array($tsRole, ['registered_manager', 'office_manager'], true); $required = array_flip($requiredTitles); $teamBookings = (int) $sessions->sum('team_registered_count'); $neededSessions = $sessions->filter(fn ($s) => ($stillNeed[$s->title] ?? 0) > 0)->count(); $totalGaps = array_sum($stillNeed); $titles = $sessions->pluck('title')->unique()->sort()->values(); @endphp @include('partials.flash')
group_add Book your team of {{ $teamCount }} {{ Str::plural('member', $teamCount) }} onto upcoming sessions.@if($isRm) Your team includes the care workers and Service Managers across the homes you oversee.@endif
{{-- Summary tiles (click to filter) --}}No upcoming sessions
New training dates will appear here once scheduled.
| Session | Date & time | Format | Spaces | Your team | Still need it | Action |
|---|---|---|---|---|---|---|
| {{ $session->title }} @if($isReq)★ Required@endif {{ $session->trainerName() }}{{ $session->training_code ? ' · '.$session->training_code : '' }} | {{ $session->session_date->format('D j M Y') }} {{ \Carbon\Carbon::parse($session->start_time)->format('H:i') }} · {{ $session->duration_minutes }} min · {{ $days === 0 ? 'today' : ($days === 1 ? 'tomorrow' : 'in '.$days.' days') }} | {{ $session->format === 'online' ? 'videocam' : 'location_on' }} {{ $session->format === 'in_person' ? ($session->location ?: 'In person') : 'Online' }} | @if($cap > 0) @php $pct = min(100, (int) round($session->booked_count / $cap * 100)); @endphp {{ $left === 0 ? 'Full' : $left.' left' }} {{ $session->booked_count }} / {{ $cap }} booked @else No limit · {{ $session->booked_count }} booked @endif | @if($session->team_registered_count > 0) how_to_reg{{ $session->team_registered_count }} booked @else None yet @endif | @if($need > 0) {{ $need }} {{ Str::plural('person', $need) }} @else — @endif | {{ $left === 0 ? 'visibility' : 'how_to_reg' }} {{ $left === 0 ? 'View' : 'Book team' }} |
★ Required = selected for one of your homes in Manage Training. “Still need it” counts team members whose home requires that training, who haven’t attended it and aren’t booked on any upcoming date.
@include('management._datatables') @endif @endsection