@extends('layouts.app')
@section('page_title','My Trainings')
@section('page_subtitle','Register for available HR, safety and workplace-policy training.')
@section('content')
<div class="card"><table class="table"><tr><th>Training</th><th>Dates</th><th>Location</th><th>Status</th><th>Action</th></tr>@forelse($trainings as $training)<tr><td><strong>{{ $training->title }}</strong><br><span class="muted small">{{ $training->description }}</span></td><td>{{ $training->start_date?->format('d M Y') }} - {{ $training->end_date?->format('d M Y') }}</td><td>{{ $training->location }}</td><td>{{ ucfirst($training->status) }}</td><td>@if(in_array($training->id,$enrolledIds))<span class="badge green">Registered</span>@else<form method="POST" action="{{ route('user.trainings.enroll',$training) }}">@csrf<button class="btn secondary">Register</button></form>@endif</td></tr>@empty<tr><td colspan="5"><div class="empty">No active trainings.</div></td></tr>@endforelse</table><div class="pagination">{{ $trainings->links() }}</div></div>
@endsection
