@forelse($transactions as $tx)
@php
$source = strtolower($tx->source);
$isRockads = $source === 'rockads';
$cur = strtoupper($tx->currency_code);
$curLow = strtolower($cur);
$sym = $cur === 'USD' ? '$' : '€';
$isPos = $tx->direction === 'credit';
$dispAmt = ($isPos ? '+' : '−') . $sym . number_format((float) $tx->amount, 2);
$amtCls = $isPos ? 'green' : 'red';
$statusRaw = strtolower($tx->status ?? '');
$isDone = in_array($statusRaw, ['completed', 'done', 'success', 'approved']);
$statusCls = $isDone ? 'tx-done' : 'tx-proc';
$statusLbl = $isDone ? 'Completed' : ucfirst($tx->status ?: 'Processing');
$statusKey = $isDone ? 'completed' : 'processing';
$dateStr = $tx->provider_created_at ? $tx->provider_created_at->format('d.m H:i') : '—';
$walletName = $tx->providerWallet ? ($tx->providerWallet->name ?: $tx->providerWallet->code) : '—';
$adAcctName = $tx->adAccount ? ($tx->adAccount->name ?: $tx->adAccount->external_id) : null;
$kind = $tx->kind ?: 'unknown';
if ($isRockads) {
$nbCls = 'tx-nb-violet';
$nbLbl = '↔ ' . ucwords(str_replace('_', ' ', $kind));
if ($kind === 'withdraw4adaccount') { $nbLbl = '↑ Withdrawal'; $nbCls = 'tx-nb-red'; $scope = 'withdrawal'; }
elseif ($kind === 'transfer2adaccount') { $nbLbl = '→ Transfer'; $nbCls = 'tx-nb-amber'; $scope = 'transfer'; }
else { $scope = 'rockads'; }
$detailHtml = 'Rockads · ' . $walletName . '';
if ($adAcctName) {
$detailHtml = 'Wallet ↔ ' . $adAcctName . '';
}
} else {
$scope = 'gradyn';
if ($kind === 'topup') {
$nbLbl = '↑ Account Top-up'; $nbCls = 'tx-nb-purple'; $scope = 'adtopup';
} elseif ($kind === 'withdrawal') {
$nbLbl = '↓ Ad Account Withdrawal'; $nbCls = 'tx-nb-orange'; $scope = 'withdrawal';
} else {
$nbLbl = '↔ ' . ucfirst($kind); $nbCls = 'tx-nb-violet';
}
if ($adAcctName) {
$detailHtml = 'Wallet → ' . $adAcctName . '';
} else {
$detailHtml = $tx->destination ?? 'Wallet';
}
}
$shortRef = strlen((string)$tx->external_id) > 12 ? substr((string)$tx->external_id, 0, 8).'...' : $tx->external_id;
@endphp
| {{ $shortRef }} |
{!! $nbLbl !!} |
{{ ucfirst($source) }} · {{ $cur }} |
{!! $dispAmt !!} |
{!! $detailHtml !!} |
{!! $dateStr !!} |
● {{ $statusLbl }} |
@empty
| No transactions found. |
@endforelse