<div class="d-flex justify-content-between align-items-center mb-4">
    <h4 class="mb-0"><?= lang('finance.receipt') ?> #<?= e($receipt['receipt_number']) ?></h4>
    <div class="d-flex gap-2">
        <?php if (auth_can('receipts.print')): ?>
        <a href="/finance/receipts/<?= $receipt['id'] ?>/print" target="_blank" class="btn btn-info"><i class="fas fa-print me-1"></i><?= lang('common.print') ?></a>
        <?php endif; ?>
        <a href="/finance/receipts" class="btn btn-outline-secondary"><?= lang('common.back') ?></a>
    </div>
</div>

<div class="row justify-content-center">
    <div class="col-lg-8">
        <div class="card">
            <div class="card-body p-4">
                <div class="text-center mb-4">
                    <h4><?= e($clubName) ?></h4>
                    <p class="text-muted mb-0"><?= e($clubAddress) ?></p>
                </div>
                <hr>
                <div class="row mb-3">
                    <div class="col-6">
                        <strong><?= lang('finance.receipt_no') ?>:</strong> <?= e($receipt['receipt_number']) ?><br>
                        <strong><?= lang('finance.date') ?>:</strong> <?= format_date($receipt['receipt_date']) ?>
                    </div>
                    <div class="col-6 text-end">
                        <strong><?= lang('finance.member') ?>:</strong> <?= e($receipt['member_name']) ?><br>
                        <strong><?= lang('finance.membership_no') ?>:</strong> <?= e($receipt['membership_number']) ?>
                    </div>
                </div>

                <table class="table table-bordered">
                    <thead class="table-light">
                        <tr><th>#</th><th><?= lang('finance.description') ?></th><th class="text-end"><?= lang('finance.amount') ?></th></tr>
                    </thead>
                    <tbody>
                        <?php foreach ($items as $i => $item): ?>
                        <tr><td><?= $i + 1 ?></td><td><?= e($item['description_en']) ?></td><td class="text-end"><?= format_number($item['amount']) ?></td></tr>
                        <?php endforeach; ?>
                    </tbody>
                    <tfoot>
                        <tr class="table-primary"><td colspan="2" class="text-end"><strong><?= lang('finance.total') ?>:</strong></td><td class="text-end"><strong><?= money($receipt['total_amount']) ?></strong></td></tr>
                    </tfoot>
                </table>

                <p class="mb-0"><strong><?= lang('finance.payment_method') ?>:</strong> <?= e($receipt['method_name'] ?? 'N/A') ?></p>
                <p class="mt-2"><?= status_badge($receipt['status']) ?></p>
            </div>
        </div>
    </div>
</div>