🛜 {{ __('Hotspot Manager') }} @push('styles') @endpush @push('scripts') {{-- Scripts handled by Vite/NPM --}} @endpush {{-- ── Router Selector ── --}}
@if($selectedRouter) {{ __(':count Online', ['count' => $onlineCount]) }} @endif
@if(!$selectedRouter)
{{ __('Select a connected router to manage Hotspot.') }}
@else {{-- ── Navigation Tabs ── --}} {{-- ====================================================================== --}} {{-- DASHBOARD TAB --}} {{-- ====================================================================== --}} @if($activeTab==='dashboard')
{{-- Resources Bar --}} @if($routerResources)
{{ __('CPU:') }} {{ $routerResources['cpu-load'] ?? 0 }}%
{{ __('MEM:') }} {{ number_format(($routerResources['free-memory'] ?? 0)/1048576, 1) }}MB / {{ number_format(($routerResources['total-memory'] ?? 0)/1048576, 1) }}MB
{{ __('HDD:') }} {{ number_format(($routerResources['free-hdd-space'] ?? 0)/1048576, 1) }}MB
{{ __('Uptime:') }} {{ $routerResources['uptime'] ?? '—' }}
{{ $routerResources['board-name'] ?? 'MikroTik' }} ({{ $routerResources['version'] ?? '?' }})
@endif
{{ count($users) }}
{{ __('Total Users') }}
{{ $onlineCount }}
{{ __('Online Now') }}
{{ $totalVouchers - $usedVouchers }}
{{ __('Unused Vouchers') }}
৳{{ number_format($monthIncome,0) }}
{{ __('This Month Income') }}
{{-- Sales Chart --}}
{{ __('Last 7 Days Sales') }}
{{-- Active Sessions Mini --}}
{{ __('Active Sessions') }}
@forelse($sessions as $s) @empty @endforelse
{{ __('User') }}{{ __('IP') }}{{ __('MAC') }}{{ __('Uptime') }}
{{ $s['user'] ?? '-' }} {{ $s['address'] ?? '-' }} {{ $s['mac-address'] ?? '-' }} {{ $s['uptime'] ?? '-' }}
{{ __('No active sessions') }}
{{-- Hotspot Logs --}}
{{ __('Live Hotspot Log') }}
@forelse($hsLogs as $log)
{{ $log['topics'] }} {{ Carbon\Carbon::parse($log['time'])->format('H:i:s') }}
{{ $log['message'] }}
@empty
{{ __('No logs found.') }}
@endforelse
{{-- Today Income / Stats --}}
{{ __('Today Income') }}
৳{{ number_format($todayIncome,2) }}
{{ now()->format('d M Y') }}
{{ __('Hotspot Servers') }}
@forelse($servers as $sv)
{{ $sv['name'] ?? '-' }}
{{ $sv['interface'] ?? '' }}
{{ ($sv['disabled'] ?? 'false')==='false'?__('ON'):__('OFF') }}
@empty
{{ __('No servers') }}
@endforelse
@endif {{-- ====================================================================== --}} {{-- USERS TAB --}} {{-- ====================================================================== --}} @if($activeTab==='users')
{!! __('Hotspot Users on :router', ['router' => '' . e($selectedRouter) . '']) !!} {{ count($users) }}
@forelse($users as $u) @php $bytesInRaw = (int)($u['bytes-in'] ?? 0); $bytesOutRaw = (int)($u['bytes-out'] ?? 0); $bytesIn = $bytesInRaw > 1073741824 ? number_format($bytesInRaw/1073741824,2).'GB' : number_format($bytesInRaw/1048576,1).'MB'; $bytesOut = $bytesOutRaw > 1073741824 ? number_format($bytesOutRaw/1073741824,2).'GB' : number_format($bytesOutRaw/1048576,1).'MB'; @endphp @empty @endforelse
{{ __('Server') }} {{ __('Name') }} {{ __('Profile') }} {{ __('MAC Address') }} {{ __('Uptime') }} {{ __('Bytes In') }} {{ __('Bytes Out') }} {{ __('Comment') }} {{ __('Action') }}
{{ $u['server'] ?? 'all' }} {{ $u['name'] ?? '-' }} @if(isset($u['password']) && $u['password'])
{{ $u['password'] }} @endif
{{ $u['profile'] ?? '-' }} {{ $u['mac-address'] ?? '—' }} {{ $u['uptime'] ?? '0s' }} {{ $bytesIn }} {{ $bytesOut }} {{ $u['comment'] ?? '—' }}
{{ __('No hotspot users found on this router.') }}
@endif {{-- ====================================================================== --}} {{-- SESSIONS TAB --}} {{-- ====================================================================== --}} @if($activeTab==='sessions')
{!! __('Active Sessions on :router', ['router' => '' . e($selectedRouter) . '']) !!}
@forelse($sessions as $s) @empty @endforelse
#{{ __('User') }}{{ __('IP Address') }}{{ __('MAC Address') }}{{ __('Uptime') }}{{ __('Download') }}{{ __('Upload') }}{{ __('Server') }}{{ __('Action') }}
{{ $loop->iteration }} {{ $s['user'] ?? '-' }} {{ $s['address'] ?? '-' }} {{ $s['mac-address'] ?? '-' }} {{ $s['uptime'] ?? '-' }} {{ number_format((int)($s['bytes-in'] ?? 0)/1048576,2) }} MB {{ number_format((int)($s['bytes-out'] ?? 0)/1048576,2) }} MB {{ $s['server'] ?? '-' }}
{{ __('No active hotspot sessions.') }}
@endif {{-- ====================================================================== --}} {{-- VOUCHERS TAB --}} {{-- ====================================================================== --}} @if($activeTab==='vouchers')
{{-- Generator Form --}}
{{ __('Voucher Generator') }}
@error('v_profile')
{{ $message }}
@enderror @if($v_profile) @php $localPkg = collect($hotspotPackages)->firstWhere('package', $v_profile); @endphp @if($localPkg)
{{ __('Linked to DB Package:') }} ৳{{ $localPkg->price }}
@endif @endif
@if(!$v_user_equals_pass)
@endif
{{-- Voucher List + Print --}}
{{-- Stats row --}}
{{ $totalVouchers }}
{{ __('Total') }}
{{ $totalVouchers - $usedVouchers }}
{{ __('Unused') }}
{{ $usedVouchers }}
{{ __('Used') }}
{{-- Batch overview --}} @if($voucherBatches->isNotEmpty())
{{ __('Batches') }}
@foreach($voucherBatches as $b) @endforeach
{{ __('Batch') }}{{ __('Profile') }}{{ __('Price') }}{{ __('Unused') }}{{ __('Used') }}{{ __('Actions') }}
{{ $b->batch_name }} {{ $b->profile }} ৳{{ number_format($b->price,0) }} {{ $b->unused_count }} {{ $b->used_count }}
@endif {{-- Filter --}}
@foreach(['all','unused','used','expired'] as $f) @endforeach
{{-- Voucher Table --}}
@forelse($vouchers as $v) @php $rUser = collect($users)->firstWhere('name', $v->username); $uptime = $rUser['uptime'] ?? '00:00:00'; $bIn = (int)($rUser['bytes-in'] ?? 0); $bOut = (int)($rUser['bytes-out'] ?? 0); $formatBytes = function($b) { if ($b == 0) return '0 Byte'; if ($b < 1024) return $b . ' Byte'; if ($b < 1048576) return number_format($b/1024, 0) . ' KiB'; if ($b < 1073741824) return number_format($b/1048576, 0) . ' MiB'; return number_format($b/1073741824, 1) . ' GiB'; }; @endphp @empty @endforelse
{{ __('Server') }} {{ __('Name') }} {{ __('Print') }} {{ __('Profile') }} {{ __('MAC Address') }} {{ __('Uptime') }} {{ __('Bytes In') }} {{ __('Bytes Out') }} {{ __('Comment') }}
@php $isUserDisabled = collect($users)->firstWhere('name', $v->username)['disabled'] ?? 'false'; @endphp
all
{{ $v->username }}
{{ $v->profile }} {{ $v->mac_address ?: '' }} {{ $uptime }} {{ $formatBytes($bIn) }} {{ $formatBytes($bOut) }}
{{ $v->batch_name }} {{ $v->note }}
{{ __('No vouchers found.') }}
{{ $vouchers->links() }}
@endif {{-- ====================================================================== --}} {{-- PROFILES TAB --}} {{-- ====================================================================== --}} @if($activeTab==='profiles')
{{ $editUserProfileId ? __('Edit User Profile') : __('Add User Profile') }} @if($editUserProfileId) @endif
@error('up_name')
{{ $message }}
@enderror
@if($editUserProfileId) @endif
{{-- Linked packages from billing DB --}}
{{ __('Packages in DB') }}
@forelse($hotspotPackages as $pkg)
{{ $pkg->package }} @if($pkg->mikrotik_rate_limit)
{{ $pkg->mikrotik_rate_limit }}@endif
৳{{ number_format($pkg->price,0) }}
@empty
{{ __('No packages in database.') }}
@endforelse
{!! __('User Profiles on :router', ['router' => '' . e($selectedRouter) . '']) !!} {{ count($userProfiles) }}
@forelse($userProfiles as $p) @empty @endforelse
{{ __('Name') }} {{ __('Rate Limit') }} {{ __('Shared') }} {{ __('Session TO') }} {{ __('Idle TO') }} {{ __('Address Pool') }} {{ __('Actions') }}
{{ $p['name'] ?? '-' }} @if($p['rate-limit'] ?? '') {{ $p['rate-limit'] }} @else @endif {{ $p['shared-users'] ?? '1' }} @php $st = $p['session-timeout'] ?? ''; @endphp {{ ($st && $st !== '0s') ? $st : '∞' }} @php $it = $p['idle-timeout'] ?? ''; @endphp {{ ($it && $it !== '0s') ? $it : '∞' }} @php $pool = $p['address-pool'] ?? 'none'; @endphp {{ $pool ?: 'none' }} @if(($p['default'] ?? 'no') === 'no') @endif
{{ __('No user profiles found.') }}
@endif {{-- ====================================================================== --}} {{-- INCOME TAB --}} {{-- ====================================================================== --}} @if($activeTab==='income')
{{-- Record Sale Form --}}
{{ __('Record Sale / Payment') }}
@error('s_username')
{{ $message }}
@enderror
@error('s_profile')
{{ $message }}
@enderror
@error('s_amount')
{{ $message }}
@enderror
{{-- Sales list --}}
৳{{ number_format($todayIncome,2) }}
{{ __('Today') }}
৳{{ number_format($monthIncome,2) }}
{{ __('This Month') }}
{{ __('To') }}
{{ __('Sales Records') }}
@forelse($sales as $s) @empty @endforelse @if($sales->isNotEmpty()) @endif
{{ __('Date') }}{{ __('User') }}{{ __('Profile') }}{{ __('Amount') }}{{ __('Method') }}{{ __('Voucher') }}{{ __('Note') }}{{ __('Del') }}
{{ $s->sale_date->format('d M Y') }} {{ $s->username }} {{ $s->profile }} ৳{{ number_format($s->amount,2) }} {{ $s->payment_method }} {{ $s->voucher_code ?? '—' }} {{ $s->note }}
{{ __('No sales recorded for selected period.') }}
{{ __('Total:') }} ৳{{ number_format($sales->sum('amount'),2) }}
@endif {{-- ====================================================================== --}} {{-- REPORT TAB --}} {{-- ====================================================================== --}} @if($activeTab==='report') @php $r = $reportData; $dailyData = $r['daily'] ?? collect(); $byProfile = $r['byProfile'] ?? collect(); @endphp
{{-- Summary Cards --}}
৳{{ number_format($r['total'] ?? 0, 2) }}
{!! __('Total Income (:from → :to)', ['from' => e($r['from'] ?? ''), 'to' => e($r['to'] ?? '')]) !!}
{{ $r['count'] ?? 0 }}
{{ __('Total Sales') }}
৳{{ $r['count'] > 0 ? number_format(($r['total'] ?? 0) / $r['count'], 2) : '0.00' }}
{{ __('Avg Per Sale') }}
{{-- Daily breakdown --}}
{{ __('Daily Income Breakdown') }}
@php $grandTotal = $r['total'] ?? 0; @endphp @forelse($dailyData as $date => $daySales) @php $dayTotal = $daySales->sum('amount'); @endphp @empty @endforelse
{{ __('Date') }}{{ __('Sales Count') }}{{ __('Total Amount') }}{{ __('% of Period') }}
{{ \Carbon\Carbon::parse($date)->format('d M Y') }} {{ $daySales->count() }} ৳{{ number_format($dayTotal,2) }} @if($grandTotal > 0)
{{ round($dayTotal/$grandTotal*100) }}%
@endif
{{ __('No data for selected period.') }}
{{-- By Profile --}}
{{ __('Income by Profile') }}
@forelse($byProfile as $bp)
{{ $bp['profile'] }} ×{{ $bp['count'] }}
৳{{ number_format($bp['total'],2) }}
@empty
{{ __('No profile data.') }}
@endforelse
{{-- Voucher summary --}}
{{ __('Voucher Summary') }}
{{ __('Total Vouchers') }}{{ $totalVouchers }}
{{ __('Used') }}{{ $usedVouchers }}
{{ __('Unused') }}{{ $totalVouchers - $usedVouchers }}
@endif {{-- end report tab --}} {{-- ====================================================================== --}} {{-- SETUP TAB --}} {{-- ====================================================================== --}} @if($activeTab==='setup')
{{-- ── Left Column: Server Overview + Server Profiles ── --}}
{{-- Hotspot Servers --}}
{{ __('Hotspot Servers') }} {{ count($servers) }}
@forelse($servers as $s) @empty Middle: @endforelse
{{ __('Name') }}{{ __('Interface') }}{{ __('Address Pool') }}{{ __('Profile') }}
{{ $s['name'] ?? '-' }} {{ $s['interface'] ?? '-' }} {{ $s['address-pool'] ?? 'none' }} {{ $s['profile'] ?? '-' }}
{{ __('No hotspot servers found.') }}
{{-- Server Profiles --}}
{{ __('Server Profiles') }}
@forelse($profiles as $p) @empty @endforelse
{{ __('Name') }}{{ __('Hotspot Address') }}{{ __('DNS Name') }}{{ __('Login By') }}
{{ $p['name'] ?? '-' }} {{ $p['hotspot-address'] ?? '-' }} {{ $p['dns-name'] ?? '-' }} {{ $p['login-by'] ?? '-' }}
{{ __('No server profiles found.') }}
{{-- ── Right Column: Quick Stats + Link to Profiles Tab ── --}}
{{-- Active Sessions Summary --}}
{{ __('Live Status') }}
{{ $onlineCount }}
{{ __('Online') }}
{{ count($users) }}
{{ __('Total Users') }}
{{ count($userProfiles) }}
{{ __('Profiles') }}
{{-- User Profiles Quick View (Read-only, manage in Profiles tab) --}}
{{ __('User Profiles') }} {{ count($userProfiles) }}
@forelse($userProfiles as $p) @empty @endforelse
{{ __('Name') }}{{ __('Rate Limit') }}{{ __('Shared') }}{{ __('Session Timeout') }}
{{ $p['name'] ?? '-' }} {{ $p['rate-limit'] ?? '—' }} {{ $p['shared-users'] ?? 1 }} {{ $p['session-timeout'] ?? '—' }}
{!! __('No profiles. Go to :link to add.', ['link' => '' . __('Profiles') . '']) !!}
@endif {{-- ====================================================================== --}} {{-- USER MODAL — lives outside all tab conditionals so it works from any tab --}} {{-- (editVoucher, editUserByName, startAddUser all dispatch open-modal) --}} {{-- ====================================================================== --}} {{-- Print area: inside router branch so Users + Vouchers tabs can print from any active tab --}} @endif {{-- end $selectedRouter --}} @push('scripts') @endpush