<?php $__env->startSection('title', 'بانک حرکات ورزشی'); ?>

<?php $__env->startSection('content'); ?>
    <div class="flex items-center justify-between mb-6">
        <h1 class="text-xl font-bold">بانک حرکات ورزشی</h1>
        <div class="flex gap-2">
            <a href="<?php echo e(route('admin.muscles.index')); ?>" class="bg-gray-100 text-sm px-4 py-2 rounded-lg">مدیریت عضلات</a>
            <a href="<?php echo e(route('admin.equipment.index')); ?>" class="bg-gray-100 text-sm px-4 py-2 rounded-lg">مدیریت تجهیزات</a>
            <a href="<?php echo e(route('admin.exercises.create')); ?>" class="bg-gray-900 text-white text-sm px-4 py-2 rounded-lg">+ حرکت جدید</a>
        </div>
    </div>

    <form method="GET" class="flex flex-wrap gap-2 mb-4">
        <input type="text" name="q" value="<?php echo e(request('q')); ?>" placeholder="جستجوی نام حرکت..."
               class="border rounded-lg px-3 py-2 text-sm flex-1 min-w-[160px]">
        <select name="muscle" class="border rounded-lg px-3 py-2 text-sm">
            <option value="">همه عضلات</option>
            <?php $__currentLoopData = $muscles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $muscle): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($muscle->id); ?>" <?php if(request('muscle') == $muscle->id): echo 'selected'; endif; ?>><?php echo e($muscle->name); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
        <select name="difficulty" class="border rounded-lg px-3 py-2 text-sm">
            <option value="">همه سطوح</option>
            <option value="beginner" <?php if(request('difficulty') === 'beginner'): echo 'selected'; endif; ?>>مبتدی</option>
            <option value="intermediate" <?php if(request('difficulty') === 'intermediate'): echo 'selected'; endif; ?>>متوسط</option>
            <option value="advanced" <?php if(request('difficulty') === 'advanced'): echo 'selected'; endif; ?>>پیشرفته</option>
        </select>
        <select name="status" class="border rounded-lg px-3 py-2 text-sm">
            <option value="">همه وضعیت‌ها</option>
            <option value="active" <?php if(request('status') === 'active'): echo 'selected'; endif; ?>>فعال</option>
            <option value="inactive" <?php if(request('status') === 'inactive'): echo 'selected'; endif; ?>>غیرفعال</option>
        </select>
        <button class="bg-gray-100 px-4 py-2 rounded-lg text-sm">فیلتر</button>
    </form>

    <div class="bg-white rounded-xl shadow-sm overflow-x-auto">
        <table class="w-full text-sm">
            <thead class="bg-gray-50 text-gray-500">
                <tr>
                    <th class="p-3 text-right">GIF</th>
                    <th class="p-3 text-right">نام</th>
                    <th class="p-3 text-right">عضله اصلی</th>
                    <th class="p-3 text-right">سطح سختی</th>
                    <th class="p-3 text-right">وضعیت</th>
                    <th class="p-3 text-right">عملیات</th>
                </tr>
            </thead>
            <tbody class="divide-y">
                <?php $__empty_1 = true; $__currentLoopData = $exercises; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $exercise): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td class="p-3">
                            <?php if($exercise->gif_path): ?>
                                <img src="<?php echo e(Storage::disk('public')->url($exercise->gif_path)); ?>" class="w-12 h-12 rounded object-cover">
                            <?php else: ?>
                                <div class="w-12 h-12 rounded bg-gray-100"></div>
                            <?php endif; ?>
                        </td>
                        <td class="p-3 font-medium"><?php echo e($exercise->name); ?></td>
                        <td class="p-3"><?php echo e($exercise->mainMuscle?->name ?? '—'); ?></td>
                        <td class="p-3"><?php echo e($exercise->difficulty->label()); ?></td>
                        <td class="p-3">
                            <?php if($exercise->is_active): ?>
                                <span class="text-green-600 bg-green-50 px-2 py-1 rounded-full text-xs">فعال</span>
                            <?php else: ?>
                                <span class="text-gray-500 bg-gray-100 px-2 py-1 rounded-full text-xs">غیرفعال</span>
                            <?php endif; ?>
                        </td>
                        <td class="p-3 flex gap-3">
                            <a href="<?php echo e(route('admin.exercises.edit', $exercise)); ?>" class="text-blue-600 hover:underline">ویرایش</a>
                            <form method="POST" action="<?php echo e(route('admin.exercises.destroy', $exercise)); ?>" onsubmit="return confirm('حذف شود؟');">
                                <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                <button class="text-red-600 hover:underline">حذف</button>
                            </form>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr><td colspan="6" class="p-6 text-center text-gray-400">حرکتی ثبت نشده است.</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>

    <div class="mt-4"><?php echo e($exercises->links()); ?></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\paradox\Desktop\fresh\abtin-sport-platform\resources\views/admin/exercises/index.blade.php ENDPATH**/ ?>