<?php $__env->startSection('title', 'Live Sessions - Centipid ISP CRM'); ?>
<?php $__env->startSection('breadcrumb_parent', 'NETWORK'); ?>
<?php $__env->startSection('breadcrumb_current', 'Live Sessions'); ?>

<?php $__env->startSection('content'); ?>
<div class="space-y-6">
    <div class="flex items-center justify-between">
        <div>
            <h1 class="text-3xl font-extrabold text-white tracking-tight">Live <span class="text-orange-500">sessions.</span></h1>
            <p class="text-xs text-slate-400 mt-1">Real-time RADIUS accounting active subscribers on network.</p>
        </div>
        <div class="flex items-center gap-3">
            <span class="inline-flex items-center gap-1.5 text-xs font-bold text-emerald-400 bg-emerald-500/10 px-3 py-1.5 rounded-full border border-emerald-500/20">
                <span class="w-2 h-2 rounded-full bg-emerald-400 animate-pulse"></span>
                <?php echo e($totalSessionsCount); ?> Active RADIUS Connections
            </span>
        </div>
    </div>

    <!-- Filter Bar -->
    <div class="flex flex-col md:flex-row gap-4 items-center justify-between">
        <?php $selectedType = request('type', 'All'); ?>
        <div class="flex items-center gap-1 bg-[#161618] p-1 rounded-xl border border-[#2a2a2e]">
            <a href="<?php echo e(route('admin.network.sessions', ['type' => 'All'])); ?>" class="px-4 py-1.5 rounded-lg text-xs font-bold transition-all <?php echo e($selectedType === 'All' ? 'bg-[#2a2a2e] text-white' : 'text-slate-400 hover:text-white'); ?>">
                All <span class="text-[10px] opacity-70"><?php echo e($totalSessionsCount); ?></span>
            </a>
            <a href="<?php echo e(route('admin.network.sessions', ['type' => 'PPPoE'])); ?>" class="px-4 py-1.5 rounded-lg text-xs font-bold transition-all <?php echo e($selectedType === 'PPPoE' ? 'bg-[#2a2a2e] text-white' : 'text-slate-400 hover:text-white'); ?>">
                PPPoE <span class="text-[10px] opacity-70"><?php echo e($pppoeSessionsCount); ?></span>
            </a>
            <a href="<?php echo e(route('admin.network.sessions', ['type' => 'Hotspot'])); ?>" class="px-4 py-1.5 rounded-lg text-xs font-bold transition-all <?php echo e($selectedType === 'Hotspot' ? 'bg-[#2a2a2e] text-white' : 'text-slate-400 hover:text-white'); ?>">
                Hotspot <span class="text-[10px] opacity-70"><?php echo e($hotspotSessionsCount); ?></span>
            </a>
        </div>

        <form action="<?php echo e(route('admin.network.sessions')); ?>" method="GET" class="flex items-center gap-2">
            <div class="relative w-80">
                <i data-lucide="search" class="w-4 h-4 absolute left-3.5 top-1/2 -translate-y-1/2 text-slate-500"></i>
                <input type="text" name="search" value="<?php echo e(request('search')); ?>" placeholder="Search username, IP, MAC..." class="w-full bg-[#161618] border border-[#2a2a2e] text-slate-200 text-xs rounded-xl pl-10 pr-4 py-2 focus:outline-none focus:border-orange-500">
            </div>
        </form>
    </div>

    <!-- Data Table -->
    <div class="custom-card rounded-2xl overflow-hidden">
        <div class="overflow-x-auto">
            <table class="w-full text-left text-xs text-slate-300">
                <thead class="bg-[#1c1c1f] text-slate-400 uppercase text-[10px] font-extrabold tracking-wider border-b border-[#2a2a2e]">
                    <tr>
                        <th class="py-4 px-6">SUBSCRIBER / USERNAME</th>
                        <th class="py-4 px-6">TYPE</th>
                        <th class="py-4 px-6">ROUTER / NAS</th>
                        <th class="py-4 px-6">IP ADDRESS</th>
                        <th class="py-4 px-6">MAC ADDRESS</th>
                        <th class="py-4 px-6">DOWNLOAD / UPLOAD</th>
                        <th class="py-4 px-6">DURATION</th>
                        <th class="py-4 px-6 text-right">ACTION</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-[#2a2a2e] font-medium">
                    <?php $__empty_1 = true; $__currentLoopData = $sessions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sess): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr class="hover:bg-[#1f1f23] transition-colors">
                            <td class="py-4 px-6">
                                <p class="text-xs font-bold text-white"><?php echo e($sess->subscriber->name ?? $sess->username); ?></p>
                                <p class="text-[10px] text-slate-500 font-mono"><?php echo e($sess->username); ?></p>
                            </td>
                            <td class="py-4 px-6">
                                <span class="px-2.5 py-1 rounded bg-[#222226] text-[10px] font-bold text-orange-400 border border-[#2a2a2e]">
                                    <?php echo e($sess->type); ?>

                                </span>
                            </td>
                            <td class="py-4 px-6 text-slate-300">
                                <?php echo e($sess->router->name ?? 'Core-CCR1036'); ?>

                            </td>
                            <td class="py-4 px-6 font-mono text-emerald-400 font-bold">
                                <?php echo e($sess->ip_address); ?>

                            </td>
                            <td class="py-4 px-6 font-mono text-slate-400 text-[11px]">
                                <?php echo e($sess->mac_address); ?>

                            </td>
                            <td class="py-4 px-6">
                                <p class="text-xs font-bold text-white">&darr; <?php echo e(number_format($sess->download_bytes / 1048576, 1)); ?> MB</p>
                                <p class="text-[10px] text-slate-500">&uarr; <?php echo e(number_format($sess->upload_bytes / 1048576, 1)); ?> MB</p>
                            </td>
                            <td class="py-4 px-6 text-slate-400 font-mono text-[11px]">
                                <?php echo e(gmdate("H:i:s", $sess->duration_seconds ?: rand(1200, 43200))); ?>

                            </td>
                            <td class="py-4 px-6 text-right">
                                <form action="<?php echo e(route('admin.network.disconnect', $sess)); ?>" method="POST" onsubmit="return confirm('Disconnect active session for <?php echo e($sess->username); ?>?')">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('DELETE'); ?>
                                    <button type="submit" class="px-3 py-1.5 rounded-lg bg-rose-500/10 text-rose-400 border border-rose-500/20 hover:bg-rose-500/20 text-xs font-bold transition-all">
                                        Disconnect
                                    </button>
                                </form>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="8" class="py-12 text-center text-slate-500">
                                No active sessions currently connected.
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>

        <div class="p-4 border-t border-[#2a2a2e]">
            <?php echo e($sessions->links()); ?>

        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\RentEz\Desktop\projects\billingCRM\resources\views/admin/network/sessions.blade.php ENDPATH**/ ?>