@extends('layouts.app')

@section('title', 'Payees')
@section('heading', 'Payees')

@section('content')
@include('finance.top-submenu')
@include('settings.partials.back-to-home')
    <x-card>
        <div class="mb-4 flex justify-between items-center">
            <p class="text-slate-600">Payees (recipients of payments).</p>
            <a href="{{ route('payees.create') }}" class="inline-flex items-center rounded-lg bg-slate-800 px-4 py-2 text-sm font-medium text-white hover:bg-slate-700"><i class="bi bi-plus-lg me-1"></i>Add Payee</a>
        </div>
        <x-table>
            <x-slot name="head">
                <tr>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Name</th>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Email</th>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Phone</th>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Actions</th>
                </tr>
            </x-slot>
            @forelse($payees as $p)
                <tr>
                    <td class="px-4 py-3 text-sm text-slate-900">{{ $p->name }}</td>
                    <td class="px-4 py-3 text-sm text-slate-600">{{ $p->email ?? '—' }}</td>
                    <td class="px-4 py-3 text-sm text-slate-600">{{ $p->phone ?? '—' }}</td>
                    <td class="whitespace-nowrap px-4 py-3 text-sm space-x-2">
                        <a href="{{ route('payees.edit', $p) }}" class="btn-icon-action btn-icon-action--edit" title="Edit" aria-label="Edit"><i class="bi bi-pencil-square"></i></a>
                        @include('partials.delete-form', ['action' => route('payees.destroy', $p)])
                    </td>
                </tr>
            @empty
                <tr><td colspan="4" class="px-4 py-8 text-center text-sm text-slate-500">No payees yet.</td></tr>
            @endforelse
        </x-table>
        @if($payees->hasPages())<div class="mt-4">{{ $payees->links() }}</div>@endif
    </x-card>
@endsection
