@extends('layouts.app')
@section('title', 'Academic Years')
@section('content')
    <x-page-head title="Academic Years" subtitle="Archive & rollover" />
    <x-panel>
        @if ($years->isEmpty())
            <x-empty-state title="No academic years" message="Define academic years and terms for enrolment and reporting." />
        @else
            <div class="table-wrap"><table><thead><tr><th>Name</th><th>Code</th><th>Period</th><th>Terms</th><th>Current</th></tr></thead><tbody>
                @foreach ($years as $year)
                    <tr><td>{{ $year->name }}</td><td>{{ $year->code }}</td><td>{{ optional($year->starts_on)->format('Y') }} – {{ optional($year->ends_on)->format('Y') }}</td><td>{{ $year->terms->count() }}</td><td>@if($year->is_current)<x-badge variant="green">Current</x-badge>@else—@endif</td></tr>
                @endforeach
            </tbody></table></div>
            <div style="margin-top:16px;">{{ $years->links() }}</div>
        @endif
    </x-panel>
@endsection
