<?php $__env->startSection('title', 'Хийсэн ажлууд'); ?>
<?php $__env->startSection('page_title', 'Хийсэн ажлууд'); ?>

<?php $__env->startSection('content'); ?>

<div class="flex items-center justify-between mb-6">
    <form method="GET" class="flex items-center gap-2">
        <input type="text" name="search" value="<?php echo e(request('search')); ?>" placeholder="Хайх..." class="px-4 py-2 border border-gray-200 rounded-lg outline-none">
        <select name="category_id" class="px-4 py-2 border border-gray-200 rounded-lg outline-none">
            <option value="">Бүх ангилал</option>
            <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($c->id); ?>" <?php if(request('category_id') == $c->id): echo 'selected'; endif; ?>><?php echo e($c->name); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
        <button class="px-4 py-2 bg-nsma-dark text-white rounded-lg">Шүүх</button>
    </form>
    <a href="<?php echo e(route('admin.portfolios.create')); ?>" class="bg-nsma-red text-white font-semibold px-4 py-2 rounded-lg">+ Шинэ ажил</a>
</div>

<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-4">
    <?php $__empty_1 = true; $__currentLoopData = $portfolios; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
        <div class="bg-white rounded-2xl border border-gray-100 overflow-hidden">
            <img src="<?php echo e($p->coverImageUrl()); ?>" class="w-full aspect-video object-cover" onerror="this.style.background='#0F1729'">
            <div class="p-4">
                <div class="flex items-center justify-between mb-2">
                    <span class="text-xs text-gray-500"><?php echo e($p->category->name ?? ''); ?></span>
                    <?php if($p->is_featured): ?> <span class="text-xs px-2 py-0.5 rounded bg-yellow-100 text-yellow-700">⭐ Featured</span> <?php endif; ?>
                </div>
                <h4 class="font-semibold mb-1"><?php echo e($p->title); ?></h4>
                <p class="text-xs text-gray-500 mb-3"><?php echo e($p->client_name); ?></p>
                <div class="flex items-center justify-between">
                    <span class="text-xs px-2 py-1 rounded <?php echo e($p->is_active ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-600'); ?>"><?php echo e($p->is_active ? 'Идэвхтэй' : 'Идэвхгүй'); ?></span>
                    <div class="flex gap-1">
                        <a href="<?php echo e(route('admin.portfolios.edit', $p)); ?>" class="px-2 py-1 text-xs bg-nsma-dark text-white rounded">Засах</a>
                        <form action="<?php echo e(route('admin.portfolios.destroy', $p)); ?>" method="POST" class="inline" onsubmit="return confirm('Устгах уу?')">
                            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                            <button class="px-2 py-1 text-xs bg-red-500 text-white rounded">×</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
        <p class="col-span-full text-center text-gray-500 py-12">Ажил нэмээгүй байна.</p>
    <?php endif; ?>
</div>

<div class="mt-4"><?php echo e($portfolios->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:\xampp\htdocs\uninsma.mn\resources\views/admin/portfolios/index.blade.php ENDPATH**/ ?>