<?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'] ?>/edit" class="btn btn-warning">تعديل</a>
<form method="post" action="/playgrounds/<?= (int) $playground['id'] ?>/toggle" class="d-inline">
    <?= csrf_field() ?>
    <button type="submit" class="btn <?= $playground['is_active'] ? 'btn-outline-danger' : 'btn-outline-success' ?>">
        <?= $playground['is_active'] ? 'تعطيل' : 'تفعيل' ?>
    </button>
</form>
<?php $__template->endSection(); ?>

<?php $__template->section('content'); ?>
<div class="row">
    <div class="col-md-8">
        <div class="card mb-3">
            <div class="card-header">بيانات الملعب</div>
            <div class="card-body">
                <table class="table table-borderless">
                    <tr><th style="width:200px;">الاسم</th><td><?= e($playground['playground_name_ar']) ?></td></tr>
                    <tr><th>النوع</th><td><?= e($types[$playground['playground_type']] ?? $playground['playground_type']) ?></td></tr>
                    <tr><th>المرفق</th><td><?= e($playground['facility_name'] ?? '-') ?></td></tr>
                    <tr><th>الحالة</th><td><span class="badge bg-<?= $playground['is_active'] ? 'success' : 'secondary' ?>"><?= $playground['is_active'] ? 'نشط' : 'غير نشط' ?></span></td></tr>
                    <?php if ($playground['has_rows']): ?>
                    <tr><th><?= e($playground['row_label_ar'] ?? 'حارة') ?></th><td><?= (int) $playground['row_count'] ?></td></tr>
                    <?php endif; ?>
                    <?php $hours = json_decode($playground['operating_hours_json'] ?? '{}', true); ?>
                    <?php if (!empty($hours)): ?>
                    <tr><th>ساعات العمل</th><td><?= ($hours['start'] ?? 7) ?>:00 - <?= ($hours['end'] ?? 22) ?>:00</td></tr>
                    <?php endif; ?>
                    <?php if ($playground['notes']): ?>
                    <tr><th>ملاحظات</th><td><?= e($playground['notes']) ?></td></tr>
                    <?php endif; ?>
                </table>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-header">إجراءات سريعة</div>
            <div class="card-body d-grid gap-2">
                <a href="/playgrounds/<?= (int) $playground['id'] ?>/mirror" class="btn btn-outline-info">المرآة (الحالة اللحظية)</a>
                <a href="/playgrounds/<?= (int) $playground['id'] ?>/schedules" class="btn btn-outline-secondary">الجداول الشهرية</a>
                <a href="/playgrounds/<?= (int) $playground['id'] ?>/attendance" class="btn btn-outline-primary">تسجيل الحضور</a>
                <a href="/playgrounds/<?= (int) $playground['id'] ?>/dashboard" class="btn btn-outline-success">لوحة التحكم</a>
            </div>
        </div>
    </div>
</div>
<?php $__template->endSection(); ?>
