<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>التنازلات<?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?>
<div style="padding:8px 16px;background:#EFF6FF;border:1px solid #BFDBFE;border-radius:6px;font-size:13px;color:#0284C7;">
    💡 لتقديم طلب تنازل، اذهب لصفحة العضو
</div>
<?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<div class="card"><div class="table-responsive"><table class="data-table"><thead><tr><th>#</th><th>العضو المتنازل</th><th>رقم العضوية</th><th>قيمة العضوية</th><th>نسبة التنازل</th><th>رسوم التنازل</th><th>الحالة</th><th>الإجراءات</th></tr></thead><tbody>
<?php foreach ($rows as $r): ?>
<tr>
    <td><?= (int) $r['id'] ?></td>
    <td><a href="/members/<?= (int) $r['source_member_id'] ?>" style="color:#1e3a5f;font-weight:600;"><?= e($r['member_name'] ?? '') ?></a></td>
    <td style="font-weight:600;"><?= e($r['membership_number'] ?? '—') ?></td>
    <td><?= money($r['membership_value_at_waiver'] ?? '0') ?></td>
    <td><?= e($r['waiver_fee_percentage'] ?? '30') ?>%</td>
    <td style="font-weight:700;color:#1e3a5f;"><?= money($r['waiver_fee_amount'] ?? '0') ?></td>
    <td><span style="color:<?= match($r['status'] ?? '') { 'completed' => '#059669', 'approved' => '#0284C7', default => '#D97706' } ?>;font-weight:600;">● <?= match($r['status'] ?? '') { 'requested' => 'مقدم', 'approved' => 'معتمد', 'completed' => 'مكتمل', default => $r['status'] ?? '' } ?></span></td>
    <td><a href="/waivers/<?= (int) $r['id'] ?>" class="btn btn-sm btn-outline">عرض</a></td>
</tr>
<?php endforeach; ?>
<?php if (empty($rows)): ?><tr><td colspan="8" style="text-align:center;padding:40px;color:#6B7280;">لا توجد تنازلات</td></tr><?php endif; ?>
</tbody></table></div></div>
<?php $__template->endSection(); ?>