@extends('layouts.app')
@section('content')
<div class="container-xxl flex-grow-1 container-p-y"><div class="card"><div class="card-header"><h5 class="mb-0">Referrals</h5></div>
<div class="table-responsive"><table class="table"><thead><tr><th>Code</th><th>Referrer</th><th>Referred</th><th>Reward</th><th>Status</th><th></th></tr></thead><tbody>
@foreach($referrals as $referral)
<tr><td>{{ $referral->code }}</td><td>{{ $referral->referrer->name ?? 'N/A' }}</td><td>{{ $referral->referredUser->name ?? 'N/A' }}</td><td>${{ number_format($referral->reward_amount,2) }}</td><td>{{ ucfirst($referral->status) }}</td><td>@can('update referrals')<a href="{{ route('admin.referrals.edit',$referral) }}" class="btn btn-sm btn-outline-primary">Edit</a>@else<span class="text-muted">-</span>@endcan</td></tr>
@endforeach
</tbody></table></div><div class="card-body">{{ $referrals->links() }}</div></div></div>
@endsection
