@extends('layouts.admin')
@section('title', 'Deposit Logs')
@section('content')
<div class="page-header"><h1>Deposit Logs</h1><p>Review and approve client deposit requests</p></div>

<div class="md-card">
    <div class="table-wrap">
        <table class="md-table md-table-light">
            <thead>
                <tr><th>ID</th><th>User</th><th>Network</th><th>Wallet Address</th><th>Amount</th><th>Status</th><th>Date</th><th>Actions</th></tr>
            </thead>
            <tbody>
                @forelse($deposits as $deposit)
                <tr>
                    <td>{{ $deposit->id }}</td>
                    <td>{{ $deposit->user->name }}</td>
                    <td>{{ $deposit->network }}</td>
                    <td style="max-width:180px;overflow:hidden;text-overflow:ellipsis">{{ $deposit->wallet_address }}</td>
                    <td>${{ number_format($deposit->amount, 2) }}</td>
                    <td><span class="badge {{ $deposit->status->badgeClass() }}">{{ $deposit->status->label() }}</span></td>
                    <td>{{ $deposit->created_at->format('Y-m-d H:i') }}</td>
                    <td>
                        @if($deposit->status === \App\Enums\RecordStatus::Pending)
                        <div class="action-group">
                            <form method="POST" action="{{ route('admin.deposits.approve', $deposit) }}">@csrf
                                <button class="md-btn md-btn-filled md-btn-sm">Approve</button>
                            </form>
                            <form method="POST" action="{{ route('admin.deposits.reject', $deposit) }}">@csrf
                                <button class="md-btn md-btn-danger md-btn-sm">Reject</button>
                            </form>
                        </div>
                        @else
                        <span style="color:var(--md-on-surface-variant)">No actions</span>
                        @endif
                    </td>
                </tr>
                @empty
                <tr><td colspan="8" style="text-align:center;padding:2rem">No deposits</td></tr>
                @endforelse
            </tbody>
        </table>
    </div>
    <div style="padding:1rem">{{ $deposits->links() }}</div>
</div>
@endsection
