<div class="row">
    <div class="col-12">
        <div class="card glass-card">
            <div class="card-header"><h5 class="card-title">Loyalty Report</h5></div>
            <div class="card-body">
                <?php $this->include('Reports/partials/filter_date') ?>
                <div class="table-responsive mt-3">
                    <table class="table table-hover">
                        <thead>
                            <tr><th>Customer</th><th class="text-center">Total Points</th><th class="text-center">Earned</th><th class="text-center">Redeemed</th><th class="text-text-end">Value Redeemed</th></tr>
                        </thead>
                        <tbody>
                            <?php if (empty($data)): ?>
                            <tr><td colspan="5" class="text-center py-4 text-muted">No data available.</td></tr>
                            <?php else: ?>
                                <?php foreach ($data as $row): ?>
                                <tr>
                                    <td><?= e($row->customer_name ?? 'N/A') ?></td>
                                    <td class="text-center"><?= $row->total_points ?></td>
                                    <td class="text-center"><?= $row->earned_points ?></td>
                                    <td class="text-center"><?= $row->redeemed_points ?></td>
                                    <td class="text-end"><?= currency($row->value_redeemed ?? 0) ?></td>
                                </tr>
                                <?php endforeach; ?>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
