{{-- Updated Alpine State to handle dynamic terms array --}}
{{-- Header Section --}}

{{ __('Manage academic years and terms') }}

{{-- Trigger Button --}}
{{-- Validation Errors Alert --}} @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif {{-- Academic Years List --}}
@forelse(($academic_years ?? []) as $year)

{{ $year['name'] ?? 'Unnamed Year' }}

@if($year['is_active'] ?? false) {{ __('Active') }} @else {{ __('Inactive') }} @endif

{{ \Carbon\Carbon::parse($year['start_date'])->format('M d, Y') }} — {{ \Carbon\Carbon::parse($year['end_date'])->format('M d, Y') }}

{{-- Activate Button Form --}} @if(!($year['is_active'] ?? false))
@csrf
@endif {{ __('Manage') }}
{{-- Terms --}} @if(isset($year['terms']) && count($year['terms']) > 0)

{{ __('Academic Terms') }}

@foreach($year['terms'] as $term)
{{ $term['name'] ?? '' }} {{ \Carbon\Carbon::parse($term['start_date'])->format('M d') }} - {{ \Carbon\Carbon::parse($term['end_date'])->format('M d') }} @if($term['is_current'] ?? false) @endif
@endforeach
@endif
@empty
📅

{{ __('No academic years') }}

{{ __('Create your first academic year to get started.') }}

@endforelse
{{-- CREATE MODAL --}}