@php // Client-side open seeds — deferred $set (arg 3 = false) never fires /livewire/update. $defaultCurrency = current_panel()?->base_currency ?: 'USD'; $defaultTz = config('app.timezone', 'UTC'); $blank = ['editingId' => null, 'first_name' => '', 'last_name' => '', 'email' => '', 'password' => '', 'password_confirmation' => '', 'timezone' => $defaultTz, 'currency' => $defaultCurrency, 'showModal' => true]; @endphp
{{ __('Balance') }}{{ __('Created') }} @forelse ($users as $user) @php $edit = ['editingId' => $user->id, 'first_name' => (string) $user->first_name, 'last_name' => (string) $user->last_name, 'email' => (string) $user->email, 'password' => '', 'timezone' => (string) ($user->timezone ?: $defaultTz), 'currency' => (string) ($user->currency ?: $defaultCurrency), 'showModal' => true]; $edit['password_confirmation'] = ''; $bal = ['balanceUserId' => $user->id, 'balanceAmount' => '', 'balanceType' => 'credit', 'balanceNote' => '', 'showBalanceModal' => true]; @endphp @empty @endforelse
{{ __('No.') }} {{ __('Client') }} {{ __('Last IP') }} {{ __('Custom Rate') }} {{ __('Status') }} {{ __('Action') }}
{{ $loop->iteration + ($users->firstItem() - 1) }}
{{-- The name opens the detail view: it's the first thing clicked when someone wants to know who this client is. --}}
{{ $user->email }}
{{ money($user->wallet?->balance ?? 0, $user->currency ?: 'USD') }} {{ $lastIps[$user->id] ?? '—' }} {{ rf_date($user->created_at) }} {{-- A read-only seat still sees the list, but is offered no control that would answer 403 the moment it was used. --}} @if ($canManage) {{-- Sign in as the client: same mechanic the owner uses to enter a reseller's panel, scoped to THIS panel's clients and returning to this same list. --}} @endif @if ($canSetBalance) {{-- Credit balance: goes through the server because the modal shows the client's real balance, not a stale one. --}} @endif
@if ($users->hasPages())
{{ $users->links() }}
@endif
{{-- Bulk actions bar --}} @if (count($selected) > 0)
{{ trans_choice(':count selected|:count selected', count($selected), ['count' => count($selected)]) }} @if ($canManage) @endif
@endif {{-- Add / edit modal --}}
@error('first_name')

{{ $message }}

@enderror
@error('email')

{{ $message }}

@enderror
@error('password')

{{ $message }}

@enderror
{{-- Client detail card: profile, money, purchases, support and own prices. Only queries the database while it's open (see detailData). --}} @if ($detail) @php $du = $detail['user']; @endphp
{{ $du->display_name }}
{{ $du->email }}
{{ $du->status === 'active' ? __('Active') : __('Inactive') }} @if ($canManage) @endif
{{ __('Balance') }}
{{ money($detail['balance'], $du->currency ?: 'USD') }}
{{ __('Spent') }}
{{ money($detail['spent'], $du->currency ?: 'USD') }}
{{ __('Orders') }}
{{ number_format($detail['orders_total']) }}
{{ __('Tickets') }}
{{ number_format($detail['tickets']) }} @if ($detail['open_tickets'] > 0){{ __(':n open', ['n' => $detail['open_tickets']]) }}@endif

{{ __('Latest orders') }}

@forelse ($detail['orders'] as $o) @empty @endforelse
#{{ __('Service') }}{{ __('Qty') }}{{ __('Charge') }}{{ __('Status') }}{{ __('Date') }}
{{ $o->id }} {{ \Illuminate\Support\Str::limit(\App\Support\CatalogText::display($o->service_name_snapshot), 42) }} {{ number_format($o->quantity) }} {{ money($o->charge, $o->currency) }} {{ __(ucfirst(str_replace('_', ' ', $o->status))) }} {{ rf_date($o->created_at) }}

{{ __('Wallet movements') }}

@forelse ($detail['ledger'] as $entry) @empty @endforelse
{{ __('Type') }}{{ __('Amount') }}{{ __('Balance after') }}{{ __('Date') }}
{{ __(ucfirst(str_replace('_', ' ', $entry->type))) }} {{ money($entry->amount, $entry->currency) }} {{ money($entry->balance_after, $entry->currency) }} {{ rf_datetime($entry->created_at) }}
{{-- Custom prices: this is what gives the "Custom rate" switch its meaning. Without this section the switch turned on a pricing branch no screen knew how to feed. --}}

{{ __('Custom prices for this client') }}

@if ($canManage)
@error('priceServiceId')

{{ $message }}

@enderror @error('priceValue')

{{ $message }}

@enderror @endif
@forelse ($detail['custom_prices'] as $cp) @empty @endforelse
{{ __('Service') }}{{ __('Price / 1K') }}
{{ \Illuminate\Support\Str::limit(\App\Support\CatalogText::display($cp->service?->name), 52) }} {{ rate_money($cp->price, $du->currency ?: 'USD') }} @if ($canManage) @endif
@endif
{{-- Add funds: manual credit — the same modal the owner has in /admin/users. Only adds (for subtracting there's "Adjust balance"), shows the real balance before and after, and stores the operation reference in the ledger. --}}
{{-- Who they are and how much they have right now --}}
{{ $addFundsUserName }}
{{ __('Current balance') }}: {{ money($addFundsCurrentBalance, $addFundsUserCurrency) }}
{{-- Fixed method: a credit from the panel is always manual --}}
{{ __('Payment method') }}: {{ __('Manual / Bank transfer') }}
@error('addFundsAmount')

{{ $message }}

@enderror

{{ __('Stored in the ledger for reference. Leave blank if not applicable.') }}

@if (is_numeric($addFundsAmount) && (float) $addFundsAmount > 0)
{{ __('New balance after adding') }} {{ money((string) ((float) $addFundsCurrentBalance + (float) $addFundsAmount), $addFundsUserCurrency) }}
@endif
{{-- Balance adjustment modal --}}
@error('balanceAmount')

{{ $message }}

@enderror