@extends('wallet.layouts.master') @section('title','Dashboard') @section('description', 'Company Dashboard') @php $fmtDate = function ($dt) { if (! $dt) return '—'; try { return \Illuminate\Support\Carbon::parse($dt)->format('M j, Y, g:i A'); } catch (\Throwable $e) { return (string) $dt; } }; $monthLabel = \Illuminate\Support\Carbon::now()->format('F Y'); $userCounts = collect($users_counts ?? [])->map(fn ($c) => (int) $c)->values()->all(); $userDates = collect($users_dates ?? [])->map(fn ($d) => (string) $d)->values()->all(); $registrationSparkSource = array_slice($userCounts, -12); $registrationSparkMax = max(1, ...$registrationSparkSource); $registrationSparkBars = array_map( fn ($count) => $count > 0 ? max(24, (int) round(($count / $registrationSparkMax) * 100)) : 8, $registrationSparkSource ); $smsSeries = array_values(array_map('intval', $sms_counts ?? [])); $hasUserChart = array_sum($userCounts) > 0; $hasSmsChart = collect($sms_counts ?? [])->sum() > 0; $smsLabels = array_map( fn ($s) => ucfirst(strtolower(str_replace('NOTDELIVERED', 'Not delivered', $s))), array_keys($sms_counts ?? []) ); $treasuryTotal = collect($treasuryCards ?? [])->sum('usd_value'); $stats = [ ['label' => 'Registered users', 'value' => $total_users, 'icon' => 'ti-users', 'color' => 'primary', 'meta' => ($total_users_last_30_days ?? 0).' in the last 30 days', 'link' => route('users'), 'spark' => $registrationSparkBars], ['label' => 'Pending activation', 'value' => $pending_activations ?? 0, 'icon' => 'ti-user-exclamation', 'color' => 'warning', 'meta' => 'Awaiting email confirmation', 'link' => route('users'), 'spark' => []], ['label' => 'Open tickets', 'value' => $open_tickets, 'icon' => 'ti-ticket', 'color' => 'danger', 'meta' => $open_tickets_current_month.' opened this month', 'link' => route('tickets'), 'spark' => []], ['label' => 'Resolved tickets', 'value' => $close_tickets, 'icon' => 'ti-circle-check', 'color' => 'success', 'meta' => $close_tickets_current_month.' resolved this month', 'link' => route('tickets'), 'spark' => []], ]; @endphp @section('page-css') @endsection @section('content')

Dashboard

Overview for {{ $monthLabel }}

{{-- Stat cards --}}
@foreach($stats as $stat) @endforeach
{{-- Charts --}}

Registration activity

New clients per day, {{ $registrationWindowLabel ?? 'last 30 days' }}

{{ $total_users_last_30_days ?? 0 }} new
@if($hasUserChart)
@else
No registrations in the last 30 days

Share a joining code or add a client from the Users page.

@endif

SMS status

Messages sent in {{ $monthLabel }}

@if($hasSmsChart)
@else
No SMS sent this month

Delivery statistics will appear here.

@endif
{{-- Treasury --}}

Company wallet & gas

Treasury balances from your CryptoAPIs HD wallet

@if(!empty($cryptoWallet))
Total value
${{ number_format((float) $treasuryTotal, 2) }}
@endif Manage wallet
@if(empty($cryptoWallet))
No HD wallet connected

Add your CryptoAPIs key to issue deposit addresses and track gas balances.

Add API key
@else
@foreach($treasuryCards as $wallet) @endforeach
Asset Address Balance Value
@if(!empty($wallet['image'])) {{ $wallet['title'] }} @else
{{ substr($wallet['title'], 0, 1) }}
@endif
{{ $wallet['title'] }} {{ $wallet['network_note'] }} @if(!empty($wallet['is_gas'])) Gas @endif
@if($wallet['address'] !== '') {{ $wallet['address'] }} @else — @endif {{ rtrim(rtrim(number_format((float) $wallet['balance'], 8, '.', ','), '0'), '.') ?: '0' }} {{ $wallet['title'] }} ${{ number_format((float) ($wallet['usd_value'] ?? 0), 2) }}
@endif
{{-- Last transactions --}}

Latest transactions

Last 10 deposits and withdrawals across your clients

See all
@if($transactions->isNotEmpty())
@foreach($transactions as $trans) @php $client = $trans->user; $clientName = $client ? (trim(($client->fname ?? '').' '.($client->lname ?? '')) ?: $client->email) : '—'; $isDeposit = $trans->type == 'Deposit'; @endphp @endforeach
Client Type Amount USD Coin Conf. Date
@if($client)
{{ strtoupper(substr($clientName, 0, 1)) }}
{{ $clientName }}
{{ $client->email }}
@else — @endif
{{ $isDeposit ? 'Deposit' : 'Withdrawal' }} {{ $isDeposit ? '+' : '-' }}{{ $trans->amount }} ${{ number_format((float) $trans->usd_amount, 2) }} {{ $trans->coin_short_name }} {{ $trans->confirmations ?? 0 }} {{ $fmtDate($trans->date ?: $trans->created_at) }}
@else
No transactions yet

Client deposits and withdrawals will show up here.

@endif
@endsection @section('script') @endsection