<?php use function App\Core\e; $section = 'odemeler'; $money = static fn ($v, $c = 'TRY') => number_format((float) $v, 2, ',', '.') . ' ' . $c; ?>
<div class="panel zpanel zpanel-app">
    <?php require BASE_PATH . '/app/Views/zpanel/_sidebar.php'; ?>
    <section class="panel-body zpanel-main">
        <div class="zpanel-head"><div><p class="eyebrow">ZPanel</p><h1>Odemeler</h1><p class="muted">Order/payment kayitlari. Kart bilgisi bu ekranda asla gosterilmez; refund TODO.</p></div></div>
        <section class="zpanel-card"><div class="table-scroll"><table class="zpanel-table">
            <thead><tr><th>Order no</th><th>Kullanici</th><th>Creator</th><th>Paket</th><th>Tutar</th><th>Provider</th><th>Status</th><th>Tarih</th></tr></thead><tbody>
            <?php foreach (($payments ?? []) as $payment): ?><tr><td><?= e($payment['order_no'] ?? '-') ?></td><td><?= e($payment['user_username'] ?? '-') ?></td><td><?= e($payment['creator_username'] ?? '-') ?></td><td><?= e($payment['package_name'] ?? '-') ?></td><td><?= e($money($payment['gross_amount'] ?? $payment['total'] ?? 0, $payment['currency'] ?? 'TRY')) ?></td><td><?= e($payment['provider'] ?? '-') ?></td><td><span class="status-pill"><?= e(($payment['payment_status'] ?? '') ?: ($payment['order_status'] ?? '-')) ?></span></td><td><?= e($payment['created_at'] ?? '') ?></td></tr><?php endforeach; ?>
            <?php if (empty($payments)): ?><tr><td colspan="8">Odeme kaydi yok.</td></tr><?php endif; ?>
            </tbody></table></div></section>
    </section>
</div>
