@php $isEdit = $session->exists; $action = $isEdit ? route('trainer.sessions.update', $session) : route('trainer.sessions.store'); $input = 'w-full px-4 py-2.5 bg-surface-container rounded-lg border-none focus:ring-2 focus:ring-primary/20 text-body-md outline-none'; $label = 'block text-label-md font-label-md text-on-surface-variant mb-1.5'; $dateVal = old('session_date', optional($session->session_date)->format('Y-m-d')); $timeVal = old('start_time', $session->start_time ? \Carbon\Carbon::parse($session->start_time)->format('H:i') : ''); $formatVal = old('format', $session->format ?? 'online'); $isExt = (bool) old('is_external', $session->external_trainer_name ? 1 : 0); $extName = old('external_trainer_name', $session->external_trainer_name); @endphp
@csrf @if($isEdit) @method('PUT') @endif
@php $names = $trainingNames ?? collect(); $currentTitle = old('title', $session->title); $isNewTitle = $currentTitle && ! $names->contains('name', $currentTitle); @endphp @php $currentDesc = optional($names->firstWhere('name', $currentTitle))->description; @endphp

info {{ $currentDesc }}

This training is saved to the shared list so other trainers can reuse the same name.

@error('title')

{{ $message }}

@enderror
@php // Training hours: 9:00am–6:00pm only. $slots = []; for ($hh = 9; $hh <= 18; $hh++) { foreach ([0, 15, 30, 45] as $mm) { if ($hh === 18 && $mm > 0) continue; $slots[] = sprintf('%02d:%02d', $hh, $mm); } } @endphp
@php $durVal = (int) old('duration_minutes', $session->duration_minutes ?? 60); @endphp
@foreach([30 => '30 min', 45 => '45 min', 60 => '1 hour'] as $mins => $lbl) @endforeach

@php $teamsAuto = \App\Support\TeamsMeeting::autoAvailable(); $myDefault = auth()->user()->default_meeting_link; $enteredOld = old('teams_link'); // Use the friendly "saved link" panel on a NEW session when the trainer has // a default and hasn't just typed an override. Never for external sessions — // those use the external trainer's own link, not the Segra trainer's default. $useSavedPanel = $myDefault && ! $isEdit && ! $enteredOld && ! $isExt; $extLinkVal = old('external_meeting_link', $isEdit && $isExt ? $session->teams_link : ''); @endphp {{-- External trainer's own meeting link (e.g. their Zoom) — pasted in manually. --}}

videocam Paste the link the external trainer gave you — it isn’t saved as your own default.

@error('external_meeting_link')

{{ $message }}

@enderror
@if($useSavedPanel) {{-- Friendly: the saved link is used automatically; no URL to deal with. --}}
check_circle

Your saved meeting link will be used

{{ $myDefault }}

@else {{-- Required only when there's no auto-generate available and no saved link. --}} @if($teamsAuto)

auto_awesome Leave blank to auto-generate a meeting link. Or paste your own to use instead.

@else

push_pin Add your meeting link once — it’s saved and filled in for every future online session.

@endif @endif
{{-- /internalMeetingBlock --}}
@unless($isEdit) {{-- Resources: handouts staff can download before the session (instead of photocopying) --}}
folder_open

Resources (optional)

Drop in handouts, slides or workbooks — everyone booked on can download them from the session page. For a recurring training they’re added to every date. You can add more later.

@error('resources')

{{ $message }}

@enderror @error('resources.*')

{{ $message }}

@enderror
{{-- Recurrence: run this training repeatedly --}}
repeat

Repeat this training

Create a whole series in one go — e.g. every weekday for 6 months.

@foreach([1 => 'Mon', 2 => 'Tue', 3 => 'Wed', 4 => 'Thu', 5 => 'Fri', 6 => 'Sat', 7 => 'Sun'] as $iso => $dow) @endforeach

Leave all unticked to use the start date's weekday.

info Each occurrence becomes its own session, so bookings, attendance and notes are tracked separately. Max 500 occurrences.

@endunless {{-- Trainers: primary (you) + up to two supporting trainers --}} @php $primaryTrainer = $isEdit ? ($session->trainer ?? auth()->user()) : auth()->user(); $trainers = ($trainers ?? collect())->reject(fn ($t) => $t->id === $primaryTrainer->id)->values(); $sup1 = old('support_trainer_1_id', $session->support_trainer_1_id); $sup2 = old('support_trainer_2_id', $session->support_trainer_2_id); @endphp
groups

Trainers

Add up to two supporting trainers to help deliver this session.

workspace_premium {{ $primaryTrainer->name }} · leads this session
{{-- External (non-Segra) trainer --}}
@foreach(($externalTrainers ?? collect()) as $name)

Pick a previous external trainer or type a new one. External sessions can run at the same time as your own and don’t need supporting trainers.

@error('external_trainer_name')

{{ $message }}

@enderror
@if($trainers->isEmpty())

info No other trainers are available to add as support yet.

@else
@error('support_trainer_1_id')

{{ $message }}

@enderror
@error('support_trainer_2_id')

{{ $message }}

@enderror
@endif
{{-- /internalBlock --}}
Cancel