<?php $__template->layout('Layout.main'); ?>

<?php $__template->section('title'); ?>الحسابات البنكية<?php $__template->endSection(); ?>

<?php $__template->section('page_actions'); ?>
<a href="/accounting/bank-accounts/create" class="btn btn-primary">+ حساب بنكي جديد</a>
<?php $__template->endSection(); ?>

<?php $__template->section('content'); ?>
<div class="card">
    <div class="table-responsive">
        <table class="data-table" style="width:100%;">
            <thead>
                <tr>
                    <th>اسم الحساب</th>
                    <th>البنك</th>
                    <th>رقم الحساب</th>
                    <th>العملة</th>
                    <th>الرصيد الحالي</th>
                    <th>الحالة</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($accounts as $acc): ?>
                    <tr>
                        <td style="font-weight:600;"><?= e($acc['account_name_ar']) ?><?= (int)$acc['is_default'] ? ' <span style="color:#0D7377;font-size:11px;">(افتراضي)</span>' : '' ?></td>
                        <td><?= e($acc['bank_name_ar']) ?></td>
                        <td style="direction:ltr;text-align:right;"><?= e($acc['account_number']) ?></td>
                        <td><?= e($acc['currency']) ?></td>
                        <td style="direction:ltr;text-align:right;font-weight:600;"><?= money($acc['current_balance']) ?></td>
                        <td><span style="color:<?= (int)$acc['is_active'] ? '#059669' : '#DC2626' ?>;font-weight:600;"><?= (int)$acc['is_active'] ? 'نشط' : 'موقف' ?></span></td>
                        <td><a href="/accounting/bank-accounts/<?= (int)$acc['id'] ?>/edit" class="btn btn-sm btn-outline">تعديل</a></td>
                    </tr>
                <?php endforeach; ?>
                <?php if (empty($accounts)): ?>
                    <tr><td colspan="7" style="text-align:center;color:#6B7280;padding:30px;">لا توجد حسابات بنكية</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__template->endSection(); ?>
