<?php
$db = Database::getInstance();
$expCount = (int)$db->fetchColumn("SELECT COUNT(*) FROM member_cards WHERE status='active' AND expiry_date IS NOT NULL AND expiry_date BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 30 DAY)");
?>
<div class="card border-warning h-100">
    <div class="card-body">
        <div class="d-flex justify-content-between">
            <div>
                <h6 class="text-muted mb-1"><?= lang('cards.expiring_30') ?></h6>
                <h3 class="mb-0 text-warning"><?= number_format($expCount) ?></h3>
                <small class="text-muted">Cards expiring within 30 days</small>
            </div>
            <div class="align-self-center"><i class="fas fa-id-card fa-2x text-warning opacity-50"></i></div>
        </div>
        <a href="/cards" class="stretched-link"></a>
    </div>
</div>