@extends('layouts.student')
@section('title', 'Report Cards')
@section('content')
    <x-page-head title="Report Cards" subtitle="Published results" />
    <x-panel>
        @if ($reportCards->isEmpty())
            <x-empty-state title="No report cards" message="Published report cards will appear here." />
        @else
            <div class="table-wrap"><table><thead><tr><th>Term</th><th>Class</th><th>Average</th><th>Published</th><th></th></tr></thead><tbody>
                @foreach ($reportCards as $card)
                    <tr>
                        <td>{{ $card->term?->name }}</td>
                        <td>{{ $card->schoolClass?->name }}</td>
                        <td>{{ number_format((float) $card->overall_average, 1) }}%</td>
                        <td>{{ $card->published_at?->format('d M Y') }}</td>
                        <td class="text-right"><a href="{{ route('student.report-cards.show', $card) }}" class="btn btn-ghost btn-sm">View</a></td>
                    </tr>
                @endforeach
            </tbody></table></div>
            {{ $reportCards->links() }}
        @endif
    </x-panel>
@endsection
