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

<p class="text-muted mb-4">This month's revenue at a glance, plus the pricing and billing setup screens.</p>

<div class="row g-3 mb-4">
    <div class="col-md-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="text-muted small text-uppercase fw-bold mb-1">Revenue This Month</div>
                <div class="fs-3 fw-bold"><?= format_money($monthRevenue) ?></div>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="text-muted small text-uppercase fw-bold mb-1">Collected This Month</div>
                <div class="fs-3 fw-bold"><?= format_money($monthCollected) ?></div>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="text-muted small text-uppercase fw-bold mb-2">By Category</div>
                <?php foreach ((new \Config\Lookups())->folioCategories as $key => $meta): ?>
                    <div class="d-flex justify-content-between small mb-1">
                        <span class="text-muted"><?= esc($meta['label']) ?></span>
                        <span class="fw-semibold"><?= format_money($monthByCategory[$key] ?? '0.00') ?></span>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
</div>

<div class="row g-3">
    <div class="col-md-4">
        <a href="<?= site_url('rate-plans') ?>" class="card h-100 text-decoration-none text-dark">
            <div class="card-body">
                <i class="bi bi-tags fs-3" style="color: var(--brand);"></i>
                <h5 class="mt-2">Rate Plans</h5>
                <p class="text-muted small mb-0">Manage seasonal and promotional pricing for room types.</p>
            </div>
        </a>
    </div>
    <div class="col-md-4">
        <a href="<?= site_url('corporate-accounts') ?>" class="card h-100 text-decoration-none text-dark">
            <div class="card-body">
                <i class="bi bi-briefcase fs-3" style="color: var(--brand);"></i>
                <h5 class="mt-2">Corporate Accounts</h5>
                <p class="text-muted small mb-0">Companies billed on a monthly statement instead of per-stay.</p>
            </div>
        </a>
    </div>
    <div class="col-md-4">
        <a href="<?= site_url('settings') ?>" class="card h-100 text-decoration-none text-dark">
            <div class="card-body">
                <i class="bi bi-credit-card fs-3" style="color: var(--brand);"></i>
                <h5 class="mt-2">Payment Integrations</h5>
                <p class="text-muted small mb-0">Hubtel, WhatsApp and SMS credentials for this hotel.</p>
            </div>
        </a>
    </div>
</div>

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