<?= $this->extend('admin/layouts/main') ?>
<?= $this->section('content') ?>

<div class="row g-3 mb-4">
    <div class="col-lg-3 col-6">
        <div class="stat-card">
            <div class="stat-label">Total Hotels</div>
            <div class="stat-value"><?= (int) $totalHotels ?></div>
        </div>
    </div>
    <div class="col-lg-3 col-6">
        <div class="stat-card">
            <div class="stat-label">Est. MRR</div>
            <div class="stat-value"><?= format_money($mrr) ?></div>
        </div>
    </div>
    <div class="col-lg-3 col-6">
        <div class="stat-card">
            <div class="stat-label">Total Collected</div>
            <div class="stat-value"><?= format_money($totalCollected) ?></div>
        </div>
    </div>
    <div class="col-lg-3 col-6">
        <div class="stat-card">
            <div class="stat-label">Outstanding</div>
            <div class="stat-value"><?= format_money($totalOutstanding) ?></div>
        </div>
    </div>
</div>

<div class="row g-3">
    <div class="col-lg-6">
        <div class="card">
            <div class="card-header">Subscriptions by Status</div>
            <ul class="list-group list-group-flush">
                <?php foreach ((new \Config\Lookups())->subscriptionStatuses as $key => $s): ?>
                    <li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><span class="badge bg-<?= $s['badge'] ?> me-2"><?= esc($s['label']) ?></span></span>
                        <span class="fw-bold"><?= (int) ($subsByStatus[$key] ?? 0) ?></span>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
    </div>
    <div class="col-lg-6">
        <div class="card">
            <div class="card-header">Invoices by Status</div>
            <ul class="list-group list-group-flush">
                <?php foreach ((new \Config\Lookups())->invoiceStatuses as $key => $s): ?>
                    <li class="list-group-item d-flex justify-content-between align-items-center">
                        <span><span class="badge bg-<?= $s['badge'] ?> me-2"><?= esc($s['label']) ?></span></span>
                        <span class="fw-bold"><?= (int) ($invoicesByStatus[$key] ?? 0) ?></span>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
    </div>
</div>

<?= $this->endSection() ?>
