@extends('layouts.teacher')
@section('title', 'Attendance')
@section('content')
    <x-page-head title="Attendance" subtitle="Daily register">
        <x-slot:actions>
            <a href="{{ route('teacher.attendance.mark') }}" class="btn btn-primary">Mark Attendance</a>
        </x-slot:actions>
    </x-page-head>
    <x-panel>
        @if ($sessions->isEmpty())
            <x-empty-state title="No sessions" message="Mark attendance for your classes to see records here." />
        @else
            <div class="table-wrap"><table><thead><tr><th>Date</th><th>Class</th><th>Recorded By</th><th>Status</th></tr></thead><tbody>
                @foreach ($sessions as $session)
                    <tr>
                        <td>{{ $session->date?->format('M j, Y') }}</td>
                        <td>{{ $session->schoolClass?->name }}</td>
                        <td>{{ $session->recordedBy?->full_name ?? '—' }}</td>
                        <td><x-badge :status="$session->status" /></td>
                    </tr>
                @endforeach
            </tbody></table></div>
            <div style="margin-top:16px;">{{ $sessions->links() }}</div>
        @endif
    </x-panel>
@endsection
