<?php $__env->startSection('title', 'Super Admin Dashboard'); ?>
<?php $__env->startSection('page-title', 'Platform Dashboard'); ?>
<?php $__env->startSection('page-subtitle', 'Active, trial, new, and expired tenants'); ?>

<?php $__env->startSection('content'); ?>
<div class="row g-3 mb-4">
    <?php $__currentLoopData = [
        ['Active tenants', $activeTenants, 'bi-building-check', route('super.tenants.index', ['view' => 'active'])],
        ['Trial tenants', $trialTenants, 'bi-hourglass-split', route('super.tenants.index', ['view' => 'trial'])],
        ['New tenants', $newTenants, 'bi-stars', route('super.tenants.index', ['view' => 'new'])],
        ['Expired tenants', $expiredTenants, 'bi-exclamation-triangle', route('super.tenants.index', ['view' => 'expired'])],
    ]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as [$label, $value, $icon, $url]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="col-md-6 col-xl-3">
            <a class="card metric-card text-decoration-none text-reset" href="<?php echo e($url); ?>">
                <div class="card-body d-flex justify-content-between">
                    <div>
                        <div class="text-muted small"><?php echo e($label); ?></div>
                        <div class="h3 mb-0"><?php echo e($value); ?></div>
                    </div>
                    <i class="bi <?php echo e($icon); ?> fs-2 text-info"></i>
                </div>
            </a>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>

<div class="row g-3 mb-4">
    <div class="col-md-3">
        <div class="card border-0 shadow-sm h-100">
            <div class="card-body">
                <div class="text-muted small">Total tenants</div>
                <div class="h4 mb-0"><?php echo e($tenantsTotal); ?></div>
            </div>
        </div>
    </div>
    <div class="col-md-3">
        <a href="<?php echo e(route('super.plans.index')); ?>" class="card border-0 shadow-sm h-100 text-reset text-decoration-none">
            <div class="card-body">
                <div class="text-muted small">Active plans</div>
                <div class="h4 mb-0"><?php echo e($activePlans); ?></div>
            </div>
        </a>
    </div>
    <div class="col-md-3">
        <div class="card border-0 shadow-sm h-100">
            <div class="card-body">
                <div class="text-muted small">Monthly revenue</div>
                <div class="h4 mb-0"><?php echo e(number_format($monthlyRevenue, 2)); ?></div>
            </div>
        </div>
    </div>
    <div class="col-md-3">
        <div class="card border-0 shadow-sm h-100">
            <div class="card-body">
                <div class="text-muted small">Open tickets</div>
                <div class="h4 mb-0"><?php echo e($openTickets); ?></div>
            </div>
        </div>
    </div>
</div>

<div class="row g-3 mb-4">
    <div class="col-md-6">
        <a href="<?php echo e(route('super.agents.index', ['status' => 'active'])); ?>" class="card border-0 shadow-sm h-100 text-reset text-decoration-none">
            <div class="card-body d-flex justify-content-between align-items-start">
                <div>
                    <div class="text-muted small">Active merchants</div>
                    <div class="h4 mb-0"><?php echo e($activeAgents); ?></div>
                </div>
                <i class="bi bi-person-check fs-3 text-success"></i>
            </div>
        </a>
    </div>
    <div class="col-md-6">
        <a href="<?php echo e(route('super.agents.index', ['status' => 'pending'])); ?>" class="card border-0 shadow-sm h-100 text-reset text-decoration-none">
            <div class="card-body d-flex justify-content-between align-items-start">
                <div>
                    <div class="text-muted small">Pending merchant signups</div>
                    <div class="h4 mb-0"><?php echo e($pendingAgents); ?></div>
                </div>
                <i class="bi bi-hourglass-split fs-3 text-warning"></i>
            </div>
        </a>
    </div>
</div>

<div class="row g-4">
    <div class="col-lg-7">
        <div class="card border-0 shadow-sm">
            <div class="card-header bg-white fw-semibold">New tenants</div>
            <div class="table-responsive">
                <table class="table mb-0">
                    <thead><tr><th>Company</th><th>Tenant state</th><th>Plan</th><th></th></tr></thead>
                    <tbody>
                    <?php $__currentLoopData = $newTenantsList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tenant): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td>
                                <div class="fw-semibold"><?php echo e($tenant->name); ?></div>
                                <small class="text-muted">Joined <?php echo e($tenant->created_at?->diffForHumans()); ?></small>
                            </td>
                            <td>
                                <?php if($tenant->isExpired()): ?>
                                    <span class="badge text-bg-warning">Expired</span>
                                <?php elseif($tenant->isOnTrial()): ?>
                                    <span class="badge text-bg-success">Trial</span>
                                <?php else: ?>
                                    <span class="badge text-bg-secondary"><?php echo e(ucfirst($tenant->status)); ?></span>
                                <?php endif; ?>
                            </td>
                            <td><?php echo e($tenant->plan?->name ?? 'None'); ?></td>
                            <td><a href="<?php echo e(route('super.tenants.show', $tenant)); ?>" class="btn btn-sm btn-outline-primary">Open</a></td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="col-lg-5">
        <div class="card border-0 shadow-sm">
            <div class="card-header bg-white fw-semibold">Pending payments</div>
            <div class="list-group list-group-flush">
                <?php $__empty_1 = true; $__currentLoopData = $pendingPayments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $payment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <a class="list-group-item list-group-item-action" href="<?php echo e(route('super.billing.index')); ?>">
                        <div class="fw-semibold"><?php echo e($payment->tenant?->name); ?> - <?php echo e(number_format($payment->amount, 2)); ?></div>
                        <small class="text-muted"><?php echo e($payment->plan?->name); ?> · <?php echo e($payment->reference); ?></small>
                    </a>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <div class="list-group-item text-muted">No pending payments.</div>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\Polite hp\Documents\Codex\2026-05-08\build-a-complete-production-ready-saas\microfinance-saas\resources\views\super\dashboard.blade.php ENDPATH**/ ?>