<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>الجداول الشهرية - <?= e($playground['playground_name_ar']) ?><?php $__template->endSection(); ?>

<?php $__template->section('page_actions'); ?>
<a href="/playgrounds/<?= (int) $playground['id'] ?>/schedules/create" class="btn btn-primary"><i data-lucide="plus" style="width:16px;height:16px;vertical-align:middle;margin-left:4px;"></i> جدول جديد</a>
<a href="/playgrounds/<?= (int) $playground['id'] ?>" class="btn btn-outline-secondary">رجوع</a>
<?php $__template->endSection(); ?>

<?php $__template->section('content'); ?>
<?php if (empty($schedules)): ?>
<div class="card" style="padding:60px;text-align:center;">
    <i data-lucide="calendar" style="width:48px;height:48px;color:#9CA3AF;margin-bottom:16px;"></i>
    <p style="font-size:16px;color:#6B7280;">لا توجد جداول شهرية</p>
    <a href="/playgrounds/<?= (int) $playground['id'] ?>/schedules/create" class="btn btn-primary">إنشاء أول جدول</a>
</div>
<?php else: ?>
<div class="card">
    <div class="card-body p-0">
        <table class="table table-hover mb-0">
            <thead>
                <tr>
                    <th>اسم الجدول</th>
                    <th>الشهر</th>
                    <th>ساعات العمل</th>
                    <th>الحالة</th>
                    <th>الإجراءات</th>
                </tr>
            </thead>
            <tbody>
            <?php foreach ($schedules as $sched): ?>
            <tr>
                <td><?= e($sched['plan_name_ar']) ?></td>
                <td><?= e($sched['plan_month']) ?></td>
                <td><?= e($sched['day_start_time'] ?? '07:00') ?> - <?= e($sched['day_end_time'] ?? '22:00') ?></td>
                <td>
                    <?php if ($sched['status'] === 'active'): ?>
                        <span class="badge bg-success">نشط</span>
                    <?php elseif ($sched['status'] === 'draft'): ?>
                        <span class="badge bg-secondary">مسودة</span>
                    <?php else: ?>
                        <span class="badge bg-dark">مؤرشف</span>
                    <?php endif; ?>
                </td>
                <td>
                    <a href="/playgrounds/<?= (int) $playground['id'] ?>/schedules/<?= (int) $sched['id'] ?>" class="btn btn-sm btn-outline-primary">عرض</a>
                    <a href="/playgrounds/<?= (int) $playground['id'] ?>/schedules/<?= (int) $sched['id'] ?>/edit" class="btn btn-sm btn-outline-warning">تعديل</a>
                </td>
            </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
<?php endif; ?>
<?php $__template->endSection(); ?>
