{{-- One externally-delivered course: how to do it (website + steps), its submission status, and the certificate upload form. Shared by the course page and My Vault. Expects: $course (with requires_external_cert), $sub (latest ExternalCertificateSubmission or null), optional $showTitle (default true). --}} @php $me = auth()->user(); $canUpload = \Illuminate\Support\Facades\Route::has($me->primaryRole().'.course.external-cert.store'); $fileRoute = \Illuminate\Support\Facades\Route::has($me->primaryRole().'.external-cert.file'); $steps = collect(preg_split('/\r\n|\r|\n/', (string) $course->external_instructions))->map(fn ($s) => trim($s))->filter()->values(); $isDone = ($course->pivot->status ?? null) === 'completed'; $showTitle = $showTitle ?? true; @endphp
@if($showTitle)

{{ $course->title }}

@else

Complete this training online, then upload your certificate

@endif @if($isDone) check_circle Approved — complete @elseif($sub && $sub->isPending()) hourglass_top Awaiting approval @elseif($sub && $sub->isRejected()) error Needs re-upload @else upload_file Certificate not uploaded yet @endif
{{-- Step 1: do the training on the external website --}} @if(! $isDone && ($course->external_url || $steps->isNotEmpty()))

Step 1 — Do the training on the external website

@if($steps->isNotEmpty())
    @foreach($steps as $step)
  1. {{ $step }}
  2. @endforeach
@endif @if($course->external_url) open_in_new Open the training website

{{ $course->external_url }}

@endif
@elseif(! $isDone)

This course is completed outside Segra. Ask your manager for the website link if you don't have it.

@endif {{-- Step 2: upload the certificate --}} @if($isDone)

Your certificate has been approved and this course is complete.

@elseif($sub && $sub->isPending())

Step 2 — done. Submitted {{ $sub->created_at->format('j M Y') }} (completed {{ optional($sub->completion_date)->format('j M Y') }}). @if($fileRoute) View my upload. @endif Your Service / Registered Manager will review it shortly.

@else

Step 2 — Upload your certificate

@if($sub && $sub->isRejected())
Returned by your manager: {{ $sub->review_note }} — please upload a corrected certificate.
@endif @if($canUpload)
@csrf
@error('file')

{{ $message }}

@enderror
@error('completion_date')

{{ $message }}

@enderror
@else

Upload isn’t available for your account — please speak to your manager.

@endif @endif