<?php $__env->startSection('title', 'Category Details'); ?>

<?php $__env->startSection('content'); ?>
    <div class="flex justify-between items-center mb-6">
        <h1 class="text-2xl font-bold">Category Details</h1>
        <div class="space-x-2">
            <a href="<?php echo e(route('admin.categories.edit', $category->id)); ?>" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">Edit</a>
            <a href="<?php echo e(route('admin.categories.index')); ?>" class="bg-gray-500 text-white px-4 py-2 rounded hover:bg-gray-600">Back</a>
        </div>
    </div>
    <?php $category->load('media'); ?>
    <div class="flex gap-6">
        <?php if($category->image_url): ?>
            <div class="shrink-0">
                <img src="<?php echo e($category->image_url); ?>" alt="<?php echo e($category->name); ?>" class="w-48 h-48 object-cover rounded-lg border">
            </div>
        <?php endif; ?>
        <div class="bg-white rounded-lg shadow p-6 flex-1 max-w-lg">
            <table class="w-full">
                <tr class="border-b"><td class="py-3 font-medium text-gray-600">ID</td><td class="py-3"><?php echo e($category->id); ?></td></tr>
                <tr class="border-b"><td class="py-3 font-medium text-gray-600">Name</td><td class="py-3"><?php echo e($category->name); ?></td></tr>
                <tr class="border-b"><td class="py-3 font-medium text-gray-600">Slug</td><td class="py-3"><?php echo e($category->slug); ?></td></tr>
                <tr class="border-b"><td class="py-3 font-medium text-gray-600">Icon</td><td class="py-3"><?php echo e($category->icon ?? '-'); ?></td></tr>
                <tr class="border-b"><td class="py-3 font-medium text-gray-600">Description</td><td class="py-3"><?php echo e($category->description ?? '-'); ?></td></tr>
                <tr class="border-b"><td class="py-3 font-medium text-gray-600">Sort Order</td><td class="py-3"><?php echo e($category->sort_order); ?></td></tr>
                <tr class="border-b"><td class="py-3 font-medium text-gray-600">Active</td><td class="py-3"><?php echo e($category->is_active ? 'Yes' : 'No'); ?></td></tr>
                <tr><td class="py-3 font-medium text-gray-600">Created</td><td class="py-3"><?php echo e($category->created_at->format('Y-m-d H:i')); ?></td></tr>
            </table>
        </div>
    </div>

    <?php if($category->media->isNotEmpty()): ?>
        <div class="bg-white rounded-lg shadow p-6 mt-6">
            <div class="flex justify-between items-center mb-4">
                <h3 class="font-bold text-lg">Media (<?php echo e($category->media->count()); ?>)</h3>
                <a href="<?php echo e(route('admin.media.create', ['mediable_type' => 'Modules\\Category\\Models\\Category', 'mediable_id' => $category->id])); ?>" class="text-blue-600 text-sm hover:underline">+ Add Media</a>
            </div>
            <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
                <?php $__currentLoopData = $category->media; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $media): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="border rounded overflow-hidden">
                        <?php if($media->type === 'image'): ?>
                            <img src="<?php echo e(Storage::disk('public')->url($media->path)); ?>" alt="<?php echo e($media->filename); ?>" class="w-full h-32 object-cover">
                        <?php else: ?>
                            <div class="h-32 bg-gray-100 flex items-center justify-center text-gray-400 text-sm"><?php echo e($media->type); ?></div>
                        <?php endif; ?>
                        <div class="p-2 text-xs truncate"><?php echo e($media->filename); ?></div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        </div>
    <?php else: ?>
        <div class="bg-white rounded-lg shadow p-6 mt-6 text-center text-gray-500">
            <p>No media attached.</p>
            <a href="<?php echo e(route('admin.media.create', ['mediable_type' => 'Modules\\Category\\Models\\Category', 'mediable_id' => $category->id])); ?>" class="text-blue-600 hover:underline text-sm">Upload media</a>
        </div>
    <?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin::layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH G:\abo bilal nuisan\bernie_store\bernie-backend\Modules/Admin\resources/views/categories/show.blade.php ENDPATH**/ ?>