@foreach ($this->types() as $t) @endforeach
@forelse ($entries as $e) @php $positive = \App\Support\Money::isPositive((string) $e->amount); // The bonus goes INSIDE its deposit, never in a separate row. $hasBonus = $e->type === 'deposit' && (float) ($e->bonus_amount ?? 0) > 0; // reseller_margin is informative: WalletService stores the // margin there, not a balance (meta: "informative margin; not // a wallet balance"). Showing it as "Balance after" would be a // lie, so the cell says "—" and explains why on hover. $informative = $e->type === 'reseller_margin'; // The payment transaction behind a deposit: it's where the // gateway reference, proof, and PDF receipt come from. $txn = $e->type === 'deposit' ? ($txns[$e->reference_id] ?? null) : null; $ref = ''; if ($txn && ($txn->gateway_reference ?? null)) { $ref = $txn->gateway_reference; } elseif ($e->reference_type && $e->reference_id) { $ref = class_basename($e->reference_type).'#'.$e->reference_id; } elseif (! empty($e->meta['order_id'])) { $ref = 'ORD-'.$e->meta['order_id']; } @endphp @empty @endforelse
{{ __('No.') }} {{ __('Type') }} {{ __('Amount') }} {{ __('Bonus') }} {{ __('Balance After') }} {{ __('Reference') }} {{ __('Invoice') }} {{ __('Created') }}
{{ $loop->iteration + ($entries->firstItem() - 1) }} {{ \App\Support\LedgerTypes::label($e->type) }} {{ $positive ? '+' : '' }}{{ money($e->amount, $e->currency) }} @if ($hasBonus) +{{ money($e->bonus_amount, $e->currency) }} @else — @endif @if ($informative) — @else {{ money($hasBonus && $e->bonus_balance_after ? $e->bonus_balance_after : $e->balance_after, $e->currency) }} @endif @if ($ref)
{{ $ref }}
@endif @if ($txn && $txn->proof_path) {{ __('Proof') }} @endif @if (! $ref && ! ($txn && $txn->proof_path)) — @endif
@if ($txn && $txn->uid && $txn->status === 'completed') @else — @endif {{ rf_datetime($e->created_at) }}
@if ($entries->hasPages())
{{ $entries->links() }}
@endif