<?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>النسبة</th><th>سنوي</th><th>الفرع</th><th>الإجراءات</th></tr>
            </thead>
            <tbody>
                <?php foreach ($services as $s): ?>
                <tr>
                    <td><code style="font-size:11px;"><?= e($s['service_code']) ?></code></td>
                    <td><?= e($s['name_ar']) ?></td>
                    <td><span style="background:#F3F4F6;padding:2px 8px;border-radius:4px;font-size:12px;"><?= e($s['price_type']) ?></span></td>
                    <td style="direction:ltr;text-align:right;"><?= $s['base_amount'] ? money($s['base_amount']) : '—' ?></td>
                    <td><?= $s['percentage'] ? percentage($s['percentage']) : '—' ?></td>
                    <td style="direction:ltr;text-align:right;"><?= $s['annual_amount'] ? money($s['annual_amount']) : '—' ?></td>
                    <td style="font-size:12px;"><?= e($s['branch_name'] ?? 'عام') ?></td>
                    <td><a href="/catalog/<?= (int) $s['id'] ?>/edit" class="btn btn-sm btn-outline">تعديل</a></td>
                </tr>
                <?php endforeach; ?>
                <?php if (empty($services)): ?>
                <tr><td colspan="8" style="text-align:center;padding:40px;color:#6B7280;">لا توجد خدمات</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__template->endSection(); ?>