<?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['member_id'] ?>" style="color:#1e3a5f;font-weight:600;"><?= e($r['member_name']) ?></a></td>
    <td><?= e($r['spouse_name']) ?></td>
    <td style="font-size:13px;"><?= e($r['divorce_date']) ?></td>
    <td style="font-size:13px;"><?= e(\App\Modules\Divorce\Models\DivorceCase::getCaseTypeLabel($r['divorce_case_type'])) ?></td>
    <td style="font-weight:600;"><?= money($r['total_fee'] ?? $r['fee_amount'] ?? '0') ?></td>
    <?php
    $sColor = match($r['status']) { 'completed' => '#059669', 'fee_paid' => '#7C3AED', 'board_approved' => '#2563EB', 'rejected' => '#DC2626', default => '#D97706' };
    $sLabel = match($r['status']) { 'completed' => 'مكتمل', 'fee_paid' => 'تم السداد', 'board_approved' => 'معتمد', 'board_review' => 'في انتظار المجلس', 'rejected' => 'مرفوض', 'submitted' => 'مقدّم', default => $r['status'] };
    ?>
    <td><span style="color:<?= $sColor ?>;font-weight:600;">● <?= $sLabel ?></span></td>
    <td><a href="/divorce/<?= (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(); ?>