@extends('partials.app') @section('title', 'Refreshment Training Plans') @php $statusMap = [ 'created' => ['label' => 'Created', 'class' => 'badge-dark'], 'inreview' => ['label' => 'In Review', 'class' => 'badge-warning'], 'reviewed' => ['label' => 'Reviewed', 'class' => 'badge-info'], 'approved' => ['label' => 'Approved', 'class' => 'badge-success'], ]; $isChildView = isset($parentPlan); $isCreatedRoute = request()->routeIs('created-annual-training*'); @endphp @section('content')
@if (session('success'))
{{ session('success') }}
@endif

{{ $isChildView ? 'Refreshment Programs' : 'Refreshment Main Plan Setup' }}

@if ($isChildView) Main Plan: {{ $parentPlan->name }} @else Click a plan to view its child programs. @endif

@if (!$isChildView)
@if (request()->filled('search')) Reset @endif
@endif @if (!$isChildView && !$isCreatedRoute)
@forelse ($trainings as $plan)
{{ $plan->name }}
View Programs
@empty
No annual plans found.
@endforelse
{{ $trainings->links('pagination::bootstrap-4') }}
@else
@foreach ($trainings as $training) @php $statusMeta = $statusMap[$training->status ?? 'created'] ?? $statusMap['created']; $trainerAcceptance = $training->trainerAcceptanceSummary(); $isExpired = $training->isExpired(); @endphp
@if ($isExpired)
Ended
@endif
{{ $training->steps->count() }} Steps {{ $statusMeta['label'] }} {{ $trainerAcceptance['display'] }}
{{ $training->acceptedTrainers->count() }} {{ $training->trainees->count() }}
@csrf @method('PATCH')
@if ($isExpired) @else @endif
@csrf @method('DELETE')
Status: {{ $statusMeta['label'] }}
Type: {{ ucwords(str_replace('_', ' ', $training->training_type ?? 'classroom')) }}
Start: {{ $training->start_date ? \Illuminate\Support\Carbon::parse($training->start_date)->format('d M Y') : 'N/A' }}
End: {{ $training->end_date ? \Illuminate\Support\Carbon::parse($training->end_date)->format('d M Y') : 'N/A' }}
@foreach ($training->steps as $step)
{{ $loop->iteration }} {{ $step->name }}
{{ ucfirst($training->status ?? 'created') }}
@endforeach
@forelse($training->trainers as $trainer)
{{ $trainer->name }}
{{ $trainer->designation->name ?? 'No designation' }}
@empty

No trainers assigned.

@endforelse
@forelse($training->trainees as $user)
{{ $user->name }}
{{ $user->email }}
{{ $user->designation->name ?? 'No designation' }}
@empty
No users enrolled yet.
@endforelse
@forelse($training->documents as $doc) @empty @endforelse
Document Name Question Quota
{{ $doc->doc_name }} {{ $doc->pivot->question_quota }}
No documents linked.
@endforeach @if ($trainings->isEmpty())
No trainings found.
@endif
@unless ($isChildView)
{{ $trainings->links('pagination::bootstrap-4') }}
@endunless @endif
@endsection