<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>الأعضاء الأجانب<?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>الرسوم (USD)</th><th>الحالة</th></tr></thead>
            <tbody>
                <?php foreach ($rows as $r): ?>
                <tr>
                    <td><a href="/members/<?= (int) $r['member_id'] ?>" style="color:#1e3a5f;font-weight:600;"><?= e($r['member_name']) ?></a></td>
                    <td style="direction:ltr;text-align:right;"><?= e($r['passport_number']) ?></td>
                    <td><?= e($r['nationality_name'] ?? '—') ?></td>
                    <td style="font-size:13px;<?php
                        $expiry = $r['passport_expiry_date'] ?? '';
                        $sixMonths = date('Y-m-d', strtotime('+6 months'));
                        echo ($expiry && $expiry <= $sixMonths) ? 'color:#DC2626;font-weight:600;' : '';
                    ?>"><?= e($expiry) ?></td>
                    <td style="font-weight:600;direction:ltr;text-align:right;"><?= number_format((float) ($r['fee_amount_usd'] ?? 0), 2) ?> $</td>
                    <td><span style="color:#059669;font-weight:600;">● نشط</span></td>
                </tr>
                <?php endforeach; ?>
                <?php if (empty($rows)): ?><tr><td colspan="6" style="text-align:center;padding:40px;color:#6B7280;">لا يوجد أعضاء أجانب</td></tr><?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__template->endSection(); ?>