@extends('layouts.student')
@section('title', 'Report a Case')
@section('content')
    <x-page-head title="Report a Case" subtitle="My reports">
        <x-slot:actions><a href="{{ route('student.cases.create') }}" class="btn btn-primary">New Report</a></x-slot:actions>
    </x-page-head>
    <x-panel>
        @if ($reports->isEmpty())
            <x-empty-state title="No reports yet" message="You can report bullying, misconduct, or any concern. Your class teacher and headmaster will be notified." />
        @else
            <div class="table-wrap"><table><thead><tr><th>Case</th><th>About</th><th>Stage</th><th>Date</th><th></th></tr></thead><tbody>
                @foreach ($reports as $report)
                    <tr>
                        <td>{{ $report->case_number }}</td>
                        <td>{{ $report->subjectStudent?->full_name ?? $report->title }}</td>
                        <td><x-badge variant="blue">{{ $casesService->stageLabel($report->stage) }}</x-badge></td>
                        <td>{{ $report->created_at->format('d M Y') }}</td>
                        <td class="text-right"><a href="{{ route('student.cases.show', $report) }}" class="btn btn-ghost btn-sm">View</a></td>
                    </tr>
                @endforeach
            </tbody></table></div>
            <div style="margin-top:16px;">{{ $reports->links() }}</div>
        @endif
    </x-panel>
@endsection
