@extends('layouts.app')

@section('content')
<div class="container">
    <h1 class="text-2xl font-bold mb-4">Expiring Members</h1>

    <table class="table-auto w-full border border-gray-300">
        <thead class="bg-gray-100">
            <tr>
                <th class="p-2 border">Member</th>
                <th class="p-2 border">Fingerprint ID</th>
                <th class="p-2 border">Expiry Date</th>
                <th class="p-2 border">Next Payment Date</th>
                <th class="p-2 border">Actions</th>
            </tr>
        </thead>
        <tbody>
            @foreach($payments as $payment)
            <tr>
                <td class="p-2 border">{{ $payment->member->first_name }} {{ $payment->member->surname }}</td>
                <td class="p-2 border">{{ $payment->finger_id }}</td>
                <td class="p-2 border">{{ $payment->expiry_date }}</td>
                <td class="p-2 border">{{ $payment->next_payment_date }}</td>
                <td class="p-2 border flex gap-2">
                    <a href="{{ route('payments.renew', $payment->member->id) }}" class="btn btn-green">Renew Membership</a>
                    <a href="{{ route('payments.history', $payment->member->id) }}" class="btn btn-blue">View History</a>
                </td>
            </tr>
            @endforeach
        </tbody>
    </table>
</div>
@endsection
