@php /* Points are keyed to a phone number: an account without one earns nothing, and this
is where the customer learns that, with the one-click way to fix it. */
@endphp
@if (trim((string) ($user['phone'] ?? '')) === '')
@endif
@if (empty($wallets))
@else
@foreach ($wallets as $w)
@php $acct = $w['account'];
$balance = (int) $w['balance'];
$label = (string) $w['label'];
$slug = (string) ($acct['restaurant_slug'] ?? '');
$cheapest = $w['cheapest'];
$pct = (int) $w['progress_pct'];
$toGo = (int) $w['to_go']; @endphp
{{ loyalty_points($balance, $label) }}
@if ($cheapest)
@if ($toGo <= 0)
{!! t_raw('account.redeem_now_text', [':title' => '' . e((string) $cheapest['title']) . '']) !!}
@else
{!! t_raw('account.more_to_unlock_text', [':n' => '' . number_format($toGo) . '', ':label' => e($label), ':title' => '' . e((string) $cheapest['title']) . '']) !!}
@endif
@endif
@if (!empty($w['rewards']))
@foreach ($w['rewards'] as $rw)
@php $cost = (int) $rw['points_cost'];
$eligible = $balance >= $cost;
$isFree = ($rw['type'] ?? '') === 'free_item'; @endphp
{{ (string) $rw['title'] }}
{{ loyalty_points($cost, $label) }}
@if ($eligible)
{{ t_raw('account.claim_at_checkout') }}
@else
{{ t_raw('account.need_more_text', [':n' => number_format($cost - $balance), ':label' => $label]) }}
@endif
@endforeach
@endif
@if (!empty($w['ledger']))
{{ t_raw('vendor.staff.heading_recent_activity') }}
@foreach ($w['ledger'] as $tx)
@php $pts = (int) $tx['points'];
$up = $pts >= 0;
$note = (string) ($tx['note'] ?? '');
$type = (string) ($tx['type'] ?? '');
if ($note === '') { $note = status_label('loyalty_tx', $type); }; @endphp
-
{{ $note }}
{{ $up ? '+' : '−' }}{{ number_format(abs($pts)) }}
{!! fmt_day($tx['created_at']) !!}
@endforeach
@endif
@endforeach
@endif