<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>هياكل الرواتب<?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?>
<a href="/hr/salary-structures/create" class="btn btn-primary" style="display:inline-flex;align-items:center;gap:6px;"><i data-lucide="plus" style="width:16px;height:16px;"></i> إضافة هيكل</a>
<?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></tr></thead>
            <tbody>
                <?php if (empty($structures)): ?>
                <tr><td colspan="6" style="text-align:center;padding:40px;color:#9CA3AF;">لا توجد هياكل رواتب</td></tr>
                <?php else: ?>
                <?php foreach ($structures as $s): ?>
                <tr>
                    <td><code><?= e($s['code']) ?></code></td>
                    <td><a href="/hr/salary-structures/<?= (int) $s['id'] ?>"><?= e($s['name_ar']) ?></a></td>
                    <td><?= (int) $s['component_count'] ?></td>
                    <td><?= $s['is_default'] ? '<span style="color:#059669;">&#10003;</span>' : '' ?></td>
                    <td>
                        <?php if ($s['is_active']): ?>
                        <span style="display:inline-block;padding:2px 8px;border-radius:9999px;font-size:12px;background:#DEF7EC;color:#03543F;">نشط</span>
                        <?php else: ?>
                        <span style="display:inline-block;padding:2px 8px;border-radius:9999px;font-size:12px;background:#FDE8E8;color:#9B1C1C;">غير نشط</span>
                        <?php endif; ?>
                    </td>
                    <td>
                        <a href="/hr/salary-structures/<?= (int) $s['id'] ?>" style="color:#2563EB;margin-inline-end:8px;"><i data-lucide="eye" style="width:16px;height:16px;"></i></a>
                        <a href="/hr/salary-structures/<?= (int) $s['id'] ?>/edit" style="color:#059669;"><i data-lucide="edit" style="width:16px;height:16px;"></i></a>
                    </td>
                </tr>
                <?php endforeach; ?>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<script>if(typeof lucide!=='undefined')lucide.createIcons();</script>
<?php $__template->endSection(); ?>
