<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>جداول العمل<?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?><a href="/hr/schedules/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><th>إجراءات</th></tr></thead>
            <tbody>
                <?php if (empty($schedules)): ?>
                <tr><td colspan="7" style="text-align:center;padding:40px;color:#9CA3AF;">لا توجد جداول عمل</td></tr>
                <?php else: ?>
                <?php $typeLabels = ['fixed' => 'ثابت', 'rotating' => 'دوري', 'flexible' => 'مرن']; ?>
                <?php foreach ($schedules as $s): ?>
                <tr>
                    <td><code><?= e($s['code']) ?></code></td>
                    <td><?= e($s['name_ar']) ?></td>
                    <td><?= e($typeLabels[$s['schedule_type']] ?? $s['schedule_type']) ?></td>
                    <td><?= e($s['hours_per_day']) ?></td>
                    <td><?= e($s['hours_per_week']) ?></td>
                    <td><?= (int) $s['employee_count'] ?></td>
                    <td><a href="/hr/schedules/<?= (int) $s['id'] ?>/edit" style="color:#2563EB;"><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(); ?>
