{{-- Tabs --}}
@if($counts['pending'] > 0) @endif
{{-- PENDING DEPOSITS TAB: approve/reject actions + full invoice detail --}} @if($isPendingTab) @forelse ($rows as $t) @php $binanceId = $t->meta['binance_order_id'] ?? null; $gatewayRef = $t->gateway_reference ?? ($t->meta['stripe_id'] ?? $t->meta['paypal_id'] ?? $t->meta['gateway_ref'] ?? null); $driverLabel = match($t->driver) { 'manual' => __('Manual / Bank'), 'binance_manual' => 'Binance Pay', 'stripe' => 'Stripe', 'paypal' => 'PayPal', default => ucfirst(str_replace('_', ' ', $t->driver ?? '—')), }; @endphp {{-- Invoice: pending deposits have no invoice yet (generated on approval) --}} @empty @endforelse
{{ __('No.') }} {{ __('User') }} {{ __('Amount') }} {{ __('Method') }} {{ __('Reference') }} {{ __('Invoice') }} {{ __('Note') }} {{ __('Date') }} {{ __('Actions') }}
#{{ $t->id }}
{{ $t->user?->name ?? '—' }}
{{ $t->user?->email }}
+{{ money($t->amount) }} @if(!empty($t->fee) && (float)$t->fee > 0)
{{ __('fee') }}: {{ money($t->fee) }}
@endif @if(!empty($t->meta['bonus_amount']) && (float)$t->meta['bonus_amount'] > 0)
+{{ money($t->meta['bonus_amount']) }} {{ __('bonus') }}
@endif
{{ $driverLabel }}
@if($t->method?->name && $t->method->name !== $driverLabel)
{{ $t->method->name }}
@endif
@if($gatewayRef)
{{ $gatewayRef }}
@endif @if($binanceId)
Order: {{ $binanceId }}
@endif @if($t->proof_path) 📎 {{ __('View proof') }} @endif @if(!$gatewayRef && !$binanceId && !$t->proof_path) — @endif
— {{ $t->meta['note'] ?? $t->meta['proof_note'] ?? '—' }} {{ rf_datetime($t->created_at) }}
@if($t->driver === 'binance_manual') @endif
{{ __('No pending deposits.') }}
{{-- LEDGER TABS: all movement types with balance_after --}} @else {{-- Pending deposits above the ledger in "All": they don't move the balance yet (no Balance) and the badge leads to the Pending Approval tab, where the actions live. --}} @foreach ($pendingRows as $t) @endforeach @forelse ($rows as $entry) @php // bonus_amount comes from a correlated subquery: only on deposit rows. $bonus = ($entry->type === 'deposit') ? ($entry->bonus_amount ?? ($entry->meta['bonus_amount'] ?? null)) : null; $hasBonus = $bonus !== null && (float)$bonus > 0; $isCredit = (float)$entry->amount > 0; $amountColor = $isCredit ? 'var(--color-success-600)' : 'var(--color-danger-600)'; $amountSign = $isCredit ? '+' : ''; // Label and tone come from the shared LedgerTypes map. The // match() this replaced had an arm for a `refund` // type the enum never had, and no arm at all for // plan charges, reseller costs or margins — those // fell through to the raw enum value. $typeLabel = \App\Support\LedgerTypes::label($entry->type); $typeBadge = \App\Support\LedgerTypes::tone($entry->type); // For deposit entries, the reference() relation is the PaymentTransaction $txn = ($entry->type === 'deposit') ? $entry->reference : null; // Build a readable reference $ref = ''; if ($txn && ($txn->gateway_reference ?? null)) { $ref = $txn->gateway_reference; } elseif ($entry->reference_type && $entry->reference_id) { $shortType = class_basename($entry->reference_type); $ref = $shortType.'#'.$entry->reference_id; } elseif (!empty($entry->meta['transaction_uid'])) { $ref = 'TXN-'.strtoupper(substr($entry->meta['transaction_uid'], -8)); } elseif (!empty($entry->meta['order_id'])) { $ref = 'ORD-'.$entry->meta['order_id']; } // Driver label for deposit rows $driverLabel = $txn ? match($txn->driver ?? '') { 'manual' => __('Manual / Bank'), 'binance_manual' => 'Binance Pay', 'stripe' => 'Stripe', 'paypal' => 'PayPal', default => ucfirst(str_replace('_', ' ', $txn->driver ?? '')), } : null; @endphp {{-- Reference: gateway ref + binance order ID + proof attachment --}} {{-- Invoice: PDF icon, only for approved deposits with a UID --}} @empty @endforelse
{{ __('No.') }} {{ __('User') }} {{ __('Amount') }} {{ __('Bonus') }} {{ __('Balance') }} {{ __('Type') }} {{ __('Method') }} {{ __('Reference') }} {{ __('Invoice') }} {{ __('Date') }}
#P{{ $t->id }}
{{ $t->user?->name ?? '—' }}
{{ $t->user?->email }}
+{{ money($t->amount) }} — — {{ $t->method?->name ?? ucfirst(str_replace('_', ' ', $t->driver ?? '—')) }} {{ $t->gateway_reference ?? ($t->meta['gateway_ref'] ?? '—') }} — {{ rf_datetime($t->created_at) }}
#{{ $entry->id }}
{{ $entry->user?->name ?? '—' }}
{{ $entry->user?->email }}
{{ $amountSign }}{{ money(abs((float)$entry->amount)) }} @if($txn && !empty($txn->fee) && (float)$txn->fee > 0)
{{ __('fee') }}: {{ money($txn->fee) }}
@endif
@if($hasBonus) +{{ money($bonus) }} @else — @endif {{-- When a deposit has a bonus, show the balance_after of the bonus ledger row (the true final balance after both credits). --}} {{ money($hasBonus && $entry->bonus_balance_after ? $entry->bonus_balance_after : $entry->balance_after) }} {{ $typeLabel }} @if($driverLabel) {{ $driverLabel }} @else — @endif @if($ref)
{{ $ref }}
@endif @if($txn && ($txn->meta['binance_order_id'] ?? null))
Order: {{ $txn->meta['binance_order_id'] }}
@endif @if($txn && $txn->proof_path) 📎 {{ __('Proof') }} @endif @if(!$ref && !($txn && $txn->proof_path)) — @endif
@if($txn && $txn->uid) @else — @endif {{ rf_datetime($entry->created_at) }}
{{ __('No transactions found.') }}
@endif
{{ $rows->links() }}