@extends('layouts.admin')

@section('content')
<div class="container">
    <h1>Pending Deposits</h1>
    <table class="table">
        <thead>
            <tr>
                <th>User</th>
                <th>Coin</th>
                <th>Amount</th>
                <th>Transaction ID</th>
                <th>Proof</th>
                <th>Status</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            @foreach($deposits as $deposit)
                <tr>
                    <td>{{ $deposit->user->name }}</td>
                    <td>{{ $deposit->coin->name }}</td>
                    <td>{{ number_format($deposit->amount, 8) }}</td>
                    <td>{{ $deposit->transaction_id }}</td>
                    <td>
                        @if($deposit->proof)
                            <a href="{{ asset('storage/app/public/' . $deposit->proof) }}" target="_blank">View Proof</a>
                        @endif
                    </td>
                    <td>{{ ucfirst($deposit->status) }}</td>
                    <td>
                        @if($deposit->status == 'pending')
                            <form action="{{ route('admin.deposits.approve', $deposit->id) }}" method="POST" style="display:inline;">
                                @csrf
                                <button type="submit" class="btn btn-success">Approve</button>
                            </form>
                            <form action="{{ route('admin.deposits.reject', $deposit->id) }}" method="POST" style="display:inline;">
                                @csrf
                                <button type="submit" class="btn btn-danger">Reject</button>
                            </form>
                        @endif
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
</div>
@endsection
