@extends('layouts.app')
@section('title', 'Receipts')
@section('content')
    <x-page-head title="Receipts" subtitle="Issue, store & re-send receipts">
        <x-slot:actions>
            <x-export-menu module="receipts" :import="false" />
            <a href="{{ route('finance.receipts.create') }}" class="btn btn-primary">New Receipt</a>
        </x-slot:actions>
    </x-page-head>
    <x-panel>
        @if ($receipts->isEmpty())
            <x-empty-state title="No receipts" message="Issued payment receipts will appear here." />
        @else
            <div class="table-wrap"><table><thead><tr><th>Receipt #</th><th>Student</th><th>Amount</th><th>Date</th><th>Method</th><th></th></tr></thead><tbody>
                @foreach ($receipts as $receipt)
                    <tr>
                        <td>{{ $receipt->receipt_number }}</td>
                        <td>{{ $receipt->student?->full_name ?? '—' }}</td>
                        <td>{{ number_format($receipt->amount, 2) }}</td>
                        <td>{{ optional($receipt->payment_date)->format('d M Y') }}</td>
                        <td>{{ $receipt->payment_method }}</td>
                        <td>
                            <a href="{{ route('communication.emails.receipt.compose', $receipt) }}" class="btn btn-ghost btn-sm">Email</a>
                        </td>
                    </tr>
                @endforeach
            </tbody></table></div>
            <div style="margin-top:16px;">{{ $receipts->links() }}</div>
        @endif
    </x-panel>
@endsection
