@extends('layouts.app') @section('title', 'Session') @section('content') arrow_back Back to My Trainings @include('partials.flash') @php $isPast = $session->hasEnded(); $viewerRole = $session->trainerRoleFor(auth()->id()); @endphp @if($viewerRole === 'support')
handshake

You're supporting this session

{{ $session->trainerName() ?? 'The lead trainer' }} leads it. You can record attendance and add training notes, but only the lead can edit or delete the session.

@endif {{-- Session header --}}

{{ $session->title }}

@if($session->training_code) sell{{ $session->training_code }} @endif {{ $session->format === 'in_person' ? 'In-Person' : 'Online' }} @if($isPast)Completed@endif
calendar_month{{ $session->session_date->format('l, j F Y') }} schedule{{ \Carbon\Carbon::parse($session->start_time)->format('H:i') }} · {{ $session->duration_minutes }} min {{ $session->format === 'online' ? 'videocam' : 'location_on' }} @if($session->format === 'online' && $session->teams_link) Join on {{ $session->meetingProvider() }} @else {{ $session->format === 'online' ? 'Online' : ($session->location ?? 'Venue TBC') }} @endif
@php $support = $session->supportTrainers(); @endphp
workspace_premium {{ $session->trainerName() ?? '—' }} · lead @foreach($support as $st) person{{ $st->name }} · support @endforeach
@if($viewerRole === 'lead')
@unless($isPast) edit Edit @endunless
@csrf @method('DELETE')
@if($session->recurrence_group_id)
@csrf @method('DELETE')
@endif
@endif
{{-- Attendance --}}
how_to_reg

Attendance

({{ $attendees->count() }})
@php $open = $session->attendanceOpen(); $sum = [ 'attended' => $attendees->where('pivot.status', 'attended')->count(), 'no_show' => $attendees->where('pivot.status', 'no_show')->count(), 'on_leave' => $attendees->where('pivot.status', 'on_leave')->count(), ]; @endphp {{-- Attendance window notice --}} @unless($open)
schedule

Attendance not open yet

You can mark attendance from {{ $session->attendanceOpensAt()->format('H:i, j M Y') }} — 10 minutes before the training starts.

@endunless {{-- Attendance summary (report) --}} @if($sum['attended'] || $sum['no_show'] || $sum['on_leave'])
{{ $sum['attended'] }} attended @if($sum['no_show']){{ $sum['no_show'] }} no-show@endif @if($sum['on_leave']){{ $sum['on_leave'] }} on leave@endif
@endif {{-- Email the joining details (booking emails + delivery status per person) --}} @php $canEmail = $session->isUpcoming() && $attendees->whereNotIn('pivot.status', ['on_leave'])->isNotEmpty(); @endphp @if($session->isUpcoming())

mail @if(! ($mailEnabled ?? false)) Email is switched off in Settings — staff only see this session in Segra. @else Booked staff are emailed the joining details automatically. Each person’s latest email status is shown below. @endif

@if(($mailEnabled ?? false) && $canEmail)
@csrf
@endif
{{-- One small form per person (kept outside the attendance form) --}} @foreach($attendees as $attendee) @endforeach @endif
@csrf
@if($attendees->isEmpty())
No one is booked onto this session yet.
@else
    @foreach($attendees as $attendee) @php $st = $attendee->pivot->status; $badge = match($st) { 'attended' => ['label' => 'Attended', 'class' => 'text-primary'], 'no_show' => ['label' => 'No-show', 'class' => 'text-error'], 'on_leave' => ['label' => 'On leave', 'class' => 'text-[#8a6d3b]'], default => ['label' => 'Booked', 'class' => 'text-outline'], }; $onLeave = $st === 'on_leave'; @endphp
  • {{ strtoupper(collect(explode(' ', $attendee->name))->map(fn($n) => $n[0] ?? '')->take(2)->implode('')) }}

    {{ $attendee->name }}

    {{ $badge['label'] }}@if($attendee->pivot->note) · {{ $attendee->pivot->note }}@endif holiday_village{{ $attendee->location?->name ?? 'No service' }} @if($attendee->location?->registeredManager) supervisor_accountRM: {{ $attendee->location->registeredManager->name }} @endif @if($attendee->pivot->certificate_path) workspace_premiumCertificate uploaded @endif
    {{-- Latest email to this person about this session --}} @php $mailLog = ($emailStatus ?? collect())->get($attendee->id); @endphp
    @if(! $attendee->email) unsubscribeNo email address on file @elseif($mailLog && $mailLog->status === 'failed') error{{ $mailLog->typeLabel() }} email failed · {{ $mailLog->created_at->format('j M H:i') }} @elseif($mailLog) mark_email_read{{ $mailLog->typeLabel() }} email sent · {{ $mailLog->created_at->format('j M H:i') }} @else schedule_sendNo email sent yet @endif @if(($mailEnabled ?? false) && $session->isUpcoming() && $attendee->email && ! $onLeave) @endif
  • @endforeach

{{ $open ? 'Tick everyone who attended, then save. You can update this later.' : 'Opens '.$session->attendanceOpensAt()->diffForHumans().'.' }}

@endif
{{-- Training notes (resources / handouts first) --}}
@include('trainer.sessions._resources')
edit_note

Training Notes

@csrf

These notes are shared with attendees after the session (summary, follow-up actions, resources).

@endsection